Login, registration etc.
authorRadek Czajka <rczajka@rczajka.pl>
Fri, 21 Oct 2022 14:57:42 +0000 (16:57 +0200)
committerRadek Czajka <rczajka@rczajka.pl>
Fri, 21 Oct 2022 14:57:42 +0000 (16:57 +0200)
21 files changed:
src/catalogue/templates/catalogue/2022/author_detail.html
src/catalogue/templates/catalogue/2022/book_detail.html
src/catalogue/templates/catalogue/2022/theme_detail.html
src/club/templates/club/2022/donation_step_base.html
src/infopages/templates/infopages/2022/infopage.html
src/newsletter/forms.py
src/newsletter/templates/newsletter/2022/subscribe_form.html
src/newsletter/templates/newsletter/2022/subscribed.html
src/newsletter/views.py
src/wolnelektury/forms.py
src/wolnelektury/static/2022/more.scss
src/wolnelektury/templates/2022/base_real.html
src/wolnelektury/templates/2022/base_simple.html [new file with mode: 0644]
src/wolnelektury/templates/2022/form.html [deleted file]
src/wolnelektury/templates/account/base.html
src/wolnelektury/templates/openid/login.html
src/wolnelektury/templates/registration/login.html
src/wolnelektury/templates/registration/register.html [new file with mode: 0644]
src/wolnelektury/templates/socialaccount/base.html [new file with mode: 0644]
src/wolnelektury/templatetags/title.py [new file with mode: 0644]
src/wolnelektury/views.py

index 39b2d11..9ba6aaf 100644 (file)
@@ -2,7 +2,7 @@
 
 {% load choose_cites from social_tags %}
 
-{% block content %}
+{% block global-content %}
   <div class="l-container">
     <div class="l-breadcrumb">
       <a href="/"><span>Strona główna</span></a>
index a3d5005..9082d01 100644 (file)
@@ -6,7 +6,7 @@
 {% load likes_book from social_tags %}
 
 
-{% block content %}
+{% block global-content %}
     <div class="l-container">
       <div class="l-breadcrumb">
         <a href="/"><span>Strona główna</span></a>
index 71ec046..c0afc33 100644 (file)
@@ -1,7 +1,7 @@
 {% extends '2022/base_real.html' %}
 {% load pagination_tags %}
 
-{% block content %}
+{% block global-content %}
   <div class="l-container">
     <div class="l-breadcrumb">
       <a href="/"><span>Strona główna</span></a>
index df26493..4659079 100644 (file)
@@ -4,11 +4,11 @@
 {% load static %}
 
 
-{% block content %}
+{% block global-content %}
   <div class="l-container">
     <div class="l-breadcrumb">
-      <a href="#"><span>Strona główna</span></a>
-      <a href="#"><span>Wesprzyj nas</span></a>
+      <a href="/"><span>Strona główna</span></a>
+      <span>Wesprzyj nas</span>
     </div>
   </div>
 
             <div class="l-article__overlay" data-max-height="91">
               {% chunk 'donation-faq' %}
             </div>
+            <button class="l-article__read-more" aria-label="Kliknij aby rozwinąć" data-label="Więcej" data-action="Mniej">Więcej</button>
           </div>
         </div>
       </div>
index 7867908..9c14723 100644 (file)
@@ -1,7 +1,7 @@
 {% extends '2022/base.html' %}
 
 
-{% block content %}
+{% block global-content %}
   <div class="l-container">
     <div class="l-breadcrumb">
       <a href="/"><span>Strona główna</span></a>
index 4e42ae6..ff7005a 100644 (file)
@@ -50,6 +50,7 @@ Więcej informacji w <a href="https://nowoczesnapolska.org.pl/prywatnosc/">polit
 class SubscribeForm(NewsletterForm):
     mailing = True
     agree_newsletter = None
+    required_css_class = 'required'
 
     email = EmailField(label=_('email address'))
 
index d3b573b..f667c08 100644 (file)
@@ -1,47 +1,25 @@
-{% extends "2022/base.html" %}
+{% extends "2022/base_simple.html" %}
 {% load i18n %}
 {% load honeypot %}
 
