From c014693c5b67004bb0e968078fec8aedffdd2ea0 Mon Sep 17 00:00:00 2001
From: Olivier Mehani <shtrom+mediagoblin@ssji.net>
Date: Sun, 3 Mar 2019 22:17:27 +1100
Subject: [PATCH] Add datetime_format config option
Signed-off-by: Olivier Mehani <shtrom+mediagoblin@ssji.net>
---
mediagoblin/config_spec.ini | 3 +++
.../mediagoblin/fragments/header_notifications.html | 2 +-
mediagoblin/templates/mediagoblin/media_displays/image.html | 2 +-
mediagoblin/templates/mediagoblin/moderation/report.html | 6 +++---
.../templates/mediagoblin/user_pages/blog_media.html | 4 ++--
mediagoblin/templates/mediagoblin/user_pages/media.html | 4 ++--
mediagoblin/templates/mediagoblin/user_pages/report.html | 2 +-
7 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/mediagoblin/config_spec.ini b/mediagoblin/config_spec.ini
index c696c327..8901cefa 100644
a
|
b
|
no_referrer = boolean(default=True)
|
92 | 92 | # Push stuff |
93 | 93 | push_urls = string_list(default=list()) |
94 | 94 | |
| 95 | # Python strftime's format [0] |
| 96 | # https://docs.python.org/library/datetime.html#strftime-strptime-behavior |
| 97 | datetime_format = string(default="%I:%M%p %Y-%m-%d") |
95 | 98 | exif_visible = boolean(default=False) |
96 | 99 | original_date_visible = boolean(default=False) |
97 | 100 | |
diff --git a/mediagoblin/templates/mediagoblin/fragments/header_notifications.html b/mediagoblin/templates/mediagoblin/fragments/header_notifications.html
index 58960e7a..1e1683a0 100644
a
|
b
|
|
21 | 21 | user=comment_target.get_actor.username, |
22 | 22 | media=comment_target.slug_or_id) }}#comment" |
23 | 23 | class="comment_whenlink"> |
24 | | <span title='{{- comment_object.created.strftime("%I:%M%p %Y-%m-%d") -}}'> |
| 24 | <span title='{{- comment_object.created.strftime(app_config['datetime_format']) -}}'> |
25 | 25 | {%- trans formatted_time=timesince(comment_object.created) -%} |
26 | 26 | {{ formatted_time }} ago |
27 | 27 | {%- endtrans -%} |
diff --git a/mediagoblin/templates/mediagoblin/media_displays/image.html b/mediagoblin/templates/mediagoblin/media_displays/image.html
index d0050f50..93bd72a0 100644
a
|
b
|
|
35 | 35 | {% if original_date %} |
36 | 36 | <h3>{% trans %}Created{% endtrans %}</h3> |
37 | 37 | |
38 | | <p><span title="{{ original_date.strftime("%I:%M%p %Y-%m-%d") }}"> |
| 38 | <p><span title="{{ original_date.strftime(app_config['datetime_format']) }}"> |
39 | 39 | {%- trans formatted_time=timesince(original_date) -%} |
40 | 40 | {{ formatted_time }} ago |
41 | 41 | {%- endtrans -%} |
diff --git a/mediagoblin/templates/mediagoblin/moderation/report.html b/mediagoblin/templates/mediagoblin/moderation/report.html
index abbd4a0c..efd1adae 100644
a
|
b
|
|
54 | 54 | user=target.get_actor.username, |
55 | 55 | media=target.slug_or_id) }}#comment" |
56 | 56 | class="comment_whenlink"> |
57 | | <span title='{{- comment.created.strftime("%I:%M%p %Y-%m-%d") -}}'> |
| 57 | <span title='{{- comment.created.strftime(app_config['datetime_format']) -}}'> |
58 | 58 | {%- trans formatted_time=timesince(comment.created) -%} |
59 | 59 | {{ formatted_time }} ago |
60 | 60 | {%- endtrans -%} |
… |
… |
|
117 | 117 | <a href="{{ request.urlgen('mediagoblin.moderation.reports_detail', |
118 | 118 | report_id=report.id) }}" |
119 | 119 | class="report_whenlink"> |
120 | | <span title='{{- report.created.strftime("%I:%M%p %Y-%m-%d") -}}'> |
| 120 | <span title='{{- report.created.strftime(app_config['datetime_format']) -}}'> |
121 | 121 | {%- trans formatted_time=timesince(report.created) -%} |
122 | 122 | {{ formatted_time }} ago |
123 | 123 | {%- endtrans -%} |
… |
… |
|
150 | 150 | {% trans %}Status{% endtrans %}: |
151 | 151 | </h2> |
152 | 152 | <b>{% trans %}RESOLVED{% endtrans %}</b> |
153 | | {{ report.resolved.strftime("%I:%M%p %Y-%m-%d") }} |
| 153 | {{ report.resolved.strftime(app_config['datetime_format']) }} |
154 | 154 | <pre> |
155 | 155 | <p>{{ report.result }}</p> |
156 | 156 | </pre> |
diff --git a/mediagoblin/templates/mediagoblin/user_pages/blog_media.html b/mediagoblin/templates/mediagoblin/user_pages/blog_media.html
index 24328725..322770f4 100644
a
|
b
|
|
128 | 128 | user=media.get_actor.username, |
129 | 129 | media=media.slug_or_id) }}#comment" |
130 | 130 | class="comment_whenlink"> |
131 | | <span title='{{- comment_object.created.strftime("%I:%M%p %Y-%m-%d") -}}'> |
| 131 | <span title='{{- comment_object.created.strftime(app_config['datetime_format']) -}}'> |
132 | 132 | {%- trans formatted_time=timesince(comment_object.created) -%} |
133 | 133 | {{ formatted_time }} ago |
134 | 134 | {%- endtrans -%} |
… |
… |
|
148 | 148 | </div> |
149 | 149 | <div class="media_sidebar"> |
150 | 150 | <h3>{% trans %}Added{% endtrans %}</h3> |
151 | | <p><span title="{{ media.created.strftime("%I:%M%p %Y-%m-%d") }}"> |
| 151 | <p><span title="{{ media.created.strftime(app_config['datetime_format']) }}"> |
152 | 152 | {%- trans formatted_time=timesince(media.created) -%} |
153 | 153 | {{ formatted_time }} ago |
154 | 154 | {%- endtrans -%} |
diff --git a/mediagoblin/templates/mediagoblin/user_pages/media.html b/mediagoblin/templates/mediagoblin/user_pages/media.html
index b93da06e..39a09d45 100644
a
|
b
|
|
148 | 148 | user=media.get_actor.username, |
149 | 149 | media=media.slug_or_id) }}#comment" |
150 | 150 | class="comment_whenlink"> |
151 | | <span title='{{- comment_object.created.strftime("%I:%M%p %Y-%m-%d") -}}'> |
| 151 | <span title='{{- comment_object.created.strftime(app_config['datetime_format']) -}}'> |
152 | 152 | {%- trans formatted_time=timesince(comment_object.created) -%} |
153 | 153 | {{ formatted_time }} ago |
154 | 154 | {%- endtrans -%} |
… |
… |
|
183 | 183 | |
184 | 184 | <div class="five columns media_sidebar"> |
185 | 185 | <h3>{% trans %}Added{% endtrans %}</h3> |
186 | | <p><span title="{{ media.created.strftime("%I:%M%p %Y-%m-%d") }}"> |
| 186 | <p><span title="{{ media.created.strftime(app_config['datetime_format']) }}"> |
187 | 187 | {%- trans formatted_time=timesince(media.created) -%} |
188 | 188 | {{ formatted_time }} ago |
189 | 189 | {%- endtrans -%} |
diff --git a/mediagoblin/templates/mediagoblin/user_pages/report.html b/mediagoblin/templates/mediagoblin/user_pages/report.html
index 4a88f4b7..78bcc62a 100644
a
|
b
|
|
38 | 38 | user=media.get_actor.username, |
39 | 39 | media=media.slug_or_id) }}#comment" |
40 | 40 | class="comment_whenlink"> |
41 | | <span title='{{- comment_object.created.strftime("%I:%M%p %Y-%m-%d") -}}'> |
| 41 | <span title='{{- comment_object.created.strftime(app_config['datetime_format']) -}}'> |
42 | 42 | {%- trans formatted_time=timesince(comment_object.created) -%} |
43 | 43 | {{ formatted_time }} ago |
44 | 44 | {%- endtrans -%} |