Merge lp:~widelands-dev/widelands-website/auto_copyr_year into lp:widelands-website

Proposed by kaputtnik
Status: Merged
Merged at revision: 481
Proposed branch: lp:~widelands-dev/widelands-website/auto_copyr_year
Merge into: lp:widelands-website
Diff against target: 354 lines (+90/-128)
12 files modified
mainpage/context_processors.py (+1/-2)
mainpage/templatetags/all_users.py (+0/-12)
mainpage/templatetags/forum_navigation.py (+0/-18)
mainpage/templatetags/get_model_name.py (+0/-8)
mainpage/templatetags/wl_extras.py (+52/-0)
mainpage/views.py (+7/-12)
templates/base.html (+2/-1)
templates/django_messages/compose.html (+1/-1)
templates/footer.html (+2/-4)
templates/login_box.html (+23/-68)
templates/navigation.html (+1/-1)
templates/pagination/pagination_mod.html (+1/-1)
To merge this branch: bzr merge lp:~widelands-dev/widelands-website/auto_copyr_year
Reviewer Review Type Date Requested Status
GunChleoc Approve
Review via email: mp+337911@code.launchpad.net

Description of the change

Set the last year of copyright notice in the footer automatically to current year.

Some cleanups.

To post a comment you must log in.
Revision history for this message
GunChleoc (gunchleoc) wrote :

Code LGTM, not tested.

review: Approve
Revision history for this message
kaputtnik (franku) wrote :