+{% block settings %}
+  {% load title %}
+  {% title form.newsletter.page_title %}
+{% endblock %}
 
-{% block content %}
-  <div class="l-container">
-    <div class="l-breadcrumb">
-      <a href="/"><span>Strona główna</span></a>
-      <a>{{ page_title }}</a>
-    </div>
-  </div>
-
-  <main class="l-main">
-    <div class="l-checkout__box" style="margin-bottom: 70px;">
-      <div class="l-checkout__box__header">
-        <div class="l-checkout__box__header__content">
-          <h1>{{ page_title }}</h1>
-        </div>
-      </div>
-
-      <div class="l-checkout__cols">
-        <div class="l-checkout__col"></div>
-        <div class="l-checkout__col">
-          <form method="post">
-            <div class="l-checkout__form">
-              {% csrf_token %}
-              {% render_honeypot_field %}
-              {{ form }}
 
-              <div class="helptext">
-                {{ form.data_processing }}
-              </div>
+{% block content %}
+  <h1>{{ title }}</h1>
 
-              <div class="l-checkout__form__row confirm">
-                <div class="l-checkout__input">
-                  <button style="margin-left:0">Dalej</button>
-                </div>
-              </div>
+  <form method="post">
+    {% csrf_token %}
+    {% render_honeypot_field %}
+    {{ form }}
 
-            </div>
-          </form>
-        </div>
-      </div>
+    <div class="helptext">
+      {{ form.data_processing }}
     </div>
-  </main>
+
+    <button>Dalej</button>
+  </form>
 {% endblock %}
index b93a4f6..5396885 100644 (file)
@@ -1,28 +1,18 @@
-{% extends "2022/base.html" %}
+{% extends "2022/base_simple.html" %}
 {% load i18n %}
 
-{% block content %}
-  <div class="l-container">
-    <div class="l-breadcrumb">
-      <a href="/"><span>Strona główna</span></a>
-      <a>{{ page_title }}</a>
-    </div>
-  </div>
 
-  <main class="l-main">
-    <div class="l-checkout__box" style="margin-bottom: 70px;">
-      <div class="l-checkout__box__header">
-        <div class="l-checkout__box__header__content">
-          <h1>{{ page_title }}</h1>
-        </div>
-      </div>
+{% block settings %}
+  {% load title %}
+  {% trans "Subscribed" as title %}
+  {% title title %}
+{% endblock %}
+
+
+{% block content %}
+  <h1>{{ title }}</h1>
 
-      <div class="l-checkout__cols">
-        <div class="l-checkout__col"></div>
-        <div class="l-checkout__col">
-          {% trans "You have subscribed to Wolne Lektury newsletter." %}
-        </div>
-      </div>
-    </div>
-  </main>
+  <p>
+    {% trans "You have subscribed to Wolne Lektury newsletter." %}
+  </p>
 {% endblock %}
index 11256ca..3c63553 100644 (file)
@@ -22,7 +22,6 @@ def subscribe_form(request, slug=''):
 
     if new_layout:
         template_name = 'newsletter/2022/subscribe_form.html'
