diff options
Diffstat (limited to 'mediagoblin/templates')
8 files changed, 122 insertions, 27 deletions
diff --git a/mediagoblin/templates/mediagoblin/admin/panel.html b/mediagoblin/templates/mediagoblin/admin/panel.html index 6bcb5c24..1c3c866e 100644 --- a/mediagoblin/templates/mediagoblin/admin/panel.html +++ b/mediagoblin/templates/mediagoblin/admin/panel.html @@ -104,7 +104,7 @@ <td>{{ media_entry.id }}</td> <td>{{ media_entry.get_uploader.username }}</td> <td><a href="{{ media_entry.url_for_self(request.urlgen) }}">{{ media_entry.title }}</a></td> - <td>{{ media_entry.created.strftime("%F %R") }}</td> + <td><span title='{{ media_entry.created.strftime("%F %R") }}'>{{ timesince(media_entry.created) }}</span></td> </tr> {% endfor %} </table> diff --git a/mediagoblin/templates/mediagoblin/base.html b/mediagoblin/templates/mediagoblin/base.html index 66b95661..9c42a756 100644 --- a/mediagoblin/templates/mediagoblin/base.html +++ b/mediagoblin/templates/mediagoblin/base.html @@ -16,7 +16,10 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. -#} <!doctype html> -<html> +<html +{% block mediagoblin_html_tag %} +{% endblock mediagoblin_html_tag %} +> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> diff --git a/mediagoblin/templates/mediagoblin/media_displays/pdf.html b/mediagoblin/templates/mediagoblin/media_displays/pdf.html new file mode 100644 index 00000000..e946f3ab --- /dev/null +++ b/mediagoblin/templates/mediagoblin/media_displays/pdf.html @@ -0,0 +1,84 @@ +{# +# GNU MediaGoblin -- federated, autonomous media hosting +# Copyright (C) 2011, 2012 MediaGoblin contributors. See AUTHORS. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +#} + +{% extends 'mediagoblin/user_pages/media.html' %} + +{% set medium_view = request.app.public_store.file_url( + media.media_files['medium']) %} + +{% if 'pdf' in media.media_files %} + {% set pdf_view = request.app.public_store.file_url( + media.media_files['pdf']) %} +{% else %} + {% set pdf_view = request.app.public_store.file_url( + media.media_files['original']) %} +{% endif %} + +{% set pdf_js = global_config.get('media_type:mediagoblin.media_types.pdf', {}).get('pdf_js', False) %} + +{% if pdf_js %} + {% block mediagoblin_html_tag %} + dir="ltr" mozdisallowselectionprint moznomarginboxes + {% endblock mediagoblin_html_tag %} +{% endif %} + +{% block mediagoblin_head -%} + {{ super() }} + + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> + +{%- endblock %} + +{% block mediagoblin_media %} +{% if pdf_js %} +<iframe width=640px height=480px + src="{{ request.staticdirect('/extlib/pdf.js/web/viewer.html') }}?file={{ pdf_view }} "> +</iframe> + +{% else %} + <a href="{{ pdf_view }}"> + <img id="medium" + class="media_image" + src="{{ medium_view }}" + alt="{% trans media_title=media.title -%} Image for {{ media_title}}{% endtrans %}"/> + </a> +{% endif %} +{% endblock %} + +{% block mediagoblin_sidebar %} + <h3>{% trans %}Download{% endtrans %}</h3> + <ul> + {% if 'original' in media.media_files %} + <li> + <a href="{{ request.app.public_store.file_url( + media.media_files.original) }}"> + {%- trans %}Original file{% endtrans -%} + </a> + </li> + {% endif %} + {% if 'pdf' in media.media_files %} + <li> + <a href="{{ request.app.public_store.file_url( + media.media_files.pdf) }}"> + {%- trans %}PDF file{% endtrans -%} + </a> + </li> + {% endif %} + </ul> +{% endblock %} diff --git a/mediagoblin/templates/mediagoblin/user_pages/collection_confirm_delete.html b/mediagoblin/templates/mediagoblin/user_pages/collection_confirm_delete.html index 2b790584..694eb979 100644 --- a/mediagoblin/templates/mediagoblin/user_pages/collection_confirm_delete.html +++ b/mediagoblin/templates/mediagoblin/user_pages/collection_confirm_delete.html @@ -41,9 +41,10 @@ <div class="form_submit_buttons"> {# TODO: This isn't a button really... might do unexpected things :) #} - <a class="button_action" href="{{ request.urlgen('mediagoblin.user_pages.user_collection', - collection=collection.slug, - user=request.user.username) }}">{% trans %}Cancel{% endtrans %}</a> + <a class="button_action" href=" + {{- collection.url_for_self(request.urlgen) }}"> + {%- trans %}Cancel{% endtrans -%} + </a> <input type="submit" value="{% trans %}Delete permanently{% endtrans %}" class="button_form" /> {{ csrf_token }} </div> diff --git a/mediagoblin/templates/mediagoblin/user_pages/collection_item_confirm_remove.html b/mediagoblin/templates/mediagoblin/user_pages/collection_item_confirm_remove.html index 449cc3ce..dc31d90f 100644 --- a/mediagoblin/templates/mediagoblin/user_pages/collection_item_confirm_remove.html +++ b/mediagoblin/templates/mediagoblin/user_pages/collection_item_confirm_remove.html @@ -47,9 +47,10 @@ <div class="form_submit_buttons"> {# TODO: This isn't a button really... might do unexpected things :) #} - <a class="button_action" href="{{ request.urlgen('mediagoblin.user_pages.user_collection', - collection=collection_item.in_collection.slug, - user=request.user.username) }}">{% trans %}Cancel{% endtrans %}</a> + <a class="button_action" href=" + {{- collection_item.in_collection.url_for_self(request.urlgen) }}"> + {%- trans %}Cancel{% endtrans -%} + </a> <input type="submit" value="{% trans %}Remove{% endtrans %}" class="button_form" /> {{ csrf_token }} </div> diff --git a/mediagoblin/templates/mediagoblin/user_pages/collection_list.html b/mediagoblin/templates/mediagoblin/user_pages/collection_list.html index abf22623..8ac0b988 100644 --- a/mediagoblin/templates/mediagoblin/user_pages/collection_list.html +++ b/mediagoblin/templates/mediagoblin/user_pages/collection_list.html @@ -15,7 +15,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. #} -{% extends "mediagoblin/base.html" %} +{%- extends "mediagoblin/base.html" %} {% block title %} {%- trans username=user.username -%} @@ -39,17 +39,17 @@ <a href="{{ request.urlgen('mediagoblin.submit.collection', user=user.username) }}"> {%- trans %}Create new collection{% endtrans -%} + </a> </p> {% endif %} {% endif %} <ul> {% for coll in collections %} - {% set coll_url = request.urlgen( - 'mediagoblin.user_pages.user_collection', - user=user.username, - collection=coll.slug) %} - <li><a href="{{ coll_url }}">{{ coll.title }}</li> + {%- set coll_url = coll.url_for_self(request.urlgen) %} + <li> + <a href="{{ coll_url }}">{{ coll.title }}</a> + </li> {% endfor %} </ul> diff --git a/mediagoblin/templates/mediagoblin/user_pages/media.html b/mediagoblin/templates/mediagoblin/user_pages/media.html index 04be81aa..6d32d009 100644 --- a/mediagoblin/templates/mediagoblin/user_pages/media.html +++ b/mediagoblin/templates/mediagoblin/user_pages/media.html @@ -119,16 +119,20 @@ <div class="comment_author"> <img src="{{ request.staticdirect('/images/icon_comment.png') }}" /> <a href="{{ request.urlgen('mediagoblin.user_pages.user_home', - user=comment_author.username) }}"> + user=comment_author.username) }}" + class="comment_authorlink"> {{- comment_author.username -}} </a> - {% trans %}at{% endtrans %} <a href="{{ request.urlgen('mediagoblin.user_pages.media_home.view_comment', comment=comment.id, user=media.get_uploader.username, - media=media.slug_or_id) }}#comment"> - {{- comment.created.strftime("%I:%M%p %Y-%m-%d") -}} - </a>: + media=media.slug_or_id) }}#comment" + class="comment_whenlink"> + <span title='{{- comment.created.strftime("%I:%M%p %Y-%m-%d") -}}'> + {%- trans formatted_time=timesince(comment.created) -%} + {{ formatted_time }} ago + {%- endtrans -%} + </span></a>: </div> <div class="comment_content"> {% autoescape False -%} @@ -143,10 +147,12 @@ {% endif %} </div> <div class="media_sidebar"> - {% trans date=media.created.strftime("%Y-%m-%d") -%} - <h3>Added on</h3> - <p>{{ date }}</p> - {%- endtrans %} + <h3>Added</h3> + <p><span title="{{ media.created.strftime("%I:%M%p %Y-%m-%d") }}"> + {%- trans formatted_time=timesince(media.created) -%} + {{ formatted_time }} ago + {%- endtrans -%} + </span></p> {% if media.tags %} {% include "mediagoblin/utils/tags.html" %} {% endif %} diff --git a/mediagoblin/templates/mediagoblin/utils/wtforms.html b/mediagoblin/templates/mediagoblin/utils/wtforms.html index 35b4aa04..be6976c2 100644 --- a/mediagoblin/templates/mediagoblin/utils/wtforms.html +++ b/mediagoblin/templates/mediagoblin/utils/wtforms.html @@ -19,7 +19,7 @@ {# Render the label for a field #} {% macro render_label(field) %} {%- if field.label.text -%} - <label for="{{ field.label.field_id }}">{{ _(field.label.text) }}</label> + <label for="{{ field.label.field_id }}">{{ field.label.text }}</label> {%- endif -%} {%- endmacro %} @@ -39,11 +39,11 @@ {{ field }} {%- if field.errors -%} {% for error in field.errors %} - <p class="form_field_error">{{ _(error) }}</p> + <p class="form_field_error">{{ error }}</p> {% endfor %} {%- endif %} {%- if field.description %} - <p class="form_field_description">{{ _(field.description)|safe }}</p> + <p class="form_field_description">{{ field.description|safe }}</p> {%- endif %} </div> {%- endmacro %} @@ -59,7 +59,7 @@ {% macro render_table(form) -%} {% for field in form %} <tr> - <th>{{ _(field.label.text) }}</th> + <th>{{ field.label.text }}</th> <td> {{field}} {% if field.errors %} |