I have tested it a lot. Merged and deployed.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'mainpage/context_processors.py'
--- mainpage/context_processors.py 2016-12-15 12:55:44 +0000
+++ mainpage/context_processors.py 2018-02-17 11:33:36 +0000
@@ -2,6 +2,5 @@
22
33
4def settings_for_templates(request):4def settings_for_templates(request):
5 context = {'USE_GOOGLE_ANALYTICS': settings.USE_GOOGLE_ANALYTICS,5 context = {'USE_GOOGLE_ANALYTICS': settings.USE_GOOGLE_ANALYTICS,}
6 'LOGO_FILE': settings.LOGO_FILE}
7 return context6 return context
87
=== removed file 'mainpage/templatetags/all_users.py'
--- mainpage/templatetags/all_users.py 2017-11-06 17:50:17 +0000
+++ mainpage/templatetags/all_users.py 1970-01-01 00:00:00 +0000
@@ -1,12 +0,0 @@
1#!/usr/bin/env python -tt
2# encoding: utf-8
3
4from django import template
5from django.contrib.auth.models import User
6
7register = template.Library()
8
9@register.simple_tag
10def all_users():
11 """Provide a list of all users"""
12 return [str(u.username) for u in User.objects.all()]
130
=== removed file 'mainpage/templatetags/forum_navigation.py'
--- mainpage/templatetags/forum_navigation.py 2016-12-15 12:55:44 +0000
+++ mainpage/templatetags/forum_navigation.py 1970-01-01 00:00:00 +0000
@@ -1,18 +0,0 @@
1from pybb.models import Category
2from django import template
3
4
5register = template.Library()
6
7@register.inclusion_tag('mainpage/forum_navigation.html')
8def forum_navigation():
9 """Makes the forum list available to the navigation, even
10 if it is not loaded directly.
11
12 Ordering:
13 1.: value of 'Position' in pybb.Category
14 2.: value of 'Position' of pybb.Forum.
15
16 """
17 categories = Category.objects.all()
18 return {'categories': categories}
190
=== removed file 'mainpage/templatetags/get_model_name.py'
--- mainpage/templatetags/get_model_name.py 2017-08-16 22:18:21 +0000
+++ mainpage/templatetags/get_model_name.py 1970-01-01 00:00:00 +0000
@@ -1,8 +0,0 @@
1from django import template
2
3register = template.Library()
4
5@register.filter
6def get_model_name(object):
7 """Returns the name of an objects model"""
8 return object.__class__.__name__
9\ No newline at end of file0\ No newline at end of file
101
=== added file 'mainpage/templatetags/wl_extras.py'
--- mainpage/templatetags/wl_extras.py 1970-01-01 00:00:00 +0000
+++ mainpage/templatetags/wl_extras.py 2018-02-17 11:33:36 +0000
@@ -0,0 +1,52 @@
1#!/usr/bin/env python -tt
2# encoding: utf-8
3
4from django import template
5
6register = template.Library()
7
8
9@register.simple_tag
10def current_year():
11 """Just return the current year."""
12
13 from datetime import date
14 return date.today().year
15
16
17@register.simple_tag
18def wl_logo():
19 """Just return the name of the logo."""
20
21 from django.conf import settings
22 return settings.LOGO_FILE
23
24
25@register.simple_tag
26def all_users():
27 """Provide a list of all users."""
28
29 from django.contrib.auth.models import User
30 return [str(u.username) for u in User.objects.all()]
31
32
33@register.inclusion_tag('mainpage/forum_navigation.html')
34def forum_navigation():
35 """Makes the forum list available to the navigation.
36
37 Ordering:
38 1.: value of 'Position' in pybb.Category
39 2.: value of 'Position' of pybb.Forum.
40
41 """
42
43 from pybb.models import Category
44 categories = Category.objects.all()
45 return {'categories': categories}
46
47
48@register.filter
49def get_model_name(object):
50 """Returns the name of an objects model."""
51
52 return object.__class__.__name__
053
=== modified file 'mainpage/views.py'
--- mainpage/views.py 2017-10-30 11:58:00 +0000
+++ mainpage/views.py 2018-02-17 11:33:36 +0000
@@ -1,4 +1,3 @@
1from django.shortcuts import render_to_response
2from django.template import RequestContext1from django.template import RequestContext
3from settings import WIDELANDS_SVN_DIR, INQUIRY_RECIPIENTS2from settings import WIDELANDS_SVN_DIR, INQUIRY_RECIPIENTS
4from templatetags.wl_markdown import do_wl_markdown3from templatetags.wl_markdown import do_wl_markdown
@@ -7,7 +6,6 @@
7from mainpage.forms import ContactForm6from mainpage.forms import ContactForm
8from django.shortcuts import render7from django.shortcuts import render
9from django.http import HttpResponseRedirect, HttpResponse8from django.http import HttpResponseRedirect, HttpResponse
10from django.core.urlresolvers import reverse
11import sys9import sys
12import json10import json
13import os11import os
@@ -17,8 +15,7 @@
1715
1816
19def mainpage(request):17def mainpage(request):
20 return render_to_response('mainpage.html',18 return render(request, 'mainpage.html',)
21 context_instance=RequestContext(request))
2219
2320
24def legal_notice(request):21def legal_notice(request):
@@ -132,10 +129,9 @@
132129
133 txt = do_wl_markdown(txt, custom=False)130 txt = do_wl_markdown(txt, custom=False)
134131
135 return render_to_response('mainpage/developers.html',132 return render(request, 'mainpage/developers.html',
136 {'developers': txt},133 {'developers': txt}
137 context_instance=RequestContext(request)134 )
138 )
139135
140136
141def changelog(request):137def changelog(request):
@@ -146,10 +142,9 @@
146142
147 """143 """
148 data = codecs.open(WIDELANDS_SVN_DIR + 'ChangeLog', encoding='utf-8', mode='r').read()144 data = codecs.open(WIDELANDS_SVN_DIR + 'ChangeLog', encoding='utf-8', mode='r').read()
149 return render_to_response('mainpage/changelog.html',145 return render(request, 'mainpage/changelog.html',
150 {'changelog': data},146 {'changelog': data},
151 context_instance=RequestContext(request)147 )
152 )
153148
154149
155def custom_http_500(request):150def custom_http_500(request):
156151
=== modified file 'templates/base.html'
--- templates/base.html 2017-11-08 08:32:10 +0000
+++ templates/base.html 2018-02-17 11:33:36 +0000
@@ -1,3 +1,4 @@
1{% load wl_extras %}
12
2<!DOCTYPE html>3<!DOCTYPE html>
3{% comment %}4{% comment %}
@@ -51,7 +52,7 @@
51 <div class="loginBox posRight">52 <div class="loginBox posRight">
52 {% include "login_box.html" %}53 {% include "login_box.html" %}
53 </div>54 </div>
54 <a href="{% url 'mainpage' %}"><img src="{{ MEDIA_URL }}img/{{ LOGO_FILE }}" class="posLeft" alt="Widelands Logo" /></a>55 <a href="{% url 'mainpage' %}"><img src="{{ MEDIA_URL }}img/{% wl_logo %}" class="posLeft" alt="Widelands Logo" /></a>
55 </div>56 </div>
56 <div id="topmenu">57 <div id="topmenu">
57 <!-- Navigation -->58 <!-- Navigation -->
5859
=== modified file 'templates/django_messages/compose.html'
--- templates/django_messages/compose.html 2017-11-08 08:38:00 +0000
+++ templates/django_messages/compose.html 2018-02-17 11:33:36 +0000
@@ -1,6 +1,6 @@
1{% extends "django_messages/base.html" %} 1{% extends "django_messages/base.html" %}
2{% load i18n %}2{% load i18n %}
3{% load all_users %}3{% load wl_extras %}
44
5{% block title %}5{% block title %}
6Compose - {{ block.super }}6Compose - {{ block.super }}
77
=== modified file 'templates/footer.html'
--- templates/footer.html 2017-01-23 13:01:31 +0000
+++ templates/footer.html 2018-02-17 11:33:36 +0000
@@ -2,13 +2,11 @@
2 vim:ft=htmldjango:2 vim:ft=htmldjango:
33
4 This file is included by mainpage and contains the footer4 This file is included by mainpage and contains the footer
5
6 (which contains nothing at the moment)
7{% endcomment %}5{% endcomment %}
86
97{% load wl_extras %}
108
11<div id="footer">9<div id="footer">
12 Copyright &copy; 2009 - 2017 By the Widelands Development Team<br />10 Copyright &copy; 2009 - {% current_year %} By the Widelands Development Team<br />
13 <a class="small" href="{% url 'legal_notice' %}">Legal notice (contact)</a>11 <a class="small" href="{% url 'legal_notice' %}">Legal notice (contact)</a>
14</div>12</div>
1513
=== modified file 'templates/login_box.html'
--- templates/login_box.html 2018-02-16 15:38:34 +0000
+++ templates/login_box.html 2018-02-17 11:33:36 +0000
@@ -2,73 +2,28 @@
22
3<!-- Login form / User information -->3<!-- Login form / User information -->
4{% if user.is_authenticated %}4{% if user.is_authenticated %}
5<div class="small posLeft">5 <div class="small posLeft">
6 Welcome {{ user|user_link }},<br/>6 Welcome {{ user|user_link }},<br/>
7 <a href="{% url 'scheduling_main' %}">Playtime Scheduler</a>7 <a href="{% url 'scheduling_main' %}">Playtime Scheduler</a>
8</div>8 </div>
9<div class="right small posRight">9 <div class="right small posRight">
10 <ul>10 <ul>
11 <li>11 <li>
12 {% if messages_inbox_count %}12 {% if messages_inbox_count %}
13 <a href="{% url 'messages_inbox' %}" title="You have {{ messages_inbox_count }} new messages">Messages ({{ messages_inbox_count }})</a>13 <a href="{% url 'messages_inbox' %}" title="You have {{ messages_inbox_count }} new messages">Messages ({{ messages_inbox_count }})</a>
14 {% else %}14 {% else %}
15 <a href="{% url 'messages_inbox' %}" title="No new message">Messages</a>15 <a href="{% url 'messages_inbox' %}" title="No new message">Messages</a>
16 {% endif %}16 {% endif %}
17 </li>17 </li>
18 <li><a href="{% url 'notification_notices' %}">Notifications</a></li>18 <li><a href="{% url 'notification_notices' %}">Notifications</a></li>
19 <li><a href="{% url 'profile_edit' %}">Edit Profile</a></li>19 <li><a href="{% url 'profile_edit' %}">Edit Profile</a></li>
20 <li><a href="{% url 'auth_logout' %}?next={{ request.path|iriencode }}">Logout</a></li>20 <li><a href="{% url 'auth_logout' %}?next={{ request.path|iriencode }}">Logout</a></li>
21 </ul>21 </ul>
22</div>22 </div>
23{% else %}23{% else %}
24<h4>Login</h4>24 <h4>Login</h4>
25{% comment %}25 <div class="small center">
26<form method="post" action="https://{{ request.META.HTTP_HOST }}/accounts/login/" id="login_box">26 <a href="{% url 'auth_login' %}?next={{ request.path|iriencode }}">Click here to login</a><br />
27 <input id="id_login_username" type="text" name="username" maxlength="30" placeholder="Username" />27 <a href="{% url 'auth_password_reset' %}">Lost password?</a> | <a href="{% url 'registration_register' %}">Register now!</a>
28 <input id="id_login_password" type="password" name="password" />28 </div>
29 <input type="hidden" id="submitted" value="false" />
30 <button type="submit">login</button>
31 <input type="hidden" name="next" value="{{ request.path|iriencode }}" />
32 {% csrf_token %}
33</form>
34{% endcomment %}
35<div class="small center">
36 <a href="{% url 'auth_login' %}?next={{ request.path|iriencode }}">Click here to login</a><br />
37 <a href="{% url 'auth_password_reset' %}">Lost password?</a> | <a href="{% url 'registration_register' %}">Register now!</a>
38</div>
39{% endif %}29{% endif %}
40{% comment %}
41{# Login via iframe does not work between http and https #}
42<script type="text/javascript">
43$("#login_box").submit( function(data) {
44 var frameName = "login_frame" + (new Date()).getTime();
45 var frameSrc = "https://{{ request.META.HTTP_HOST }}/accounts/login/?next="
46 + window.location.pathname + window.location.search + window.location.hash;
47 var loginFrame = $("<iframe name=\"" + frameName + "\" src=\"" + frameSrc + "\" />");
48
49 $("#login_box input[type='submit']").attr("disabled", "disabled")
50 loginFrame.css("display", "none");
51 loginFrame.load(function(data){
52 // get required fields
53 my_user_field = $(window.frames[ frameName ].document.getElementById("id_username"));
54 my_pass_field = $(window.frames[ frameName ].document.getElementById("id_password"));
55 parent_user_field = $("#id_login_username");
56 parent_pass_field = $("#id_login_password");
57 submitted_field = $("#submitted");
58
59 if (submitted_field.val() != "true") {
60 // copy login information and submit
61 my_user_field.val(parent_user_field.val() == "Username" ? "" : parent_user_field.val());
62 my_pass_field.val(parent_pass_field.val());
63 // submit form to parent
64 submitted_field.val("true");
65 login_form = $(window.frames[ frameName ].document.getElementById("login_form"));
66 login_form.attr('target', "_parent");
67 login_form.submit();
68 }
69 });
70 jQuery('body:first').append(loginFrame);
71 return false;
72});
73</script>
74{% endcomment %}
7530
=== modified file 'templates/navigation.html'
--- templates/navigation.html 2018-02-09 16:48:48 +0000
+++ templates/navigation.html 2018-02-17 11:33:36 +0000
@@ -2,7 +2,7 @@
2 vim:ft=htmldjango2 vim:ft=htmldjango
3{% endcomment %}3{% endcomment %}
44
5{% load forum_navigation %}5{% load wl_extras %}
66
7<script type="text/javascript">7<script type="text/javascript">
8 /* Enable dropdown menus on touch devices */8 /* Enable dropdown menus on touch devices */
99
=== modified file 'templates/pagination/pagination_mod.html'
--- templates/pagination/pagination_mod.html 2017-08-16 22:18:21 +0000
+++ templates/pagination/pagination_mod.html 2018-02-17 11:33:36 +0000
@@ -7,7 +7,7 @@
7{% endcomment %}7{% endcomment %}
88
9{% load i18n %}9{% load i18n %}
10{% load get_model_name %}10{% load wl_extras %}
11 {% block previouslink %}11 {% block previouslink %}
12 <span class="summary">12 <span class="summary">
13 <strong>{{ page_obj.start_index }}</strong> &mdash;13 <strong>{{ page_obj.start_index }}</strong> &mdash;

Subscribers

People subscribed via source and target branches