Added templates, urls and views for home page and versions list.
This commit is contained in:
parent
dad7884524
commit
da4c9670dc
|
@ -0,0 +1,8 @@
|
|||
{% extends "layout.html" %}
|
||||
|
||||
{% block content %}
|
||||
<div class="hero">
|
||||
<h1 class="text-center">Minecraft Codex is on alpha!</h1>
|
||||
<p class="text-center">Happy minning!</p>
|
||||
</div>
|
||||
{% endblock %}
|
|
@ -0,0 +1,61 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="/static/lib/font-awesome.3.1.1.css" />
|
||||
<link rel="stylesheet" href="/static/lib/bootstrap.css" />
|
||||
<link rel="stylesheet" href="/static/lib/responsive.css" />
|
||||
<title>Title</title>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<div class="navbar">
|
||||
<div class="navbar-inner">
|
||||
<div class="container" style="width: auto;">
|
||||
<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>
|
||||
</a>
|
||||
<a class="brand" href="/">
|
||||
Minecraft Codex
|
||||
<sup>alpha! :3</sup>
|
||||
</a>
|
||||
<div class="nav-collapse">
|
||||
<ul class="nav">
|
||||
<li class="{% if section == 'home' %}active{% endif %}">
|
||||
<a href="/">Home</a>
|
||||
</li>
|
||||
<li class="{% if section == 'versions' %}active{% endif %}">
|
||||
<a href="/versions">Versions</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div><!-- /.nav-collapse -->
|
||||
</div>
|
||||
</div><!-- /navbar-inner -->
|
||||
</div>
|
||||
</header>
|
||||
<div class="container">
|
||||
{% block content %}
|
||||
Content
|
||||
{% endblock %}
|
||||
</div>
|
||||
<footer class="container-fluid">
|
||||
<hr style="margin: 0" />
|
||||
<div class="pull-left">
|
||||
<small>
|
||||
MinecraftCodex v.{{ app_version }}<br />
|
||||
This site is under construction. It's public so people can see its evolution.<br />
|
||||
If you have feedback, please use the contact information on the right.
|
||||
</small>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
<a href="http://twitter.com/minecraftcodex">
|
||||
<i class="icon-twitter"></i> @minecraftcodex
|
||||
</a><br />
|
||||
<a href="#">
|
||||
<i class="icon-envelope"></i> Email
|
||||
</a>
|
||||
</div>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,43 @@
|
|||
{% extends "layout.html" %}
|
||||
|
||||
{% block content %}
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th nowrap="nowrap">Version number</th>
|
||||
<th>Released</th>
|
||||
<th>Changes</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<h1>Minecraft versions</h1>
|
||||
<hr />
|
||||
{% for item in page.object_list %}
|
||||
<tr>
|
||||
<td nowrap="nowrap">
|
||||
<p class="text-center">
|
||||
{{ item.status }} {{ item.version_number }}
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p class="text-center">
|
||||
{{ item.date }}
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
{{ item.changelog|nl2br }}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="pagination pagination-centered">
|
||||
<ul>
|
||||
{% for p in range(1, paginator.num_pages) %}
|
||||
<li {% if p == page_number %}class="active"{% endif %}>
|
||||
<a href="?page={{p}}">{{ p }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
{% endblock %}
|
|
@ -1 +1,27 @@
|
|||
# Create your views here.
|
||||
from django.shortcuts import render_to_response
|
||||
from database.models import Version
|
||||
from django.core.paginator import Paginator
|
||||
from django.template import Context
|
||||
|
||||
def home(request):
|
||||
return render_to_response('home.html')
|
||||
|
||||
def versions(request):
|
||||
section = 'versions'
|
||||
versions = Version.objects.all().order_by('-date', '-version_number')
|
||||
paginator = Paginator(versions, 10)
|
||||
page_number = 1
|
||||
|
||||
if 'page' in request.GET:
|
||||
page_number = int(request.GET['page'])
|
||||
|
||||
page = paginator.page(page_number)
|
||||
|
||||
data = {
|
||||
'section': section,
|
||||
'page': page,
|
||||
'page_number': page_number,
|
||||
'paginator': paginator,
|
||||
}
|
||||
|
||||
return render_to_response('versions.html', data)
|
||||
|
|
|
@ -15,4 +15,6 @@ urlpatterns = patterns('',
|
|||
# Uncomment the next line to enable the admin:
|
||||
(r'^grappelli/', include('grappelli.urls')),
|
||||
url(r'^management/', include(admin.site.urls)),
|
||||
url(r'^$', 'database.views.home'),
|
||||
url(r'^versions/', 'database.views.versions')
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue