← Back to team overview

widelands-dev team mailing list archive

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

 

kaputtnik has proposed merging lp:~widelands-dev/widelands-website/iso_date_image_options into lp:widelands-website.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #338332 in Widelands Website: "Wiki Image display could need more options"
  https://bugs.launchpad.net/widelands-website/+bug/338332
  Bug #1285660 in Widelands Website: "forum calendar date should be standard (ISO 8601)"
  https://bugs.launchpad.net/widelands-website/+bug/1285660

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands-website/iso_date_image_options/+merge/282653

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
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands-website/iso_date_image_options into lp:widelands-website.
=== modified file 'media/css/wiki.css'
--- media/css/wiki.css	2015-09-16 20:21:15 +0000
+++ media/css/wiki.css	2016-01-14 19:36:43 +0000
@@ -118,3 +118,22 @@
     border: 1px solid #000;
     padding: 0px 5px;
 }
+
+/*********************/
+/* Image positioning */
+/*********************/
+
+img.right {
+	float: right;
+	padding-left: 1em;
+}
+
+img.left {
+	float: left;
+	padding-right: 1em;
+}
+
+img.center {
+	display: block;
+	margin: auto;
+}

=== modified file 'settings.py'
--- settings.py	2016-01-12 08:05:17 +0000
+++ settings.py	2016-01-14 19:36:43 +0000
@@ -113,7 +113,7 @@
 ######################
 AUTH_PROFILE_MODULE = 'wlprofile.Profile'
 DEFAULT_TIME_ZONE = 3
-DEFAULT_TIME_DISPLAY = r"%ND(m-d-y), H:i"
+DEFAULT_TIME_DISPLAY = r"%ND(Y-m-d,) H:i" #According to ISO 8601
 DEFAULT_MARKUP ="markdown"
 SIGNATURE_MAX_LENGTH = 255
 SIGNATURE_MAX_LINES = 8

=== modified file 'templates/wiki/edit.html'
--- templates/wiki/edit.html	2015-04-01 20:01:41 +0000
+++ templates/wiki/edit.html	2016-01-14 19:36:43 +0000
@@ -117,14 +117,24 @@
 				<td  style="vertical-align: middle; text-align: center;"><img src="{{ img.url }}"></td>
 			</tr>
 			<tr>
-				<td class="grey" style="text-align: right;">Code to use in article:</td>
+				<td class="grey">Code to use in article:</td>
+				{# Show only one code snippet if the image is greater than 700px #}
 				{% if img.image.width > 700 %}
-					<td style="text-align: center;">[![{{img.name}}]({{ img.url }})]({{ img.url }})</td>
+				<td style="text-align: center;">[![{{img.name}}]({{ img.url }})]({{ img.url }})</td>
+
+				{# otherwise give all options #}
 				{% else %}
 					<td style="text-align: center;">![{{img.name}}]({{ img.url }})</td>
+			</tr>
+				<tr>
+					<td class="grey">Right aligned:</td>
+					<td style="text-align: center;">![{{img.name}}]({{ img.url }}){: .right}</td>
+				</tr>
+				<tr>
+					<td class="grey">Left aligned:</td>
+					<td style="text-align: center;">![{{img.name}}]({{ img.url }}){: .left}</td>
+				</tr>
 				{% endif %}
-			</tr>
-		
 		</tbody>
 		</table>
 		{% endfor %}

=== modified file 'wlprofile/templatetags/custom_date.py'
--- wlprofile/templatetags/custom_date.py	2012-04-22 12:51:33 +0000
+++ wlprofile/templatetags/custom_date.py	2016-01-14 19:36:43 +0000
@@ -102,11 +102,11 @@
         delta = ddate(date.year,date.month,date.day) - \
                 ddate(now.year,now.month,now.day)
         if delta.days == 0:
-            return _(ur'\t\o\d\a\y')
+            return _(ur'\T\o\d\a\y')
         elif delta.days == 1:
-            return _(ur'\t\o\m\o\r\r\o\w')
+            return _(ur'\T\o\m\o\r\r\o\w')
         elif delta.days == -1:
-            return _(ur'\y\e\s\t\e\r\d\a\y')
+            return _(ur'\Y\e\s\t\e\r\d\a\y')
         else:
             return g.group(1)
     try:


Follow ups