Separate club join view for app users.
authorRadek Czajka <rczajka@rczajka.pl>
Mon, 18 Mar 2019 09:56:56 +0000 (10:56 +0100)
committerRadek Czajka <rczajka@rczajka.pl>
Mon, 18 Mar 2019 09:56:56 +0000 (10:56 +0100)
src/club/templates/club/membership_form_app.html [new file with mode: 0644]
src/club/urls.py
src/club/views.py
src/wolnelektury/templates/base/app.html [new file with mode: 0644]

diff --git a/src/club/templates/club/membership_form_app.html b/src/club/templates/club/membership_form_app.html
new file mode 100644 (file)
index 0000000..62ad688
--- /dev/null
@@ -0,0 +1,21 @@
+{% extends "base/app.html" %}
+
+
+{% block titleextra %}Towarzystwo Wolnych Lektur{% endblock %}
+
+
+{% block body %}
+<div class="white-box normal-text">
+
+       <h1>{% if membership %}Odnów swoje członkostwo w Towarzystwie Wolnych Lektur{% else %}Dołącz do Towarzystwa Wolnych Lektur{% endif %}</h1>
+
+<form method="POST" action="">
+  {% csrf_token %}
+
+  {{ form.as_p }}
+  <button type='submit'>Dołącz</button>
+</form>
+
+</div>
+
+{% endblock %}
index 0a8b53a..dcefc22 100644 (file)
@@ -5,6 +5,7 @@ from . import views
 urlpatterns = [
     url(r'^$', views.ClubView.as_view()),
     url(r'^dolacz/$', views.JoinView.as_view(), name='club_join'),
 urlpatterns = [
     url(r'^$', views.ClubView.as_view()),
     url(r'^dolacz/$', views.JoinView.as_view(), name='club_join'),
+    url(r'^dolacz/app/$', views.AppJoinView.as_view(), name='club_join'),
 
     url(r'^plan/(?P<key>[-a-z0-9]+)/$', views.ScheduleView.as_view(), name='club_schedule'),
     url(r'^przylacz/(?P<key>[-a-z0-9]+)/$', views.claim, name='club_claim'),
 
     url(r'^plan/(?P<key>[-a-z0-9]+)/$', views.ScheduleView.as_view(), name='club_schedule'),
     url(r'^przylacz/(?P<key>[-a-z0-9]+)/$', views.claim, name='club_claim'),
index e6dc996..1393b96 100644 (file)
@@ -13,8 +13,8 @@ class ClubView(TemplateView):
 
 
 class JoinView(CreateView):
 
 
 class JoinView(CreateView):
-    template_name = 'club/membership_form.html'
     form_class = ScheduleForm
     form_class = ScheduleForm
+    template_name = 'club/membership_form.html'
 
     def get(self, request):
         schedule = get_active_schedule(request.user)
 
     def get(self, request):
         schedule = get_active_schedule(request.user)
@@ -23,7 +23,7 @@ class JoinView(CreateView):
         else:
             return super(JoinView, self).get(request)
 
         else:
             return super(JoinView, self).get(request)
 
-    def get_context_data(self):
+    def get_context_data(self, form=None):
         c = super(JoinView, self).get_context_data()
         c['membership'] = getattr(self.request.user, 'membership', None)
         return c
         c = super(JoinView, self).get_context_data()
         c['membership'] = getattr(self.request.user, 'membership', None)
         return c
@@ -42,6 +42,10 @@ class JoinView(CreateView):
         return retval
 
 
         return retval
 
 
+class AppJoinView(JoinView):
+    template_name = 'club/membership_form_app.html'
+
+
 class ScheduleView(View):
     def get(self, request, key):
         schedule = models.Schedule.objects.get(key=key)
 class ScheduleView(View):
     def get(self, request, key):
         schedule = models.Schedule.objects.get(key=key)
diff --git a/src/wolnelektury/templates/base/app.html b/src/wolnelektury/templates/base/app.html
new file mode 100644 (file)
index 0000000..b893773
--- /dev/null
@@ -0,0 +1,106 @@
+<!DOCTYPE html>
+{% spaceless %}
+  <html lang="{{ LANGUAGE_CODE }}" prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb#">
+    {% load pipeline i18n %}
+    {% load static from staticfiles %}
+    {% load catalogue_tags funding_tags reporting_stats %}
+    {% load piwik_tags %}
+    {% load ssi_include ssi_csrf_token from ssify %}
+    {% load user_username user_is_staff from common_tags %}
+    {% load cache %}
+    {% get_current_language as LANGUAGE_CODE %}
+    <head>
+      <meta charset="utf-8">
+      <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
+      <meta name="application-name" content="Wolne Lektury" />
+      <meta property="og:site_name" content="Wolne Lektury" />
+      <meta property="og:title" content="{% block ogtitle %}{{ page_title }}{% endblock %}" />
+      <meta property="og:type" content="{% block ogtype %}website{% endblock %}" />
+      <meta property="og:image" content="{% block ogimage %}{{ FULL_STATIC_URL }}img/wiatrak.jpg{% endblock %}" />
+      <meta name="description" content="{% block metadescription %}Darmowe, opracowane, pełne teksty lektur, e-booki, audiobooki i pliki DAISY na wolnej licencji.{% endblock %}" />
+      {% block ogextra %}{% endblock %}
+
+      <title>
+        {% block title %}{% block titleextra %}{{ page_title }}{% endblock %} :: {% trans "Wolne Lektury" %}{% endblock %}
+      </title>
+      <link rel="icon" href="{% static 'img/favicon.png' %}" type="image/png"/>
+      <link rel="search" type="application/opensearchdescription+xml" title="Wolne Lektury"
+            href="{% static 'opensearch.xml' %}"/>
+      <link rel="manifest" href="/manifest.json">
+      {% stylesheet "main" %}
+      {% block extrahead %}{% endblock %}
+    </head>
+    <body id="{% block bodyid %}base{% endblock %}">
+
+      {% block bodycontent %}
+
+        <div id="whole-header">
+          <div id="header-wrapper">
+            <header id="main">
+              <a href="/" id="logo">
+                <img src="{% static 'img/logo-neon.png' %}" alt="Wolne Lektury"/>
+              </a>
+
+              <div id="lang-menu" class="hoverget">
+                <span id='lang-button' class='hoverclick'>
+                  <span class="lang-flag">⚐</span>
+                  <span class="label"> {% trans "Language" %}</span>
+                </span>
+                <div id="lang-menu-items">
+                  {% for lang in LANGUAGES %}
+                    <form action="{% url 'set_language' %}" method="post">
+                      {% ssi_csrf_token %}
+                      <input type="hidden" name="language" value="{{ lang.0 }}"/>
+                      <button type="submit" lang="{{ lang.0 }}"
+                              class="{% ifequal lang.0 LANGUAGE_CODE %}active{% endifequal %}">{{ lang.1 }}</button>
+                    </form>
+                  {% endfor %}
+                </div>
+              </div>
+
+              <nav id="menu">
+                <ul id="user-info">
+                  {% user_username as user_username %}
+                  {% user_is_staff as user_is_staff %}
+                  {{ user_username.if }}
+                    <li>
+                      <a href="{% url 'user_settings' %}">
+                        <strong>{{ user_username }}</strong>
+                      </a>
+                    </li>
+                  {{ user_username.endif }}
+                  {{ user_username.if }}
+                    <li>
+                      <a href="{% url 'logout' %}?next={% block logout %}{{ request.get_full_path }}{% endblock %}">{% trans "Logout" %}</a>
+                    </li>
+                  {{ user_username.endif }}
+                </ul>
+
+              </nav>
+            </header>
+          </div>
+        </div>
+
+        <div id="main-content">
+          {% block body %}
+          {% endblock %}
+          <div class="clearboth"></div>
+        </div>
+
+      {% endblock bodycontent %}
+
+      <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
+      <script type="text/javascript">
+        var LANGUAGE_CODE = "{{ LANGUAGE_CODE }}";
+        var STATIC_URL = "{{ STATIC_URL }}";
+      </script>
+      {% javascript "base" %}
+
+      {% tracking_code %}
+
+      {% block extrabody %}{% endblock %}
+
+      <script src="{% static "js/contrib/modernizr.custom.19652.js" %}"></script>
+    </body>
+  </html>
+{% endspaceless %}