Merge lp:~widelands-dev/widelands-website/auto_copyr_year into lp:widelands-website
- auto_copyr_year
- Merge into trunk
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 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
GunChleoc | Approve | ||
Review via email: mp+337911@code.launchpad.net |
Commit message
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
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
1 | === modified file 'mainpage/context_processors.py' | |||
2 | --- mainpage/context_processors.py 2016-12-15 12:55:44 +0000 | |||
3 | +++ mainpage/context_processors.py 2018-02-17 11:33:36 +0000 | |||
4 | @@ -2,6 +2,5 @@ | |||
5 | 2 | 2 | ||
6 | 3 | 3 | ||
7 | 4 | def settings_for_templates(request): | 4 | def settings_for_templates(request): |
10 | 5 | context = {'USE_GOOGLE_ANALYTICS': settings.USE_GOOGLE_ANALYTICS, | 5 | context = {'USE_GOOGLE_ANALYTICS': settings.USE_GOOGLE_ANALYTICS,} |
9 | 6 | 'LOGO_FILE': settings.LOGO_FILE} | ||
11 | 7 | return context | 6 | return context |
12 | 8 | 7 | ||
13 | === removed file 'mainpage/templatetags/all_users.py' | |||
14 | --- mainpage/templatetags/all_users.py 2017-11-06 17:50:17 +0000 | |||
15 | +++ mainpage/templatetags/all_users.py 1970-01-01 00:00:00 +0000 | |||
16 | @@ -1,12 +0,0 @@ | |||
17 | 1 | #!/usr/bin/env python -tt | ||
18 | 2 | # encoding: utf-8 | ||
19 | 3 | |||
20 | 4 | from django import template | ||
21 | 5 | from django.contrib.auth.models import User | ||
22 | 6 | |||
23 | 7 | register = template.Library() | ||
24 | 8 | |||
25 | 9 | @register.simple_tag | ||
26 | 10 | def all_users(): | ||
27 | 11 | """Provide a list of all users""" | ||
28 | 12 | return [str(u.username) for u in User.objects.all()] | ||
29 | 13 | 0 | ||
30 | === removed file 'mainpage/templatetags/forum_navigation.py' | |||
31 | --- mainpage/templatetags/forum_navigation.py 2016-12-15 12:55:44 +0000 | |||
32 | +++ mainpage/templatetags/forum_navigation.py 1970-01-01 00:00:00 +0000 | |||
33 | @@ -1,18 +0,0 @@ | |||
34 | 1 | from pybb.models import Category | ||
35 | 2 | from django import template | ||
36 | 3 | |||
37 | 4 | |||
38 | 5 | register = template.Library() | ||
39 | 6 | |||
40 | 7 | @register.inclusion_tag('mainpage/forum_navigation.html') | ||
41 | 8 | def forum_navigation(): | ||
42 | 9 | """Makes the forum list available to the navigation, even | ||
43 | 10 | if it is not loaded directly. | ||
44 | 11 | |||
45 | 12 | Ordering: | ||
46 | 13 | 1.: value of 'Position' in pybb.Category | ||
47 | 14 | 2.: value of 'Position' of pybb.Forum. | ||
48 | 15 | |||
49 | 16 | """ | ||
50 | 17 | categories = Category.objects.all() | ||
51 | 18 | return {'categories': categories} | ||
52 | 19 | 0 | ||
53 | === removed file 'mainpage/templatetags/get_model_name.py' | |||
54 | --- mainpage/templatetags/get_model_name.py 2017-08-16 22:18:21 +0000 | |||
55 | +++ mainpage/templatetags/get_model_name.py 1970-01-01 00:00:00 +0000 | |||
56 | @@ -1,8 +0,0 @@ | |||
57 | 1 | from django import template | ||
58 | 2 | |||
59 | 3 | register = template.Library() | ||
60 | 4 | |||
61 | 5 | @register.filter | ||
62 | 6 | def get_model_name(object): | ||
63 | 7 | """Returns the name of an objects model""" | ||
64 | 8 | return object.__class__.__name__ | ||
65 | 9 | \ No newline at end of file | 0 | \ No newline at end of file |
66 | 10 | 1 | ||
67 | === added file 'mainpage/templatetags/wl_extras.py' | |||
68 | --- mainpage/templatetags/wl_extras.py 1970-01-01 00:00:00 +0000 | |||
69 | +++ mainpage/templatetags/wl_extras.py 2018-02-17 11:33:36 +0000 | |||
70 | @@ -0,0 +1,52 @@ | |||
71 | 1 | #!/usr/bin/env python -tt | ||
72 | 2 | # encoding: utf-8 | ||
73 | 3 | |||
74 | 4 | from django import template | ||
75 | 5 | |||
76 | 6 | register = template.Library() | ||
77 | 7 | |||
78 | 8 | |||
79 | 9 | @register.simple_tag | ||
80 | 10 | def current_year(): | ||
81 | 11 | """Just return the current year.""" | ||
82 | 12 | |||
83 | 13 | from datetime import date | ||
84 | 14 | return date.today().year | ||
85 | 15 | |||
86 | 16 | |||
87 | 17 | @register.simple_tag | ||
88 | 18 | def wl_logo(): | ||
89 | 19 | """Just return the name of the logo.""" | ||
90 | 20 | |||
91 | 21 | from django.conf import settings | ||
92 | 22 | return settings.LOGO_FILE | ||
93 | 23 | |||
94 | 24 | |||
95 | 25 | @register.simple_tag | ||
96 | 26 | def all_users(): | ||
97 | 27 | """Provide a list of all users.""" | ||
98 | 28 | |||
99 | 29 | from django.contrib.auth.models import User | ||
100 | 30 | return [str(u.username) for u in User.objects.all()] | ||
101 | 31 | |||
102 | 32 | |||
103 | 33 | @register.inclusion_tag('mainpage/forum_navigation.html') | ||
104 | 34 | def forum_navigation(): | ||
105 | 35 | """Makes the forum list available to the navigation. | ||
106 | 36 | |||
107 | 37 | Ordering: | ||
108 | 38 | 1.: value of 'Position' in pybb.Category | ||
109 | 39 | 2.: value of 'Position' of pybb.Forum. | ||
110 | 40 | |||
111 | 41 | """ | ||
112 | 42 | |||
113 | 43 | from pybb.models import Category | ||
114 | 44 | categories = Category.objects.all() | ||
115 | 45 | return {'categories': categories} | ||
116 | 46 | |||
117 | 47 | |||
118 | 48 | @register.filter | ||
119 | 49 | def get_model_name(object): | ||
120 | 50 | """Returns the name of an objects model.""" | ||
121 | 51 | |||
122 | 52 | return object.__class__.__name__ | ||
123 | 0 | 53 | ||
124 | === modified file 'mainpage/views.py' | |||
125 | --- mainpage/views.py 2017-10-30 11:58:00 +0000 | |||
126 | +++ mainpage/views.py 2018-02-17 11:33:36 +0000 | |||
127 | @@ -1,4 +1,3 @@ | |||
128 | 1 | from django.shortcuts import render_to_response | ||
129 | 2 | from django.template import RequestContext | 1 | from django.template import RequestContext |
130 | 3 | from settings import WIDELANDS_SVN_DIR, INQUIRY_RECIPIENTS | 2 | from settings import WIDELANDS_SVN_DIR, INQUIRY_RECIPIENTS |
131 | 4 | from templatetags.wl_markdown import do_wl_markdown | 3 | from templatetags.wl_markdown import do_wl_markdown |
132 | @@ -7,7 +6,6 @@ | |||
133 | 7 | from mainpage.forms import ContactForm | 6 | from mainpage.forms import ContactForm |
134 | 8 | from django.shortcuts import render | 7 | from django.shortcuts import render |
135 | 9 | from django.http import HttpResponseRedirect, HttpResponse | 8 | from django.http import HttpResponseRedirect, HttpResponse |
136 | 10 | from django.core.urlresolvers import reverse | ||
137 | 11 | import sys | 9 | import sys |
138 | 12 | import json | 10 | import json |
139 | 13 | import os | 11 | import os |
140 | @@ -17,8 +15,7 @@ | |||
141 | 17 | 15 | ||
142 | 18 | 16 | ||
143 | 19 | def mainpage(request): | 17 | def mainpage(request): |
146 | 20 | return render_to_response('mainpage.html', | 18 | return render(request, 'mainpage.html',) |
145 | 21 | context_instance=RequestContext(request)) | ||
147 | 22 | 19 | ||
148 | 23 | 20 | ||
149 | 24 | def legal_notice(request): | 21 | def legal_notice(request): |
150 | @@ -132,10 +129,9 @@ | |||
151 | 132 | 129 | ||
152 | 133 | txt = do_wl_markdown(txt, custom=False) | 130 | txt = do_wl_markdown(txt, custom=False) |
153 | 134 | 131 | ||
158 | 135 | return render_to_response('mainpage/developers.html', | 132 | return render(request, 'mainpage/developers.html', |
159 | 136 | {'developers': txt}, | 133 | {'developers': txt} |
160 | 137 | context_instance=RequestContext(request) | 134 | ) |
157 | 138 | ) | ||
161 | 139 | 135 | ||
162 | 140 | 136 | ||
163 | 141 | def changelog(request): | 137 | def changelog(request): |
164 | @@ -146,10 +142,9 @@ | |||
165 | 146 | 142 | ||
166 | 147 | """ | 143 | """ |
167 | 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() |
172 | 149 | return render_to_response('mainpage/changelog.html', | 145 | return render(request, 'mainpage/changelog.html', |
173 | 150 | {'changelog': data}, | 146 | {'changelog': data}, |
174 | 151 | context_instance=RequestContext(request) | 147 | ) |
171 | 152 | ) | ||
175 | 153 | 148 | ||
176 | 154 | 149 | ||
177 | 155 | def custom_http_500(request): | 150 | def custom_http_500(request): |
178 | 156 | 151 | ||
179 | === modified file 'templates/base.html' | |||
180 | --- templates/base.html 2017-11-08 08:32:10 +0000 | |||
181 | +++ templates/base.html 2018-02-17 11:33:36 +0000 | |||
182 | @@ -1,3 +1,4 @@ | |||
183 | 1 | {% load wl_extras %} | ||
184 | 1 | 2 | ||
185 | 2 | <!DOCTYPE html> | 3 | <!DOCTYPE html> |
186 | 3 | {% comment %} | 4 | {% comment %} |
187 | @@ -51,7 +52,7 @@ | |||
188 | 51 | <div class="loginBox posRight"> | 52 | <div class="loginBox posRight"> |
189 | 52 | {% include "login_box.html" %} | 53 | {% include "login_box.html" %} |
190 | 53 | </div> | 54 | </div> |
192 | 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> |
193 | 55 | </div> | 56 | </div> |
194 | 56 | <div id="topmenu"> | 57 | <div id="topmenu"> |
195 | 57 | <!-- Navigation --> | 58 | <!-- Navigation --> |
196 | 58 | 59 | ||
197 | === modified file 'templates/django_messages/compose.html' | |||
198 | --- templates/django_messages/compose.html 2017-11-08 08:38:00 +0000 | |||
199 | +++ templates/django_messages/compose.html 2018-02-17 11:33:36 +0000 | |||
200 | @@ -1,6 +1,6 @@ | |||
201 | 1 | {% extends "django_messages/base.html" %} | 1 | {% extends "django_messages/base.html" %} |
202 | 2 | {% load i18n %} | 2 | {% load i18n %} |
204 | 3 | {% load all_users %} | 3 | {% load wl_extras %} |
205 | 4 | 4 | ||
206 | 5 | {% block title %} | 5 | {% block title %} |
207 | 6 | Compose - {{ block.super }} | 6 | Compose - {{ block.super }} |
208 | 7 | 7 | ||
209 | === modified file 'templates/footer.html' | |||
210 | --- templates/footer.html 2017-01-23 13:01:31 +0000 | |||
211 | +++ templates/footer.html 2018-02-17 11:33:36 +0000 | |||
212 | @@ -2,13 +2,11 @@ | |||
213 | 2 | vim:ft=htmldjango: | 2 | vim:ft=htmldjango: |
214 | 3 | 3 | ||
215 | 4 | This file is included by mainpage and contains the footer | 4 | This file is included by mainpage and contains the footer |
216 | 5 | |||
217 | 6 | (which contains nothing at the moment) | ||
218 | 7 | {% endcomment %} | 5 | {% endcomment %} |
219 | 8 | 6 | ||
221 | 9 | 7 | {% load wl_extras %} | |
222 | 10 | 8 | ||
223 | 11 | <div id="footer"> | 9 | <div id="footer"> |
225 | 12 | Copyright © 2009 - 2017 By the Widelands Development Team<br /> | 10 | Copyright © 2009 - {% current_year %} By the Widelands Development Team<br /> |
226 | 13 | <a class="small" href="{% url 'legal_notice' %}">Legal notice (contact)</a> | 11 | <a class="small" href="{% url 'legal_notice' %}">Legal notice (contact)</a> |
227 | 14 | </div> | 12 | </div> |
228 | 15 | 13 | ||
229 | === modified file 'templates/login_box.html' | |||
230 | --- templates/login_box.html 2018-02-16 15:38:34 +0000 | |||
231 | +++ templates/login_box.html 2018-02-17 11:33:36 +0000 | |||
232 | @@ -2,73 +2,28 @@ | |||
233 | 2 | 2 | ||
234 | 3 | <!-- Login form / User information --> | 3 | <!-- Login form / User information --> |
235 | 4 | {% if user.is_authenticated %} | 4 | {% if user.is_authenticated %} |
254 | 5 | <div class="small posLeft"> | 5 | <div class="small posLeft"> |
255 | 6 | Welcome {{ user|user_link }},<br/> | 6 | Welcome {{ user|user_link }},<br/> |
256 | 7 | <a href="{% url 'scheduling_main' %}">Playtime Scheduler</a> | 7 | <a href="{% url 'scheduling_main' %}">Playtime Scheduler</a> |
257 | 8 | </div> | 8 | </div> |
258 | 9 | <div class="right small posRight"> | 9 | <div class="right small posRight"> |
259 | 10 | <ul> | 10 | <ul> |
260 | 11 | <li> | 11 | <li> |
261 | 12 | {% if messages_inbox_count %} | 12 | {% if messages_inbox_count %} |
262 | 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> |
263 | 14 | {% else %} | 14 | {% else %} |
264 | 15 | <a href="{% url 'messages_inbox' %}" title="No new message">Messages</a> | 15 | <a href="{% url 'messages_inbox' %}" title="No new message">Messages</a> |
265 | 16 | {% endif %} | 16 | {% endif %} |
266 | 17 | </li> | 17 | </li> |
267 | 18 | <li><a href="{% url 'notification_notices' %}">Notifications</a></li> | 18 | <li><a href="{% url 'notification_notices' %}">Notifications</a></li> |
268 | 19 | <li><a href="{% url 'profile_edit' %}">Edit Profile</a></li> | 19 | <li><a href="{% url 'profile_edit' %}">Edit Profile</a></li> |
269 | 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> |
270 | 21 | </ul> | 21 | </ul> |
271 | 22 | </div> | 22 | </div> |
272 | 23 | {% else %} | 23 | {% else %} |
288 | 24 | <h4>Login</h4> | 24 | <h4>Login</h4> |
289 | 25 | {% comment %} | 25 | <div class="small center"> |
290 | 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 /> |
291 | 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> |
292 | 28 | <input id="id_login_password" type="password" name="password" /> | 28 | </div> |
278 | 29 | <input type="hidden" id="submitted" value="false" /> | ||
279 | 30 | <button type="submit">login</button> | ||
280 | 31 | <input type="hidden" name="next" value="{{ request.path|iriencode }}" /> | ||
281 | 32 | {% csrf_token %} | ||
282 | 33 | </form> | ||
283 | 34 | {% endcomment %} | ||
284 | 35 | <div class="small center"> | ||
285 | 36 | <a href="{% url 'auth_login' %}?next={{ request.path|iriencode }}">Click here to login</a><br /> | ||
286 | 37 | <a href="{% url 'auth_password_reset' %}">Lost password?</a> | <a href="{% url 'registration_register' %}">Register now!</a> | ||
287 | 38 | </div> | ||
293 | 39 | {% endif %} | 29 | {% endif %} |
294 | 40 | {% comment %} | ||
295 | 41 | {# Login via iframe does not work between http and https #} | ||
296 | 42 | <script type="text/javascript"> | ||
297 | 43 | $("#login_box").submit( function(data) { | ||
298 | 44 | var frameName = "login_frame" + (new Date()).getTime(); | ||
299 | 45 | var frameSrc = "https://{{ request.META.HTTP_HOST }}/accounts/login/?next=" | ||
300 | 46 | + window.location.pathname + window.location.search + window.location.hash; | ||
301 | 47 | var loginFrame = $("<iframe name=\"" + frameName + "\" src=\"" + frameSrc + "\" />"); | ||
302 | 48 | |||
303 | 49 | $("#login_box input[type='submit']").attr("disabled", "disabled") | ||
304 | 50 | loginFrame.css("display", "none"); | ||
305 | 51 | loginFrame.load(function(data){ | ||
306 | 52 | // get required fields | ||
307 | 53 | my_user_field = $(window.frames[ frameName ].document.getElementById("id_username")); | ||
308 | 54 | my_pass_field = $(window.frames[ frameName ].document.getElementById("id_password")); | ||
309 | 55 | parent_user_field = $("#id_login_username"); | ||
310 | 56 | parent_pass_field = $("#id_login_password"); | ||
311 | 57 | submitted_field = $("#submitted"); | ||
312 | 58 | |||
313 | 59 | if (submitted_field.val() != "true") { | ||
314 | 60 | // copy login information and submit | ||
315 | 61 | my_user_field.val(parent_user_field.val() == "Username" ? "" : parent_user_field.val()); | ||
316 | 62 | my_pass_field.val(parent_pass_field.val()); | ||
317 | 63 | // submit form to parent | ||
318 | 64 | submitted_field.val("true"); | ||
319 | 65 | login_form = $(window.frames[ frameName ].document.getElementById("login_form")); | ||
320 | 66 | login_form.attr('target', "_parent"); | ||
321 | 67 | login_form.submit(); | ||
322 | 68 | } | ||
323 | 69 | }); | ||
324 | 70 | jQuery('body:first').append(loginFrame); | ||
325 | 71 | return false; | ||
326 | 72 | }); | ||
327 | 73 | </script> | ||
328 | 74 | {% endcomment %} | ||
329 | 75 | 30 | ||
330 | === modified file 'templates/navigation.html' | |||
331 | --- templates/navigation.html 2018-02-09 16:48:48 +0000 | |||
332 | +++ templates/navigation.html 2018-02-17 11:33:36 +0000 | |||
333 | @@ -2,7 +2,7 @@ | |||
334 | 2 | vim:ft=htmldjango | 2 | vim:ft=htmldjango |
335 | 3 | {% endcomment %} | 3 | {% endcomment %} |
336 | 4 | 4 | ||
338 | 5 | {% load forum_navigation %} | 5 | {% load wl_extras %} |
339 | 6 | 6 | ||
340 | 7 | <script type="text/javascript"> | 7 | <script type="text/javascript"> |
341 | 8 | /* Enable dropdown menus on touch devices */ | 8 | /* Enable dropdown menus on touch devices */ |
342 | 9 | 9 | ||
343 | === modified file 'templates/pagination/pagination_mod.html' | |||
344 | --- templates/pagination/pagination_mod.html 2017-08-16 22:18:21 +0000 | |||
345 | +++ templates/pagination/pagination_mod.html 2018-02-17 11:33:36 +0000 | |||
346 | @@ -7,7 +7,7 @@ | |||
347 | 7 | {% endcomment %} | 7 | {% endcomment %} |
348 | 8 | 8 | ||
349 | 9 | {% load i18n %} | 9 | {% load i18n %} |
351 | 10 | {% load get_model_name %} | 10 | {% load wl_extras %} |
352 | 11 | {% block previouslink %} | 11 | {% block previouslink %} |
353 | 12 | <span class="summary"> | 12 | <span class="summary"> |
354 | 13 | <strong>{{ page_obj.start_index }}</strong> — | 13 | <strong>{{ page_obj.start_index }}</strong> — |
Code LGTM, not tested.