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"> <div class="form_submit_buttons">
{# TODO: This isn't a button really... might do unexpected things :) #} {# TODO: This isn't a button really... might do unexpected things :) #}
<a class="button_action" href="{{ request.urlgen('mediagoblin.user_pages.user_collection', <a class="button_action" href="
collection=collection.slug, {{- collection.url_for_self(request.urlgen) }}">
user=request.user.username) }}">{% trans %}Cancel{% endtrans %}</a> {%- trans %}Cancel{% endtrans -%}
</a>
<input type="submit" value="{% trans %}Delete permanently{% endtrans %}" class="button_form" /> <input type="submit" value="{% trans %}Delete permanently{% endtrans %}" class="button_form" />
{{ csrf_token }} {{ csrf_token }}
</div> </div>

View File

@ -47,9 +47,10 @@
<div class="form_submit_buttons"> <div class="form_submit_buttons">
{# TODO: This isn't a button really... might do unexpected things :) #} {# TODO: This isn't a button really... might do unexpected things :) #}
<a class="button_action" href="{{ request.urlgen('mediagoblin.user_pages.user_collection', <a class="button_action" href="
collection=collection_item.in_collection.slug, {{- collection_item.in_collection.url_for_self(request.urlgen) }}">
user=request.user.username) }}">{% trans %}Cancel{% endtrans %}</a> {%- trans %}Cancel{% endtrans -%}
</a>
<input type="submit" value="{% trans %}Remove{% endtrans %}" class="button_form" /> <input type="submit" value="{% trans %}Remove{% endtrans %}" class="button_form" />
{{ csrf_token }} {{ csrf_token }}
</div> </div>

View File

@ -15,7 +15,7 @@
# You should have received a copy of the GNU Affero General Public License # 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/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
#} #}
{% extends "mediagoblin/base.html" %} {%- extends "mediagoblin/base.html" %}
{% block title %} {% block title %}
{%- trans username=user.username -%} {%- trans username=user.username -%}
@ -39,17 +39,17 @@
<a href="{{ request.urlgen('mediagoblin.submit.collection', <a href="{{ request.urlgen('mediagoblin.submit.collection',
user=user.username) }}"> user=user.username) }}">
{%- trans %}Create new collection{% endtrans -%} {%- trans %}Create new collection{% endtrans -%}
</a>
</p> </p>
{% endif %} {% endif %}
{% endif %} {% endif %}
<ul> <ul>
{% for coll in collections %} {% for coll in collections %}
{% set coll_url = request.urlgen( {%- set coll_url = coll.url_for_self(request.urlgen) %}
'mediagoblin.user_pages.user_collection', <li>
user=user.username, <a href="{{ coll_url }}">{{ coll.title }}</a>
collection=coll.slug) %} </li>
<li><a href="{{ coll_url }}">{{ coll.title }}</li>
{% endfor %} {% endfor %}
</ul> </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) ATOM feed id is a tag URI (see http://en.wikipedia.org/wiki/Tag_URI)
""" """
atomlinks = [{ atomlinks = [{
'href': request.urlgen( 'href': collection.url_for_self(request.urlgen, qualified=True),
'mediagoblin.user_pages.user_collection',
qualified=True, user=request.matchdict['user'], collection=collection.slug),
'rel': 'alternate', 'rel': 'alternate',
'type': 'text/html' 'type': 'text/html'
}] }]