Fixed all links that sentry marked as errors:

+ Some versions don't getting reverse URLs
+ Pages wasn't linking property
+ Using reverse for all URLs
+ Version details can show info from more than one release
This commit is contained in:
Felipe Martin 2013-05-25 11:27:07 +02:00
parent c5b9517573
commit d4f45fac07
6 changed files with 48 additions and 26 deletions

View File

@ -8,7 +8,7 @@
It's public in this state so the people can see its progress over time, It's public in this state so the people can see its progress over time,
and send feedback/suggestions to the staff. and send feedback/suggestions to the staff.
</p> </p>
<p class="text-center">For more details about the project, go to the <a href="/about">about section</a>.</p> <p class="text-center">For more details about the project, go to the <a href="{{ url('aboutpage') }}">about section</a>.</p>
<p class="text-center">Happy minning!</p> <p class="text-center">Happy minning!</p>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -13,7 +13,8 @@
<div class="navbar"> <div class="navbar">
<div class="navbar-inner"> <div class="navbar-inner">
<div class="container" style="width: auto;"> <div class="container" style="width: auto;">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> <a class="btn btn-navbar" data-toggle="collapse"
data-target=".nav-collapse">
<span class="icon-bar"></span> <span class="icon-bar"></span>
<span class="icon-bar"></span> <span class="icon-bar"></span>
<span class="icon-bar"></span> <span class="icon-bar"></span>
@ -25,15 +26,15 @@
<div class="nav-collapse"> <div class="nav-collapse">
<ul class="nav"> <ul class="nav">
<li class="{% if section == 'home' %}active{% endif %}"> <li class="{% if section == 'home' %}active{% endif %}">
<a href="/">Home</a> <a href="{{ url('homepage') }}">Home</a>
</li> </li>
<li class="{% if section == 'versions' %}active{% endif %}"> <li class="{% if section == 'versions' %}active{% endif %}">
<a href="/versions">Versions</a> <a href="{{ url('version_list') }}">Versions</a>
</li> </li>
</ul> </ul>
<ul class="nav pull-right"> <ul class="nav pull-right">
<li class="pull-right {% if section == 'about' %}active{% endif %}"> <li class="pull-right {% if section == 'about' %}active{% endif %}">
<a href="/about">About the project</a> <a href="{{ url('aboutpage') }}">About the project</a>
</li> </li>
</ul> </ul>
</div><!-- /.nav-collapse --> </div><!-- /.nav-collapse -->

View File

@ -1,21 +1,27 @@
{% extends "layout.html" %} {% extends "layout.html" %}
{% block head_title %} {% block head_title %}
{{ super() }} | Version | {{ item.version_number }} {{ super() }} | Version | {{ version_number }}
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<h1>Minecraft versions</h1> <h1>Minecraft versions</h1>
<hr /> <hr />
<a href="/versions"><i class="icon-arrow-left"></i> Go back</a> <a href="/versions/"><i class="icon-arrow-left"></i> Go back</a>
<h2>{% if item.status != 'release' %}{{ item.status }}{% endif %} {{ item.version_number }}</h2> <h2>{% if status != 'release' %}{{ status }}{% endif %} {{ version_number }}</h2>
Released on {{ item.date }} {% if results > 1 %}
{% if item.jarfiles %} <div class="alert alert-info">This version contains more than one release.</div>
<h3>Downloads</h3>
{% for jarfile in item.jarfiles %}
<a href="{{ jarfile.url }}" class="btn btn-info btn-small">{{ jarfile.description|capitalize }}</a>&nbsp;
{% endfor %}
{% endif %} {% endif %}
<h3>Changelog</h3> {% for version in items %}
<p>{{ item.changelog|nl2br }}</p> <hr />
Released on {{ version.date }}
{% if version.jarfiles %}
<h3>Downloads</h3>
{% for jarfile in version.jarfiles %}
<a href="{{ jarfile.url }}" class="btn btn-info btn-small">{{ jarfile.description|capitalize }}</a>&nbsp;
{% endfor %}
{% endif %}
<h3>Changelog</h3>
<p>{{ version.changelog|nl2br }}</p>
{% endfor %}
{% endblock %} {% endblock %}

View File

@ -53,7 +53,7 @@
<ul> <ul>
{% for p in range(1, paginator.num_pages) %} {% for p in range(1, paginator.num_pages) %}
<li {% if p == page_number %}class="active"{% endif %}> <li {% if p == page_number %}class="active"{% endif %}>
<a href="?page={{ p }}">{{ p }}</a> <a href="{{ url('version_list') }}?page={{ p }}">{{ p }}</a>
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>

View File

@ -11,7 +11,8 @@ def home(request):
def versions(request): def versions(request):
section = 'versions' section = 'versions'
versions = Version.objects.filter(snapshot=False).order_by('-date', '-version_number') versions = Version.objects.filter(snapshot=False).\
order_by('-date', '-version_number')
paginator = Paginator(versions, 50) paginator = Paginator(versions, 50)
page_number = 1 page_number = 1
@ -30,12 +31,17 @@ def versions(request):
return render_to_response('versions.html', context_instance=context) return render_to_response('versions.html', context_instance=context)
def version(request, version, status='release'): def version(request, version, status='release'):
section = 'versions' section = 'versions'
item = Version.objects.get(status=status, version_number=version) items = Version.objects.filter(status=status, version_number=version).\
order_by('-date')
data = { data = {
'version_number': version,
'status': status,
'section': section, 'section': section,
'item': item, 'items': items,
'results': len(items)
} }
context = RequestContext(request, data) context = RequestContext(request, data)
return render_to_response('version.html', context_instance=context) return render_to_response('version.html', context_instance=context)

View File

@ -16,15 +16,24 @@ urlpatterns = patterns('',
# Uncomment the next line to enable the admin: # Uncomment the next line to enable the admin:
(r'^grappelli/', include('grappelli.urls')), (r'^grappelli/', include('grappelli.urls')),
url(r'^management/', include(admin.site.urls)), url(r'^management/', include(admin.site.urls)),
url(r'^$', 'database.views.home'), # Home
url(r'^$', 'database.views.home', name='homepage'),
# Static # Static
url(r'^about/', 'database.views.about'), url(r'^about/', 'database.views.about', name='aboutpage'),
# Database # Versions
url(r'^versions/(?P<version>[a-z0-9\.\_]+)/', 'database.views.version', name='version_release'), url(r'^versions/(?P<version>[A-Za-z0-9\.\_ ]+)/',
url(r'^versions/(?P<status>[a-z]+)\-(?P<version>[a-z0-9\.\_]+)/', 'database.views.version', name='version'), 'database.views.version',
url(r'^versions/', 'database.views.versions'), name='version_release'
),
url(r'^versions/(?P<status>[a-z]+)\-(?P<version>[A-Za-z0-9\.\_ ]+)/',
'database.views.version',
name='version'
),
url(r'^versions/', 'database.views.versions', name='version_list'),
# Robots # Robots
(r'^robots\.txt$', lambda r: HttpResponse("", mimetype="text/plain")), (r'^robots\.txt$', lambda r: HttpResponse("", mimetype="text/plain")),
# Favicon # Favicon
(r'^favicon\.ico$', lambda r: HttpResponseRedirect('/static/favicon.ico')), (r'^favicon\.ico$', lambda r: HttpResponseRedirect('/static/favicon.ico')),
) )