And remove some stray white space from the output.
from mediagoblin.edit.lib import may_edit_media
from mediagoblin.decorators import (require_active_login, active_user_from_url,
get_media_entry_by_id,
- get_user_media_entry, user_may_alter_collection, get_user_collection)
+ user_may_alter_collection, get_user_collection)
from mediagoblin.tools.response import render_to_response, redirect
from mediagoblin.tools.translate import pass_to_ugettext as _
from mediagoblin.tools.text import (
'text/svg+xml']
-@get_user_media_entry
+@get_media_entry_by_id
@require_active_login
def edit_attachments(request, media):
if mg_globals.app_config['allow_attachments']:
# 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 %}
{% 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>
{% 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 -%}
# 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 %}
{% 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") %}
'mediagoblin.edit.views:edit_media')
add_route('mediagoblin.edit.attachments',
- '/u/<string:user>/m/<string:media>/attachments/',
+ '/u/<string:user>/m/<int:media_id>/attachments/',
'mediagoblin.edit.views:edit_attachments')