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

Proposed by kaputtnik
Status: Merged
Merged at revision: 402
Proposed branch: lp:~widelands-dev/widelands-website/iso_date_image_options
Merge into: lp:widelands-website
Diff against target: 93 lines (+39/-8)
4 files modified
media/css/wiki.css (+19/-0)
settings.py (+1/-1)
templates/wiki/edit.html (+16/-4)
wlprofile/templatetags/custom_date.py (+3/-3)
To merge this branch: bzr merge lp:~widelands-dev/widelands-website/iso_date_image_options
Reviewer Review Type Date Requested Status
SirVer Approve
kaputtnik (community) Needs Resubmitting
Review via email: mp+282653@code.launchpad.net

Description of the change

Changing date to ISO 8601 (YYYY-MM-DD) for not logged in users. For logged in users the settings are used which they set through user settings. New users will become the ISO 8601 format until they change the setting in their user profile.

Images in wiki could now be left/right/center aligned. The "Code to include" (shown under each image when editing an article) shows the new options for easy copy and paste. The new options appear only if the image has a width lower 700 pixel.

A width could also be applied if the code is edited by hand. F.e.

![waterfall_1.gif](/wlmedia/wlimages/WaterFall_1.gif){: .right width="50"}

where "50" is the width in pixel. Values in percent wouldn't work because percentages rely on the width of the element which contain the image. Images are placed in a <P></P>-Element which have the whole width of the article content. So using "50%" means half the size of the P-Element. So small images would be enlarged instead of scaled down.

Examples screenshots for aligning could be found in the forum post: https://wl.widelands.org/forum/topic/1906/?page=1#post-16125

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

Code LGTM - just one small nit.

Not tested.

402. By kaputtnik

merged

403. By kaputtnik

adjusted </tr>

Revision history for this message
kaputtnik (franku) wrote :

Thanks GunChleoc, i have adjusted the </tr>.

Browsers do mostly correct such misplaced things automatically, so it's not easy to verify this during testing...

review: Needs Resubmitting
Revision history for this message
SirVer (sirver) wrote :

Thanks! Deployed.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'media/css/wiki.css'
2--- media/css/wiki.css 2015-09-16 20:21:15 +0000
3+++ media/css/wiki.css 2016-01-17 08:53:43 +0000
4@@ -118,3 +118,22 @@
5 border: 1px solid #000;
6 padding: 0px 5px;
7 }
8+
9+/*********************/
10+/* Image positioning */
11+/*********************/
12+
13+img.right {
14+ float: right;
15+ padding-left: 1em;
16+}
17+
18+img.left {
19+ float: left;
20+ padding-right: 1em;
21+}
22+
23+img.center {
24+ display: block;
25+ margin: auto;
26+}
27
28=== modified file 'settings.py'
29--- settings.py 2016-01-12 08:05:17 +0000
30+++ settings.py 2016-01-17 08:53:43 +0000
31@@ -113,7 +113,7 @@
32 ######################
33 AUTH_PROFILE_MODULE = 'wlprofile.Profile'
34 DEFAULT_TIME_ZONE = 3
35-DEFAULT_TIME_DISPLAY = r"%ND(m-d-y), H:i"
36+DEFAULT_TIME_DISPLAY = r"%ND(Y-m-d,) H:i" #According to ISO 8601
37 DEFAULT_MARKUP ="markdown"
38 SIGNATURE_MAX_LENGTH = 255
39 SIGNATURE_MAX_LINES = 8
40
41=== modified file 'templates/wiki/edit.html'
42--- templates/wiki/edit.html 2015-04-01 20:01:41 +0000
43+++ templates/wiki/edit.html 2016-01-17 08:53:43 +0000
44@@ -117,14 +117,26 @@
45 <td style="vertical-align: middle; text-align: center;"><img src="{{ img.url }}"></td>
46 </tr>
47 <tr>
48- <td class="grey" style="text-align: right;">Code to use in article:</td>
49+ <td class="grey">Code to use in article:</td>
50+ {# Show only one code snippet if the image is greater than 700px #}
51 {% if img.image.width > 700 %}
52- <td style="text-align: center;">[![{{img.name}}]({{ img.url }})]({{ img.url }})</td>
53+ <td style="text-align: center;">[![{{img.name}}]({{ img.url }})]({{ img.url }})</td>
54+ </tr>
55+
56+ {# otherwise provide all options #}
57 {% else %}
58 <td style="text-align: center;">![{{img.name}}]({{ img.url }})</td>
59+ </tr>
60+
61+ <tr>
62+ <td class="grey">Right aligned:</td>
63+ <td style="text-align: center;">![{{img.name}}]({{ img.url }}){: .right}</td>
64+ </tr>
65+ <tr>
66+ <td class="grey">Left aligned:</td>
67+ <td style="text-align: center;">![{{img.name}}]({{ img.url }}){: .left}</td>
68+ </tr>
69 {% endif %}
70- </tr>
71-
72 </tbody>
73 </table>
74 {% endfor %}
75
76=== modified file 'wlprofile/templatetags/custom_date.py'
77--- wlprofile/templatetags/custom_date.py 2012-04-22 12:51:33 +0000
78+++ wlprofile/templatetags/custom_date.py 2016-01-17 08:53:43 +0000
79@@ -102,11 +102,11 @@
80 delta = ddate(date.year,date.month,date.day) - \
81 ddate(now.year,now.month,now.day)
82 if delta.days == 0:
83- return _(ur'\t\o\d\a\y')
84+ return _(ur'\T\o\d\a\y')
85 elif delta.days == 1:
86- return _(ur'\t\o\m\o\r\r\o\w')
87+ return _(ur'\T\o\m\o\r\r\o\w')
88 elif delta.days == -1:
89- return _(ur'\y\e\s\t\e\r\d\a\y')
90+ return _(ur'\Y\e\s\t\e\r\d\a\y')
91 else:
92 return g.group(1)
93 try:

Subscribers

People subscribed via source and target branches