diff options
Diffstat (limited to 'mediagoblin/templates')
18 files changed, 182 insertions, 97 deletions
diff --git a/mediagoblin/templates/mediagoblin/base.html b/mediagoblin/templates/mediagoblin/base.html index 34986fdb..25e71396 100644 --- a/mediagoblin/templates/mediagoblin/base.html +++ b/mediagoblin/templates/mediagoblin/base.html @@ -36,19 +36,27 @@ <script src="{{ request.staticdirect('/js/extlib/html5shiv.js') }}"></script> <![endif]--> + {# For clarification, the difference between the extra_head.html template + # and the head template hook is that the former should be used by + # themes and the latter should be used by plugins. + # The reason is that only one thing can override extra_head.html... + # but multiple plugins can hook into the template hook. + #} {% include "mediagoblin/extra_head.html" %} + {% template_hook("head") %} {% block mediagoblin_head %} {% endblock mediagoblin_head %} </head> <body> + {% include 'mediagoblin/bits/body-start.html' %} {% block mediagoblin_body %} {% block mediagoblin_header %} <header> {%- include "mediagoblin/bits/logo.html" -%} {% block mediagoblin_header_title %}{% endblock %} <div class="header_right"> - {% if request.user %} + {%- if request.user %} {% if request.user and request.user.status == 'active' %} <div class="button_action header_dropdown_down">▼</div> <div class="button_action header_dropdown_up">▲</div> @@ -60,11 +68,12 @@ {% trans %}Verify your email!{% endtrans %}</a> or <a href="{{ request.urlgen('mediagoblin.auth.logout') }}">{% trans %}log out{% endtrans %}</a> {% endif %} - {% else %} + {%- else %} <a href="{{ request.urlgen('mediagoblin.auth.login') }}?next={{ request.base_url|urlencode }}"> - {% trans %}Log in{% endtrans %}</a> - {% endif %} + {%- trans %}Log in{% endtrans -%} + </a> + {%- endif %} </div> <div class="clear"></div> {% if request.user and request.user.status == 'active' %} @@ -107,23 +116,25 @@ {% endif %} </header> {% endblock %} - <div class="container"> - <div class="mediagoblin_content"> + <div class="container"> + {% include 'mediagoblin/bits/above-content.html' %} + <div class="mediagoblin_content"> {% include "mediagoblin/utils/messages.html" %} {% block mediagoblin_content %} {% endblock mediagoblin_content %} - </div> - {% block mediagoblin_footer %} + </div> + {%- block mediagoblin_footer %} <footer> {% trans -%} - Powered by <a href="http://mediagoblin.org">MediaGoblin</a>, a <a href="http://gnu.org/">GNU</a> project. + Powered by <a href="http://mediagoblin.org/" title='Version {{ version }}'>MediaGoblin</a>, a <a href="http://gnu.org/">GNU</a> project. {%- endtrans %} {% trans source_link=app_config['source_link'] -%} Released under the <a href="http://www.fsf.org/licensing/licenses/agpl-3.0.html">AGPL</a>. <a href="{{ source_link }}">Source code</a> available. {%- endtrans %} </footer> - {% endblock mediagoblin_footer %} - {% endblock mediagoblin_body %} - </div> + {%- endblock mediagoblin_footer %} + </div> + {%- endblock mediagoblin_body %} + {% include 'mediagoblin/bits/body-end.html' %} </body> </html> diff --git a/mediagoblin/templates/mediagoblin/bits/above-content.html b/mediagoblin/templates/mediagoblin/bits/above-content.html new file mode 100644 index 00000000..bb7b9762 --- /dev/null +++ b/mediagoblin/templates/mediagoblin/bits/above-content.html @@ -0,0 +1,17 @@ +{# +# 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/>. +-#} diff --git a/mediagoblin/templates/mediagoblin/bits/body-end.html b/mediagoblin/templates/mediagoblin/bits/body-end.html new file mode 100644 index 00000000..bb7b9762 --- /dev/null +++ b/mediagoblin/templates/mediagoblin/bits/body-end.html @@ -0,0 +1,17 @@ +{# +# 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/>. +-#} diff --git a/mediagoblin/templates/mediagoblin/bits/body-start.html b/mediagoblin/templates/mediagoblin/bits/body-start.html new file mode 100644 index 00000000..bb7b9762 --- /dev/null +++ b/mediagoblin/templates/mediagoblin/bits/body-start.html @@ -0,0 +1,17 @@ +{# +# 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/>. +-#} diff --git a/mediagoblin/templates/mediagoblin/edit/attachments.html b/mediagoblin/templates/mediagoblin/edit/attachments.html index 55d446de..3fbea3be 100644 --- a/mediagoblin/templates/mediagoblin/edit/attachments.html +++ b/mediagoblin/templates/mediagoblin/edit/attachments.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" %} {% import "/mediagoblin/utils/wtforms.html" as wtforms_util %} @@ -28,13 +28,14 @@ {% block mediagoblin_content %} <form action="{{ request.urlgen('mediagoblin.edit.attachments', user= media.get_uploader.username, - media= media.id) }}" + media_id=media.id) }}" method="POST" enctype="multipart/form-data"> <div class="form_box"> <h1> - {% trans media_title=media.title -%} + {%- trans media_title=media.title -%} Editing attachments for {{ media_title }} - {%- endtrans %}</h1> + {%- endtrans -%} + </h1> <div style="text-align: center;" > <img src="{{ media.thumb_url }}" /> </div> @@ -42,19 +43,19 @@ {% if media.attachment_files|count %} <h2>{% trans %}Attachments{% endtrans %}</h2> <ul> - {% for attachment in media.attachment_files %} + {%- for attachment in media.attachment_files %} <li> <a target="_blank" href="{{ request.app.public_store.file_url( attachment['filepath']) }}"> {{- attachment.name -}} </a> </li> - {% endfor %} + {%- endfor %} </ul> {% endif %} <h2>{% trans %}Add attachment{% endtrans %}</h2> - {{ wtforms_util.render_divs(form) }} + {{- wtforms_util.render_divs(form) }} <div class="form_submit_buttons"> <a href="{{ media.url_for_self(request.urlgen) }}"> {%- trans %}Cancel{% endtrans -%} diff --git a/mediagoblin/templates/mediagoblin/edit/edit_account.html b/mediagoblin/templates/mediagoblin/edit/edit_account.html index 4b980301..3f508af4 100644 --- a/mediagoblin/templates/mediagoblin/edit/edit_account.html +++ b/mediagoblin/templates/mediagoblin/edit/edit_account.html @@ -45,11 +45,11 @@ {{ wtforms_util.render_field_div(form.new_password) }} <div class="form_field_input"> <p>{{ form.wants_comment_notification }} - {{ form.wants_comment_notification.label }}</p> + {{ wtforms_util.render_label(form.wants_comment_notification) }}</p> </div> <div class="form_field_input"> <p>{{ form.license_preference }} - {{ form.license_preference.label }}</p> + {{ wtforms_util.render_label(form.license_preference) }}</p> </div> <div class="form_submit_buttons"> <input type="submit" value="{% trans %}Save changes{% endtrans %}" class="button_form" /> diff --git a/mediagoblin/templates/mediagoblin/media_displays/image.html b/mediagoblin/templates/mediagoblin/media_displays/image.html index bc03c456..158dd67f 100644 --- a/mediagoblin/templates/mediagoblin/media_displays/image.html +++ b/mediagoblin/templates/mediagoblin/media_displays/image.html @@ -20,7 +20,7 @@ {% block mediagoblin_head %} {{ super() }} - {% template_hook("image_extrahead") %} + {% template_hook("image_head") %} {% endblock mediagoblin_head %} {% block mediagoblin_sidebar %} diff --git a/mediagoblin/templates/mediagoblin/media_displays/video.html b/mediagoblin/templates/mediagoblin/media_displays/video.html index 7d5ede8d..9eeb7c85 100644 --- a/mediagoblin/templates/mediagoblin/media_displays/video.html +++ b/mediagoblin/templates/mediagoblin/media_displays/video.html @@ -27,7 +27,9 @@ {%- endblock %} {% block mediagoblin_media %} - <video controls autoplay preload="auto" class="video-js vjs-mg-skin" + <video controls + {% if global_config['media_type:mediagoblin.media_types.video']['auto_play'] %}autoplay{% endif %} + preload="auto" class="video-js vjs-mg-skin" data-setup='{"height": {{ media.media_data.height }}, "width": {{ media.media_data.width }} }'> <source src="{{ request.app.public_store.file_url( diff --git a/mediagoblin/templates/mediagoblin/root.html b/mediagoblin/templates/mediagoblin/root.html index 5c6eb52f..529d89ef 100644 --- a/mediagoblin/templates/mediagoblin/root.html +++ b/mediagoblin/templates/mediagoblin/root.html @@ -19,6 +19,13 @@ {% from "mediagoblin/utils/object_gallery.html" import object_gallery %} +{% set feed_url = request.urlgen('mediagoblin.listings.atom_feed') %} + +{% block mediagoblin_head -%} + {% set feed_url = request.urlgen('mediagoblin.listings.atom_feed') -%} + <link rel="alternate" type="application/atom+xml" href="{{ feed_url }}"> +{%- endblock mediagoblin_head %} + {% block mediagoblin_content %} {% if request.user %} <h1>{% trans %}Explore{% endtrans %}</h1> @@ -39,4 +46,8 @@ {% endif %} <h2>{% trans %}Most recent media{% endtrans %}</h2> {{ object_gallery(request, media_entries, pagination) }} + + {#- Need to set feed_url within this block so template can use it. -#} + {%- set feed_url = feed_url -%} + {%- include "mediagoblin/utils/feed_link.html" -%} {% endblock %} diff --git a/mediagoblin/templates/mediagoblin/user_pages/collection_confirm_delete.html b/mediagoblin/templates/mediagoblin/user_pages/collection_confirm_delete.html index 7499c0cf..2b790584 100644 --- a/mediagoblin/templates/mediagoblin/user_pages/collection_confirm_delete.html +++ b/mediagoblin/templates/mediagoblin/user_pages/collection_confirm_delete.html @@ -36,7 +36,7 @@ <p class="delete_checkbox_box"> {{ form.confirm }} - <label for="{{ (form.confirm.name) }}">{{ _(form.confirm.label.text) }}</label> + {{ wtforms_util.render_label(form.confirm) }} </p> <div class="form_submit_buttons"> 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 447201cd..449cc3ce 100644 --- a/mediagoblin/templates/mediagoblin/user_pages/collection_item_confirm_remove.html +++ b/mediagoblin/templates/mediagoblin/user_pages/collection_item_confirm_remove.html @@ -42,7 +42,7 @@ <p class="delete_checkbox_box"> {{ form.confirm }} - <label for="{{ (form.confirm.name) }}">{{ _(form.confirm.label.text) }}</label> + {{ wtforms_util.render_label(form.confirm) }} </p> <div class="form_submit_buttons"> diff --git a/mediagoblin/templates/mediagoblin/user_pages/gallery.html b/mediagoblin/templates/mediagoblin/user_pages/gallery.html index e234914f..f23bb156 100644 --- a/mediagoblin/templates/mediagoblin/user_pages/gallery.html +++ b/mediagoblin/templates/mediagoblin/user_pages/gallery.html @@ -34,16 +34,28 @@ {% block mediagoblin_content -%} <h1> - {%- trans username=user.username, - user_url=request.urlgen( - 'mediagoblin.user_pages.user_home', - user=user.username) -%} - <a href="{{ user_url }}">{{ username }}</a>'s media - {%- endtrans %} + {% if tag %} + {%- trans username=user.username, + user_url=request.urlgen( + 'mediagoblin.user_pages.user_home', + user=user.username), + tag_url=request.urlgen( + 'mediagoblin.listings.tags_listing', + tag=tag) -%} + <a href="{{ user_url }}">{{ username }}</a>'s media with tag <a href="{{ tag_url }}">{{ tag }}</a> + {%- endtrans %} + {% else %} + {%- trans username=user.username, + user_url=request.urlgen( + 'mediagoblin.user_pages.user_home', + user=user.username) -%} + <a href="{{ user_url }}">{{ username }}</a>'s media + {%- endtrans %} + {% endif %} </h1> {{ object_gallery(request, media_entries, pagination) }} - + {% set feed_url = request.urlgen('mediagoblin.user_pages.atom_feed', user=user.username) %} {% include "mediagoblin/utils/feed_link.html" %} diff --git a/mediagoblin/templates/mediagoblin/user_pages/media.html b/mediagoblin/templates/mediagoblin/user_pages/media.html index 7550c6c1..876ce850 100644 --- a/mediagoblin/templates/mediagoblin/user_pages/media.html +++ b/mediagoblin/templates/mediagoblin/user_pages/media.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" %} {% import "/mediagoblin/utils/wtforms.html" as wtforms_util %} {% from "mediagoblin/utils/pagination.html" import render_pagination %} @@ -30,7 +30,7 @@ <script type="text/javascript" src="{{ request.staticdirect('/js/keyboard_navigation.js') }}"></script> - {% template_hook("media_extrahead") %} + {% template_hook("media_head") %} {% endblock mediagoblin_head %} {% block mediagoblin_content %} @@ -155,31 +155,33 @@ {% include "mediagoblin/utils/exif.html" %} - {% if media.attachment_files|count %} + {%- if media.attachment_files|count %} <h3>{% trans %}Attachments{% endtrans %}</h3> <ul> - {% for attachment in media.attachment_files %} + {%- for attachment in media.attachment_files %} <li> <a href="{{ request.app.public_store.file_url(attachment.filepath) }}"> {{- attachment.name -}} </a> </li> - {% endfor %} + {%- endfor %} </ul> - {% endif %} - {% if app_config['allow_attachments'] + {%- endif %} + {%- if app_config['allow_attachments'] and request.user and (media.uploader == request.user.id or request.user.is_admin) %} - {% if not media.attachment_files|count %} + {%- if not media.attachment_files|count %} <h3>{% trans %}Attachments{% endtrans %}</h3> - {% endif %} + {%- endif %} <p> <a href="{{ request.urlgen('mediagoblin.edit.attachments', user=media.get_uploader.username, - media=media.id) }}">{% trans %}Add attachment{% endtrans %}</a> + media_id=media.id) }}"> + {%- trans %}Add attachment{% endtrans -%} + </a> </p> - {% endif %} + {%- endif %} {% template_hook("media_sideinfo") %} diff --git a/mediagoblin/templates/mediagoblin/user_pages/media_collect.html b/mediagoblin/templates/mediagoblin/user_pages/media_collect.html index 8cdb64fe..b4c9671c 100644 --- a/mediagoblin/templates/mediagoblin/user_pages/media_collect.html +++ b/mediagoblin/templates/mediagoblin/user_pages/media_collect.html @@ -33,7 +33,7 @@ {% block mediagoblin_content %} <form action="{{ request.urlgen('mediagoblin.user_pages.media_collect', user=media.get_uploader.username, - media=media.id) }}" + media_id=media.id) }}" method="POST" enctype="multipart/form-data"> <div class="form_box"> <h1> @@ -47,39 +47,20 @@ </div> <br /> - - <p class="form_field_label"> - <label for="{{ (form.collection.name) }}">{{ _(form.collection.label.text) }}</label> - </p> + + {{- wtforms_util.render_label_p(form.collection) }} <div class="form_field_input"> {{ form.collection }} <a class="button_action" id="button_addcollection">{% trans %}+{% endtrans %}</a> </div> <div id="new_collection" class="subform"> + <h3>{% trans %}Add a new collection{% endtrans %}</h3> - <h3>{% trans %}Add a new collection{% endtrans %}</h3> - - <p class="form_field_label"> - <label for="{{ (form.collection_title.name) }}">{{ _(form.collection_title.label.text) }}</label> - </p> - <div class="form_field_input"> - {{ form.collection_title }} - </div> - <p class="form_field_label"> - <label for="{{ (form.collection_description.name) }}">{{ _(form.collection_description.label.text) }}</label> - </p> - <div class="form_field_input"> - {{ form.collection_description }} - </div> - - </div> - <p class="form_field_label"> - <label for="{{ (form.note.name) }}">{{ _(form.note.label.text) }}</label> - </p> - <div class="form_field_input"> - {{ form.note }} + {{- wtforms_util.render_field_div(form.collection_title) }} + {{- wtforms_util.render_field_div(form.collection_description) }} </div> + {{- wtforms_util.render_field_div(form.note) }} <div class="form_submit_buttons"> {# TODO: This isn't a button really... might do unexpected things :) #} diff --git a/mediagoblin/templates/mediagoblin/user_pages/media_confirm_delete.html b/mediagoblin/templates/mediagoblin/user_pages/media_confirm_delete.html index d2a5655e..1d7dcc17 100644 --- a/mediagoblin/templates/mediagoblin/user_pages/media_confirm_delete.html +++ b/mediagoblin/templates/mediagoblin/user_pages/media_confirm_delete.html @@ -40,7 +40,7 @@ <p class="delete_checkbox_box"> {{ form.confirm }} - <label for="{{ (form.confirm.name) }}">{{ _(form.confirm.label.text) }}</label> + {{ wtforms_util.render_label(form.confirm) }} </p> <div class="form_submit_buttons"> diff --git a/mediagoblin/templates/mediagoblin/utils/collections.html b/mediagoblin/templates/mediagoblin/utils/collections.html index db23625b..69738e26 100644 --- a/mediagoblin/templates/mediagoblin/utils/collections.html +++ b/mediagoblin/templates/mediagoblin/utils/collections.html @@ -20,29 +20,25 @@ {% if media.collections %} <h3>{% trans %}Collected in{% endtrans %}</h3> <p> - {% for collection in media.collections %} - {% if loop.last %} - {# the 'and' should only appear if there is more than one collections #} - {% if media.collections|length > 1 %} - · - {% endif %} - <a href="{{ collection.url_for_self(request.urlgen) }}">{{ collection['title'] }}</a> - {% elif loop.revindex == 2 %} - <a href="{{ collection.url_for_self(request.urlgen) }}">{{ collection['title'] }}</a> - {% else %} - <a href="{{ collection.url_for_self(request.urlgen) }}">{{ collection['title'] }}</a> · - {% endif %} - {% endfor %} + {%- for collection in media.collections %} + {%- if not loop.first %} + · + {%- endif %} + <a href="{{ collection.url_for_self(request.urlgen) }}"> + {{- collection.title }} ( + {{- collection.get_creator.username -}} + )</a> + {%- endfor %} </p> - {% endif %} - {% if request.user %} + {%- endif %} + {%- if request.user %} <p> <a type="submit" href="{{ request.urlgen('mediagoblin.user_pages.media_collect', user=media.get_uploader.username, - media=media.id) }}" + media_id=media.id) }}" class="button_action"> {% trans %}Add to a collection{% endtrans %} </a> </p> - {% endif %} + {%- endif %} {% endblock %} diff --git a/mediagoblin/templates/mediagoblin/utils/tags.html b/mediagoblin/templates/mediagoblin/utils/tags.html index 0127035c..bb4bd1a5 100644 --- a/mediagoblin/templates/mediagoblin/utils/tags.html +++ b/mediagoblin/templates/mediagoblin/utils/tags.html @@ -26,16 +26,20 @@ · {% endif %} <a href="{{ request.urlgen( - 'mediagoblin.listings.tags_listing', - tag=tag['slug']) }}">{{ tag['name'] }}</a> + 'mediagoblin.user_pages.user_tag_gallery', + tag=tag['slug'], + user=media.get_uploader.username) }}">{{ tag['name'] }}</a> {% elif loop.revindex == 2 %} <a href="{{ request.urlgen( - 'mediagoblin.listings.tags_listing', - tag=tag['slug']) }}">{{ tag['name'] }}</a> + 'mediagoblin.user_pages.user_tag_gallery', + tag=tag['slug'], + user=media.get_uploader.username) }}">{{ tag['name'] }}</a> {% else %} <a href="{{ request.urlgen( - 'mediagoblin.listings.tags_listing', - tag=tag['slug']) }}">{{ tag['name'] }}</a> · + 'mediagoblin.user_pages.user_tag_gallery', + tag=tag['slug'], + user=media.get_uploader.username) }}">{{ tag['name'] }}</a> + · {% endif %} {% endfor %} </p> diff --git a/mediagoblin/templates/mediagoblin/utils/wtforms.html b/mediagoblin/templates/mediagoblin/utils/wtforms.html index 58ecb8e0..35b4aa04 100644 --- a/mediagoblin/templates/mediagoblin/utils/wtforms.html +++ b/mediagoblin/templates/mediagoblin/utils/wtforms.html @@ -16,11 +16,25 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. #} +{# Render the label for a field #} +{% macro render_label(field) %} + {%- if field.label.text -%} + <label for="{{ field.label.field_id }}">{{ _(field.label.text) }}</label> + {%- endif -%} +{%- endmacro %} + +{# Render the label in a <p> for a field #} +{% macro render_label_p(field) %} + {%- if field.label.text %} + <p class="form_field_label"> + {{- render_label(field) -}} + </p> + {%- endif %} +{%- endmacro %} + {# Generically render a field #} {% macro render_field_div(field) %} - {% if field.label.text -%} - <p class="form_field_label"><label for="{{ field.label.field_id }}">{{ _(field.label.text) }}</label></p> - {%- endif %} + {{- render_label_p(field) }} <div class="form_field_input"> {{ field }} {%- if field.errors -%} @@ -28,7 +42,7 @@ <p class="form_field_error">{{ _(error) }}</p> {% endfor %} {%- endif %} - {% if field.description -%} + {%- if field.description %} <p class="form_field_description">{{ _(field.description)|safe }}</p> {%- endif %} </div> |