{% load honeypot %}
{% render_honeypot_field %}
{% endif %}
- {% if request.EXPERIMENTS.layout.value %}
- {{ form.as_p }}
- <p class="helptext">
- {{ form.data_processing }}
- </p>
- <button>{{ submit }}</button>
- {% else %}
- <ol>
- <div id="id_{% if form_prefix %}{{ form_prefix }}-{% endif %}__all__"></div>
- {% block form_fields %}
- {{ form.as_p }}
- {% endblock %}
- <li><input type="submit" value="{{ submit }}"/></li>
- </ol>
- {% endif %}
+ {{ form.as_p }}
+ <p class="helptext">
+ {{ form.data_processing }}
+ </p>
+ <button>{{ submit }}</button>
</form>
<div class="form-extra">
-{% extends request.EXPERIMENTS.layout.value|yesno:"2022/base_simple.html,base/base.html" %}
+{% extends "2022/base_simple.html" %}
{% load i18n %}
{% block titleextra %}{{ title }}{% endblock %}
+++ /dev/null
-# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
-# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
-#
-from django import template
-from django.utils.encoding import force_str
-from django.utils.safestring import mark_safe
-from ajaxable.utils import placeholdized
-
-
-register = template.Library()
-
-
-@register.filter
-def placeholdize(form):
- return placeholdized(form)
-
-
-@register.filter
-def placeholdized_ul(form):
- return placeholdized(form).as_ul()
-
-
-@register.filter
-def pretty_field(field, template=None):
- if template is None:
- template = '''
- <li>
- <span class="error">%(errors)s</span>
- <label class="nohide"><span class="label">%(label)s: </span>%(input)s</label>
- <span class="helptext">%(helptext)s</span>
- </li>'''
- return mark_safe(template % {
- 'errors': field.errors,
- 'input': field,
- 'label': ('*' if field.field.required else '') + force_str(field.label),
- 'helptext': force_str(field.help_text),
- })
-
-
-@register.filter
-def pretty_checkbox(field):
- return pretty_field(field, template='''
- <li class="checkbox">
- <span class="error">%(errors)s</span>
- <label class="nohide">%(input)s<span class="label"> %(label)s</span></label>
- <span class="helptext">%(helptext)s</span>
- </li>''')
-{% extends request.EXPERIMENTS.layout.value|yesno:"2022/base_simple.html,base/base.html" %}
+{% extends "2022/base_simple.html" %}
{% load i18n %}
{% load build_absolute_uri from fnp_common %}
-{% extends request.EXPERIMENTS.layout.value|yesno:"2022/base_simple.html,base/base.html" %}
+{% extends "2022/base_simple.html" %}
{% load i18n %}
{% block settings %}
def example3(self):
return self.get_books()[:3]
- @cached_render('catalogue/collection_box.html')
- def box(self):
- return {
- 'collection': self
- }
-
def clear_cache(self):
clear_cached_renders(self.box)
"""Returns short version of the fragment."""
return self.short_text if self.short_text else self.text
- @cached_render('catalogue/fragment_short.html')
- def midi_box(self):
- return {'fragment': self}
-
@cached_render('catalogue/fragment_promo.html')
def promo_box(self):
return {'fragment': self}
return self.tags.filter(category='theme')
def clear_cache(self):
- clear_cached_renders(self.midi_box)
clear_cached_renders(self.promo_box)
+++ /dev/null
-{% extends "base/base.html" %}
-{% load i18n %}
-{% load catalogue_tags %}
-{% load build_absolute_uri from fnp_common %}
-{% load annoy_banner from annoy %}
-{% load cache %}
-
-{% block titleextra %}{{ book.pretty_title }}{% endblock %}
-{% block ogimage %}{% if book.cover %}{{ book.cover.url|build_absolute_uri:request }}{% endif %}{% endblock %}
-
-{% block metadescription %}{% book_title book %}. {{ block.super }}{% endblock %}
-
-{% block bodyid %}book-detail{% endblock %}
-
-
-{% block body %}
- {% include 'catalogue/book_wide.html' %}
-
- {% work_list book_children %}
-
- {% spaceless %}
- {% if book.other_versions %}
- <section class="see-also">
- <h1>{% trans "Other versions" %}:</h1>
- {% for rel in book.other_versions %}
- {{ rel.mini_box }}
- {% endfor %}
- </section>
- {% endif %}
-
- {% annoy_banner 'book-page' %}
-
- <section class="see-also">
- <h2>{% trans "See also" %}:</h2>
- {% related_books book taken=book.other_versions|length %}
- </section>
- {% endspaceless %}
-
- {% with book.related_themes as themes %}
- {% if themes %}
- <h2>{% trans "Themes" %}</h2>
- {% plain_list themes book=book %}
- {% endif %}
- {% endwith %}
-
-
- <h2>{% trans "Information about the work" %}</h2>
- {% for author in book.authors %}
- <div class="white-box">
- <a style="display:block" href="{{ author.get_absolute_url }}">
- {% cache 86400 catalogue_tag_box author.pk %}
- {% include 'catalogue/tag_box.html' with tag=author %}
- {% endcache %}
- </a>
- </div>
- {% endfor %}
-
-
- {% with extra_info=book.get_extra_info_json %}
- {% for source_url in extra_info.source_urls %}
- <div class="white-box">
- <a href="{{ source_url }}">{% trans "Source" %}</a> {% trans "of the book" %}
- {% trans "in" %} {% source_name source_url %}
- </div>
- {% empty %}
- {% if extra_info.source_url %}
- <div class="white-box">
- <a href="{{ extra_info.source_url }}">{% trans "Source" %}</a> {% trans "of the book" %}
- {% trans "in" %} {% source_name extra_info.source_url %}
- </div>
- {% endif %}
- {% endfor %}
- {% if book|status:user != 'closed' %}
- <div class="white-box"><a href="{{ book.xml_url }}">{% trans "Source XML file" %}</a></div>
- {% endif %}
- {% if extra_info.about and not hide_about %}
- <div class="white-box">
- {% trans "Book on" %} <a href="{{ extra_info.about }}">{% trans "Editor's Platform" %}</a>
- </div>
- {% endif %}
- {% if book.wiki_link %}
- <div class="white-box">
- <a href="{{ book.wiki_link }}">{% trans "Book description on Wikipedia" %}</a>
- </div>
- {% endif %}
- <div class="white-box">
- <a href="{% url 'poem_from_book' book.slug %}">{% trans "Mix this book" %}</a>
- </div>
-{% endwith %}
-
-{% endblock %}
+++ /dev/null
-{% extends "base/base.html" %}
-{% load i18n %}
-{% load work_list from catalogue_tags %}
-{% load annoy_banner from annoy %}
-
-{% block titleextra %}{% trans "Theme" %} {{ theme }} {% trans "in work " %} {{ book }}{% endblock %}
-
-{% block bodyid %}tagged-object-list{% endblock %}
-
-{% block body %}
- <div class="left-column">
- <h1>{% trans "Theme" %}
- <a href="{{ theme.get_absolute_url }}">{{ theme }}</a>
- <br/>{% trans "in work " %}
- <a href="{{ book.get_absolute_url }}">{{ book }}</a></h1>
-
- {% annoy_banner 'book-fragment-list' %}
-
- </div>
-
- <div class="right-column">
- {% work_list fragments %}
- </div>
-{% endblock %}
+++ /dev/null
-{% extends request.EXPERIMENTS.layout.value|yesno:"2022/base_simple.html,base/base.html" %}
-{% load i18n %}
-{% load catalogue_tags %}
-{% load chunk from chunks %}
-
-{% block bodyid %}book-a-list{% endblock %}
-
-{% block titleextra %}{% trans "Listing of all works" %}{% endblock %}
-
-{% block body %}
- {% spaceless %}
- <h1>{% block book_list_header %}{% trans "Listing of all works" %}{% endblock %}</h1>
-
- <div class="left-column"><div class="normal-text" style="margin-bottom: 2em">
- {% block book_list_info %}
- {% chunk 'book-list' %}
- {% endblock %}
- </div></div>
-
- <div style='clear:both;'></div>
-
- <a name="top"></a>
-
- <div id="book-list-nav">
- <h2>{% trans "Table of Content" %}</h2>
- <div id="book-list-nav-index">
- {{ rendered_nav }}
- </div>
- </div>
- <div id="book-list">
- {% block book_list %}
- {{ rendered_book_list }}
- {% endblock %}
- </div>
- <a id="book-list-up" href="#top">{% trans "↑ top ↑" %}</a>
- {% endspaceless %}
-{% endblock %}
+++ /dev/null
-{% extends "catalogue/book_short.html" %}
-{% load inline_tag_list from catalogue_tags %}
-
-{% block right-column %}
- <div class="book-right-column">
- <div class="snippets">
- {% for hit in hits %}
- {% if hit.snippet %}
- <div class="snippet-text">
- <a href="{% url 'book_text' book.slug %}#sec{{hit.section_number}}">{{hit.snippet|safe}}</a>
- </div>
- {% elif hit.fragment %}
- <div class="snippet-text">
- {% if hit.themes_hit %}
- {% inline_tag_list hit.themes_hit %}
- {% endif %}
- <a href="{{hit.fragment.get_absolute_url}}">
- {% if hit.snippet %}
- {{hit.snippet|safe}}
- {% else %}
- {{hit.fragment.text|truncatewords_html:15|safe}}
- {% endif %}
- </a>
- </div>
- {% endif %}
- {% endfor %}
- </div>
- {% include 'catalogue/snippets/jplayer.html' %}
- </div>
-{% endblock %}
<div class="{% block box-class %}book-box{% if audiobooks %} audiobook-box{% endif %}{% endblock %}">
<div class="book-box-inner">
- {% block book-box-pre %}
- {% include "catalogue/snippets/like_button.html" %}
- {% endblock %}
-
{% with book.tags_by_category as tags %}
<div class="book-left-column">
<div class="book-box-body">
</div>
{% endwith %}
- {% block right-column %}
- {% if audiobooks %}{% if book|status:request.user != 'closed' %}
- <div class="book-right-column">
- {% include 'catalogue/snippets/jplayer.html' %}
- </div>
- {% endif %}{% endif %}
- {% endblock %}
{% if book.abstract %}
<div class="abstract more-expand">
{{ book.abstract|safe }}
+++ /dev/null
-{% extends "catalogue/book_short.html" %}
-{% load i18n %}
-{% load choose_fragment license_icon from catalogue_tags %}
-{% load choose_cite from social_tags %}
-{% load status from catalogue_tags %}
-{% load chunks %}
-
-
-{% block box-class %}book-wide-box{% endblock %}
-
-
-{% block cover-link %}{% if book.get_first_text %}{% url 'book_text' book.get_first_text.slug %}{% endif %}{% endblock %}
-
-
-{% block cover-area-extra %}
- {% with license=book.get_extra_info_json.license %}
- {% if license %}
- {% license_icon license %}
- {% endif %}
- {% endwith %}
-{% endblock %}
-
-
-{% block preview-info %}
- <p class="book-box-tools book-box-tools-warn">
- {% chunk "book-preview-warn" %}
- </p>
-{% endblock %}
-
-
-
-{% block right-column %}
- <div class="right-column">
- <div class="quote">
- {% choose_cite book as cite_promo %}
- {% if cite_promo %}
- {{ cite.promo_box }}
- {% else %}
- {% choose_fragment book as fragment_promo %}
- {% if fragment_promo %}
- {{ fragment_promo.promo_box }}
- {% endif %}
- {% endif %}
- </div>
- {% include 'catalogue/snippets/jplayer.html' %}
-
- {% if book|status:request.user == 'closed' %}
- {% with form=club_form %}
- <form method="POST" action="{% url 'club_join' %}" id="payment-form" class="wlform">
- {% csrf_token %}
- {% include "club/payment_form.html" %}
- {% chunk 'club_form_bottom' %}
- </form>
- {% endwith %}
-
- {% include "club/payment_info.html" %}
- {% endif %}
-
-
- </div>
-{% endblock %}
-
-
-{% block book-box-body-pre %}
- {% include "catalogue/snippets/like_button.html" %}
-{% endblock %}
-
-{% block book-box-pre %}
-{% endblock %}
-{% extends request.EXPERIMENTS.layout|yesno:"2022/base.html,base/base.html" %}
+{% extends "2022/base.html" %}
{% load i18n %}
{% load catalogue_tags reporting_stats %}
+++ /dev/null
-{% extends "base/base.html" %}
-{% load i18n %}
-{% load catalogue_tags %}
-
-{% block titleextra %}{{ collection.title }}{% endblock %}
-
-{% block bodyid %}collection{% endblock %}
-
-{% block body %}
- <h1>{{ collection.title }}</h1>
-
- {{ collection.description|safe }}
-
- {% plain_list collection.get_books by_author=True %}
-{% endblock %}
+++ /dev/null
-{% spaceless %}
- {% load i18n %}
- {% load thumbnail %}
- <div class="collection-box white-box">
- <h2><a href="{{ collection.get_absolute_url }}">{{ collection }}</a></h2>
- <div class="description">
- {% if collection.description %}
- {{ collection.description|safe|truncatewords_html:40 }}
- {% endif %}
- </div>
- <div class="covers">
- {% for book in collection.get_books|slice:":6" %}
- <a href="{{ book.get_absolute_url }}">
- <img src="{% thumbnail book.cover_clean '139x193' as th %}{{ th.url }}{% endthumbnail %}" alt="{{ book.pretty_title }}" title="{{ book.pretty_title }}">
- </a>
- {% endfor %}
- </div>
- </div>
-{% endspaceless %}
+++ /dev/null
-{% extends "base/base.html" %}
-{% load i18n %}
-{% load catalogue_tags %}
-
-{% block titleextra %}{% trans "Collections" %}{% endblock %}
-
-{% block bodyid %}collections{% endblock %}
-
-{% block body %}
- <h1>{% trans "Collections" %}</h1>
-
- {% for obj in best %}
- {{ obj.box }}
- {% endfor %}
-
- <h2>{% trans "All collections" %}</h2>
- {% plain_list objects %}
-{% endblock %}
{% load i18n %}
{% load honeypot %}
-{% load ajaxable_tags %}
<h1>{% trans "Download custom PDF" %}</h1>
<form id='custom-pdf-form' action="" method="post" accept-charset="utf-8" class="cuteform">
{% csrf_token %}
{% render_honeypot_field %}
- {% if request.EXPERIMENTS.layout.value %}
- {{ form.as_p }}
- <button type="submit">{% trans "Download" %}</button>
- {% else %}
- <ol>
- {{ form.nofootnotes|pretty_checkbox }}
- {{ form.nothemes|pretty_checkbox }}
- {{ form.nowlfont|pretty_checkbox }}
- {{ form.nocover|pretty_checkbox }}
- {{ form.leading|pretty_field }}
- {{ form.fontsize|pretty_field }}
-
- <li><input type="submit" value="{% trans "Download" %}"/></li>
- </ol>
- {% endif %}
+ {{ form.as_p }}
+ <button type="submit">{% trans "Download" %}</button>
</form>
+++ /dev/null
-{% extends "catalogue/book_list.html" %}
-{% load i18n %}
-{% load chunk from chunks %}
-
-{% block bodyid %}book-a-list{% endblock %}
-
-{% block titleextra %}{% trans "Listing of all DAISY files" %}{% endblock %}
-
-{% block extrahead %}
- <link rel="alternate" type="application/atom+xml"
- title="{% trans "Latest DAISY audiobooks" %}"
- href="{% url 'audiobook_feed' 'daisy' %}" />
-{% endblock %}
-
-{% block book_list_header %}{% trans "Listing of all DAISY files" %}{% endblock %}
-
-{% block book_list_info %}
- {% chunk 'daisy-list' %}
-{% endblock %}
-{% extends request.EXPERIMENTS.layout.value|yesno:"2022/base_simple.html,base/base.html" %}
+{% extends "2022/base_simple.html" %}
{% load i18n %}
{% load catalogue_tags %}
+++ /dev/null
-{% load i18n %}
-{% load book_title_html from catalogue_tags %}
-
-<div class="cite {% if fragment.short_text %}fragment-with-short{% endif %}">
- {% if fragment.short_text %}
- <div class="fragment-short-text">
- <blockquote class="cite-body">
- <a href="{{ fragment.get_absolute_url }}" class="fragment">
- {{ fragment.short_text|safe }}
- </a>
- </blockquote>
- <a href="#" class="toggle mono">↓ {% trans "Expand fragment" %} ↓</a>
- </div>
- {% endif %}
- <div class="fragment-long-text" {% if fragment.short_text %}style="display:none;"{% endif %}>
- <blockquote class="cite-body fragment-text">
- <a href="{{ fragment.get_absolute_url }}" class="fragment">
- {{ fragment.text|safe }}
- </a>
- </blockquote>
- {% if fragment.short_text %}
- <a href="#" class="toggle mono">↑ {% trans "Hide fragment" %} ↑</a>
- {% endif %}
- </div>
- <p class="mono source">{% book_title_html fragment.book %}</p>
-</div>
+++ /dev/null
-{% extends "base/base.html" %}
-{% load i18n %}
-{% load catalogue_tags pagination_tags %}
-{% load thumbnail %}
-
-
-{% block titleextra %}{{ picture.title }}{% endblock %}
-
-{% block bodyid %}picture-detail{% endblock %}
-
-{% block body %}
- <h1>{{picture.title}}</h1>
-
- <div id="books-list">
- <div id='breadcrumbs'>
- {% if categories.author %}
- {% for tag in categories.author %}
- <a href="{{ tag.get_absolute_url }}">{{ tag }}</a>{% if not forloop.last %}, {% endif %}
- {% endfor %}
- »
- {% endif %}
- </div>
-
- {% thumbnail picture.image_file "400x500" upscale="false" as im %}
- <img style="margin:{{ im|margin:"500x500" }}" src="{{ im.url }}" width="{{ im.x }}" height="{{ im.y }}"/>
- {% endthumbnail %}
-
- {% if picture.info.license %}
- <p>{% trans "Work is licensed under " %} <a href="{{ picture.info.license }}">{{ picture.info.license_description }}</a>.</p>
- {% endif %}
- <p>{% trans "Based on" %}: {{ picture.info.source_name }}</p>
- {% if picture.info.description %}
- <div id="description">
- <div id='description-long'>{{ picture.info.description|safe }}</div>
- {# <div id='description-short'>{{ picture.info.description|safe|truncatewords_html:30 }}</div> #}
- </div>
- <div id="toggle-description"><p></p></div>
- {% endif %}
- </div>
-
- <div id="tags-list">
- <div id="book-info">
- <h2>{% trans "Details" %}</h2>
- <ul>
- <li>
- {% trans "Author" %}:
- {% for tag in categories.author %}
- <a href="{{ tag.get_absolute_url }}">{{ tag }}</a>{% if not forloop.last %}, {% endif %}
- {% endfor %}
- </li>
- <li>
- {% trans "Epoch" %}:
- {% for tag in categories.epoch %}
- <a href="{{ tag.get_absolute_url }}">{{ tag }}</a>{% if not forloop.last %}, {% endif %}
- {% endfor %}
- </li>
- <li>
- {% trans "Kind" %}:
- {% for tag in categories.kind %}
- <a href="{{ tag.get_absolute_url }}">{{ tag }}</a>{% if not forloop.last %}, {% endif %}
- {% endfor %}
- </li>
- </ul>
- <h2>{% trans "Other resources" %}</h2>
- <ul>
- {% if picture.info.source_url %}
- <li><a href="{{ picture.info.source_url }}">{% trans "Source of the image" %}</a></li>
- {% endif %}
- {% if picture.info.about and not hide_about %}
- <li><a href="{{ picture.info.about }}">{% trans "Image on the Editor's Platform" %}</a></li>
- {% endif %}
- </ul>
- <p><a href="{{ picture.xml_file.url }}">{% trans "View XML source" %}</a></p>
- </div>
- <div id="themes-list">
- <h2>{% trans "Work's themes " %}</h2>
- <ul>
- {% for theme in picture_themes %}
- <li><a href="{{ theme.get_absolute_url }}">{{ theme }} ({{ theme.count }})</a></li>
- {% endfor %}
- </ul>
- </div>
- <div class="clearboth"></div>
- </div>
-{% endblock %}
-
-
-{% block extrabody %}
- {% javascript "picture" %}
-{% endblock %}
+++ /dev/null
-{% extends "catalogue/book_list.html" %}
-{% load i18n %}
-{% load catalogue_tags chunks %}
-{% load thumbnail %}
-
-{% block bodyid %}picture-list{% endblock %}
-
-{% block titleextra %}{% trans "Listing of all works" %}{% endblock %}
-
-{% block picture_list_header %}{% trans "Listing of all works" %}{% endblock %}
-
-
-{% block book_list %}
- {% for author, group in pictures_by_author.items %}
- <a name="{{ author.slug }}"></a>
- <div class="group">
- <h2><a href="{{ author.get_absolute_url }}">{{ author }}</a></h2>
- {% for picture in group %}
- <div class="picture">
- {% thumbnail picture.image_file "300x300" as im %}
- <img style="float: left; margin:{{ im|margin:"300x300" }}" src="{{ im.url }}" width="{{ im.x }}" height="{{ im.y }}" />
- {% endthumbnail %}
- <span class="title"><a href="{{picture.get_absolute_url}}">{{picture.title}}</a></span>
- <br class="clearboth"/>
- </div>
- {% endfor %}
- </div>
- {% endfor %}
-{% endblock %}
+++ /dev/null
-<!DOCTYPE html>
-<html>
- {% load static from static %}
- {% load i18n pipeline %}
- {% load catalogue_tags %}
- {% load thumbnail %}
- {% load piwik_tags %}
- <head>
- <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
- <meta name="description"
- content="{{ book.title }} - darmowy audiobook na wolnej licencji" />
- <title>{% trans "Wolne Lektury" %} ::
- {{ book.title }} - {{ audiobook }}</title>
- <link rel="icon" href="{% static "img/favicon.png" %}" type="image/png" />
- {% stylesheet 'main' %}
- {% stylesheet "player" %}
- {% tracking_code %}
- </head>
- <body id="{% block bodyid %}player{% endblock %}">
- {% if book.cover_thumb %}
- <img src="{% thumbnail book.cover_thumb "101x140" as thumb %}{{ thumb.url }}{% empty %}{{ book.cover_thumb.url }}{% endthumbnail %}"
- alt="Cover" style="float: left; margin: .5em 1em 1em 1em;" />
- {% endif %}
-
-
- <h1>{% book_title book %}</h1>
-
- <div class="player-info normal-text">
- <p><a target="_blank" href="{{ book.get_absolute_url }}">{% trans "Book's page" %}</a>.</p>
- <p>{% trans "Download as" %} {% download_audio book False %}.</p>
-
- {% if book.has_daisy_file %}
- <p>DAISY:</p>
- <ul class="daisy-list">
- {% for media in book.get_daisy %}
- <li><a href="{{ media.file.url }}">{{ media.name }}</a></li>
- {% endfor %}
- </ul>
- {% endif %}
- </div>
-
- <div style="clear: both"></div>
- {% include "catalogue/snippets/jplayer.html" %}
-
- {% if projects|length > 1 %}
- <p>{% trans "Audiobooks were prepared as a part of the projects:" %}</p>
- <ul>
- {% for cs, fb in projects %}
- <li>
- {% if fb %}
- {% blocktrans %}{{ cs }}, funded by {{ fb }}{% endblocktrans %}
- {% else %}
- {{ cs }}
- {% endif %}
- </li>
- {% endfor %}
- </ul>
- {% else %}
- <p>
- {% with cs=projects.0.0 fb=projects.0.1 %}
- {% if fb %}
- {% blocktrans %}Audiobooks were prepared as a part of the <em>{{ cs }}</em> project funded by {{ fb }}.{% endblocktrans %}
- {% else %}
- {% blocktrans %}Audiobooks were prepared as a part of the <em>{{ cs }}</em> project.{% endblocktrans %}
- {% endif %}
- {% endwith %}
- </p>
- {% endif %}
-
- <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.7.1/jquery.min.js" integrity="sha512-BkBgWiL0N/EFIbLZYGTgbksKG5bS6PtwnWvVk3gccv+KhtK/4wkLxCRGh+kelKiXx7Ey4jfTabLg3AEIPC7ENA==" crossorigin="anonymous"></script>
- {% javascript "player" %}
-
- </body>
-</html>
+++ /dev/null
-{% load i18n catalogue_tags %}
-{% if audiobooks %}{% if book|status:request.user != 'closed' %}
- <div class="jp-type-playlist" data-book-id="{{ book.pk }}" data-book-slug="{{ book.slug }}">
- <div id="jplayer" class="jp-jplayer" data-player="jp_container_{{ book.pk }}"
- data-supplied="oga,mp3"></div>
- <div id="jp_container_{{ book.pk }}" class="jp-audio">
- <div class="jp-type-single">
- <span class="title"></span>
- <div class="jp-gui jp-interface">
- <ul class="jp-controls">
- <li><a href="javascript:;" class="jp-play" tabindex="1">play</a></li>
- <li><a href="javascript:;" class="jp-pause" tabindex="1">pause</a></li>
- <li><a href="javascript:;" class="jp-mute" tabindex="1" title="mute">mute</a></li>
- <li><a href="javascript:;" class="jp-unmute" tabindex="1" title="unmute">unmute</a></li>
- </ul>
- <div class="jp-progress">
- <div class="jp-seek-bar">
- <div class="jp-play-bar"></div>
- </div>
- </div>
- <div class="jp-volume-bar">
- <div class="jp-volume-bar-value"></div>
- </div>
- <div class="jp-time-holder">
- <div class="jp-current-time"></div>
- <div class="jp-duration"></div>
- </div>
- </div>
- <div class="jp-playlist">
- <ul>
- {% for i in audiobooks %}
- <li data-mp3='{{ i.mp3.file.url }}' data-ogg='{{ i.ogg.file.url }}' data-media-id="{{ i.mp3.id }}">
- <div class='play'>{{ i.mp3.name }}
- <div class='extra-info'>
- {% with extra_info=i.mp3.get_extra_info_json %}
- {% trans "Artist:" %} <span class='artist'>{{ extra_info.artist_name }}</span>,
- {% trans "director:" %} <span class='director'>{{ extra_info.director_name }}</span>
- {% if extra_info.license %}{% license_icon extra_info.license %}{% endif %}
- {% if i.mp3.project_icon %}<img class="project-icon" src="{{ i.mp3.project_icon }}">{% endif %}
- <p>
- {% if i.mp3.project_description %}{{ i.mp3.project_description }}{% else %}
- {% with fb=extra_info.funded_by %}
- {% if fb %}Dofinansowano ze środków: {{ fb }}.{% endif %}
- {% endwith %}
- {% endif %}
- </p>
- {% endwith %}
- </div>
- </div>
- </li>
- {% endfor %}
- </ul>
- </div>
-
- <div class="jp-no-solution">
- <span>Update Required</span>
- To play the media you will need to either update your browser to a recent version or update your
- <a href="http://get.adobe.com/flashplayer/" target="_blank">Flash plugin</a>.
- </div>
- </div>
- </div>
- <div>
- {% if audiobooks|length > 1 %}
- <a class="play-prev">« {% trans "previous" %}</a>
- {% trans "Part" %} <span class="number">1</span> / {{ audiobooks|length }}
- <a class="play-next">{% trans "next" %} »</a>
- {% endif %}
- </div>
- </div>
-{% endif %}{% endif %}
+++ /dev/null
-{% load likes_book from social_tags %}
-{% likes_book book as likes %}
-<div class="star {% if not likes %}un{% endif %}like">
- <div class="if-like" >
- <a id="social-book-sets-{{ book.slug }}" data-callback='social-book-sets'
- class='ajaxable' href='{% url "social_book_sets" book.slug %}'>★</a>
- </div>
- <div class="if-unlike">
- <form id="social-like-book-{{ book.slug }}"
- data-callback='social-like-book' method='post'
- class='ajax-form' action='{% url "social_like_book" book.slug %}'>
- {% csrf_token %}
- <button type='submit'>☆</button>
- </form>
- </div>
-</div>
+++ /dev/null
-{% extends "base/base.html" %}
-{% load i18n %}
-{% load cache %}
-{% load plain_list from catalogue_tags %}
-
-{% block titleextra %}{{ title }}{% endblock %}
-
-{% block bodyid %}tag-catalogue{% endblock %}
-
-{% block body %}
- <h1>{{ title|title }} {% trans "on Wolne Lektury" %}</h1>
-
- {% for tag in best %}
- <a class="tag-box" href="{{ tag.get_absolute_url }}">
- {% cache 86400 catalogue_tag_box tag.pk %}
- {% include 'catalogue/tag_box.html' %}
- {% endcache %}
- </a>
- {% endfor %}
-
- <h2>{{ whole_category }}</h2>
-
- {% plain_list tags %}
-{% endblock %}
+++ /dev/null
-{% extends "base/base.html" %}
-{% load i18n %}
-{% load catalogue_tags social_tags %}
-
-{% block titleextra %}{% if tags %}{% title_from_tags tags %}{% elif list_type == 'gallery' %}{% trans "Art" %}{% elif list_type == 'audiobooks' %}{% trans "Audiobooks" %}{% else %}{% trans "Literature" %}{% endif %}{% endblock %}
-
-
-{% block bodyid %}tagged-object-list{% endblock %}
-
-{% block body %}
- <div class="tabbed-filter">
- <h1>{% if tags %}{% html_title_from_tags tags %}{% endif %}</h1>
-
- <div class="tabs">
- <a class="tab white-box" data-id="authors">{% trans "Authors" %}</a>
- <a class="tab white-box" data-id="epochs">{% trans "Epochs" %}</a>
- <a class="tab white-box" data-id="genres">{% trans "Genres" %}</a>
- <a class="tab white-box" data-id="kinds">{% trans "Kinds" %}</a>
- {% if theme_is_set %}
- <a class="tab white-box" data-id="themes">{% trans "Themes" %}</a>
- {% endif %}
- </div>
- </div>
-
- <div class="tabbed-filter-contents">
- <div id="authors" class="white-box normal-text tab-content">
- {% inline_tag_list categories.author tags 'author' list_type=list_type %}
- </div>
- <div id="epochs" class="white-box normal-text tab-content">
- {% inline_tag_list categories.epoch tags 'epoch' list_type=list_type %}
- </div>
- <div id="genres" class="white-box normal-text tab-content">
- {% inline_tag_list categories.genre tags 'genre' list_type=list_type %}
- </div>
- <div id="kinds" class="white-box normal-text tab-content">
- {% inline_tag_list categories.kind tags 'kind' list_type=list_type %}
- </div>
- {% if theme_is_set %}
- <div id="themes" class="white-box normal-text tab-content">
- {% inline_tag_list categories.theme tags 'theme' list_type=list_type %}
- </div>
- {% endif %}
- </div>
-
- {% if theme_is_set %}
- {% work_list object_list %}
- {% else %}
- <div id="books-list">
- {% if object_list %}
- {% work_list best %}
- {% if tags %}
- <h2>{% trans "All matching works" %}</h2>
- {% else %}
- {% if list_type == 'audiobooks' %}
- <h2>{% trans "Listing of all audiobooks" %}</h2>
- {% else %}
- <h2>{% trans "All works" %}</h2>
- {% endif %}
- {% endif %}
- {% plain_list object_list by_author=True list_type=list_type %}
- {% if daisy %}
- <h2>{% trans "DAISY files" %}</h2>
- {% plain_list daisy by_author=True %}
- {% endif %}
- {% else %}
- {% trans "Sorry! Search cirteria did not match any resources." %}
- {% include "info/join_us.html" %}
- {% endif %}
- </div>
-
- {% if categories.theme and list_type != 'audiobooks' %}
- <h2>{% trans "Motifs and themes" %}</h2>
- {% plain_list categories.theme choice=tags list_type=list_type %}
- {% endif %}
- {% endif %}
-
- {% for tag in tags %}
- {% if tag.category != 'set' %}
- <h2>{% trans tag.category as c %}{{ c|capfirst }}: {{ tag }}</h2>
- <div class="white-box">
- {% if tag.has_description %}
- {{ tag.description|safe }}
- {% else %}
- <em>{% trans "No description." %}</em>
- {% endif %}
- </div>
-
- {% if tag.wiki_link %}
- <div class="white-box">
- <a href="{{ tag.wiki_link }}">
- {{ tag }} {% trans "in Wikipedia" %}
- </a></div>
- {% endif %}
- {% if tag.culturepl_link %}
- <div class="white-box">
- <a href="{{ tag.culturepl_link }}">
- {{ tag }} {% trans "in Culture.pl" %}
- </a></div>
- {% endif %}
- {% endif %}
- {% endfor %}
-{% endblock %}
+++ /dev/null
-{% spaceless %}
-
- {% load cache %}
- {% load pagination_tags %}
- {% load class_name from catalogue_tags %}
- {% load status from catalogue_tags %}
-
- {% autopaginate object_list 10 %}
-
- <ol class='work-list'>
- {% for item in object_list %}
- <li class='{{ item|class_name }}-item'>
- {% if item|class_name == 'Book' %}
- {% include "catalogue/book_short.html" with book=item %}
- {% else %}
- {{ item.midi_box }}
- {% endif %}
- </li>
- {% endfor %}
- </ol>
-
- {% paginate %}
-
-{% endspaceless %}
}
-@register.inclusion_tag('catalogue/work-list.html', takes_context=True)
-def work_list(context, object_list):
- request = context.get('request')
- return {'object_list': object_list, 'request': request}
-
-
@register.inclusion_tag('catalogue/plain_list.html', takes_context=True)
def plain_list(context, object_list, with_initials=True, by_author=False, choice=None, book=None, list_type='books',
paged=True, initial_blocks=False):
return LICENSES.get(license_url, {}).get('locative', default)
-@register.filter
-def class_name(obj):
- return obj.__class__.__name__
-
-
@register.simple_tag
def source_name(url):
url = url.lstrip()
path('rodzaj/', views.tag_catalogue, {'category': 'kind'}, name='kind_catalogue'),
path('motyw/', views.tag_catalogue, {'category': 'theme'}, name='theme_catalogue'),
- path('galeria/', views.gallery, name='gallery'),
+ path('galeria/', views.GalleryView.as_view(), name='gallery'),
path('kolekcje/', views.collections, name='catalogue_collections'),
- path('lektury/', views.literature, name='book_list'),
+ path('lektury/', views.LiteratureView.as_view(), name='book_list'),
path('lektury/<slug:slug>/', views.collection, name='collection'),
- path('audiobooki/', views.audiobooks, name='audiobook_list'),
+ path('audiobooki/', views.AudiobooksView.as_view(), name='audiobook_list'),
path('daisy/', views.daisy_list, name='daisy_list'),
path('jtags/', search.views.hint, {'param': 'q', 'mozhint': True}, name='jhint'),
path('nowe/', ListView.as_view(
# Public interface. Do not change this URLs.
path('lektura/<slug:slug>.html', views.book_text, name='book_text'),
- path('lektura/<slug:slug>/audiobook/', views.player, name='book_player'),
path('lektura/<slug:slug>/', views.book_detail, name='book_detail'),
path('lektura/<slug:slug>/motyw/<slug:theme_slug>/',
views.book_fragments, name='book_fragments'),
from django.views.generic import TemplateView
from ajaxable.utils import AjaxableFormView
-from club.forms import ScheduleForm, DonationStep1Form
+from club.forms import DonationStep1Form
from club.models import Club
from annoy.models import DynamicTextInsert
from pdcounter import views as pdcounter_views
})
-def book_list(request, filters=None, template_name='catalogue/book_list.html',
- nav_template_name='catalogue/snippets/book_list_nav.html',
- list_template_name='catalogue/snippets/book_list.html'):
- """ generates a listing of all books, optionally filtered """
- books_by_author, orphans, books_by_parent = Book.book_list(filters)
- books_nav = OrderedDict()
- for tag in books_by_author:
- if books_by_author[tag]:
- books_nav.setdefault(tag.sort_key[0], []).append(tag)
- return render(request, template_name, {
- 'rendered_nav': render_to_string(nav_template_name, {'books_nav': books_nav}),
- 'rendered_book_list': render_to_string(list_template_name, {
- 'books_by_author': books_by_author,
- 'orphans': orphans,
- 'books_by_parent': books_by_parent,
- })
- })
-
-
def daisy_list(request):
- if request.EXPERIMENTS['layout'].value:
- return object_list(request, Book.objects.filter(media__type='daisy'))
- return book_list(request, Q(media__type='daisy'), template_name='catalogue/daisy_list.html')
+ return object_list(request, Book.objects.filter(media__type='daisy'))
def collection(request, slug):
coll = get_object_or_404(Collection, slug=slug)
- if request.EXPERIMENTS['layout'].value:
- template_name = 'catalogue/2022/collection.html'
- else:
- template_name = 'catalogue/collection.html'
+ template_name = 'catalogue/2022/collection.html'
return render(request, template_name, {
'collection': coll,
'active_menu_item': 'collections',
if extra:
result.update(extra)
- if request.EXPERIMENTS['layout'].value:
- has_theme = any(((theme := x).category == 'theme' for x in tags))
- if has_theme:
- result['main_tag'] = theme
- template = 'catalogue/2022/theme_detail.html'
- else:
- template = 'catalogue/2022/author_detail.html'
+ has_theme = any(((theme := x).category == 'theme' for x in tags))
+ if has_theme:
+ result['main_tag'] = theme
+ template = 'catalogue/2022/theme_detail.html'
else:
- template = 'catalogue/tagged_object_list.html'
+ template = 'catalogue/2022/author_detail.html'
return render(
request, template, result,
)
-def literature(request):
- if request.EXPERIMENTS['layout'].value:
- return LiteratureView.as_view()(request)
- books = Book.objects.filter(parent=None, findable=True)
- return object_list(request, books, related_tags=get_top_level_related_tags([]))
-
-
-def gallery(request):
- if request.EXPERIMENTS['layout'].value:
- return GalleryView.as_view()(request)
- return object_list(request, Picture.objects.all(), list_type='gallery')
-
-
-def audiobooks(request):
- if request.EXPERIMENTS['layout'].value:
- return AudiobooksView.as_view()(request)
- audiobooks = Book.objects.filter(findable=True, media__type__in=('mp3', 'ogg')).distinct()
- return object_list(request, audiobooks, list_type='audiobooks', extra={
- 'daisy': Book.objects.filter(findable=True, media__type='daisy').distinct(),
- })
-
-
class ResponseInstead(Exception):
def __init__(self, response):
super(ResponseInstead, self).__init__()
def tagged_object_list(request, tags, list_type):
- if request.EXPERIMENTS['layout'].value and list_type in ('books', 'audiobooks'):
+ if list_type in ('books', 'audiobooks'):
return TaggedObjectList.as_view()(request, tags=tags)
try:
fragments = Fragment.tagged.with_all([theme]).filter(
Q(book=book) | Q(book__ancestor=book))
- if request.EXPERIMENTS['layout'].value:
- template_name = 'catalogue/2022/book_fragments.html'
- else:
- template_name = 'catalogue/book_fragments.html'
-
+ template_name = 'catalogue/2022/book_fragments.html'
return render(
request,
template_name,
except Book.DoesNotExist:
return pdcounter_views.book_stub_detail(request, slug)
- new_layout = request.EXPERIMENTS['layout']
-
return render(
request,
- 'catalogue/2022/book_detail.html' if new_layout.value else 'catalogue/book_detail.html',
+ 'catalogue/2022/book_detail.html',
{
'book': book,
'accessible': book.is_accessible_to(request.user),
'book_children': book.children.all().order_by('parent_number', 'sort_key'),
'active_menu_item': 'books',
- 'club_form': ScheduleForm() if book.preview else None,
'club': Club.objects.first() if book.preview else None,
'donation_form': DonationStep1Form(),
})
-# używane w publicznym interfejsie
-def player(request, slug):
- book = get_object_or_404(Book, slug=slug)
- if not book.has_media('mp3'):
- raise Http404
-
- audiobooks, projects, total_duration = book.get_audiobooks()
-
- return render(
- request,
- 'catalogue/player.html',
- {
- 'book': book,
- 'audiobook': '',
- 'audiobooks': audiobooks,
- 'projects': projects,
- })
-
-
def book_text(request, slug):
book = get_object_or_404(Book, slug=slug)
else:
best = described_tags
- if request.EXPERIMENTS['layout'].value:
- template_name = 'catalogue/2022/tag_catalogue.html'
- else:
- template_name = 'catalogue/tag_catalogue.html'
-
+ template_name = 'catalogue/2022/tag_catalogue.html'
return render(request, template_name, {
'tags': tags,
'best': best,
else:
best = objects
- if request.EXPERIMENTS['layout'].value:
- template_name = 'catalogue/2022/collections.html'
- else:
- template_name = 'catalogue/collections.html'
-
+ template_name = 'catalogue/2022/collections.html'
return render(request, template_name, {
'objects': objects,
'best': best,
from .payu.forms import CardTokenForm
-class ScheduleForm(forms.ModelForm, NewsletterForm):
- data_processing = '''Informacja o przetwarzaniu danych osobowych
-
-<div class='more-expand'>Administratorem Twoich danych osobowych jest Fundacja Wolne Lektury z siedzibą w Warszawie, przy ul. Marszałkowskiej 84/92 lok.125, 00-514 Warszawa (dalej: Fundacja).
-
-Z Fundacją można się kontaktować we wszystkich sprawach dotyczących przetwarzania danych osobowych oraz korzystania z praw związanych z przetwarzaniem danych, w szczególności w zakresie wycofania udzielonej zgody na przetwarzanie danych poprzez adres e-mail fundacja@nowoczesnapolska.org.pl, telefonicznie pod numerem +48 22 621 30 17 (w dni powszednie w godz. 9-17) lub listownie pisząc na adres siedziby Fundacji.
-Podanie danych osobowych jest dobrowolne, jednak konieczne do przeprowadzenia płatności oraz realizacji innych celów wskazanych poniżej.
-
-Twoje dane będą przetwarzane w celu:
- • rozliczeniowym, księgowym, i innych sprawach związanych z Twoją darowizną na podstawie art. 6 ust. 1 lit. b i c RODO,
- • kontaktu telefonicznego, przez media elektroniczne oraz listownie, celem informowania o działalności oraz prośby o wsparcie na podstawie art. 6 ust. 1 lit. a,
- • przesyłania e-mailem newslettera: regularnej informacji o działalności fundacji oraz próśb o wsparcie na podstawie art. 6 ust. 1 lit. a RODO,
- • ewentualnego ustalenia i dochodzenia roszczeń lub obrony przed nimi; zapewnienia bezpieczeństwa u Administratora oraz realizacji wewnętrznych celów administracyjnych, analitycznych i statystycznych na podstawie art. 6 ust. 1 lit. f RODO; uzasadnionym interesem Administratora jest możliwość obrony przed ewentualnymi roszczeniami, zapewnienia bezpieczeństwa u Administratora oraz możliwość realizacji wewnętrznych celów administracyjnych, analitycznych i statystycznych przez Fundację.
-
-Fundacja nie udostępnia Twoich danych osobowych podmiotom trzecim. Fundacja może korzystać z usług podwykonawców w celu realizacji kontaktu w ramach wyrażonej zgody. W szczególności Twoje dane mogą być przekazywane podmiotom takim jak banki, firma obsługująca księgowość i firmy współpracujące przy prowadzeniu akcji informacyjnych i edukacyjnych – przy czym takie podmioty przetwarzają dane wyłącznie na podstawie umowy z administratorem, wyłącznie zgodnie z poleceniami administratora i wyłącznie zgodnie z zakresem udzielonej zgody.
-
-Twoje dane osobowe będą przechowywane do momentu wycofania zgody, rozliczenia darowizn, a po tym okresie przez okres przedawnienia ewentualnych roszczeń lub przez okres, który wynika z przepisów prawa, w szczególności obowiązku przechowywania dokumentów księgowych (rachunkowych).
-
-Przysługuje Ci prawo dostępu do Twoich danych oraz prawo żądania ich sprostowania, ich usunięcia lub ograniczenia ich przetwarzania. W zakresie, w jakim podstawą przetwarzania Twoich danych osobowych jest przesłanka prawnie uzasadnionego interesu administratora, przysługuje Ci prawo wniesienia sprzeciwu wobec przetwarzania Twoich danych osobowych. W zakresie, w jakim podstawą przetwarzania Twoich danych osobowych jest zgoda, masz prawo wycofania zgody. Wycofanie zgody nie ma wpływu na zgodność z prawem przetwarzania, którego dokonano na podstawie zgody przed jej wycofaniem. W celu skorzystania z powyższych praw należy skontaktować się z fundacją w dowolny wskazany powyżej sposób.
-
-Masz prawo do wniesienia skargi do organu nadzorczego, jeżeli uważasz, że Twoje dane osobowe są przetwarzane w niewłaściwy sposób.
-
-Twoje dane osobowe nie będą profilowane, ani przesyłane do państw trzecich i organizacji międzynarodowych.
-
-</div>
-'''.replace('\n', '<br>')
-
- class Meta:
- model = models.Schedule
- fields = ['monthly', 'amount',
- 'first_name', 'last_name',
- 'email', 'phone',
- 'postal',
- 'postal_code', 'postal_town', 'postal_country',
- 'method']
- widgets = {
- 'amount': forms.HiddenInput,
- 'monthly': forms.HiddenInput,
- 'method': forms.HiddenInput,
-
- 'first_name': forms.TextInput(attrs={"placeholder": _('first name')}),
- 'last_name': forms.TextInput(attrs={"placeholder": _('last name')}),
-
- 'postal': forms.Textarea(attrs={"placeholder": _("street address")}),
- 'postal_code': forms.TextInput(attrs={"placeholder": _('postal code')}),
- 'postal_town': forms.TextInput(attrs={"placeholder": _('town')}),
- }
-
- def __init__(self, referer=None, **kwargs):
- self.referer = referer
- super().__init__(**kwargs)
-
- self.fields['first_name'].required = True
- self.fields['last_name'].required = True
- self.fields['phone'].required = True
-
- self.consent = []
- for c in models.Consent.objects.filter(active=True).order_by('order'):
- key = f'consent{c.id}'
- self.fields[key] = forms.BooleanField(
- label=c.text,
- required=c.required
- )
- self.consent.append((
- c, key, (lambda k: lambda: self[k])(key)
- ))
-
- def clean_amount(self):
- value = self.cleaned_data['amount']
- club = models.Club.objects.first()
- if club and value < club.min_amount:
- raise forms.ValidationError(
- _('Minimal amount is %(amount)d PLN.') % {
- 'amount': club.min_amount
- }
- )
- return value
-
- def clean_method(self):
- value = self.cleaned_data['method']
- monthly = self.cleaned_data['monthly']
- for m in payment_methods.methods:
- if m.slug == value:
- if (monthly and m.is_recurring) or (not monthly and m.is_onetime):
- return value
- if monthly:
- return payment_methods.recurring_payment_method.slug
- else:
- return payment_methods.single_payment_method.slug
-
- def save(self, *args, **kwargs):
- NewsletterForm.save(self, *args, **kwargs)
- self.instance.source = self.referer or ''
- instance = super().save(*args, **kwargs)
-
- consents = []
- for consent, key, consent_field in self.consent:
- if self.cleaned_data[key]:
- instance.consent.add(consent)
-
- return instance
-
-
class PayUCardTokenForm(CardTokenForm):
def get_queryset(self, view):
return view.get_schedule().payucardtoken_set
updateable = False
def initiate(self, request, schedule):
- return reverse('club_dummy_payment', args=[schedule.key])
+ raise NotImplementedError
class PayU(PaymentMethod):
expiration_reliable = True
slug = 'payu'
name = 'PayU'
- template_name = 'club/payment/payu.html'
def __init__(self, pos_id):
self.pos_id = pos_id
class PayURe(PaymentMethod):
slug = 'payu-re'
name = 'PayU recurring'
- template_name = 'club/payment/payu-re.html'
is_recurring = True
expiration_reliable = True
cancellable = True
class PayPal(PaymentMethod):
slug = 'paypal'
name = 'PayPal'
- template_name = 'club/payment/paypal.html'
is_recurring = True
is_onetime = False
+++ /dev/null
-{% extends request.session.from_app|yesno:"base/app.html,base/base.html" %}
-
-
-{% block titleextra %}{% trans "Wolne Lektury need your help!" %}{% endblock %}
-
-
-{% block body %}
- <div class="white-box normal-text">
-
- <h1>Testowa płatność</h1>
-
- <p> {{ schedule.email }}</p>
- <p> {{ schedule.amount }}</p>
- <p> {{ schedule.plan.get_interval_display }}</p>
-
- <!--form method="POST" action="">
- {% csrf_token %}
-
- {{ form.as_p }}
- <button type='submit'>Zapłać</button>
- </form-->
-
-
- {% if request.GET.p == 'inline' %}
- <div id="payu-widget"></div>
- {% else %}
- {% if request.GET.p == 'popup' %}
- <form action="http://exampledomain.com/processOrder.php" method="post">
- <button id="pay-button">Pay now</button>
- </form>
- <script
- src="https://secure.payu.com/front/widget/js/payu-bootstrap.js"
- pay-button="#pay-button"
- merchant-pos-id="145227"
- shop-name="Nazwa sklepu"
- total-amount="9.99"
- currency-code="PLN"
- customer-language="pl"
- store-card="true"
- customer-email="email@exampledomain.com"
- sig="250f5f53e465777b6fefb04f171a21b598ccceb2899fc9f229604ad529c69532">
- </script>
-
-
- {% else %}
- <form method="POST" action="">
- {% csrf_token %}
-
- {{ form.as_p }}
- <button type='submit'>Zapłać</button>
- </form>
- {% endif %}
- {% endif %}
-
- </div>
-
- <script
- src="https://secure.payu.com/front/widget/js/payu-bootstrap.js"
- merchant-pos-id="145227"
- shop-name="TEST"
- total-amount="12345"
- currency-code="PLN"
- customer-language="en"
- store-card="true"
- payu-brand="false"
- success-callback="test"
- widget-mode="use"
- customer-email="test@test.com"
- sig="203ec8c4b9571ce6b4c03058f57264f04d06d00a86da19390d47ba1be4551578"
- </script>
-
-{% endblock %}
-{% extends request.EXPERIMENTS.layout.value|yesno:"2022/base_simple.html,base/base.html" %}
+{% extends "2022/base_simple.html" %}
{% load i18n %}
{% load active_schedule from club %}
{% load chunks %}
+++ /dev/null
-{% extends request.session.from_app|yesno:"base/app.html,base/base.html" %}
-{% load i18n %}
-{% load chunks %}
-{% load thumbnail %}
-{% load club %}
-
-{% block titleextra %}{% trans "Join us in freeing the books!" %}{% endblock %}
-{% block metadescription %}{% trans "„Wolne Lektury należy wspierać, bo są” - Filip Springer" %}{% endblock %}
-
-
-{% block body %}
- <div class="white-box normal-text">
-
- <h1>{% trans "Support Wolne Lektury" %}</h1>
- <h2 style="margin-bottom:2em;">
- {% if membership %}
- {# Displays to members. #}
- {% trans "Thank you for your support! Support us again!" %}
- {% else %}
- {# Displays to non-supporters. #}
- {% trans "Thank you for wanting to free the books with us!" %}
- {% endif %}</h2>
-
- {% with schedule=request.user|active_schedule %}
- {% if schedule %}
- <p><a href="{{ schedule.get_absolute_url }}">{% trans "See your past support." %}</a></p>
- {% endif %}
- {% endwith %}
-
- <div class='twocol'>
-
- <form method="POST" action="" id="payment-form" class="wlform">
- {% csrf_token %}
-
- {% chunk 'club_form_top' %}
-
- {% if supporters_target %}
- {% club_monthly_since supporters_since as supporters %}
- {% club_monthly_missing_since supporters_since supporters_target as missing_supporters %}
- <p>
- {% blocktrans %}Help us get 100 new Friends by the end of the school semester.{% endblocktrans %}
- {% blocktrans count supporters=supporters %}
- So far <b style="color: #0d7e85">{{ supporters }}</b> reader has already supported us with a regular donation,
- {% plural %}
- So far <b style="color: #0d7e85">{{ supporters }}</b> readers have already supported us with a regular donation,
- {% endblocktrans %}
- {% blocktrans count missing_supporters=missing_supporters %}
- <b style="color: #0d7e85">{{ missing_supporters }}</b> is missing.
- {% plural %}
- <b style="color: #0d7e85">{{ missing_supporters }}</b> are missing.
- {% endblocktrans %}
- </p>
- <div class="funding" style="background: none;"><div class="description"><div class="progress" style="text-align: center; background-size: {{ supporters }}% 1px;"><span class="piece progress-collected"> {{ supporters }}</span><span class="piece progress-target">{{ missing_supporters }} </span><div style="clear: both"></div></div></div></div>
- {% endif %}
-
- {% include "club/payment_form.html" %}
-
- {% chunk 'club_form_bottom' %}
-
- </form>
-
- <div class="club-form-info">
- {% if ambassador %}
- <div class="ambassador {% if ambassador.photo %}with-photo{% endif %}">
- <div>
- <em>
- {{ ambassador.text }}
- </em>
- <div style="font-size: 1.2em">{{ ambassador.name }}</div>
- </div>
- {% if ambassador.photo %}
- <img src="{% thumbnail ambassador.photo "100x100" as thumb %}{{ thumb.url }}{% empty %}{{ ambassador.photo.url }}{% endthumbnail %}">
- {% endif %}
- </div>
- {% endif %}
-
- {% include "club/payment_info.html" %}
-</div>
-</div>
-
-</div>
-
-{% endblock %}
+++ /dev/null
-{% extends "base/app.html" %}
-{% load i18n %}
-
-
-{% block titleextra %}{% trans "Wolne Lektury need your help!" %}{% endblock %}
-
-
-{% block body %}
- <div class="white-box normal-text">
-
- <h1>{% if membership %}Odnów swoje wsparcie dla Wolnych Lektur{% else %}Wspieraj Wolne Lektury{% endif %}</h1>
-
- <form method="POST" action="">
- {% csrf_token %}
-
- {{ form.as_p }}
- <button type='submit'>Wspieraj</button>
-</form>
-
-</div>
-
-{% endblock %}
+++ /dev/null
-{% load static %}
-<img src="{% static 'club/paypal.png' %}">
-
+++ /dev/null
-{% load i18n %}
-{% load static %}
-<span style="padding-right: 5px; font-size: 12px">
- {% trans "Safe payments" %}
-</span>
-<span class="button active" data-method="payu-re">
- <img src="{% static 'club/payu/payu.png' %}" alt="PayU">
- <img src="{% static 'club/visa-100.png' %}" alt="Visa" >
- <img src="{% static 'club/mastercard.png' %}" alt="Mastercard">
-</span>
-<span class="button" data-method="paypal">
- <img src="{% static 'club/paypal2.png' %}" alt="PayPal">
-</span>
+++ /dev/null
-{% load i18n %}
-{% load static %}
-<span style="vertical-align: bottom; padding-right: 5px; font-size: 12px;">
- {% trans "Safe payments" %}
-</span>
-<img src="{% static 'club/payu/payu.png' %}">
-<img src="{% static 'club/payu/blik.png' %}">
-<img src="{% static 'club/visa-100.png' %}">
-<img src="{% static 'club/mastercard.png' %}">
-<span class="method">{# As in wire transfer of money. #}{% trans "transfer" %}</span>
+++ /dev/null
-{% load i18n %}
-
-<ul class="errorlist">
- {% for e in form.non_field_errors %}
- <li>{{ e }}</li>
- {% endfor %}
- {% for e in form.plan.errors %}
- <li>{{ e }}</li>
- {% endfor %}
- {% for e in form.amount.errors %}
- <li>{{ e }}</li>
- {% endfor %}
- {% for e in form.method.errors %}
- <li>{{ e }}</li>
- {% endfor %}
-</ul>
-
-<h3>1. {% trans "Choose your type of support" %}</h3>
-
-{{ form.amount }}
-{{ form.monthly }}
-{{ form.method }}
-<div class="plan-select">
- <span class="button plan-toggle" data-plan="plan-single" data-monthly="False">{% trans "one-time" %}</span>
- <span class="button plan-toggle active" data-plan="plan-monthly" data-monthly="True">{% trans "monthly" %}</span>
-</div>
-
-<h3>2. {% trans "Choose the amount" %}</h3>
-
-<div class="plan" id="plan-single" style="display:none;" data-monthly="False" data-min-for-year="{{ club.min_for_year }}" data-amount="{{ club.default_single_amount }}">
- {% for amount in club.singleamount_set.all %}
- <span class="button kwota{% if amount.amount == club.default_single_amount %} active{% endif %}{% if amount.amount >= club.min_for_year %} yearly{% endif %}">{{ amount.amount }}</span>
- {% endfor %}
-
- <span class="inna">
- <span class="button">{% trans "different amount" %}</span>
- <input type="number" min="{{ club.min_amount }}">
- </span>
- <div class="methods">{% include 'club/payment/payu.html' %}</div>
-</div>
-
-
-<div class="plan" id="plan-monthly" data-monthly="True" data-amount="{{ club.default_monthly_amount }}">
- {% for amount in club.monthlyamount_set.all %}
- <span class="button kwota{% if amount.amount == club.default_monthly_amount %} active{% endif %}">{{ amount.amount }}</span>
- {% endfor %}
-
- <span class="inna">
- <span class="button">{% trans "different amount" %}</span>
- <input type="number" min="{{ club.min_amount }}">
- </span>
- <div class="methods">
- {% include 'club/payment/payu-re.html' %}
- </div>
-</div>
-
-<h3>3. {% trans "Provide contact details" %}</h3>
-
-<p>
- <label class="required">{% trans "First and last name:" %}</label><br>
- {{ form.first_name }}
- <br><br>
- {{ form.last_name }}
-</p>
-
-
-<p>
- <label for="id_email" {% if form.email.field.required %}class="required"{% endif %}>{% trans "E-mail:" %}</label><br>
- {{ form.email }}
-</p>
-
-<p>
- <label for="id_phone" {% if form.phone.field.required %}class="required"{% endif %}>{% trans "Phone number:" %}</label><br>
- {{ form.phone }}
-</p>
-
-<p>
- <label for="id_postal" {% if form.postal.field.required %}class="required"{% endif %}>{% trans "Postal address:" %}</label><br>
- {{ form.postal }}<br>
- {{ form.postal_code }} {{ form.postal_town }}<br>
- {{ form.postal_country }}
-</p>
-
-{% for c, key, consent_field in form.consent %}
- <p>
- {{ consent_field }}
- <label for="id_{{ key }}" {% if c.required %}class="required"{% endif %}>
- {{ consent_field.label }}
- </label>
- </p>
-{% endfor %}
-
-
-<p>
- {{ form.agree_newsletter }}
- <label for="id_agree_newsletter">
- {% trans "I'd like to subscribe the newsletter." %}
- </label>
-</p>
-
-<p class="helptext">{% trans 'You can unsubscribe at any point. More in the <a target="_blank" href="https://nowoczesnapolska.org.pl/prywatnosc/">privacy policy</a>.' %}</p>
-
-<div class="helptext">{{ form.data_processing|safe }}</div>
-
-<div><button class="submit" type='submit'>{% trans "Donate" %}</button></div>
+++ /dev/null
-{% load chunks %}
-
-<div class="chunk-alt">
- <div class="chunk chunk-monthly">
- {% chunk 'club-form-info-monthly' %}
- </div>
- <div class="chunk chunk-single" style="display: none;">
- {% chunk 'club-form-info-single' %}
- </div>
- <div class="chunk chunk-single-year" style="display: none;">
- {% chunk 'club-form-info-single-year' %}
- </div>
-</div>
-{% extends request.EXPERIMENTS.layout.value|yesno:"2022/base_simple.html,base/base.html" %}
+{% extends "2022/base_simple.html" %}
{% load i18n %}
+++ /dev/null
-{% extends request.session.from_app|yesno:"base/app.html,base/base.html" %}
-{% load chunks %}
-{% load i18n %}
-
-
-{% block titleextra %}{% trans "Wolne Lektury need your help!" %}{% endblock %}
-
-
-{% block body %}
-
-
- <div class="white-box normal-text">
-
- <h1>{% trans "Thank you" %}</h1>
-
- {% chunk 'club_thanks' %}
-
- {% if request.session.from_app %}
- <a href="wolnelekturyapp://paypal_return">{% trans "Go back to the app" %}</a>
- {% endif %}
-
-</div>
-
-{% endblock %}
+++ /dev/null
-
-<div style="display:flex">
-{% for _1, optgroup, _2 in widget.optgroups %}
- {% for option in optgroup %}
- <div style="display: flex-item;">
- {% with plan=option.label %}
- <big>{{ plan.min_amount }} zł</big><br>
- {{ plan.get_interval_display }}
-
- {% for pm in plan.payment_methods %}
- <div>
- <input id="id_{{ option.value }}_{{ pm.slug }}" type="radio" name="payment_method" value="{{ option.value }}_{{ pm.slug }}">
- <label for="id_{{ option.value }}_{{ pm.slug }}">
- {% include pm.template_name %}
- </label>
- </div>
- {% endfor %}
-
- {% endwith %}
- </div>
- {% endfor %}
-{% endfor %}
-</div>
-
-
-{% extends request.session.from_app|yesno:"base/app.html,base/base.html" %}
+{% extends "2022/base_simple.html" %}
{% load chunks i18n %}
<div class="white-box normal-text">
<h1>{% blocktrans with year=view.kwargs.year email=object.email %}Summary of donations in the year {{ year }} for the address {{ email }}.{% endblocktrans %}</h1>
- <table class="table">
+ <table class="table" border="1">
<thead>
<tr>
<th>{% trans "Date" %}</th>
-{% extends request.session.from_app|yesno:"base/app.html,base/base.html" %}
+{% extends "2022/base_simple.html" %}
{% load i18n %}
{% endif %}
</p>
+ <p></p>
<form id="theform" method='POST'>
{% csrf_token %}
{{ form }}
</form>
-
-
<script>
function paymentcallback(data) {
$("#theform #id_token").val(data.value);
path('przylacz/<key>/', views.claim, name='club_claim'),
path('anuluj/<key>/', views.cancel, name='club_cancel'),
- path('testowa-platnosc/<key>/', views.DummyPaymentView.as_view(), name='club_dummy_payment'),
path('platnosc/payu/cykl/<key>/', banner_exempt(views.PayURecPayment.as_view()), name='club_payu_rec_payment'),
path('platnosc/payu/<key>/', banner_exempt(views.PayUPayment.as_view()), name='club_payu_payment'),
from django.views import View
from .payu import POSS
from .payu import views as payu_views
-from .forms import ScheduleForm, PayUCardTokenForm
+from .forms import PayUCardTokenForm
from . import forms
from . import models
from .helpers import get_active_schedule
class JoinView(CreateView):
+ form_class = forms.DonationStep1Form
+ template_name = 'club/2022/donation_step1.html'
+
@property
def club(self):
return models.Club.objects.first()
- @property
- def new_layout(self):
- return self.request.EXPERIMENTS['layout'].value
-
- def get_template_names(self):
- if self.new_layout:
- return 'club/2022/donation_step1.html'
- return 'club/membership_form.html'
-
- def get_form_class(self):
- if self.new_layout:
- return forms.DonationStep1Form
- return ScheduleForm
-
def is_app(self):
return self.request.GET.get('app')
return c
def get_initial(self):
+ # referer?
if self.request.user.is_authenticated and self.request.user.email:
return {
'email': self.request.user.email
def get_form_kwargs(self):
kwargs = super().get_form_kwargs()
- if not self.new_layout:
- kwargs['referer'] = self.request.META.get('HTTP_REFERER', '')
+ #kwargs['referer'] = self.request.META.get('HTTP_REFERER', '')
return kwargs
def form_valid(self, form):
return retval
def get_success_url(self):
- if self.new_layout:
- return reverse('donation_step2', args=[self.object.key])
- return self.object.initiate_payment(self.request)
+ return reverse('donation_step2', args=[self.object.key])
@method_decorator(never_cache, name='dispatch')
step = 3
def get_template_names(self):
- if self.request.EXPERIMENTS['layout'].value:
- if not self.object.payed_at:
- return 'club/2022/donation_step3.html'
+ if not self.object.payed_at:
+ return 'club/2022/donation_step3.html'
return 'club/schedule.html'
def get_context_data(self, *args, **kwargs):
return HttpResponseRedirect(schedule.get_absolute_url())
-class DummyPaymentView(TemplateView):
- template_name = 'club/dummy_payment.html'
-
- def get_context_data(self, key):
- return {
- 'schedule': models.Schedule.objects.get(key=key),
- }
-
- def post(self, request, key):
- schedule = models.Schedule.objects.get(key=key)
- schedule.create_payment()
-
- return HttpResponseRedirect(schedule.get_absolute_url())
-
-
class PayUPayment(DetailView):
model = models.Schedule
slug_field = slug_url_kwarg = 'key'
class ScheduleThanksView(DetailView):
model = models.Schedule
+ template_name = 'club/2022/donation_step4.html'
slug_field = slug_url_kwarg = 'key'
step = 4
- def get_template_names(self):
- if self.request.EXPERIMENTS['layout'].value:
- return 'club/2022/donation_step4.html'
- return 'club/thanks.html'
-
def get_context_data(self, *args, **kwargs):
ctx = super().get_context_data(*args, **kwargs)
ctx['active_menu_item'] = 'club'
-{% extends request.EXPERIMENTS.layout.value|yesno:"2022/base_simple.html,base/base.html" %}
+{% extends "2022/base_simple.html" %}
{% load i18n pagination_tags %}
{% load set_get from set_get %}
-{% extends request.EXPERIMENTS.layout.value|yesno:"2022/base.html,base/base.html" %}
+{% extends "2022/base.html" %}
{% load static i18n %}
{% block breadcrumbs %}
-{% extends request.EXPERIMENTS.layout.value|yesno:"2022/base_simple.html,base/base.html" %}
+{% extends "2022/base_simple.html" %}
{% load i18n %}
{% load fnp_share %}
-{% extends request.EXPERIMENTS.layout.value|yesno:"2022/base_simple.html,base/base.html" %}
+{% extends "2022/base_simple.html" %}
{% load i18n %}
{% load fnp_share %}
+++ /dev/null
-{% extends "base/base.html" %}
-{% load i18n static %}
-{% load pagination_tags %}
-{% load fnp_share %}
-{% load thumbnail %}
-{% load build_absolute_uri from fnp_common %}
-{% load fundings from funding_tags %}
-{% load chunks %}
-
-
-{% block titleextra %}{{ object }}{% endblock %}
-
-{% block ogimage %}{{ object.cover.url|build_absolute_uri:request }}{% endblock %}
-
-{% block metadescription %}Wesprzyj kolejną publikację Wolnych Lektur!{% endblock %}
-
-
-{% block body %}
- <h1>{{ object }}</h1>
-
- {{ object.detail_bar }}
- <div class="white-box">
- <div class="funding-details-intro">
- {% if object.cover %}
- <img src="{% thumbnail object.cover "139x193" as thumb %}{{ thumb.url }}{% empty %}{{ object.cover.url }}{% endthumbnail %}"
- alt="Cover" class="funding-cover" />
- {% endif %}
- <div class="normal-text">
- <h3>{% trans "Help free the book!" %}</h3>
- {{ object.description|safe }}
- </div>
- </div>
-
- {% if object.is_current %}
- <div class="normal-text">
- <h3>{% trans "Support the publication" %}</h3>
- <form action="" method="post">
- <table>
- {# FIXME after upgrade to django 1.9 use field_order #}
- {% for field in form %}
- {% if field.name != 'agree_newsletter' %}
- <tr>
- <th>{{ field.label }}</th>
- <td>
- {{ field.errors }}{{ field }}
- {% if field.help_text %}<br /><span class="helptext">{{ field.help_text }}</span>
- {% endif %}
- </td>
- </tr>
- {% endif %}
- {% endfor %}
- <tr>
- <td></td>
- <td>
- <label>{{ form.agree_newsletter }} {{ form.agree_newsletter.label }}</label>
- <br/><span class="helptext">{{ form.data_processing }}</span>
- </td>
- </tr>
- <tr>
- <td></td>
- <td>
- <button type="submit" style="border: none; background: none; cursor: pointer">
- <img alt="{% trans 'Donate!' %}" src="{% static 'img/payu.png' %}" />
- </button>
- </td>
- </tr>
- </table>
- </form>
- </div>
-
- {% chunk "funding_form_bottom" %}
-
- {{ object.status }}
- <a href='//nowoczesnapolska.org.pl/pomoz-nam/wesprzyj-nas/' target="_blank" style='float:right;border:1px solid #ddd;padding: 1em;margin:0 0 1em 1em;background:#eee;'><img src='//nowoczesnapolska.org.pl/wp-content/themes/koed/annoy/procent.png' alt='1%' style='float:left;margin-right: 1em;margin-top:.2em;'>Możesz też przekazać<br/>1% podatku na rozwój biblioteki. →</a>
- {{ object.status_more }}
- <p><a href="{% url 'infopage' 'wesprzyj' %}">{% trans "Learn more" %}</a>.</p>
-
- {% url 'funding_current' object.slug as current %}
- <p class="normal-text">{% trans "Tell your friends!" %}</p>
- <p class="share">{% share current _("Support Wolne Lektury!") "big" %}</p>
- <div style="clear:both;"></div>
- {% endif %}
-
- <p class="normal-text"><a href="{% url 'funding' %}">{% trans "See all fundraisers." %}</a></p>
- </div>
-
- <h2>{% trans "Supporters" %}:</h2>
-
- <div class="white-box normal-text">
- {% fundings object %}
- </div>
-{% endblock %}
+++ /dev/null
-{% extends "base/base.html" %}
-{% load i18n %}
-{% load pagination_tags %}
-
-{% block titleextra %}{% trans "All fundraisers" %}{% endblock %}
-
-{% block bodyid %}funding-offer-list{% endblock %}
-
-{% block body %}
- <h1>{% trans "All fundraisers" %}</h1>
-
- {% autopaginate object_list 10 %}
- {% if page_obj.number == 1 %}
- <h2>{% trans "Current fundraiser:" %}</h2>
- {% endif %}
-
- {% for offer in object_list %}
- {% with is_win=offer.is_win is_current=offer.is_current %}
- {% if not is_current and forloop.first and page_obj.number == 1 %}
- <p class="normal-text">{% trans "No fundraiser is currently running." %}</p>
- <h2>{% trans "Previous fundraisers:" %}</h2>
- {% endif %}
-
- {{ offer.list_bar }}
-
- <div class="white-box normal-text">
- {% if is_current %}
- <h3>{% trans "Help free the book!" %}</h3>
- {{ offer.description|safe }}
- {% endif %}
- {{ offer.status }}
- {{ offer.status_more }}
- </div>
-
- {% if is_current and not forloop.last %}
- <h2>{% trans "Previous fundraisers:" %}</h2>
- {% endif %}
- {% endwith %}
- {% endfor %}
- {% paginate %}
-{% endblock %}
-{% extends request.EXPERIMENTS.layout.value|yesno:"2022/base_simple.html,base/base.html" %}
+{% extends "2022/base_simple.html" %}
{% load i18n %}
{% load fnp_share %}
{% load polls_tags %}
-{% extends request.EXPERIMENTS.layout.value|yesno:"2022/base_simple.html,base/base.html" %}
+{% extends "2022/base_simple.html" %}
{% load i18n %}
{% block titleextra %}{% trans "Remaining funds" %}{% endblock %}
class OfferDetailView(FormView):
form_class = FundingForm
-
- def get_template_names(self):
- if self.request.EXPERIMENTS['layout'].value:
- return 'funding/2022/offer_detail.html'
- else:
- return "funding/offer_detail.html"
+ template_name = 'funding/2022/offer_detail.html'
@csrf_exempt
def dispatch(self, request, slug=None):
class OfferListView(ListView):
queryset = Offer.public()
-
- def get_template_names(self):
- if self.request.EXPERIMENTS['layout'].value:
- return 'funding/2022/offer_list.html'
- return 'funding/offer_list.html'
+ template_name = 'funding/2022/offer_list.html'
def get_context_data(self, **kwargs):
ctx = super(OfferListView, self).get_context_data(**kwargs)
+++ /dev/null
-{% extends "base/base.html" %}
-{% load i18n %}
-
-{% block titleextra %}{{ page.title }}{% endblock %}
-
-{% block metadescription %}{{ left_column|striptags|truncatewords:10 }}{% endblock %}
-
-{% block body %}
- <h1>{{ page.title }}</h1>
-
- {% autoescape off %}
- <div class="left-column">
- <div class="normal-text">
- {{ left_column }}
- </div>
- </div>
- <div class="right-column">
- <div class="normal-text">
- {{ right_column }}
- </div>
- </div>
- {% endautoescape %}
-{% endblock %}
def infopage(request, slug):
page = get_object_or_404(InfoPage, slug=slug)
- new_layout = request.EXPERIMENTS['layout']
-
rc = RequestContext(request)
try:
left_column = Template(page.left_column).render(rc)
return render(
request,
- 'infopages/2022/infopage.html' if new_layout.value else 'infopages/infopage.html',
+ 'infopages/2022/infopage.html',
{
'page': page,
'left_column': left_column,
-{% extends request.EXPERIMENTS.layout.value|yesno:"2022/base_simple.html,base/base.html" %}
+{% extends "2022/base_simple.html" %}
{% block settings %}
{% load title %}
-{% extends request.EXPERIMENTS.layout.value|yesno:"2022/base_simple.html,base/base.html" %}
+{% extends "2022/base_simple.html" %}
{% block settings %}
{% load title %}
-{% extends request.EXPERIMENTS.layout.value|yesno:"2022/base_simple.html,base/base.html" %}
+{% extends "2022/base_simple.html" %}
{% block settings %}
{% load title %}
-{% extends request.EXPERIMENTS.layout.value|yesno:"2022/base_simple.html,base/base.html" %}
+{% extends "2022/base_simple.html" %}
{% block settings %}
{% load title %}
+++ /dev/null
-{% extends "base/base.html" %}
-{% load i18n %}
-{% load catalogue_tags %}
-
-{% block titleextra %}Leśmianator{% endblock %}
-
-{% block metadescription %}Stwórz własny wierszmiks z utworów znajdujących się na Wolnych Lekturach.{% endblock %}
-
-{% block bodyid %}lesmianator{% endblock %}
-
-{% block body %}
- <h1>Leśmianator</h1>
-
- <div class="left-column">
- <div class="normal-text">
- <p>
- Leśmianator tworzy wierszmiksy – dzięki niemu
- <a href="{% url 'new_poem' %}">napiszesz wiersz jednym kliknięciem</a>.
- W nowej odsłonie nowe możliwości zabawy – teraz możesz zdecydować, co wrzucasz do miksera,
- a swoimi dziełami podzielić się z przyjaciółmi!
- </p>
- <p>
- Przygotowaliśmy kilka propozycji na start – możesz wybrać jedną z nich,
- albo ułożyć sobie własną, niepowtarzalną mieszankę.
- </p>
- <ul>
- <li><a href="{% url 'poem_from_book' 'liryki-lozanskie' %}">Adam Mickiewicz, Liryki lozańskie</a></li>
- <li><a href="{% url 'poem_from_book' 'sonety-krymskie' %}">Adam Mickiewicz, Sonety krymskie</a></li>
- <li><a href="{% url 'poem_from_book' 'hymny' %}">Jan Kasprowicz, Hymny</a></li>
- <li><a href="{% url 'poem_from_book' 'bogurodzica' %}">Bogurodzica</a></li>
- {% for s in shelves %}
- <li><a href="{% url 'poem_from_set' s.slug %}">{{ s.name }}</a></li>
- {% endfor %}
- </ul>
- </div>
- </div>
-
- <div class="right-column">
- <div class="normal-text">
- <h3>Miksuj utwory</h3>
- <p>
- Możesz <a href="{% url 'new_poem' %}">zmiksować całą lirykę</a> w naszej bibliotece
- albo tylko jeden konkretny utwór. Jak? Wejdź na
- <a href="{% url 'book_detail' 'do-m' %}">stronę utworu</a>,
- kliknij w link „miksuj ten utwór” – i gotowe!
- </p>
-
- <h3>Miksuj półki</h3>
- <p>
- Załóż konto, poukładaj swoje ulubione książki na półkach i miksuj
- w dowolnych konfiguracjach. Nic prostszego, niż zmieszać
- <a href="{% url 'tagged_object_list' 'autor/boleslaw-lesmian' %}">Leśmiana</a> z
- <a href="{% url 'tagged_object_list' 'autor/kazimierz-przerwa-tetmajer' %}">Tetmajerem</a>,
- a <a href="{% url 'tagged_object_list' 'autor/stefan-zeromski' %}">Żeromskiego</a> z
- <a href="{% url 'tagged_object_list' 'autor/henryk-sienkiewicz' %}">Sienkiewiczem</a>
- – wystarczy wrzucić ich utwory na półkę i klikną w link „miksuj utwory z tej półki”.
- </p>
-
- <h3>Dziel się z innymi</h3>
- <p>
- Wyszedł Ci wyjątkowo udany wierszmiks? Znajdziesz pod nim link, przy pomocy
- którego możesz się nim podzielić z przyjaciółmi.
- </p>
-
- <p>Miłej zabawy!</p>
- </div>
- </div>
-{% endblock %}
return render(
request,
- 'lesmianator/2022/lesmianator.html' if request.EXPERIMENTS['layout'].value else 'lesmianator/lesmianator.html',
+ 'lesmianator/2022/lesmianator.html',
{"last": last, "shelves": shelves})
@cache.never_cache
-{% extends request.EXPERIMENTS.layout.value|yesno:"2022/base_simple.html,base/base.html" %}
+{% extends "2022/base_simple.html" %}
{% load i18n %}
{% block settings %}
-{% extends request.EXPERIMENTS.layout.value|yesno:"2022/base_simple.html,base/base.html" %}\r
+{% extends "2022/base_simple.html" %}\r
{% load i18n %}\r
\r
{% block settings %}\r
-{% extends request.EXPERIMENTS.layout.value|yesno:"2022/base_simple.html,base/base.html" %}\r
+{% extends "2022/base_simple.html" %}\r
{% load i18n %}\r
\r
{% block settings %}\r
-{% extends request.EXPERIMENTS.layout.value|yesno:"2022/base_simple.html,base/base.html" %}
+{% extends "2022/base_simple.html" %}
{% block body %}
-{% extends request.EXPERIMENTS.layout.value|yesno:"2022/base_simple.html,base/base.html" %}
+{% extends "2022/base_simple.html" %}
{% block body %}
+++ /dev/null
-{% extends "base/base.html" %}
-{% load i18n %}
-
-{% block body %}
- <h1>{{ page_title }}</h1>
- <p>{% trans "Your subscription to Wolne Lektury newsletter is confirmed. Thank you!" %}</p>
-{% endblock %}
\ No newline at end of file
+++ /dev/null
-{% extends "base/base.html" %}
-{% load i18n %}
-{% load honeypot %}
-{% load ajaxable_tags %}
-
-{% block body %}
- <h1>{{ page_title }}</h1>
- <form id="subscribe-form" action="" method="post" accept-charset="utf-8" class="cuteform">
- {% csrf_token %}
- {% render_honeypot_field %}
- <ol>
- <li>{{ form.email|pretty_field }}</li>
- <li><span class="helptext">{{ form.data_processing }}</span></li>
- <li><input type="submit" value="{% trans "Subscribe" %}"/></li>
- </ol>
- </form>
-{% endblock %}
+++ /dev/null
-{% extends "base/base.html" %}
-{% load i18n %}
-
-{% block body %}
- <h1>{{ page_title }}</h1>
- <p>
- {% trans "You have subscribed to Wolne Lektury newsletter." %}
- </p>
-{% endblock %}
\ No newline at end of file
def subscribe_form(request, slug=''):
newsletter = get_object_or_404(Newsletter, slug=slug)
- new_layout = request.EXPERIMENTS['layout'].value
if request.POST:
form = SubscribeForm(newsletter, request.POST)
if form.is_valid():
else:
form = SubscribeForm(newsletter)
- if new_layout:
- template_name = 'newsletter/2022/subscribe_form.html'
- else:
- template_name = 'newsletter/subscribe_form.html'
+ template_name = 'newsletter/2022/subscribe_form.html'
return render(request, template_name, {
'page_title': newsletter.page_title,
'form': form,
def subscribed(request):
- new_layout = request.EXPERIMENTS['layout'].value
- if new_layout:
- template_name = 'newsletter/2022/subscribed.html'
- else:
- template_name = 'newsletter/subscribed.html'
+ template_name = 'newsletter/2022/subscribed.html'
return render(request, template_name, {
'page_title': _('Subscribed'),
})
+++ /dev/null
-# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
-# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
-#
-from django import forms
-from django.utils.translation import gettext_lazy as _
-
-
-class PaypalSubscriptionForm(forms.Form):
- amount = forms.IntegerField(min_value=5, max_value=30000, initial=20, label=_('amount in PLN'))
-{% extends request.EXPERIMENTS.layout.value|yesno:"2022/base_simple.html,base/base.html" %}
+{% extends "2022/base_simple.html" %}
{% load i18n %}
{% block body %}
+++ /dev/null
-{% load i18n %}
-<h1>{% trans "PayPal Error" %}: {{ error.message }}</h1>
-{% for detail in error.details %}
- <p>{{ detail.field }}: {{ detail.issue }}</p>
-{% endfor %}
-<p><a href="{{ error.information_link }}">{% trans "Learn more" %}</a></p>
\ No newline at end of file
+++ /dev/null
-{% extends "base/base.html" %}
-
-{% block body %}
- {% include "paypal/error.html" %}
-{% endblock %}
\ No newline at end of file
+++ /dev/null
-{% extends "base/base.html" %}
-{% load i18n %}
-{% load chunks %}
-{% load static from static %}
-
-{% block title %}{% trans "Wolne Lektury Friend Club" %}{% endblock %}
-
-{% block body %}
- <div class="mobile-margins">
- <h1>{% trans "Wolne Lektury Friend Club" %}</h1>
- <p>Poniżej możesz ustawić comiesięczną płatność <strong>(co najmniej 5 zł)</strong>, aby dołączyć do Przyjaciół Wolnych Lektur.</p>
- {# https://www.facebook.com/sharer/sharer.php?u=https%3A//wolnelektury.pl{% url 'paypal_form' %} #}
- {% if user.is_authenticated %}
- <form method="post">
- {% csrf_token %}
- {{ form.amount.label_tag }}{{ form.amount }}
- {# paypal submit button #}
- <input type="image" src="{% static 'img/btn_subscribe_LG_pl.gif' %}" alt="{% trans "Subscribe with PayPal" %}" style="margin-left: 2em; vertical-align: bottom;">
- </form>
- {% else %}
- {% trans "You must be logged in to subscribe." %}
- {% endif %}
- {% chunk "klub_info" %}
- </div>
-{% endblock %}
+++ /dev/null
-{% extends "base/base.html" %}
-{% load i18n %}
-
-{% block body %}
- {% if resource.error %}
- {% include "paypal/error.html" with error=resource.error %}
- {% else %}
- <p>{% trans "Dziękujemy, że jesteś z nami i pomagasz nam rozwijać Wolne Lektury!" %}</p>
- <p>{% trans "Pamiętaj, że zawsze możesz się z nami skontaktować:" %} <a href="mailto:wolnelektury@nowoczesnapolska.org.pl">wolnelektury@nowoczesnapolska.org.pl</a></p>
-
- <p>{% trans "Do przeczytania!" %}<br>{% trans "Zespół Wolnych Lektur" %}</p>
- {% endif %}
-{% endblock %}
\ No newline at end of file
from api.utils import HttpResponseAppRedirect
from club.models import Schedule
-from paypal.forms import PaypalSubscriptionForm
-from paypal.rest import execute_agreement, check_agreement, agreement_approval_url, PaypalError
+from paypal.rest import execute_agreement, check_agreement, agreement_approval_url
from paypal.models import BillingAgreement, BillingPlan
-def paypal_form(request, app=False):
- if request.POST:
- if not request.user.is_authenticated:
- return HttpResponseForbidden()
- form = PaypalSubscriptionForm(data=request.POST)
- if form.is_valid():
- amount = form.cleaned_data['amount']
- try:
- approval_url = agreement_approval_url(amount, app=app)
- except PaypalError as e:
- return render(request, 'paypal/error_page.html', {'error': str(e)})
- return HttpResponseRedirect(approval_url)
- else:
- form = PaypalSubscriptionForm()
- return render(request, 'paypal/form.html', {'form': form})
-
-
def paypal_init(request, key):
schedule = get_object_or_404(Schedule, key=key)
schedule.method = 'paypal'
+++ /dev/null
-{% extends "base/base.html" %}
-{% load i18n %}
-{% load time_tags %}
-
-{% block titleextra %}{{ author.name }}{% endblock %}
-
-{% block metadescription %}{% trans "Public domain counter" %}: {{author.name}}.{% endblock %}
-
-{% block bodyid %}author-detail{% endblock %}
-
-{% block body %}
- <div class="left-column">
- <h1>{{ author.name }}</h1>
- <div class="normal-text white-box">
- {% if author.has_description %}
- <div id="description">
- <div id='description-long'>{{ author.description|safe }}</div>
- <div id='description-short'>{{ author.description|safe|truncatewords_html:30 }}</div>
- </div>
- <div class="clearboth"></div>
- <div id="toggle-description"><p></p></div>
- {% endif %}
- {% if author.wiki_link %}
- <p>
- <a href="{{ author.wiki_link }}">
- {% trans "Read article about this author on Wikipedia" %}
- </a>
- </p>
- {% endif %}
-
- {% if author.alive %}
- <p>
- {% trans "This author's works are copyrighted." %}
- {% trans "<a href='http://domenapubliczna.org/co-to-jest-domena-publiczna/'>Find out</a> why Internet libraries can't publish this author's works." %}
- </p>
- {% else %}
- {% if author.in_pd %}
- <p>{% trans "This author's works are in public domain, but they were not yet published on Internet library of Wolne Lektury." %}</p>
- {% else %}
- <div>
- <p>
- {% trans "This author's works will become part of public domain and will be allowed to be published without restrictions in" %}
- </p>
- <div class='countdown' data-until='{{ pd_counter|date_to_utc|utc_for_js }}'></div>
- <p>
- {% trans "<a href='http://domenapubliczna.org/co-to-jest-domena-publiczna/'>Find out</a> why Internet libraries can't publish this author's works." %}
- </p>
- </div>
- {% endif %}
- {% endif %}
- {% include "info/join_us.html" %}
- </div>
- </div>
-
- <div class="right-column block-form">
- {% include "publishing_suggest.html" %}
- </div>
-{% endblock %}
+++ /dev/null
-{% extends "base/base.html" %}
-{% load i18n %}
-{% load time_tags %}
-
-{% block titleextra %}{{ book.title }}{% endblock %}
-
-{% block metadescription %}{% trans "Public domain counter" %}: {{ book.title }}.{% endblock %}
-
-{% block bodyid %}book-stub-detail{% endblock %}
-
-{% block body %}
- <div class="left-column">
- <h1>{{ book.author }}, {{ book.title }}</h1>
- <div class="normal-text white-box">
- {% if book.in_pd %}
- <p>{% trans "This work is in public domain and will be published on Internet library of Wolne Lektury soon." %}</p>
- {% else %}
- {% if book.pd %}
- <p>
- {% trans "This work will become part of public domain and will be allowed to be published without restrictions in" %}
- </p>
- <div class='countdown' data-until='{{ pd_counter|date_to_utc|utc_for_js }}'></div>
- <p>
- {% trans "<a href='http://domenapubliczna.org/co-to-jest-domena-publiczna/'>Find out</a> why Internet libraries can't publish this work." %}
- </p>
- {% else %}
- <p>
- {% trans "This work is copyrighted." %}
- {% trans "<a href='http://domenapubliczna.org/co-to-jest-domena-publiczna/'>Find out</a> why Internet libraries can't publish this work." %}
- </p>
- {% endif %}
- {% endif %}
- {% include "info/join_us.html" %}
- </div>
- </div>
-
- <div class="right-column block-form">
- {% include "publishing_suggest.html" %}
- </div>
-{% endblock %}
+++ /dev/null
-{% spaceless %}
- {% load i18n %}
- {% load catalogue_tags %}
-
- <div class="white-box normal-text">
- <h2><a href="{{ author.get_absolute_url }}">{{ author.name }}</a></h2>
- {% if author.alive %}
- <p>
- {% trans "This author's works are copyrighted." %}
- {% trans "<a href='http://domenapubliczna.org/co-to-jest-domena-publiczna/'>Find out</a> why Internet libraries can't publish this author's works." %}
- </p>
- {% else %}
- {% if author.in_pd %}
- <p>{% trans "This author's works are in public domain, but they were not yet published on Internet library of Wolne Lektury." %}</p>
- {% else %}
- <div>
- <p>
- {% trans "This author's works will become part of public domain and will be allowed to be published without restrictions in the year" %} {{ author.goes_to_pd }}.
- </p>
- <p>
- {% trans "<a href='http://domenapubliczna.org/co-to-jest-domena-publiczna/'>Find out</a> why Internet libraries can't publish this author's works." %}
- </p>
- </div>
- {% endif %}
- {% endif %}
- </div>
-{% endspaceless %}
form = PublishingSuggestForm(initial={"books": "%s — %s, \n" % (book.author, book.title)})
- if request.EXPERIMENTS['layout'].value:
- template_name = 'pdcounter/2022/book_detail.html'
- else:
- template_name = 'pdcounter/book_stub_detail.html'
+ template_name = 'pdcounter/2022/book_detail.html'
return render(request, template_name, {
'book': book,
form = PublishingSuggestForm(initial={"books": author.name + ", \n"})
- if request.EXPERIMENTS['layout'].value:
- template_name = 'pdcounter/2022/author_detail.html'
- else:
- template_name = 'pdcounter/author_detail.html'
+ template_name = 'pdcounter/2022/author_detail.html'
return render(request, template_name, {
'author': author,
def get_area_json(self):
return json.loads(self.area)
- @cached_render('picture/picturearea_short.html')
- def midi_box(self):
- themes = self.tags.filter(category='theme')
- things = self.tags.filter(category='thing')
- return {
- 'area': self,
- 'theme': themes[0] if themes else None,
- 'thing': things[0] if things else None,
- }
-
- def clear_cache(self):
- clear_cached_renders(self.midi_box)
-
class Picture(models.Model):
"""
'picture': self,
}
- @cached_render('picture/picture_short.html')
- def midi_box(self):
- return {
- 'picture': self,
- }
-
def related_themes(self):
return catalogue.models.Tag.objects.usage_for_queryset(
self.areas.all(), counts=True).filter(category__in=('theme', 'thing'))
def clear_cache(self):
clear_cached_renders(self.mini_box)
- clear_cached_renders(self.midi_box)
+++ /dev/null
-{% extends "picture/picture_list_thumb.html" %}
-{% load i18n %}
-
-{% block titleextra %}{{ context.collection.title }}{% endblock %}
-
-{% block book_list_header %}{{ context.collection.title }}{% endblock %}
-
-{% block book_list_info %}
- {{ context.collection.description|safe }}
-{% endblock %}
+++ /dev/null
-{% extends "base/base.html" %}
-{% load i18n %}
-{% load picture_tags catalogue_tags pagination_tags %}
-{% load thumbnail %}
-{% load build_absolute_uri from fnp_common %}
-
-
-{% block ogimage %}{% thumbnail picture.image_file "535" upscale="false" as thumb %}{{ thumb.url|build_absolute_uri:request }}{% endthumbnail %}{% endblock %}
-
-
-{% block titleextra %}{{ picture.title }}{% endblock %}
-
-{% block bodyid %}picture-detail{% endblock %}
-
-{% block body %}
- {% picture_wide picture %}
- {% spaceless %}
- <section class="see-also">
- <h1>{% trans "See also" %}:</h1>
- {% related_books picture %}
- </section>
- {% endspaceless %}
-{% endblock %}
+++ /dev/null
-{% extends "base/base.html" %}
-{% load i18n %}
-{% load catalogue_tags %}
-{% load static %}
-{% load chunk from chunks %}
-
-{% block bodyid %}picture-list{% endblock %}
-
-{% block titleextra %}{% trans "Listing of all works" context "gallery" %}{% endblock %}
-
-
-{% block body %}
- <h1>{% block book_list_header %}{% trans "Listing of all works" context "gallery" %}{% endblock %}</h1>
-
- <div class="left-column">
- <div class="normal-text">
- {% block book_list_info %}
- {% chunk 'picture-list' %}
- {% endblock %}
- </div>
- </div>
-
- <div class='clearboth'></div>
-
- {% work_list picture_list %}
-{% endblock %}
+++ /dev/null
-{% extends "picture/picture_short.html" %}
-{% load picture_tags %}
-
-{% block right-column %}
- <div class="picture-right-column">
- {% for hit in result.hits %}
- <div class="area-hit">
- <p>{{ hit.themes|join:", " }}</p>
- {% if hit.area %}
- <a href="{% url 'picture_viewer' hit.area.picture.slug %}">
- <img src="{% area_thumbnail_url hit.area "100x100" %}"/>
- </a>
- {% endif %}
- </div>
- {% endfor %}
- </div>
-{% endblock %}
+++ /dev/null
-{% extends "picture/picture_short.html" %}
-{% load i18n %}
-{% load picture_tags thumbnail %}
-
-
-{% block box-class %}book-wide-box{% endblock %}
-
-{% block picture-view %}
- <a href="{{ main_link }}">
- {% thumbnail picture.image_file "535" upscale=0 as thumb %}
- <img class="cover" src="{{thumb.url}}"/>
- {% endthumbnail %}
- </a>
-{% endblock %}
-
-
-{% block extra_categories %}
- {% with extra_info=picture.get_extra_info_json %}
- {% if extra_info.styles %}
- <span class="category">
- <span class="mono"> {% trans "Style" %}:</span> <span class="book-box-tag">
- {% for tag in extra_info.styles %}
- <a>{{ tag }}</a>
- {% if not forloop.last %}<span>, </span>{% endif %}
- {% endfor %}
- </span>
- </span>
- {% endif %}
-
- {% if extra_info.medium %}
- <span class="category">
- <span class="mono"> {% trans "Medium" %}:</span> <span class="book-box-tag">
- <a>{{ extra_info.medium }}</a>
- </span>
- </span>
- {% endif %}
-
- {% if extra_info.original_dimensions %}
- <span class="category">
- <span class="mono"> {% trans "Dimensions" %}:</span> <span class="book-box-tag">
- <a>{{ extra_info.original_dimensions }}</a>
- </span>
- </span>
- {% endif %}
-
- <span class="category">
- <span class="mono"> {% trans "Date" %}:</span> <span class="book-box-tag">
- <a>{{ extra_info.created_at }}</a>
- </span>
- </span>
- {% endwith %}
-{% endblock %}
-
-
-{% block book-box-extra-info %}
- {% if themes or things%}
- <div class="hidden-box-wrapper" id="theme-list-wrapper">
- <p>
- <a class="hidden-box-trigger theme-list-link" href="#">{% trans "Motifs, themes and objects" %}</a>
- </p>
- <div class="hidden-box">
- {% if themes %}
- <p>{% trans "Motifs and themes" %}</p>
- <ul>
- {% for theme in themes %}
- <li><a href="{% url 'picture_viewer' picture.slug %}#theme-{{theme.slug}}">{{ theme }}</a></li>
- {% endfor %}
- </ul>
- {% endif %}
- {% if things %}
- <p>{% trans "Objects" %}</p>
- <ul>
- {% for thing in things %}
- <li><a href="{% url 'picture_viewer' picture.slug %}#object-{{thing.slug}}">{{ thing }}</a></li>
- {% endfor %}
- </ul>
- {% endif %}
- </div>
- </div>
- {% else %}
- <p> </p>
- {% endif %}
-{% endblock %}
-
-
-{% block right-column %}
- {% with extra_info=picture.get_extra_info_json %}
- <div class="right-column">
- <div class="other-tools">
- <h2 class="mono">{% trans "See" %}</h2>
- <ul class="plain">
- {% if extra_info.source_url %}
- <li><a href="{{ extra_info.source_url }}">{% trans "Source" %}</a> {% trans "of the picture" %}</li>
- {% endif %}
- <li><a href="{{ picture.xml_file.url }}">{% trans "Source XML file" %}</a></li>
- {% if extra_info.about and not hide_about %}
- <li>{% trans "Picture on" %} <a href="{{ extra_info.about }}">{% trans "Editor's Platform" %}</a></li>
- {% endif %}
- {% if picture.wiki_link %}
- <li><a href="{{ picture.wiki_link }}">{% trans "Picture description on Wikipedia" %}</a></li>
- {% endif %}
- </ul>
- </div>
- </div>
- {% endwith %}
-{% endblock %}
+++ /dev/null
-{% load i18n %}
-{% load picture_tags %}
-{% load catalogue_tags %}
-
-<div class="area">
- <div class="area-thumbnail">
- <a href="{% url 'picture_viewer' area.picture.slug %}{% if theme %}#theme-{{theme.slug}}{% else %}#object-{{thing.slug}}{% endif %}">
- <img src='{% area_thumbnail_url area "100x100" %}'/>
- </a>
- </div>
- {% with area.picture as picture %}
- <div class="area-description">
- <div class="mono source">
- {% book_title_html picture %}
- </div>
- </div>
- <div style="clear:both"></div>
- {% endwith %}
-</div>
cropper = CustomCroppingEngine()
-@register.inclusion_tag('picture/picture_wide.html', takes_context=True)
-def picture_wide(context, picture):
- context.update({
- 'picture': picture,
- 'main_link': reverse('picture_viewer', args=[picture.slug]),
- 'request': context.get('request'),
- 'tags': split_tags(picture.tags),
- })
- return context
-
-
@register.simple_tag()
def area_thumbnail_url(area, geometry):
def to_square(coords):
def picture_list_thumb(request):
pictures = Picture.objects.all()
- if request.EXPERIMENTS['layout'].value:
- related_tags = Tag.objects.usage_for_model(Picture, counts=True)
- related_tags = sorted(related_tags, key=lambda t: -t.count)
- suggestion_categories = Counter()
- suggestions = []
- for t in related_tags:
- if suggestion_categories[t.category] < 3:
- suggestion_categories[t.category] += 1
- suggestions.append(t)
- if sum(suggestion_categories.values()) == 10:
- break
- template_name = 'catalogue/2022/author_detail.html'
- return render(request, template_name, {
- 'object_list': pictures,
- 'title': 'Galeria',
- 'tags': [],
- 'suggest': suggestions,
- 'list_type': 'gallery',
- })
- else:
- return render(request, template_name, {'picture_list': list(pictures)})
+ related_tags = Tag.objects.usage_for_model(Picture, counts=True)
+ related_tags = sorted(related_tags, key=lambda t: -t.count)
+ suggestion_categories = Counter()
+ suggestions = []
+ for t in related_tags:
+ if suggestion_categories[t.category] < 3:
+ suggestion_categories[t.category] += 1
+ suggestions.append(t)
+ if sum(suggestion_categories.values()) == 10:
+ break
+ template_name = 'catalogue/2022/author_detail.html'
+ return render(request, template_name, {
+ 'object_list': pictures,
+ 'title': 'Galeria',
+ 'tags': [],
+ 'suggest': suggestions,
+ 'list_type': 'gallery',
+ })
def picture_detail(request, slug):
theme_things = split_tags(picture.related_themes())
- if request.EXPERIMENTS['layout'].value:
- template_name = 'picture/2022/picture_detail.html'
- else:
- template_name = 'picture/picture_detail.html'
+ template_name = 'picture/2022/picture_detail.html'
return render(request, template_name, {
'picture': picture,
-{% extends request.EXPERIMENTS.layout.value|yesno:"2022/base_simple.html,base/base.html" %}
+{% extends "2022/base_simple.html" %}
{% load i18n %}
{% load polls_tags %}
-{% extends request.EXPERIMENTS.layout|yesno:"2022/base_simple.html,base/base.html" %}
+{% extends "2022/base_simple.html" %}
{% load i18n %}
{% block titleextra %}{% trans "Notifications" %}{% endblock %}
-{% extends request.EXPERIMENTS.layout|yesno:"2022/base_simple.html,base/base.html" %}
+{% extends "2022/base_simple.html" %}
{% load i18n %}
{% block titleextra %}{% trans "Notifications" %}{% endblock %}
+++ /dev/null
-# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
-# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
-#
-from django.urls import reverse
-from search.forms import SearchForm
-
-
-def search_form(request):
- return {'search_form': SearchForm(reverse('search_hint') + '?max=10', request.GET)}
# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
-from django import forms
-from django.forms.utils import flatatt
from django.forms.widgets import RadioSelect
-from django.utils.encoding import smart_str
-from django.utils.safestring import mark_safe
-from json import dumps
-
-
-class JQueryAutoCompleteWidget(forms.TextInput):
- def __init__(self, options, *args, **kwargs):
- self.options = dumps(options)
- super(JQueryAutoCompleteWidget, self).__init__(*args, **kwargs)
-
- def render_js(self, field_id, options):
- return '$(\'#%s\').autocomplete(%s).result(autocomplete_result_handler);' % (field_id, options)
-
- def render(self, name, value=None, attrs=None, renderer=None):
- final_attrs = self.build_attrs(self.attrs, attrs)
- final_attrs["name"] = name
- if value:
- final_attrs['value'] = smart_str(value)
-
- if 'id' not in self.attrs:
- final_attrs['id'] = 'id_%s' % name
-
- html = '''<input type="text" %(attrs)s/>
- <script type="text/javascript">//<!--
- %(js)s//--></script>
- ''' % {
- 'attrs': flatatt(final_attrs),
- 'js': self.render_js(final_attrs['id'], self.options),
- }
-
- return mark_safe(html)
-
-
-class JQueryAutoCompleteSearchWidget(JQueryAutoCompleteWidget):
- def __init__(self, *args, **kwargs):
- super(JQueryAutoCompleteSearchWidget, self).__init__(*args, **kwargs)
-
- def render_js(self, field_id, options):
- return ""
-
-
-class JQueryAutoCompleteField(forms.CharField):
- def __init__(self, source, options=None, *args, **kwargs):
- if options is None:
- options = {}
- if 'widget' not in kwargs:
- options['source'] = source
- kwargs['widget'] = JQueryAutoCompleteWidget(options)
-
- super(JQueryAutoCompleteField, self).__init__(*args, **kwargs)
-
-
-class JQueryAutoCompleteSearchField(forms.CharField):
- def __init__(self, options=None, *args, **kwargs):
- if options is None:
- options = {}
- if 'widget' not in kwargs:
- kwargs['widget'] = JQueryAutoCompleteSearchWidget(options)
-
- super(JQueryAutoCompleteSearchField, self).__init__(*args, **kwargs)
-
class InlineRadioWidget(RadioSelect):
import catalogue.models
import pdcounter.models
import picture.models
-from .fields import JQueryAutoCompleteSearchField, InlineRadioWidget
+from .fields import InlineRadioWidget
from .utils import UnaccentSearchQuery, UnaccentSearchVector
-class SearchForm(forms.Form):
- q = JQueryAutoCompleteSearchField(label=_('Search'))
- # {'minChars': 2, 'selectFirst': True, 'cacheLength': 50, 'matchContains': "word"})
-
- def __init__(self, source, *args, **kwargs):
- kwargs['auto_id'] = False
- super(SearchForm, self).__init__(*args, **kwargs)
- self.fields['q'].widget.attrs['id'] = 'search'
- self.fields['q'].widget.attrs['autocomplete'] = 'off'
- self.fields['q'].widget.attrs['data-source'] = source
- if 'q' not in self.data:
- self.fields['q'].widget.attrs['placeholder'] = _('title, author, epoch, kind, genre, phrase')
-
-
class SearchFilters(forms.Form):
q = forms.CharField(
required=False, widget=forms.HiddenInput(),
+++ /dev/null
-{% extends "base/base.html" %}
-{% load i18n %}
-{% load catalogue_tags %}
-
-{% block title %}Search{% endblock %}
-
-{% block metadescription %}{% endblock %}
-
-{% block bodyid %}newsearch{% endblock %}
-
-{% block body %}
- <h1>Search</h1>
- <form action="{% url 'search' %}" method="get" accept-charset="utf-8" id="search-form-x">
- <p>
- <input type="text" name="q" value="{{request.GET.q}}" style="width:250px; font-size: 1.2em;"/>
- <input type="submit" value="{% trans "Search" %}" />
- <br />
- <input type="checkbox" value="true" name="fuzzy" {% if fuzzy %}checked{% endif %}/> fuzzy.
- </p>
- </form>
- {% if did_you_mean %}
- Czy miałeś na mysli <a href="?q={{did_you_mean|urlencode}}">{{did_you_mean}}</a>?
- {% endif %}
-
- <div id="results">
- <ol>
- {% for result in results %}
- <li>
- <p>
- <a href="{{result.book.get_absolute_url}}">{{result.book.pretty_title}}</a>
- (id: {{result.book_id}}, score: {{result.score}})
- </p>
- <ul>
- {% for snip in hit.snippets %}
- <li>
- {{snip|safe}}<br/>
- </li>
- {% endfor %}
-
- {% for part in result.parts %}
- {% if part.header %}
- <li>W {{part.header}} nr {{part.position}}</li>
- {% else %}
- {% if part.fragment %}
- <li>
- <div style="">Tagi/Motywy: {% for tag in part.fragment.tags %}{{tag.name}} {% endfor %}</div>
- {{part.fragment.short_html|safe}}
- </li>
- {% endif %}
- {% endif %}
- {% endfor %}
- </ul>
- </li>
- {% empty %}
- <p>No results.</p>
- {% endfor %}
- </ol>
- </div>
-{% endblock %}
+++ /dev/null
-# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
-# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
-#
-import re
-from django import template
-
-register = template.Library()
-
-
-@register.inclusion_tag('catalogue/book_searched.html', takes_context=True)
-def book_searched(context, result):
- # We don't need hits which lead to sections but do not have
- # snippets.
- hits = [(idx, h)
- for (idx, h) in enumerate(result.hits)
- if result.snippets[idx] is not None or ('fragment' in h and h['themes_hit'])]
-
- for (idx, hit) in hits:
- # currently we generate one snipper per hit though.
- if len(result.snippets) <= idx:
- break
- if result.snippets[idx] is None:
- continue
- snip = result.snippets[idx]
- # fix some formattting
- snip = re.sub(r"[ \t\n]*\n[ \t\n]*", "\n", snip)
- snip = re.sub(r"(^[ \t\n]+|[ \t\n]+$)", "", snip)
-
- snip = snip.replace("\n", "<br />").replace('---', '—')
- hit['snippet'] = snip
-
- return {
- 'request': context['request'],
- 'book': result.book,
- 'hits': list(zip(*hits))[1] if hits else []
- }
+++ /dev/null
-# This file is part of FNP-Redakcja, licensed under GNU Affero GPLv3 or later.
-# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
-#
-from re import split
-
-from django import template
-
-register = template.Library()
-
-
-"""
-In template:
- {% set_get_paramater param1='const_value',param2=,param3=variable %}
-results with changes to query string:
- param1 is set to `const_value' string
- param2 is unset, if exists,
- param3 is set to the value of variable in context
-
-Using 'django.core.context_processors.request' is required.
-
-"""
-
-
-class SetGetParameter(template.Node):
- def __init__(self, values):
- self.values = values
-
- def render(self, context):
- request = template.Variable('request').resolve(context)
- params = request.GET.copy()
- for key, value in self.values.items():
- if value == '':
- if key in params:
- del(params[key])
- else:
- params[key] = template.Variable(value).resolve(context)
- return '?%s' % params.urlencode()
-
-
-@register.tag
-def set_get_parameter(parser, token):
- parts = split(r'\s+', token.contents, 2)
-
- values = {}
- for pair in parts[1].split(','):
- s = pair.split('=')
- values[s[0]] = s[1]
-
- return SetGetParameter(values)
[
item['label']
for item in data
+ ],
+ [
+ item.get('author', '')
+ for item in data
+ ],
+ [
+ item['url']
+ for item in data
]
]
+++ /dev/null
-{% spaceless %}
-
-<div class="carousel carousel-{{ carousel.placement }}"
- data-cycle-slides="section"
- data-cycle-pause-on-hover="true"
- >
-
- {% if banners|length > 1 %}
- <div class="cycle-prev"></div>
- <div class="cycle-next"></div>
- <div class="cycle-pager"></div>
- {% endif %}
-
- {% for banner in banners %}
- {% if banner %}
- {{ banner.main_box }}
- {% endif %}
- {% endfor %}
-</div>
-
-{% endspaceless %}
+++ /dev/null
-{% spaceless %}
- {% if cite.image %}
- {% if cite.image_link %}<a href="{{ cite.image_link }}">{% endif %}
- {% if cite.image_title %}
- {{ cite.image_title }}{% else %}
- untitled{% endif %}{% if cite.image_link %}</a>{% endif %}{% if cite.image_author %},
- {{ cite.image_author }}{% endif %}{% if cite.image_license %},
- {% if cite.image_license_link %}<a href="{{ cite.image_license_link }}">{% endif %}
- {{ cite.image_license }}
- {% if cite.image_license_link %}</a>{% endif %}
- {% endif %}
- {% else %}
- <a href="http://www.flickr.com/photos/lou/430980641/">books about architecture</a>,
- saikofish@Flickr,
- <a href="http://creativecommons.org/licenses/by-nc-sa/2.0/">CC BY NC SA</a>.
- {% endif %}
-{% endspaceless %}
+++ /dev/null
-{% extends "base/base.html" %}
-{% load i18n %}
-{% load catalogue_tags %}
-
-{% block titleextra %}{% trans "My shelf" %}{% endblock %}
-
-{% block logout %}/{% endblock %}
-
-{% block body %}
- <h1>{% trans "My shelf" %}</h1>
-
- {% work_list books %}
-
- {% if not books %}
- {% trans "Add works to your shelf by clicking on the star on the page of the work. The work will then show up on My shelf page." %}
- {% endif %}
-{% endblock %}
+++ /dev/null
-{% load i18n %}
-<h1>{{ title }}</h1>
-
-<form action="{% url 'social_unlike_book' view_kwargs.slug %}" method="post" accept-charset="utf-8"
- class="cuteform{% if placeholdize %} hidelabels{% endif %}">
- {% csrf_token %}
- <input type="submit" value="{% trans "Remove from my shelf" %}"/>
-</form>
-
-<form action="{{ request.get_full_path }}" method="post" accept-charset="utf-8"
- class="cuteform{% if placeholdize %} hidelabels{% endif %}">
- {% csrf_token %}
- <ol>
- <div id="id___all__"></div>
- {{ form.as_ul }}
- <li><input type="submit" value="{{ submit }}"/></li>
- </ol>
-</form>
return lazy(get_value, str)()
-@register.inclusion_tag('social/carousel.html', takes_context=True)
-def carousel(context, placement):
- carousel = Carousel.get(placement)
- banners = [
- item.get_banner()
- for item in carousel.carouselitem_set.all().select_related('banner')
- ]
-
- request = context['request']
- if 'banner' in request.GET:
- try:
- banner_id = int(request.GET['banner'])
- except (TypeError, ValueError):
- pass
- else:
- try:
- index = [b.pk for b in banners].index(banner_id)
- except ValueError:
- if request.user.is_staff:
- # Staff is allowed to preview any banner.
- try:
- banners.insert(0, Cite.objects.get(pk=banner_id))
- except Cite.DoesNotExist:
- pass
- else:
- # Put selected banner to front.
- banners = [banners[index]] + banners[:index] + banners[index+1:]
-
- return {
- 'carousel': carousel,
- 'banners': banners,
- }
-
-
@register.inclusion_tag('social/carousel_2022.html', takes_context=True)
def carousel_2022(context, placement):
banners = Carousel.get(placement).carouselitem_set.all()#first().get_banner()
path('usun-tag/', views.RemoveSetView.as_view(), name='social_remove_set_tag'),
path('moje-tagi/', views.my_tags, name='social_my_tags'),
path('lektura/<slug:slug>/nie_lubie/', views.unlike_book, name='social_unlike_book'),
- path('lektura/<slug:slug>/polki/', never_cache(views.ObjectSetsFormView()), name='social_book_sets'),
path('polka/', views.my_shelf, name='social_my_shelf'),
path('ulubione/', views.my_liked),
]
from django.views.decorators.http import require_POST
from django.views.generic.edit import FormView
-from ajaxable.utils import AjaxableFormView
-
from catalogue.models import Book, Tag
import catalogue.models.tag
from social import forms
@login_required
def my_shelf(request):
- if request.EXPERIMENTS['layout'].value:
- template_name = 'social/2022/my_shelf.html'
- else:
- template_name = 'social/my_shelf.html'
-
+ template_name = 'social/2022/my_shelf.html'
tags = list(request.user.tag_set.all())
suggest = [t for t in tags if t.name]
print(suggest)
t.name for t in tags
], safe=False
)
-
-
-class ObjectSetsFormView(AjaxableFormView):
- form_class = forms.ObjectSetsForm
- placeholdize = True
- template = 'social/sets_form.html'
- ajax_redirect = True
- POST_login = True
-
- def get_object(self, request, slug):
- return get_object_or_404(Book, slug=slug)
-
- def context_description(self, request, obj):
- return obj.pretty_title()
-
- def form_args(self, request, obj):
- return (obj, request.user), {}
-{% extends request.EXPERIMENTS.layout.value|yesno:"2022/base_simple.html,base/base.html" %}
+{% extends "2022/base_simple.html" %}
{% block settings %}
{% load title %}
{% extends "ajaxable/form.html" %}
{% load i18n %}
-{% load ajaxable_tags %}
-{% block form_fields %}
-{{ form.contact|pretty_field }}
- <li>{% trans "I'd like to find in WolneLektury.pl these…" %}</li>
- {{ form.books|pretty_field }}
- {{ form.ebook|pretty_checkbox }}
- {{ form.audiobook|pretty_checkbox }}
- {{ form.agree_newsletter|pretty_checkbox }}
- <li><span class="helptext">{{ form.data_processing }}</span></li>
-{% endblock %}
{% block extra %}
<p>{% trans "Remember that we can only publish books in public domain, ie. 70 years after the death of the author!" %}</p>
-{% endblock %}
\ No newline at end of file
+{% endblock %}
{% extends "ajaxable/form.html" %}
-{% load ajaxable_tags %}
-
-{% block form_fields %}
- {{ form.contact|pretty_field }}
- {{ form.description|pretty_field }}
- {{ form.agree_newsletter|pretty_checkbox }}
- <li><span class="helptext">{{ form.data_processing }}</span></li>
-{% endblock %}
\ No newline at end of file
# 'allauth.account.auth_backends.AuthenticationBackend',
]
ACCOUNT_EMAIL_CONFIRMATION_EXPIRE_DAYS = 2
-LOGIN_URL = '/uzytkownik/zaloguj-utworz/'
+LOGIN_URL = '/uzytkownik/login/'
LOGIN_REDIRECT_URL = '/'
'django.template.context_processors.media',
'django.template.context_processors.request',
'wolnelektury.context_processors.extra_settings',
- 'search.context_processors.search_form',
),
},
}]
window.location.reload(true);
});
+ $('.c-lang').on('click', function() {
+ !$(this).toggleClass('is-open');
+ });
+
+
+
+
+
+ $(".c-media__settings > i").on('click', function() {
+ $(".c-media__settings").toggleClass('active');
+ });
})();
.c-lang {
position: absolute;
- top: 23px;
- margin-right: 217px;
+ top: 11px;
+
+ width: 150px;
+ right: 50px + 16px;
opacity: 0;
pointer-events: none;
transition: opacity 350ms $ease-out;
z-index: $master-layer + 1;
+ display: none;
+
+ @include rwd($break-menu) {
+ display: block;
+ }
&.is-open {
.c-lang__button {
opacity: 0;
transition: all 350ms $ease-out;
pointer-events: none;
- a {
+ display: flex;
+ flex-direction: column;
+
+ button {
display: block;
padding: 9px 20px;
color: #474747;
+ background-color: transparent;
+ border: 0;
+ cursor: pointer;
+ font-family: "Source Sans Pro";
+ font-size: 16px;
+ line-height: 18.4px;
+ text-align: left;
&:hover {
background-color: #EDAA00;
background-color: #EDAA00;
}
}
-}
\ No newline at end of file
+}
display: flex;
align-items: center;
justify-content: space-between;
+ position: relative;
.icons {}
.content {
font-size: 12px;
line-height: 140%;
}
+
+ .c-media__settings {
+ position: absolute;
+ left: 0;
+ right: 0;
+ top: 0;
+ z-index: 5;
+ min-height: 30px;
+ overflow: hidden;
+
+ .icon {
+ position: absolute;
+ transition: .5s rotate;
+ bottom: 0;
+ right: 0;
+ line-height: 30px;
+ width: 40px;
+ text-align: center;
+ margin: 0;
+ }
+ > div {
+ height: 0;
+ transition: .5s height;
+ overflow: hidden;
+ background: #F2F2F2;
+ border-bottom: 5px solid #D5ECED;
+ margin-top: -5px;
+ > div {
+ padding: 30px;
+ }
+ }
+ &.active {
+ .icon {
+ rotate: 180deg;
+
+ }
+ > div {
+ height: 150px;
+ }
+ }
+ }
}
.c-media__popup {
}
.l-container {
+ position: relative;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 30px;
}
}
+ .c-lang {
+ display: block;
+ left: 16px;
+ }
}
}
}
display: flex;
flex-direction: column;
justify-content: space-between;
+ @include rwd($break-menu) {
+ width: 60%;
+ }
p {
color: $color-white;
-{% extends request.EXPERIMENTS.layout.value|yesno:"2022/base_simple.html,base/base.html" %}
+{% extends "2022/base_simple.html" %}
{% load i18n %}
{% block settings %}
-{% extends request.EXPERIMENTS.layout.value|yesno:"2022/base_simple.html,site_base.html" %}
+{% extends "2022/base_simple.html" %}
{% block body %}
<div class="white-box normal-text">
+++ /dev/null
-{% load i18n %}
-
-<h1>{{ title }}</h1>
-
-<form action="{{ request.get_full_path }}" method="post" accept-charset="utf-8"
- class="cuteform{% if placeholdize %} hidelabels{% endif %}">
- {% csrf_token %}
- <ol>
- <div id="id_{% if form_prefix %}{{ form_prefix }}-{% endif %}__all__"></div>
- {{ form.as_ul }}
- <li><a href="{% url 'account_reset_password' %}">{% trans "Forgot Password?" %}</a></li>
- <li><input type="submit" value="{{ submit }}"/></li>
- </ol>
-</form>
-
-{% if USE_OPENID %}
-<h1>{% trans "Sign in using:" %}</h1>
-
-<ul class="socialaccount_providers">
- {% include "socialaccount/snippets/provider_list.html" %}
-</ul>
-
-{% include "socialaccount/snippets/login_extra.html" %}
-{% endif %}
-
-{% block extra %}
-{% endblock %}
+++ /dev/null
-{% extends "auth/login.html" %}
-{% load i18n %}
-{% load honeypot %}
-
-{% block extra %}
- {{ block.super }}
-
- {% include "auth/register_form.html" with form=register_form title=_("or register") action_url='register' action_query=request.GET.urlencode honeypot=True submit=register_submit %}
-{% endblock %}
+++ /dev/null
-{% load i18n %}
-
-
-{% include "auth/register_form.html" %}
-
-{% if USE_OPENID %}
- <div class="form-extra">
- <h1>{% trans "Sign in using:" %}</h1>
-
- <ul class="socialaccount_providers">
- {% include "socialaccount/snippets/provider_list.html" %}
- </ul>
-
- {% include "socialaccount/snippets/login_extra.html" %}
- </div>
-{% endif %}
+++ /dev/null
-{% extends "ajaxable/form.html" %}
-{% load ajaxable_tags %}
-
-
-{% block form_fields %}
- {{ form.username|pretty_field }}
- {{ form.email|pretty_field }}
- {{ form.password1|pretty_field }}
- {{ form.password2|pretty_field }}
- {{ form.agree_newsletter|pretty_checkbox }}
- <li><span class="helptext">{{ form.data_processing }}</span></li>
-{% endblock %}
\ No newline at end of file
+++ /dev/null
-{% extends 'podcast.html' %}
-
-{% block artist_label %}Opowiada{% endblock %}
\ No newline at end of file
+++ /dev/null
-<!DOCTYPE html>
-{% spaceless %}
- <html lang="{{ LANGUAGE_CODE }}" prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb#">
- {% load pipeline i18n %}
- {% load static %}
- {% load piwik_tags %}
- {% 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="https://wolnelektury.pl" 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'>
- <img src="{% static "img/contrib/language/language.svg" %}" alt="{% trans "Language" %}">
- <span class="label"> {% trans "Language" %}</span>
- </span>
- <div id="lang-menu-items">
- {% for lang in LANGUAGES %}
- <form action="{% url 'set_language' %}" method="post">
- {% csrf_token %}
- <input type="hidden" name="language" value="{{ lang.0 }}"/>
- <button type="submit" lang="{{ lang.0 }}"
- class="{% if lang.0 == LANGUAGE_CODE %}active{% endif %}">{{ lang.1 }}</button>
- </form>
- {% endfor %}
- </div>
- </div>
-
- <nav id="menu">
- <ul id="user-info">
- {% if request.user.is_authenticated %}
- <li>
- <a href="{% url 'user_settings' %}">
- <strong>{{ request.user.username }}</strong>
- </a>
- </li>
- <li>
- <a href="{% url 'logout' %}?next={% block logout %}{{ request.get_full_path }}{% endblock %}">{% trans "Logout" %}</a>
- </li>
- {% endif %}
- </ul>
-
- </nav>
- </header>
- </div>
- </div>
-
- <div id="main-content">
- {% block body %}
- {% endblock %}
- <div class="clearboth"></div>
- </div>
-
- {% endblock bodycontent %}
-
- <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.7.1/jquery.min.js" integrity="sha512-BkBgWiL0N/EFIbLZYGTgbksKG5bS6PtwnWvVk3gccv+KhtK/4wkLxCRGh+kelKiXx7Ey4jfTabLg3AEIPC7ENA==" crossorigin="anonymous"></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 %}
+++ /dev/null
-{% extends "base/superbase.html" %}
-
-
-{% block ogtitle %}{% block titleextra %}{{ page_title }}{% endblock %}{% endblock %}
+++ /dev/null
-<!DOCTYPE html>
-{% spaceless %}
- <html lang="{{ LANGUAGE_CODE }}" prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb#" class="{% if VARIANT %}{{ VARIANT }}{% endif %}">
- {% load pipeline i18n %}
- {% load static %}
- {% load catalogue_tags funding_tags reporting_stats %}
- {% load piwik_tags %}
- {% load cache %}
- {% load chunk from chunks %}
- {% load sponsor_page from sponsors %}
- {% load annoy_banner from annoy %}
- {% 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 %}
- {% tracking_code %}
- </head>
- <body id="{% block bodyid %}base{% endblock %}">
- <ul id="skiplinks">
- <li><a href="#main-content">{% trans "Go to content" %}</a></li>
- <li><a id="skiplink-search" href="#search"">{% trans "Go to search" %}</a></li>
- <li><a href="{% block footerlink %}#footer-wrapper{% endblock %}">{% trans "Go to page footer" %}</a></li>
- </ul>
-
- {% block bodycontent %}
-
- {% block annoy %}
- {% annoy_banner 'blackout' %}
- {% annoy_banner 'top' %}
- {% if not funding_no_show_current %}
- {% cache 120 funding_top_bar LANGUAGE_CODE %}
- {% funding_top_bar %}
- {% endcache %}
- {% endif %}
- {% endblock %}
-
- <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>
-
- <p id="tagline">
- {% url 'book_list' as b %}
- {% url 'infopage' 'prawa' as r %}
- {% count_books book_count %}
- {% blocktrans count book_count as c %}
- <a href='{{ b }}'>{{ c }}</a> free reading you have <a href='{{ r }}'>right to</a>
- {% plural %}
- <a href='{{ b }}'>{{ c }}</a> free readings you have <a href='{{ r }}'>right to</a>
- {% endblocktrans %}
- </p>
-
- <div id="lang-menu" class="hoverget">
- <span id='lang-button' class='hoverclick' tabindex="0">
- <img src="{% static "img/contrib/language/language.svg" %}" alt="">
- <span class="label"> {% trans "Language" %}</span>
- </span>
- <div id="lang-menu-items">
- {% for lang in LANGUAGES %}
- <form action="{% url 'set_language' %}" method="post">
- {% csrf_token %}
- <input type="hidden" name="language" value="{{ lang.0 }}"/>
- <button type="submit" lang="{{ lang.0 }}" tabindex="121"
- class="{% if lang.0 == LANGUAGE_CODE %}active{% endif %}">{{ lang.1 }}</button>
- </form>
- {% endfor %}
- </div>
- </div>
-
- <a id="show-menu"></a>
- <nav id="menu">
- <ul id="user-info">
- {% if request.user.is_authenticated %}
- <li>
- <a href="{% url 'user_settings' %}">
- <strong>{{ request.user.username }}</strong>
- </a>
- </li>
- <li>
- <a href="{% url 'social_my_shelf' %}" id="user-shelves-link">{% trans "My shelf" %}</a>
- </li>
- {% if request.user.is_staff %}
- <li><a href="{% url 'admin:index' %}">{% trans "Administration" %}</a></li>
- {% endif %}
- <li>
- <a href="{% url 'logout' %}?next={% block logout %}{{ request.get_full_path }}{% endblock %}">{% trans "Logout" %}</a>
- </li>
- {% else %}
- <li>
- <a href="{% url 'login' %}?next={{ request.path }}" id="login">{% trans "Sign in" %}</a>
- / <a href="{% url 'register' %}?next={{ request.path }}" id="register">{% trans "Register" %}</a>
- </li>
- {% endif %}
- </ul>
-
- <ul id="main-menu-side">
- {% include "main_menu.html" %}
- </ul>
- </nav>
- <form id="search-area" action="{% url 'wlsearch' %}">
- <div id="search-field">
- <label for="search">{{ search_form.q.label }}</label>
- {{ search_form.q }}
- </div>
- <button type='submit'>{% trans "Search" %}</button>
- </form>
-
- <ul id="main-menu">
- {% include "main_menu.html" %}
- </ul>
-
-
-
- </header>
- </div>
- </div>
-
- <div id="main-content">
- {% comment %}
- <div id="banners">
- <a href="https://nowoczesnapolska.org.pl/pomoz-nam/wesprzyj-nas/">
- <img src="{% static 'img/banners/960x150_wolneLektury.jpg' %}"
- alt="Wesprzyj działalność Nowoczesnej Polski"/>
- </a>
- </div>
- {% endcomment %}
- {% block body %}
- {% endblock %}
- <div class="clearboth"></div>
- </div>
-
- <div id="footer-wrapper">
- <footer id="main">
- {% chunk 'footer' %}
- {% block add_footer %}{% endblock %}
- {% sponsor_page 'footer' %}
- </footer>
- </div>
-
- {# template #}
- <div id="ajaxable-window" class='dialog-window'>
- <div class="header"><a href="#" class="jqmClose">{% trans "Close" %}</a></div>
- <div class="target">
- <p><img src="{% static "img/indicator.gif" %}" alt="*"/> {% trans "Loading" %}</p>
- </div>
- </div>
- {% endblock bodycontent %}
-
- <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.7.1/jquery.min.js" integrity="sha512-BkBgWiL0N/EFIbLZYGTgbksKG5bS6PtwnWvVk3gccv+KhtK/4wkLxCRGh+kelKiXx7Ey4jfTabLg3AEIPC7ENA==" crossorigin="anonymous"></script>
- <script type="text/javascript">
- var LANGUAGE_CODE = "{{ LANGUAGE_CODE }}";
- var STATIC_URL = "{{ STATIC_URL }}";
- </script>
- {% javascript "base" %}
-
- {% block extrabody %}{% endblock %}
-
- <script src="{% static "js/contrib/modernizr.custom.19652.js" %}"></script>
- </body>
- </html>
-{% endspaceless %}
-{% extends form.base_template|default:request.EXPERIMENTS.layout.value|yesno:"2022/base_simple.html,base/base.html" %}
+{% extends form.base_template|default:"2022/base_simple.html" %}
{% load forms_builder_tags %}
{% load title %}
{% load i18n %}
</div>
{% if form_published %}
- {% if request.EXPERIMENTS.layout.value %}
{{ form_for_form.as_p }}
{% if form_for_form.fields %}
<button>{{ form.button_text }}</button>
{% endif %}
- {% else %}
- <table>
- {{ form_for_form.as_table }}
- {% if form_for_form.fields %}
- <tr><td></td><td><button>{{ form.button_text }}</button></td></tr>
- {% endif %}
- </table>
- {% endif %}
{% else %}
<p class="l-change-pop show">FORMULARZ ZAMKNIĘTY</p>
{% endif %}
+++ /dev/null
-{% load i18n %}
-
-<li{% if active_menu_item == 'club' %} class="active"{% endif %}>
- <a href="{% url 'club_join' %}">{% trans "Support us" %}</a>
-</li>
-<li{% if active_menu_item == 'info:lektury-szkolne' %} class="active"{% endif %}>
- <a href="{% url 'infopage' 'lektury-szkolne' %}">{% trans "School readings" %}</a>
-</li>
-<li{% if active_menu_item == 'books' %} class="active"{% endif %}>
- <a href="{% url 'book_list' %}">{% trans "Literature" %}</a>
-</li>
-<li{% if active_menu_item == 'theme' %} class="active"{% endif %}>
- <a href="{% url 'theme_catalogue' %}">{% trans "Themes" %}</a>
-</li>
-<li{% if active_menu_item == 'audiobooks' %} class="active"{% endif %}>
- <a href="{% url 'audiobook_list' %}">{% trans "Audiobooks" %}</a>
-</li>
-<li{% if active_menu_item == 'collections' %} class="active"{% endif %}>
- <a href="{% url 'catalogue_collections' %}">{% trans "Collections" %}</a>
-</li>
-<li>
- <a href="{% url 'subscribe' %}">{% trans "Newsletter" %}</a>
-</li>
+++ /dev/null
-{% extends "base/base.html" %}
-{% load latest_blog_posts from blog %}
-{% load carousel from social_tags %}
-{% load static %}
-{% load i18n catalogue_tags infopages_tags %}
-{% load cache %}
-{% load funding_tags %}
-{% get_current_language as LANGUAGE_CODE %}
-
-
-{% block title %}{% trans "Wolne Lektury internet library" %}{% endblock %}
-{% block ogtitle %}{% trans "Wolne Lektury internet library" %}{% endblock %}
-
-{% block footerlink %}#main-footer{% endblock %}
-
-{% block body %}
- {% spaceless %}
- {% carousel 'main' %}
-
- <section id="main-library">
- <h1>{% trans "In our digital library you will find" %}</h1>
- <div class="main-library-row">
- <div class="covers">
- {% for book in best %}
- {{ book.mini_box }}
- {% endfor %}
- </div>
- <div class="note white-box normal-text" style="font-size: 18px">
- <a href="{% if recommended_collection %}{{ recommended_collection.get_absolute_url }}{% else %}{% url "book_list" %}{% endif %}" style="display: block; height: 100%">
- {% trans "and many other books, poems, pictures, audiobooks…" %}
- </a>
- </div>
- </div>
- </section>
-
- <section>
- <h1>
- <a href="{% url 'recent_list' %}">
- {% trans "Recent publications" %}
- →
- </a>
- </h1>
- {% for book in last_published %}
- {{ book.mini_box }}
- {% endfor %}
- </section>
-
- {% if collections %}
- <section>
- <h1>
- <a href="{% url 'catalogue_collections' %}">
- {% trans "Collections" %}
- →
- </a>
- </h1>
- {% for collection in collections %}
- {{ collection.box }}
- {% endfor %}
- </section>
- {% endif %}
-
- <section id="main-theme">
- <h1>
- <a href="{% url 'theme_catalogue' %}">
- {% trans "Motifs and themes" %}
- →
- </a>
- </h1>
- <div class="white-box normal-text">
- <h2>{% trans "Theme" %}: {{ theme }}</h2>
- <p>{% trans "Explore works with the same theme" %}</p>
- {% for book in theme_books %}
- {{ book.mini_box }}
- {% endfor %}
- {% if theme_fragment %}
- {% cache 3600 fragment_promo theme_fragment.pk %}
- {% include 'catalogue/fragment_promo.html' with fragment=theme_fragment %}
- {% endcache %}
- {% endif %}
- </div>
- </section>
-
- <div id="main-footer" class="clearboth"></div>
-
- <section class="infopages-box">
- <h1>{% trans "News" %}</h1>
- <ol>
- {% cache 1800 latest_blog_posts %}
- {% latest_blog_posts %}
- {% endcache %}
- </ol>
- </section>
-
- <section class="infopages-box">
- <h1>{% trans "Utilities" %}</h1>
-
- <ul>
- <li><a href="{% url 'suggest' %}" id="suggest" class="ajaxable">{% trans "Report a bug or suggestion" %}</a></li>
- <li><a href="{% url 'reporting_catalogue_pdf' %}">{% trans "Download the catalogue in PDF format." %}</a></li>
- <li><a href="{% url 'gallery' %}">{% trans "Art" %}</a></li>
- <li><a href="{% url 'catalogue' %}">{% trans "All works" %}</a></li>
-
- <li><a href="{% url 'dictionary_notes' %}">{% trans "Footnotes" %}</a></li>
- <li><a href="{% url 'suggest_publishing' %}" id="suggest-publishing" class="ajaxable">{% trans "Missing a book?" %}</a></li>
- <li><a href="{% url 'publish_plan' %}">{% trans "Publishing plan" %}</a></li>
- <li><a href="{% url 'api' %}">API</a></li>
- <li><a href="{% url 'oaipmh' %}">OAI-PMH</a></li>
- <li><a href="{% url 'lesmianator' %}" lang="pl">Leśmianator</a></li>
- <li><a href="https://polski.wolnelektury.pl" lang="pl">Przewodnik dla piszących i czytających</a></li>
- <li><a href="{% url 'subscribe' %}">{% trans "Newsletter" %}</a></li>
- </ul>
- </section>
-
- <section class="infopages-box">
- <h1>{% trans "Information" %}</h1>
- <ul>
- <li><a href="https://nowoczesnapolska.org.pl/prywatnosc/">{% trans "Privacy policy" %}</a></li>
- {% infopages_on_main %}
- </ul>
-
- <div class="social-links">
- <a href="https://www.facebook.com/wolnelektury/" title='{% trans "Follow us on Facebook" %}'>
- <img src="{% static "img/social/f.png" %}" alt="Wolne Lektury @ Facebook" />
- </a>
- </div>
- </section>
- {% endspaceless %}
-{% endblock %}
-
-
-{% block add_footer %}
- {% spaceless %}
- {% if cite %}
- <p>
- {% trans "Image used:" %}
- {% cache 3600 cite_info cite.pk %}
- {% include 'social/cite_info.html' %}
- {% endcache %}
- </p>
- {% endif %}
- {% endspaceless %}
-{% endblock %}
+++ /dev/null
-<div class="jp-type-playlist">
- <div id="jplayer" class="jp-jplayer" data-player="jp_container_{{ id }}" data-supplied="mp3"></div>
- <div id="jp_container_{{ id }}" class="jp-audio">
- <div class="jp-type-single">
- <span class="title"></span>
- <div class="jp-gui jp-interface">
- <ul class="jp-controls">
- <li><a href="javascript:;" class="jp-play" tabindex="1">play</a></li>
- <li><a href="javascript:;" class="jp-pause" tabindex="1">pause</a></li>
- <li><a href="javascript:;" class="jp-mute" tabindex="1" title="mute">mute</a></li>
- <li><a href="javascript:;" class="jp-unmute" tabindex="1" title="unmute">unmute</a></li>
- </ul>
- <div class="jp-progress">
- <div class="jp-seek-bar">
- <div class="jp-play-bar"></div>
- </div>
- </div>
- <div class="jp-volume-bar">
- <div class="jp-volume-bar-value"></div>
- </div>
- <div class="jp-time-holder">
- <div class="jp-current-time"></div>
- <div class="jp-duration"></div>
- </div>
- </div>
- <div class="jp-playlist">
- <ul>
- <li data-mp3='{{ mp3 }}'>
- <div class='play'>{{ title }}
- <div class='extra-info'>
- {% if artist %}{% block artist_label %}Czyta{% endblock %} <span class='artist'>{{ artist }}</span>,{% endif %}
- {% if director %}reż. <span class='director'>{{ director }}</span>{% endif %}
- </div>
- </div>
- </li>
- </ul>
- </div>
- <div class="jp-no-solution"><span>Update Required</span>
- To play the media you will need to either update your browser to a recent version or update your
- <a href="http://get.adobe.com/flashplayer/" target="_blank">Flash plugin</a>.
- </div>
- </div>
- </div>
-</div>
\ No newline at end of file
+++ /dev/null
-{% extends "base/base.html" %}
-
-{% block body %}
- <form method="post" action="{{ action }}">
- {% csrf_token %}
- <input type="submit" value="send post"/>
- </form>
-{% endblock body %}
-{% extends request.EXPERIMENTS.layout.value|yesno:"2022/base_simple.html,base/base.html" %}
+{% extends "2022/base_simple.html" %}
{% load i18n %}
{% block settings %}
-{% extends "base/base.html" %}
+{% extends "2022/base_simple.html" %}
{# This is for allauth templates. #}
-
-{% block bodyid %}auth-page{% endblock %}
-{% block titleextra %}{% block head_title %}{% endblock %}{% endblock %}
-{% extends request.EXPERIMENTS.layout.value|yesno:"2022/base_simple.html,account/base.html" %}
+{% extends "2022/base_simple.html" %}
{% block breadcrumbs %}
-{% extends "base/base.html" %}
+{% extends "2022/base_simple.html" %}
{% load i18n %}
</div>
{% endblock %}
-
{% extends "socialaccount/base.html" %}
{% load i18n %}
-{% load ajaxable_tags %}
{% block head_title %}{% trans "Signup" %}{% endblock %}
<form class="signup cuteform" id="signup_form" method="post" action="{% url 'socialaccount_signup' %}">
{% csrf_token %}
- <ul>
- {{ form.username|pretty_field }}
- {{ form.email|pretty_field }}
- {{ form.agree_newsletter|pretty_checkbox }}
- </ul>
+ {{ form.as_p }}
{% if redirect_field_value %}
<input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}" />
{% endif %}
-{% extends request.EXPERIMENTS.layout.value|yesno:"2022/base_simple.html,base/base.html" %}
+{% extends "2022/base_simple.html" %}
{% load i18n %}
# Authentication
path('uzytkownik/', views.user_settings, name='user_settings'),
- path('uzytkownik/login/', banner_exempt(views.LoginFormView()), name='login'),
- path('uzytkownik/signup/', banner_exempt(views.RegisterFormView()), name='register'),
+ path('uzytkownik/login/', views.WLLoginView.as_view(), name='login'),
+ path('uzytkownik/signup/', views.WLRegisterView.as_view(), name='register'),
path('uzytkownik/logout/', views.logout_then_redirect, name='logout'),
- path('uzytkownik/zaloguj-utworz/', banner_exempt(views.LoginRegisterFormView()), name='login_register'),
path('uzytkownik/social/signup/', banner_exempt(views.SocialSignupView.as_view()), name='socialaccount_signup'),
]
url='/info/wlacz-sie-w-prace/', permanent=False)),
]
-urlpatterns += [
- # path('error-test/', views.exception_test),
- # path('post-test/', views.post_test),
-]
-
if settings.DEBUG:
import debug_toolbar
from django.utils.translation import gettext_lazy as _
from django.views.decorators.cache import never_cache
-from ajaxable.utils import AjaxableFormView
-from ajaxable.utils import placeholdized
from catalogue.models import Book, Collection, Tag, Fragment
import club.models
from social.utils import get_or_choose_cite
from wolnelektury.forms import RegistrationForm, SocialSignupForm, WLAuthenticationForm
-def main_page_2022(request):
+@never_cache
+def main_page(request):
+ if request.GET.get('w') in settings.WIDGETS:
+ request.EXPERIMENTS['layout'].override(True)
+ if request.EXPERIMENTS['sowka'].value:
+ request.EXPERIMENTS['layout'].override(True)
+
ctx = {}
ctx['last_published'] = Book.objects.exclude(cover_clean='').filter(findable=True, parent=None).order_by('-created_at')[:10]
ctx['recommended_collection'] = Collection.objects.filter(listed=True, role='recommend').order_by('?').first()
ctx['widget'] = settings.WIDGETS['pan-sowka']
return render(request, '2022/main_page.html', ctx)
-@never_cache
-def main_page(request):
- if request.GET.get('w') in settings.WIDGETS:
- request.EXPERIMENTS['layout'].override(True)
- if request.EXPERIMENTS['sowka'].value:
- request.EXPERIMENTS['layout'].override(True)
-
- if request.EXPERIMENTS['layout'].value:
- return main_page_2022(request)
-
- ctx = {
- 'last_published': Book.objects.exclude(cover_clean='').filter(findable=True, parent=None).order_by('-created_at')[:6],
- 'theme_books': [],
- }
-
- # FIXME: find this theme and books properly.
- if Fragment.objects.exists():
- while True:
- ctx['theme'] = Tag.objects.filter(category='theme').order_by('?')[:1][0]
- tf = Fragment.tagged.with_any([ctx['theme']]).select_related('book').filter(book__findable=True).order_by('?')[:100]
- if not tf:
- continue
- ctx['theme_fragment'] = tf[0]
- for f in tf:
- if f.book not in ctx['theme_books']:
- ctx['theme_books'].append(f.book)
- if len(ctx['theme_books']) == 3:
- break
- break
-
- # Choose collections for main.
- ctx['collections'] = Collection.objects.filter(listed=True).order_by('?')[:4]
-
- best = []
- best_places = 5
- recommended_collection = None
- for recommended in Collection.objects.filter(listed=True, role='recommend').order_by('?'):
- if recommended_collection is None:
- recommended_collection = recommended
- books = list(recommended.get_books().exclude(id__in=[b.id for b in best]).order_by('?')[:best_places])
- best.extend(books)
- best_places -= len(books)
- if not best_places:
- break
- ctx['recommended_collection'] = recommended_collection
- if best_places:
- best.extend(
- list(
- Book.objects.filter(findable=True).exclude(id__in=[b.id for b in best]).order_by('?')[:best_places]
- )
- )
- ctx['best'] = best
-
- return render(request, "main_page.html", ctx)
-
class WLLoginView(LoginView):
form_class = WLAuthenticationForm
-wl_login_view = WLLoginView.as_view()
-
-
-class LoginFormView(AjaxableFormView):
- form_class = AuthenticationForm
- template = "auth/login.html"
- placeholdize = True
- title = _('Sign in')
- submit = _('Sign in')
- ajax_redirect = True
-
- def __call__(self, request):
- if request.EXPERIMENTS['layout'].value:
- return wl_login_view(request)
-
- if request.user.is_authenticated:
- return self.redirect_or_refresh(
- request, '/',
- message=_('Already logged in as user %(user)s', ) % {'user': request.user.username})
- return super(LoginFormView, self).__call__(request)
-
- def success(self, form, request):
- auth.login(request, form.get_user())
-
-
class WLRegisterView(FormView):
form_class = RegistrationForm
template_name = 'registration/register.html'
auth.login(self.request, user)
return HttpResponseRedirect(quote_plus(self.request.GET.get('next', '/'), safe='/?='))
-wl_register_view = WLRegisterView.as_view()
-
-
-class RegisterFormView(AjaxableFormView):
- form_class = RegistrationForm
- template = "auth/register.html"
- placeholdize = True
- title = _('Register')
- submit = _('Register')
- ajax_redirect = True
- form_prefix = 'register'
- 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, '/',
- message=_('Already logged in as user %(user)s', ) % {'user': request.user.username})
- return super(RegisterFormView, self).__call__(request)
-
- def success(self, form, request):
- form.save()
- user = auth.authenticate(
- username=form.cleaned_data['username'],
- password=form.cleaned_data['password1']
- )
- auth.login(request, user)
-
-
-class LoginRegisterFormView(LoginFormView):
- template = 'auth/login_register.html'
- title = _('You have to be logged in to continue')
-
- def extra_context(self, request, obj):
- return {
- "register_form": placeholdized(RegistrationForm(prefix='register')),
- "register_submit": _('Register'),
- }
-
@never_cache
def logout_then_redirect(request):
class SocialSignupView(SignupView):
form_class = SocialSignupForm
-
-
-def exception_test(request):
- msg = request.GET.get('msg')
- if msg:
- raise Exception('Exception test: %s' % msg)
- else:
- raise Exception('Exception test')
-
-
-def post_test(request):
- return render(request, 'post_test.html', {'action': '/api/reading/jego-zasady/complete/'})