Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Finishing touches

Roland Geiderd891198befc7
diff --git a/wger/core/forms.py b/wger/core/forms.py
index d1caaf641..8afddf936 100644
--- a/wger/core/forms.py
+++ b/wger/core/forms.py
@@ -180,11 +180,11 @@ class UserEmailForm(forms.ModelForm):
class Meta:
model = User
- fields = ('email', )
+ fields = ('email',)
def clean_email(self):
"""
- E-mail must be unique system wide
+ E-mail must be unique system-wide
However, this check should only be performed when the user changes
e-mail address, otherwise the uniqueness check will because it will find one user
@@ -262,12 +262,14 @@ class RegistrationForm(UserCreationForm, UserEmailForm):
self.helper = FormHelper()
self.helper.form_class = 'wger-form'
self.helper.layout = Layout(
- 'username', 'email',
+ 'username',
+ 'email',
Row(
- Column('password1', css_class='col-6'),
- Column('password2', css_class='col-6'),
+ Column('password1', css_class='col-md-6 col-12'),
+ Column('password2', css_class='col-md-6 col-12'),
css_class='form-row'
- ), 'captcha',
+ ),
+ 'captcha',
ButtonHolder(Submit('submit', _("Register"), css_class='btn-success btn-block'))
)
@@ -282,18 +284,23 @@ class RegistrationFormNoCaptcha(UserCreationForm, UserEmailForm):
self.helper = FormHelper()
self.helper.form_class = 'wger-form'
self.helper.layout = Layout(
- 'username', 'email',
+ 'username',
+ 'email',
Row(
- Column('password1', css_class='col-6'),
- Column('password2', css_class='col-6'),
+ Column('password1', css_class='col-md-6 col-12'),
+ Column('password2', css_class='col-md-6 col-12'),
css_class='form-row'
- ), ButtonHolder(Submit('submit', _("Register"), css_class='btn-success btn-block'))
+ ),
+ ButtonHolder(
+ Submit('submit', _("Register"), css_class='btn-success col-sm-6 col-12'),
+ css_class='text-center'
+ )
)
class FeedbackRegisteredForm(forms.Form):
"""
- Feedback form used for logged in users
+ Feedback form used for logged-in users
"""
contact = forms.CharField(
max_length=50,
diff --git a/wger/core/templates/tags/language_select.html b/wger/core/templates/tags/language_select.html
index 19d7b1932..2578381e7 100644
--- a/wger/core/templates/tags/language_select.html
+++ b/wger/core/templates/tags/language_select.html
@@ -1,9 +1,11 @@
{% load i18n static %}
-<a class="dropdown-item" href="{{ i18n_path }}">
- <img src="{% static path %}"
- width="20"
- alt="{% translate name %}"
- title="{% translate name %}">
- {% translate name %} / <small>{{ name }}</small>
-</a>
+<li>
+ <a class="dropdown-item" href="{{ i18n_path }}">
+ <img src="{% static path %}"
+ width="20"
+ alt="{% translate name %}"
+ title="{% translate name %}">
+ {% translate name %} / <small>{{ name }}</small>
+ </a>
+</li>
diff --git a/wger/core/templates/template.html b/wger/core/templates/template.html
index 845ee4aa9..2ac68a4c6 100644
--- a/wger/core/templates/template.html
+++ b/wger/core/templates/template.html
@@ -185,28 +185,34 @@
{# Render the links to the other languages #}
{# #}
<div class="col-md-4">
- {% if not is_api_path %} {# Don't show language switcher in the generated API views #}
- <div class="dropup float-end">
- <button
- class="btn btn-light dropdown-toggle"
- type="button"
- data-bs-toggle="dropdown"
- aria-expanded="false">
- <span class="{% fa_class 'globe' %}"></span>
- {% translate i18n_language.name %}
- <span class="caret"></span>
+ {% if not is_api_path %}
+ {# Don't show language switcher in the generated API views #}
+ <div class="btn-group dropup">
+ <button class="btn btn-light dropdown-toggle"
+ type="button"
+ data-bs-toggle="dropdown"
+ aria-expanded="false">
+ <span class="{% fa_class 'globe' %}"></span>
+ {% translate i18n_language.name %}
+ <span class="caret"></span>
</button>
- <div class="dropdown-menu" aria-labelledby="btnGroupLanguages">
+ <ul class="dropdown-menu" aria-labelledby="btnGroupLanguages">
{% for language in languages %}
{% language_select language %}
{% endfor %}
- <div class="dropdown-divider"></div>
- <a href="https://hosted.weblate.org/engage/wger/" class="dropdown-item" target="_blank">
- <span class="{% fa_class 'plus' %}"></span>
- {% translate "Translate" %}
- </a>
- </div>
+ <li>
+ <hr class="dropdown-divider"></hr>
+ </li>
+ <li>
+ <a href="https://hosted.weblate.org/engage/wger/"
+ class="dropdown-item"
+ target="_blank">
+ <span class="{% fa_class 'plus' %}"></span>
+ {% translate "Translate" %}
+ </a>
+ </li>
+ </ul>
</div>
{% endif %}
diff --git a/wger/core/templates/template_features.html b/wger/core/templates/template_features.html
index 676074bb0..4b87031d6 100644
--- a/wger/core/templates/template_features.html
+++ b/wger/core/templates/template_features.html
@@ -22,7 +22,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta charset="utf-8">
- <meta name="author" content="Roland Geider">
+ <meta name="author" content="wger team">
<meta name="viewport" content="width=device-width, initial-scale=1">
diff --git a/wger/software/static/css/landing_page.css b/wger/software/static/css/landing_page.css
index 488607c82..c87f745f7 100644
--- a/wger/software/static/css/landing_page.css
+++ b/wger/software/static/css/landing_page.css
@@ -4,12 +4,6 @@
src: url("/static/fonts/bebas_neue/BebasNeue-Regular.woff");
}
-
-* {
- box-sizing: border-box;
- overflow-x: hidden;
-}
-
:root {
--blue: #245daf;
--green: #218064;
@@ -56,6 +50,10 @@ ul.hex-bullet {
padding-left: 0
}
+ul.hex-bullet li {
+ list-style-type: none;
+}
+
ul.hex-bullet li::before {
content: '⬢';
font-size: 20px;
diff --git a/wger/software/static/images/sign-up-bg.svg b/wger/software/static/images/sign-up-bg.svg
new file mode 100644
index 000000000..df62e3d1e
--- /dev/null
+++ b/wger/software/static/images/sign-up-bg.svg
@@ -0,0 +1,11 @@
+<svg width="946" height="946" viewBox="0 0 946 946" fill="none" xmlns="http://www.w3.org/2000/svg">
+<g clip-path="url(#clip0_968_11599)">
+<path fill-rule="evenodd" clip-rule="evenodd" d="M574.44 33.1456L945.011 350.04L843.57 789.342L371.559 911.749L0.988532 594.855L102.429 155.553L574.44 33.1456Z" fill="#F3F7FF"/>
+<path fill-rule="evenodd" clip-rule="evenodd" d="M535.077 27.9788L929.492 314.665L863.022 760.597L402.138 919.844L7.72315 633.158L74.1929 187.225L535.077 27.9788Z" stroke="#8EB4F5"/>
+</g>
+<defs>
+<clipPath id="clip0_968_11599">
+<rect width="946" height="946" fill="white"/>
+</clipPath>
+</defs>
+</svg>
diff --git a/wger/software/templates/features.html b/wger/software/templates/features.html
index 5cadc56a5..54344c567 100644
--- a/wger/software/templates/features.html
+++ b/wger/software/templates/features.html
@@ -1,5 +1,5 @@
{% extends "template_features.html" %}
-{% load i18n static wger_extras %}
+{% load i18n static wger_extras crispy_forms_tags %}
{# #}
{# Opengraph #}
@@ -20,6 +20,8 @@
{# Content #}
{# #}
{% block template %}
+
+ <!-- header -->
<header>
<!-- navbar -->
<nav class="navbar navbar-expand-lg px-4">
@@ -44,10 +46,15 @@
</li>
<li class="nav-item mx-2 my-1">
<a class="nav-link fw-semibold"
- href="#">{% translate "Mobile app" %}</a>
+ href="https://play.google.com/store/apps/details?id=de.wger.flutter">
+ {% translate "Mobile app" %}
+ </a>
</li>
<li class="nav-item mx-2 my-1">
- <a class="nav-link fw-semibold" href="#">{% translate "Donate" %}</a>
+ <a class="nav-link fw-semibold"
+ href="https://www.buymeacoffee.com/wger">
+ {% translate "Donate" %}
+ </a>
</li>
<li class="nav-item mx-2 my-1">
<a class="nav-link fw-semibold" href="https://github.com/wger-project">
@@ -55,45 +62,55 @@
</a>
</li>
<li class="nav-item mx-2 my-1">
- <a class="nav-link fw-semibold" href="#">{% translate "Community" %}</a>
+ <a class="nav-link fw-semibold" href="#">
+ {% translate "Community" %}
+ </a>
</li>
</ul>
<!-- buttons -->
- <div class="d-flex gap-2">
- <a role="button" class="btn btn-transparent"
- href="{% url 'core:user:login' %}">
- {% translate "Login" %}
- </a>
- {% if allow_registration %}
- <a role="button" class="btn btn-primary rounded-1 bg-dark-blue px-4"
- href="{% url 'core:user:registration' %}">
- {% translate "Register" %}
+ {% if not user.is_authenticated %}
+ <div class="d-flex gap-2 my-2 my-lg-0">
+ <a role="button" class="btn btn-transparent"
+ href="{% url 'core:user:login' %}">
+ {% translate "Login" %}
</a>
- {% endif %}
- </div>
+ {% if allow_registration %}
+ <a role="button" class="btn btn-primary rounded-1 bg-dark-blue px-4"
+ href="{% url 'core:user:registration' %}">
+ {% translate "Register" %}
+ </a>
+ {% endif %}
+ </div>
+ {% endif %}
</div>
</div>
</nav>
-
<div class="container-xl">
<!-- hero section -->
<section
- class="row px-3 mb-5 d-flex align-items-center justify-content-center gap-2 flex-reverse">
- <div class="col-lg-7 col-sm-12 d-flex px-5 flex-column align-items-center">
- <img src="{% static 'images/hero.png' %}" alt="a man with a dumbbell"
+ class="row px-3 mb-5 d-flex align-items-center justify-content-center gap-2 flex-row-reverse">
+ <div class="col-lg-7 col-sm-6 col-12 d-flex px-5 flex-column align-items-center">
+ <img src="{% static 'images/hero.png' %}"
+ alt="a man with a dumbbell"
class="header-hero-image">
</div>
- <div class="col-lg-4 col-sm-12 py-3 d-flex flex-column align-items-center">
+ <div class="col-lg-3 col-sm-5 col-12 d-flex py-3 flex-column align-items-start">
<h1 class="font-bebas-neue display-3 uppercase">
{% translate "Track your <br> way to your <br> ideal body" %}
</h1>
- <p class="">
- {% translate "Join wger, the community-driven <b>free <br> and open-source fitness tracker</b>" %}
+ <p>
+ {% translate "Join wger, the community-driven <b>free and open-source fitness tracker</b>" %}
</p>
- <button type="button" class="btn btn-primary rounded-1 bg-dark-blue py-2">
+
+ <a role="button"
+ class="btn btn-primary rounded-1 bg-dark-blue py-2 px-5"
+ href="
+
+ {% if user.is_authenticated %}{% url 'core:index' %}{% else %}{% url 'core:user:login' %}{% endif %}">
{% translate "Get Started" %}
- </button>
+ </a>
+
</div>
</section>
@@ -119,14 +136,12 @@
</div>
</header>
-
- <!-- main -->
+ <!-- main content -->
<main>
-
<div class="container-xl">
<!-- section 1 - workout regimen -->
- <section class="main-section" style="margin-top: 9em;">
+ <section class="main-section">
<div
class="row row-cols row-cols-lg-2 row-cols-sm-1 px-3 w-100 justify-content-center flex-reverse gy-3">
<div
@@ -239,9 +254,15 @@
<!-- button -->
<div class="row w-100 p-5 d-flex justify-content-center">
- <button type="button" class="btn btn-primary rounded-1 bg-dark-blue w-auto px-5">
- Try Wger Now
- </button>
+ <a role="button"
+ class="btn btn-primary rounded-1 bg-dark-blue w-auto px-5"
+ href="{% if allow_guest_users and not user.is_authenticated %}
+ {% url 'core:user:demo-entries' %}
+ {% else %}
+ {% url 'core:index' %}
+ {% endif %}">
+ {% translate "Try wger now" %}
+ </a>
</div>
<!-- community section -->
@@ -262,29 +283,29 @@
<p style="line-height: 30px;">
{% blocktranslate trimmed %}
wger is funded and created by the open-source community: people like
- you
- translating, adding exercises and nutritional info, developing, and
- more.
+ you translating, adding exercises and nutritional info, developing,
+ and more.
{% endblocktranslate %}
<b>
{% blocktranslate trimmed %}
We don't use ads, don't sell your personal info, and we share
- the code
- under a free and open-source license.
+ the code under a free and open-source license.
{% endblocktranslate %}
</b>
{% blocktranslate trimmed %}
Pitch in and help make wger even better!
{% endblocktranslate %}
</p>
- <div class="d-flex align-items-sm-center gap-3">
+ <div class="d-grid gap-2 d-md-block">
<a href=""
class="btn btn-primary rounded-1 w-auto px-5"
target="_blank"
rel="noopener noreferrer">
{% translate "Contribute" %}
</a>
- <a href="http://" target="_blank" rel="noopener noreferrer"
+ <a href="https://www.buymeacoffee.com/wger"
+ target="_blank"
+ rel="noopener noreferrer"
class="btn btn-outline-primary rounded-1 w-auto px-5">
{% translate "Donate" %}
</a>
@@ -295,33 +316,21 @@
</section>
<!-- sign up section -->
- <section class="main-section">
- <div class="container-xl d-flex align-items-center sign-up-bg">
+ <section class="main-section ">
+ <div class="container d-flex align-items-center sign-up-bg">
<!-- form -->
- <div class="row d-flex flex-column gap-2 w-100 align-items-center ms-1">
+ <form method="post"
+ action="{% url 'core:user:registration' %}"
+ class="row justify-content-center w-100">
+ {% csrf_token %}
<h3 class="col-12 text-center fs-1 uppercase font-bebas-neue">
{% translate "Sign Up Now For Free" %}
</h3>
- <div class="col-lg-5 col-sm-8 d-flex flex-column gap-2">
- <div class="form-floating mb-3">
- <input type="text" class="form-control" id="username" placeholder=" ">
- <label for="username">{% translate "Username" %}</label>
- </div>
- <div class="form-floating mb-3">
- <input type="email" class="form-control" id="email"
- placeholder="[email protected]">
- <label for="email">{% translate "Email address (optional)" %}</label>
- </div>
- <div class="form-floating mb-3">
- <input type="password" required class="form-control" id="password"
- placeholder=" ">
- <label for="password">{% translate "Password" %}</label>
- </div>
- <button
- class="btn btn-primary bg-dark-blue px-4 w-100">{% translate "Submit" %}</button>
+ <div class="col-lg-5 col-sm-10 col-12">
+ {% crispy form %}
</div>
- </div>
+ </form>
</div>
</section>
@@ -345,7 +354,10 @@
{% translate "Set up a private server for your gym" %}
</h6>
<p class="text-light fw-lighter text-center">
- {% translate "Don't want your data on an online service? Set up a wger instance on your own server for free!" %}
+ {% blocktranslate trimmed %}
+ Don't want your data on an online service? Set up a wger instance
+ on your own server for free!
+ {% endblocktranslate %}
</p>
</div>
<div
@@ -373,7 +385,10 @@
{% translate "Create your own version" %}
</h6>
<p class="text-light fw-lighter text-center">
- {% translate "The source code is available under the GNU AGPLv3 license! Feel free to fork it on GitHub." %}
+ {% blocktranslate trimmed %}
+ The source code is available under the GNU AGPLv3 license! Feel
+ free to fork it on GitHub.
+ {% endblocktranslate %}
</p>
</div>
</div>
@@ -384,48 +399,48 @@
<!-- footer -->
<footer class="d-grid gap-3 p-5 footer-bg">
<div class="container-xl">
- <div class="d-flex px-3">
+ <div class="d-flex pb-4">
<img src="{% static 'images/logos/logo-font-inverse.svg' %}" alt="wger logo"/>
</div>
<div class="row row-cols-lg-4 row-cols-sm-1 g-2 border-bottom border-light pb-3">
- <div class="col-lg-3 col-sm-12">
+ <div class="col-lg-3 col-sm-6 col-12">
<ul class="list-group">
- <li class="list-group-item bg-transparent border-0 text-light">
+ <li class="list-group-item bg-transparent border-0 text-light ps-0">
<h1 class="fs-5 text-white">{% translate "Account" %}</h1>
</li>
- <li class="list-group-item bg-transparent border-0 text-light fw-lighter">
+ <li class="list-group-item bg-transparent border-0 text-light fw-lighter ps-0">
<a href="{% url 'core:user:registration' %}">
{% translate "Register" %}
</a>
</li>
- <li class="list-group-item bg-transparent border-0 text-light fw-lighter">
+ <li class="list-group-item bg-transparent border-0 text-light fw-lighter ps-0">
<a href="{% url 'core:user:login' %}">
{% translate "Login" %}
</a>
</li>
- <li class="list-group-item bg-transparent border-0 text-light fw-lighter">
+ <li class="list-group-item bg-transparent border-0 text-light fw-lighter ps-0">
<a href="{% url 'core:index' %}">
{% translate "Dashboard" %}
</a>
</li>
- <li class="list-group-item bg-transparent border-0 text-light fw-lighter">
+ <li class="list-group-item bg-transparent border-0 text-light fw-lighter ps-0">
<a href="{% url 'manager:workout:overview' %}">
{% translate "Training" %}
</a>
</li>
- <li class="list-group-item bg-transparent border-0 text-light fw-lighter">
+ <li class="list-group-item bg-transparent border-0 text-light fw-lighter ps-0">
<a href="{% url 'weight:overview' %}">
{% translate "Body weight" %}
</a>
</li>
- <li class="list-group-item bg-transparent border-0 text-light fw-lighter">
+ <li class="list-group-item bg-transparent border-0 text-light fw-lighter ps-0">
<a href="{% url 'nutrition:plan:overview' %}">
{% translate "Nutrition" %}
</a>
</li>
</ul>
</div>
- <div class="col-lg-3 col-sm-12">
+ <div class="col-lg-3 col-sm-6 col-12">
<ul class="list-group">
<li class="list-group-item bg-transparent border-0 text-light">
<h1 class="fs-5 text-white">{% translate "Community" %}</h1>
@@ -436,18 +451,26 @@
</a>
</li>
<li class="list-group-item bg-transparent border-0 text-light fw-lighter">
- <a href="{% url 'manager:template:overview' %}">
+ <a href="{% url 'manager:template:public' %}">
{% translate "Workout routines" %}
</a>
</li>
+ <li class="list-group-item bg-transparent border-0 text-light fw-lighter">
+ <a href="https://discord.gg/rPWFv6W" target="_blank"
+ rel="noopener noreferrer">
+ {% translate "Discord" %}
+ </a>
+ </li>
+ <!--
<li class="list-group-item bg-transparent border-0 text-light fw-lighter">
<a href="http://" target="_blank" rel="noopener noreferrer">
Exercise translation
</a>
</li>
+ -->
</ul>
</div>
- <div class="col-lg-3 col-sm-12">
+ <div class="col-lg-3 col-sm-6 col-12">
<ul class="list-group">
<li class="list-group-item bg-transparent border-0 text-light">
<h1 class="fs-5 text-white">{% translate "Software" %}</h1>
@@ -482,7 +505,7 @@
</li>
</ul>
</div>
- <div class="col-lg-3 col-sm-12">
+ <div class="col-lg-3 col-sm-6 col-12">
<ul class="list-group">
<li class="list-group-item bg-transparent border-0 text-light">
<h1 class="fs-5 text-white">
@@ -516,28 +539,32 @@
</div>
<div class="d-flex justify-content-between py-3">
- <div class="dropup">
- <button
- class="btn btn-outline-light dropdown-toggle"
- type="button"
- data-bs-toggle="dropdown"
- aria-expanded="false">
+ <div class="btn-group dropup">
+ <button class="btn btn-outline-light dropdown-toggle"
+ type="button"
+ data-bs-toggle="dropdown"
+ aria-expanded="false">
<span class="{% fa_class 'globe' %}"></span>
{% translate i18n_language.name %}
<span class="caret"></span>
</button>
- <div class="dropdown-menu" aria-labelledby="btnGroupLanguages">
+ <ul class="dropdown-menu" aria-labelledby="btnGroupLanguages">
{% for language in languages %}
{% language_select language %}
{% endfor %}
- <div class="dropdown-divider"></div>
- <a href="https://hosted.weblate.org/engage/wger/" class="dropdown-item"
- target="_blank">
- <span class="{% fa_class 'plus' %}"></span>
- {% translate "Translate" %}
- </a>
- </div>
+ <li>
+ <hr class="dropdown-divider"></hr>
+ </li>
+ <li>
+ <a href="https://hosted.weblate.org/engage/wger/"
+ class="dropdown-item"
+ target="_blank">
+ <span class="{% fa_class 'plus' %}"></span>
+ {% translate "Translate" %}
+ </a>
+ </li>
+ </ul>
</div>
<a href="https://play.google.com/store/apps/details?id=de.wger.flutter">
diff --git a/wger/software/views.py b/wger/software/views.py
index d47533f8e..4bfb6d2f5 100644
--- a/wger/software/views.py
+++ b/wger/software/views.py
@@ -1,5 +1,3 @@
-# -*- coding: utf-8 -*-
-
# This file is part of wger Workout Manager.
#
# wger Workout Manager is free software: you can redistribute it and/or modify
@@ -21,33 +19,41 @@ import logging
from django.conf import settings
from django.contrib.auth.models import User
from django.shortcuts import render
-from django.views.decorators.cache import cache_page
+from django.core.cache import cache
# Third Party
import requests
# wger
+from wger.core.forms import RegistrationForm, RegistrationFormNoCaptcha
from wger.exercises.models import ExerciseBase
from wger.nutrition.models import Ingredient
logger = logging.getLogger(__name__)
+CACHE_KEY = 'landing-page-context'
+
-# @cache_page(60 * 60 * 24 * 10)
def features(request):
"""
- Render the features page
+ Render the landing page
"""
- # Fetch number of stars from GitHub. The page is cached, so doing this is OK
- # result = requests.get('https://api.github.com/repos/wger-project/wger').json()
- result = {'stargazers_count': 2000}
- context = {
- 'allow_registration': settings.WGER_SETTINGS['ALLOW_REGISTRATION'],
- 'allow_guest_users': settings.WGER_SETTINGS['ALLOW_GUEST_USERS'],
- 'nr_users': User.objects.count(),
- 'nr_exercises': ExerciseBase.objects.count(),
- 'nr_ingredients': Ingredient.objects.count(),
- 'nr_stars': result.get('stargazers_count', '2000')
- }
+ context = cache.get(CACHE_KEY)
+ if not context:
+ result_github_api = requests.get('https://api.github.com/repos/wger-project/wger').json()
+ context = {
+ 'nr_users': User.objects.count(),
+ 'nr_exercises': ExerciseBase.objects.count(),
+ 'nr_ingredients': Ingredient.objects.count(),
+ 'nr_stars': result_github_api.get('stargazers_count', '2000'),
+ }
+ cache.set(CACHE_KEY, context, 60 * 60 * 24 * 7) # one week
+
+ FormClass = RegistrationForm if settings.WGER_SETTINGS['USE_RECAPTCHA'] \
+ else RegistrationFormNoCaptcha
+ context['form'] = FormClass()
+ context['allow_registration'] = settings.WGER_SETTINGS['ALLOW_REGISTRATION']
+ context['allow_guest_users'] = settings.WGER_SETTINGS['ALLOW_GUEST_USERS']
+
return render(request, 'features.html', context)