Cleaned up the templates

This commit is contained in:
Correl Roush 2010-09-21 01:49:22 -04:00
parent ccff6b2c88
commit 15bf001831
8 changed files with 176 additions and 95 deletions

View file

@ -1 +1,4 @@
# Create your views here. from django.shortcuts import render_to_response
def index(request):
return render_to_response('main.html')

89
media/mtg.css Normal file
View file

@ -0,0 +1,89 @@
/* Page styles */
body {
font-family: serif;
}
h1, h2, h3, h4, h5, h6 {
text-shadow: 2px 2px 2px #999;
}
header {
border-bottom: 2px solid #999;
}
#navigation {
width: 140px;
position: absolute;
}
#navigation ul {
padding: 0px;
}
#navigation li {
list-style: none;
}
#navigation a {
display: block;
padding: 2px;
background-color: #ddd;
border-bottom: 1px solid #999;
}
#navigation a:hover {
background-color: #ccc;
}
#content {
margin-left: 160px;
}
/* Cards and mana symbols */
.mana {
height: 1em;
width: 1em;
border-radius: 0.5em;
-moz-border-radius: 5px;
display: block;
float: left;
color: #eee;
background-color: gray;
border: 1px solid black;
margin-right: 2px;
text-align: center;
}
.card {
border: 1px solid gray;
background-color: #999;
padding: 3px;
}
.mana.R, .card.R { background-color: red; }
.mana.G, .card.G { background-color: green; }
.mana.U, .card.U { background-color: blue; }
.mana.B, .card.B { background-color: black; }
.mana.W, .card.W { background-color: white; }
.card .title,
.card .info {
border: 1px solid gray;
background-color: #eee;
padding: 3px;
height: 1em;
}
.card .title .name,
.card .info .type {
font-weight: bold;
float: left;
}
.card .title .cost,
.card .info .rarity {
float: right;
}
.card .rarity {
}
.card .rarity.U { color: gray; }
.card .rarity.R { color: darkgoldenrod; }
.card .rarity.M { color: red; }
.card .picture {
height: 5em;
background-color: #ccc;
margin: 5px;
}
.card .text {
margin-top: 5px;
border: 1px solid gray;
background-color: white;
padding: 3px;
}

View file

@ -1,4 +1,4 @@
{% extends "main.html" %}
{% block content %} {% block content %}
<h2>Cards</h2> <h2>Cards</h2>
<ul> <ul>

69
templates/cards/view.html Executable file → Normal file
View file

@ -1,66 +1,8 @@
<html> {% extends "main.html" %}
<head>
<title>Card: {{ card.name }}</title>
<style type="text/css">
.mana {
height: 1em;
width: 1em;
border-radius: 0.5em;
-moz-border-radius: 5px;
display: block;
float: left;
color: #eee;
background-color: gray;
border: 1px solid black;
margin-right: 2px;
text-align: center;
}
.card {
border: 1px solid gray;
background-color: #999;
padding: 3px;
}
.mana.R, .card.R { background-color: red; }
.mana.G, .card.G { background-color: green; }
.mana.U, .card.U { background-color: blue; }
.mana.B, .card.B { background-color: black; }
.mana.W, .card.W { background-color: white; }
.card .title,
.card .info {
border: 1px solid gray;
background-color: #eee;
padding: 3px;
height: 1em;
}
.card .title .name,
.card .info .type {
font-weight: bold;
float: left;
}
.card .title .cost,
.card .info .rarity {
float: right;
}
.card .rarity {
}
.card .rarity.U { color: gray; }
.card .rarity.R { color: darkgoldenrod; }
.card .rarity.M { color: red; }
.card .picture {
height: 5em;
background-color: #ccc;
margin: 5px;
}
.card .text {
margin-top: 5px;
border: 1px solid gray;
background-color: white;
padding: 3px;
}
</style> {% block title %}Card: {{ card.name }}{% endblock %}
</head>
<body> {% block content %}
<div class="card {{ card.colors|join:" " }}"> <div class="card {{ card.colors|join:" " }}">
<div class="title"> <div class="title">
<span class="name">{{ card.name|title }}</span> <span class="name">{{ card.name|title }}</span>
@ -91,5 +33,4 @@
</ul> </ul>
</div> </div>
</div> </div>
</body> {% endblock %}
</html>

View file

@ -1,6 +1,12 @@
{% extends "main.html" %}
{% block title %}Deck: {{ deck.name }}{% endblock %}
{% block content %}
<h2>{{deck}}</h2> <h2>{{deck}}</h2>
<ul> <ul>
{% for card in deck.included_set.all %} {% for card in deck.included_set.all %}
<li>{{card.count}}x <a href="{% url mtgweb.cards.views.display name=card.card.name %}">{{ card.card }}</a></li> <li>{{card.count}}x <a href="{% url mtgweb.cards.views.display name=card.card.name %}">{{ card.card }}</a></li>
{% endfor %} {% endfor %}
</ul> </ul>
{% endblock %}

View file

@ -1,6 +1,10 @@
{% extends "main.html" %}
{% block content %}
<h2>Decks</h2> <h2>Decks</h2>
<ul> <ul>
{% for deck in decks %} {% for deck in decks %}
<li><a href="{% url mtgweb.decks.views.detail deck.id %}">{{ deck }}</a></li> <li><a href="{% url mtgweb.decks.views.detail deck.id %}">{{ deck }}</a></li>
{% endfor %} {% endfor %}
</ul> </ul>
{% endblock %}

37
templates/main.html Normal file
View file

@ -0,0 +1,37 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf8" />
<link rel="stylesheet" href="/media/mtg.css" />
<title>{% block title %}MTG Armory{% endblock %}</title>
</head>
<body>
<header>
<h1>MTG Armory</h1>
</header>
<section id="navigation">
<ul>
<li><a href="{% url mtgweb.analyzer.views.index %}">Home</a></li>
<li><a href="/cards/">Cards</a></li>
<li><a href="/decks/">Decks</a></li>
</ul>
</section>
<section id="content">
{% block content %}
<h2>Welcome to the MTG Armory</h2>
<p>
Someday this might grow up into yet another deck builder
site for folks to flock to and keep track of their stuff.
For now, though, it's just an awful looking dumping ground
for my own decks and Python experimentation.
</p>
<p>
This whole thing is just an excercise in learning Django
and HTML5, so don't expect too much out of it. Ever.
</p>
{% endblock %}
</section>
<footer>
</footer>
</body>
</html>

View file

@ -9,6 +9,7 @@ admin.autodiscover()
urlpatterns = patterns('', urlpatterns = patterns('',
# Example: # Example:
# (r'^mtgweb/', include('mtgweb.foo.urls')), # (r'^mtgweb/', include('mtgweb.foo.urls')),
(r'^$', 'mtgweb.analyzer.views.index'),
(r'^cards/$', list_detail.object_list, {'queryset': Card.objects.all(), 'paginate_by': 20}), (r'^cards/$', list_detail.object_list, {'queryset': Card.objects.all(), 'paginate_by': 20}),
(r'^cards/(?P<name>.*?)/$', 'mtgweb.cards.views.display'), (r'^cards/(?P<name>.*?)/$', 'mtgweb.cards.views.display'),
(r'^decks/$', 'mtgweb.decks.views.index'), (r'^decks/$', 'mtgweb.decks.views.index'),