-        form.template_name = '2022/form.html'
     else:
         template_name = 'newsletter/subscribe_form.html'
     return render(request, template_name, {
index f04501f..0fedd4a 100644 (file)
@@ -9,11 +9,12 @@ from newsletter.forms import NewsletterForm
 
 
 class WLAuthenticationForm(AuthenticationForm):
-    template_name = '2022/form.html'
+    required_css_class = 'required'
 
 
 # has to be this order, because otherwise the form is lacking fields
 class RegistrationForm(UserCreationForm, NewsletterForm):
+    required_css_class = 'required'
     data_processing_part2 = '''\
 Dane są przetwarzane w zakresie niezbędnym do prowadzenia serwisu, a także w celach prowadzenia statystyk, \
 ewaluacji i sprawozdawczości. W przypadku wyrażenia dodatkowej zgody adres e-mail zostanie wykorzystany \
index 06a4627..2743038 100644 (file)
@@ -261,11 +261,9 @@ body.is-open {
 
 
 form {
-    .required {
-        label:before {
-            content: "* ";
-            color: #FF4C54;
-        }
+    label.required:before {
+        content: "* ";
+        color: #FF4C54;
     }
     .helptext {
         color: #808080;
@@ -286,3 +284,89 @@ form {
     }
 }
 
+
+
+.page-simple {
+    margin-bottom: 70px;
+    padding-bottom: 30px;
+    border-radius: 10px;
+    background: #E1F1F2;
+    display: flex;
+    flex-direction: column;
+    align-items: center;
+
+    .white-box {
+        // for legacy templates
+        width: 100%;
+        display: flex;
+        flex-direction: column;
+        align-items: center;
+    }
+    
+    h1 {
+        width: 100%;
+        margin: 0 0 50px 0;
+        padding: 32px 45px;
+        border-radius: 10px 10px 0 0;
+
+        font-style: italic;
+        font-weight: 300;
+        font-size: 48px;
+        line-height: 55px;
+        letter-spacing: -0.02em;
+        background: #083F4D;
+        color: #92BD39;
+    }
+
+    > p, form {
+        min-width: 300px;
+        margin-left: 50px;
+        margin-right: 50px;
+    }
+
+    button, input[type=submit] {
+        margin: 24px 0;
+        height: 56px;
+        background: #083F4D;
+        border-radius: 3px;
+        font-weight: 600;
+        font-size: 20px;
+        line-height: 25px;
+        display: flex;
+        align-items: center;
+        justify-content: center;
+        text-align: center;
+        color: #FFFFFF;
+        width: 340px;
+    }
+
+    label {
+        font-style: normal;
+        font-weight: 600;
+        font-size: 15px;
+        line-height: 160%;
+        color: #083F4D;
+        margin-top: 24px;
+    }
+
+    input {
+        display: block;
+        width: 100%;
+        height: 56px;
+        background: #FFFFFF;
+        color: black;
+        border: 1px solid #D5ECED;
+        border-radius: 3px;
+        transition: all cubic-bezier(0, 0, 0.2, 1) 250ms;
+        padding: 10px;
+        outline: 0;
+    }
+    input[type=checkbox], input[type=radio] {
+        display: inline;
+        float: left;
+        width: 1.2em;
+        height: 1.2em;
+        vertical-align: middle;
+        margin-right: 1em;
+    }
+}
index 5993bec..aa85881 100644 (file)
@@ -2,13 +2,17 @@
 {% load pipeline %}
 {% load static %}
 {% load piwik_tags %}
+{% load title %}
+
+{% block settings %}
+{% endblock %}
 
 <html class="no-js">
   <head>
     <meta charset="utf-8">
     <meta name="description" content="">
     <meta name="viewport" content="width=device-width,initial-scale=1">
-    <title>WolneLektury.pl</title>
+    <title>{% if title %}{{ title }} | {% endif %}WolneLektury.pl</title>
     <link rel="apple-touch-icon" href="apple-touch-icon.png">
     {% stylesheet '2022' %}
       <script src="scripts/modernizr.js"></script>
   <body>
     {% include '2022/header.html' %}
 
-    {% block content %}{% endblock %}
+    {% block global-content %}
+      <div class="l-container">
+        <div class="l-breadcrumb">
+          <a href="/"><span>Strona główna</span></a>
+          {% block breadcrumbs %}<span>{{ title }}</span>{% endblock %}
+        </div>
+      </div>
+
+      <main class="l-main">
+        {% block main %}{% endblock %}
+      </main>
+    {% endblock %}
 
     {% include '2022/footer.html' %}
 
diff --git a/src/wolnelektury/templates/2022/base_simple.html b/src/wolnelektury/templates/2022/base_simple.html
new file mode 100644 (file)
index 0000000..481d814
--- /dev/null
@@ -0,0 +1,13 @@
+{% extends "2022/base.html" %}
+
+
+{% block main %}
+  <div class="page-simple">
+    {% block body %}
+      {% block content %}
+        <h1>{{ title }}</h1>
+        {% block simple-content %}{% endblock %}
+      {% endblock %}
+    {% endblock %}
+  </div>
+{% endblock main %}
diff --git a/src/wolnelektury/templates/2022/form.html b/src/wolnelektury/templates/2022/form.html
deleted file mode 100644 (file)
index 156985b..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-{% if errors %}
-  {{ errors }}
-  {% if not fields %}
-  {% endif %}
-{% endif %}
-{% for field in hidden_fields %}{{ field }}{% endfor %}
-{% for field, errors in fields %}
-  <div class="l-checkout__form__row {% if field.field.required %}required {% endif %} {{ field.css_classes }}">
-    <div class="l-checkout__input">
-      {{ errors }}
-      {% if field.label %}{{ field.label_tag }}{% endif %}
-      {# <span>*</span> #}
-      {{ field }}
-      {# field.help_text|safe #}
-    </div>
-    <div class="l-checkout__input">
-    </div>
-  </div>
-{% endfor %}
index a2ddbe6..e9980c9 100644 (file)
@@ -1,4 +1,4 @@
-{% extends "site_base.html" %}
+{% extends request.EXPERIMENTS.layout.value|yesno:"2022/base_simple.html,site_base.html" %}
 
 {% block body %}
   <div class="white-box normal-text">
index c98d7c7..10294d9 100644 (file)
@@ -1,19 +1,32 @@
-{% extends "site_base.html" %}
+{% extends "openid/base.html" %}
+
 
 {% load i18n %}
+{% block settings %}
+  {% load title %}
+  {% trans "OpenID Sign In" as title %}
+  {% title title %}
+{% endblock %}
+
+
+{% block breadcrumbs %}
+  <a href="{% url 'login' %}"><span>{% trans "Sign In" %}</span></a>
+  {{ block.super }}
+{% endblock %}
+
 
-{% block head_title %}{% trans "OpenID Sign In" %}{% endblock %}
+{% block head_title %}{% endblock %}
 
 {% block body %}
   <h1>{% trans 'OpenID Sign In' %}</h1>
   <div class="normal-text white-box">
     <form id="openid_login_form" class="openid_login" method="post" action="{% url 'openid_login' %}">
       {% csrf_token %}
-          <label for="id_openid">
-            OpenID:
-         </label><br>
-         <input id="id_openid" type="text" class="textinput" name="openid" /><br><br>
-          <button type="submit">{% trans "Sign In" %}</button>
+      <label for="id_openid" class="required">
+        OpenID:
+      </label><br>
+      <input id="id_openid" type="text" class="textinput" name="openid" /><br><br>
+      <button type="submit">{% trans "Sign In" %}</button>
     </form>
   </div>
 {% endblock %}
index 691d3db..a962aec 100644 (file)
@@ -1,50 +1,37 @@
-{% extends "2022/base.html" %}
+{% extends "2022/base_simple.html" %}
 {% load i18n %}
 
+{% block settings %}
+  {% load title %}
+  {% trans 'Sign In' as title %}
+  {% title title %}
+{% endblock %}
+
+
+{% block sbreadcrumbs %}
+  <a>Zaloguj się</a>
+{% endblock %}
+
+{% block stitle %}Zaloguj się{% endblock %}
+
 {% block content %}
-  <div class="l-container">
-    <div class="l-breadcrumb">
-      <a href="/"><span>Strona główna</span></a>
-      <a>Zaloguj się</a>
-    </div>
-  </div>
-
-  <main class="l-main">
-    <div class="l-checkout__box" style="margin-bottom: 70px;">
-      <div class="l-checkout__box__header">
-        <div class="l-checkout__box__header__content">
-          <h1>Zaloguj się</h1>
-        </div>
-      </div>
-      <div class="l-checkout__cols">
-        <div class="l-checkout__col"></div>
-        <div class="l-checkout__col">
-          <form method="post">
-            <div class="l-checkout__form">
-              {% csrf_token %}
-              {{ form }}
-              <div class="l-checkout__form__row confirm">
-                <div class="l-checkout__input">
-                  <button style="margin-left:0">Dalej</button>
-                </div>
-              </div>
-
-              <a href="{% url 'account_reset_password' %}">{% trans "Forgot Password?" %}</a>
-            </div>
-          </form>
-
-          {% if USE_OPENID %}
-            <h3>{% trans "Sign in using:" %}</h3>
-
-            <ul class="socialaccount_providers">
-              {% include "socialaccount/snippets/provider_list.html" %}
-            </ul>
-
-            {% include "socialaccount/snippets/login_extra.html" %}
-          {% endif %}
-
-        </div>
-      </div>
-    </div>
-  </main>
+  <h1>{{ title }}</h1>
+
+  <form method="post">
+    {% csrf_token %}
+    {{ form }}
+    <button>Dalej</button>
+
+    <a href="{% url 'account_reset_password' %}">{% trans "Forgot Password?" %}</a>
+
+    {% if USE_OPENID %}
+      <h3>{% trans "Sign in using:" %}</h3>
+
+      <ul class="socialaccount_providers">
+        {% include "socialaccount/snippets/provider_list.html" %}
+      </ul>
+
+      {% include "socialaccount/snippets/login_extra.html" %}
+    {% endif %}
+  </form>
 {% endblock %}
diff --git a/src/wolnelektury/templates/registration/register.html b/src/wolnelektury/templates/registration/register.html
new file mode 100644 (file)
index 0000000..33ad875
--- /dev/null
@@ -0,0 +1,30 @@
+{% extends "2022/base_simple.html" %}
+{% load i18n %}
+
+
+{% block settings %}
+  {% load title %}
+  {% trans "Register" as title %}
+  {% title title %}
+{% endblock %}
+
+
+{% block simple-content %}
+  <form method="post">
+    {% csrf_token %}
+    {{ form.as_p }}
+    <button>{% trans "Register" %}</button>
+    <p class="helptext">{{ form.data_processing }}</p>
+
+    {% if USE_OPENID %}
+      <h3>{% trans "Sign in using:" %}</h3>
+
+      <ul class="socialaccount_providers">
+        {% include "socialaccount/snippets/provider_list.html" %}
+      </ul>
+
+      {% include "socialaccount/snippets/login_extra.html" %}
+    {% endif %}
+
+  </form>
+{% endblock %}
diff --git a/src/wolnelektury/templates/socialaccount/base.html b/src/wolnelektury/templates/socialaccount/base.html
new file mode 100644 (file)
index 0000000..934f4a6
--- /dev/null
@@ -0,0 +1,7 @@
+{% extends request.EXPERIMENTS.layout.value|yesno:"2022/base_simple.html,account/base.html" %}
+
+
+{% block breadcrumbs %}
+  <span>{% block head_title %}{% endblock %}</span>
+  {{ block.super }}
+{% endblock %}
diff --git a/src/wolnelektury/templatetags/title.py b/src/wolnelektury/templatetags/title.py
new file mode 100644 (file)
index 0000000..47a5876
--- /dev/null
@@ -0,0 +1,9 @@
+from django.template import Library
+
+
+register = Library()
+
+@register.simple_tag(takes_context=True)
+def title(context, t=None):
+    context.dicts[0]['title'] = t
+    return ''
index 593a7ba..8729216 100644 (file)
@@ -12,6 +12,7 @@ from django.contrib.auth.decorators import login_required
 from django.contrib.auth.forms import AuthenticationForm
 from django.contrib.auth.views import LoginView
 from django.core.cache import cache
+from django.views.generic import FormView
 from django.http import HttpResponse, HttpResponseRedirect
 from django.shortcuts import render
 from django.utils.translation import gettext_lazy as _
@@ -102,6 +103,13 @@ class LoginFormView(AjaxableFormView):
         auth.login(request, form.get_user())
 
 
+class WLRegisterView(FormView):
+    form_class = RegistrationForm
+    template_name = 'registration/register.html'
+
+wl_register_view = WLRegisterView.as_view()
+
+
 class RegisterFormView(AjaxableFormView):
     form_class = RegistrationForm
     template = "auth/register.html"
@@ -113,6 +121,9 @@ class RegisterFormView(AjaxableFormView):
     honeypot = True
 
     def __call__(self, request):
+        if request.EXPERIMENTS['layout'].value:
+            return wl_register_view(request)
+
         if request.user.is_authenticated:
             return self.redirect_or_refresh(
                 request, '/',