Use collection.url_for_self more; Add missing /a.

Using collection.url_for_self(request.urlgen) instead
of request.urlgen(lengthy) is so much nicer, so using
it around the place.

Also added a few missing </a> in one template.
This commit is contained in:
Elrond 2013-05-05 14:29:57 +02:00
parent d13cd99483
commit fc45b38626
4 changed files with 15 additions and 15 deletions

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -522,9 +522,7 @@ def collection_atom_feed(request):
ATOM feed id is a tag URI (see http://en.wikipedia.org/wiki/Tag_URI)
"""
atomlinks = [{
'href': request.urlgen(
'mediagoblin.user_pages.user_collection',
qualified=True, user=request.matchdict['user'], collection=collection.slug),
'href': collection.url_for_self(request.urlgen, qualified=True),
'rel': 'alternate',
'type': 'text/html'
}]