Template updates, mainly updating the deck view
This commit is contained in:
parent
5d7e896415
commit
0f7d70da83
6 changed files with 142 additions and 56 deletions
|
@ -24,6 +24,8 @@ class Card(models.Model, mtg.Card):
|
||||||
|
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
def get_cost(self):
|
||||||
|
return mtg.ManaCost(self.cost)
|
||||||
class Deck(models.Model):
|
class Deck(models.Model):
|
||||||
name = models.CharField(max_length=80)
|
name = models.CharField(max_length=80)
|
||||||
cards = models.ManyToManyField(Card, through='Included')
|
cards = models.ManyToManyField(Card, through='Included')
|
||||||
|
|
|
@ -2,7 +2,7 @@ from django.http import Http404
|
||||||
from django.shortcuts import render_to_response
|
from django.shortcuts import render_to_response
|
||||||
from mtgweb.analyzer.models import Deck
|
from mtgweb.analyzer.models import Deck
|
||||||
from mtgweb.lib.mtg import mtg
|
from mtgweb.lib.mtg import mtg
|
||||||
from pygooglechart import PieChart3D
|
from pygooglechart import PieChart3D, SimpleLineChart, Axis
|
||||||
|
|
||||||
def index(request):
|
def index(request):
|
||||||
decks = Deck.objects.all()
|
decks = Deck.objects.all()
|
||||||
|
@ -58,4 +58,5 @@ def detail(request, id):
|
||||||
'deck': deck,
|
'deck': deck,
|
||||||
'land_chart': land_chart,
|
'land_chart': land_chart,
|
||||||
'symbol_chart': symbol_chart,
|
'symbol_chart': symbol_chart,
|
||||||
|
'ramp_chart': ramp_chart,
|
||||||
'curve': curve})
|
'curve': curve})
|
||||||
|
|
|
@ -7,30 +7,41 @@ h1, h2, h3, h4, h5, h6 {
|
||||||
text-shadow: 2px 2px 2px #999;
|
text-shadow: 2px 2px 2px #999;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#main {
|
||||||
|
width: 990px;
|
||||||
|
}
|
||||||
header {
|
header {
|
||||||
border-bottom: 2px solid #999;
|
border-bottom: 2px solid #999;
|
||||||
}
|
}
|
||||||
#navigation {
|
#navigation {
|
||||||
width: 140px;
|
|
||||||
position: absolute;
|
|
||||||
}
|
}
|
||||||
#navigation ul {
|
#navigation ul {
|
||||||
|
margin: 0px;
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
|
float: left;
|
||||||
|
width: 100%;
|
||||||
|
background-color: #ddd;
|
||||||
|
border-bottom: 1px solid #999;
|
||||||
}
|
}
|
||||||
#navigation li {
|
#navigation li {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
|
float: left;
|
||||||
}
|
}
|
||||||
#navigation a {
|
#navigation a,
|
||||||
|
#navigation a:visited,
|
||||||
|
#navigation a:hover {
|
||||||
display: block;
|
display: block;
|
||||||
padding: 2px;
|
padding: 2px;
|
||||||
background-color: #ddd;
|
text-decoration: none;
|
||||||
border-bottom: 1px solid #999;
|
padding-left: 1em;
|
||||||
|
padding-right: 1em;
|
||||||
}
|
}
|
||||||
#navigation a:hover {
|
#navigation a:hover {
|
||||||
background-color: #ccc;
|
background-color: #ccc;
|
||||||
}
|
}
|
||||||
#content {
|
#content {
|
||||||
margin-left: 160px;
|
padding-top: 2em;
|
||||||
|
padding-left: 60px;
|
||||||
}
|
}
|
||||||
/* Cards and mana symbols */
|
/* Cards and mana symbols */
|
||||||
.mana.symbol {
|
.mana.symbol {
|
||||||
|
@ -65,11 +76,11 @@ header {
|
||||||
background-color: #eee;
|
background-color: #eee;
|
||||||
padding: 3px;
|
padding: 3px;
|
||||||
height: 1em;
|
height: 1em;
|
||||||
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
.card .title .name,
|
.card .title .name,
|
||||||
.card .info .type {
|
.card .info .type {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
float: left;
|
|
||||||
text-shadow: 2px 2px 2px #999;
|
text-shadow: 2px 2px 2px #999;
|
||||||
}
|
}
|
||||||
.card .title .cost,
|
.card .title .cost,
|
||||||
|
@ -125,3 +136,27 @@ header {
|
||||||
.mana-curve .bar {
|
.mana-curve .bar {
|
||||||
background-color: #999;
|
background-color: #999;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
section.mana {
|
||||||
|
width: 500px;
|
||||||
|
position: absolute;
|
||||||
|
margin-left: 430px;
|
||||||
|
}
|
||||||
|
section.mana section {
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
section.mana section.curve,
|
||||||
|
section.mana section.ramp {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
section.mana table {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
section.cards {
|
||||||
|
width: 400px;
|
||||||
|
}
|
||||||
|
section.cards .card-type {
|
||||||
|
font-weight: bold;
|
||||||
|
text-shadow: 2px 2px 2px #999;
|
||||||
|
list-style: none;
|
||||||
|
}
|
||||||
|
|
|
@ -7,7 +7,9 @@
|
||||||
<div class="title">
|
<div class="title">
|
||||||
<span class="name">{{ card.name|title }}</span>
|
<span class="name">{{ card.name|title }}</span>
|
||||||
<span class="cost">
|
<span class="cost">
|
||||||
|
{% if cost.converted > 0 %}
|
||||||
{% include 'cards/manacost.html' %}
|
{% include 'cards/manacost.html' %}
|
||||||
|
{% endif %}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="picture"></div>
|
<div class="picture"></div>
|
||||||
|
|
|
@ -6,24 +6,68 @@
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h2>{{deck}}</h2>
|
<h2>{{deck}}</h2>
|
||||||
|
<section class="mana">
|
||||||
<h3>Mana</h3>
|
<h3>Mana</h3>
|
||||||
|
<section class="lands">
|
||||||
<h4>Lands</h4>
|
<h4>Lands</h4>
|
||||||
<img src="{{ land_chart.get_url }}" />
|
<img src="{{ land_chart.get_url }}" />
|
||||||
|
</section>
|
||||||
|
<section class="symbols">
|
||||||
<h4>Symbols</h4>
|
<h4>Symbols</h4>
|
||||||
<img src="{{ symbol_chart.get_url }}" />
|
<img src="{{ symbol_chart.get_url }}" />
|
||||||
|
</section>
|
||||||
|
<section class="curve">
|
||||||
<h4>Curve</h4>
|
<h4>Curve</h4>
|
||||||
<table class="mana-curve">
|
<table class="mana-curve">
|
||||||
{% for cost, count in curve.items %}
|
{% for cost, count in curve.items %}
|
||||||
<tr>
|
<tr>
|
||||||
<td class="cost">{{ cost }}</td>
|
<td class="cost">{{ cost }}</td>
|
||||||
<td><div class="bar" style="text-align: right; width: {% widthratio count curve.values|getsum 100 %}%">{{ count }}</div></td>
|
<td><div class="bar" style="text-align: right; width: {% widthratio count curve.values|getmax 100 %}%">{{ count }}</div></td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
|
</section>
|
||||||
|
<section class="ramp">
|
||||||
|
<h4>Ramp</h4>
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<img src="{{ ramp_chart.get_url }}" />
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<table>
|
||||||
|
{% for turn in deck.ramp %}
|
||||||
|
<tr>
|
||||||
|
<td>Turn {{ turn.turn }}</td>
|
||||||
|
<td>{{ turn.probability }}%</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</section>
|
||||||
|
</section>
|
||||||
|
<section class="cards">
|
||||||
<h3>Cards</h3>
|
<h3>Cards</h3>
|
||||||
|
{% regroup deck.included_set.all by card.type as cards %}
|
||||||
<ul>
|
<ul>
|
||||||
{% for card in deck.included_set.all %}
|
{% for group in cards %}
|
||||||
<li>{{card.count}}x <a href="{% url mtgweb.cards.views.display name=card.card.name %}">{{ card.card }}</a></li>
|
<li class="card-type">{{ group.grouper|title }}
|
||||||
|
<ul>
|
||||||
|
{% for included in group.list %}
|
||||||
|
<li>
|
||||||
|
<div class="card {% if included.card.colors|length > 1 %}gold{% else %}{{ included.card.colors|join:' ' }}{% endif %}">
|
||||||
|
<div class="title">
|
||||||
|
<span class="name">{{ included.count }}x</span>
|
||||||
|
<a class="name" href="{% url mtgweb.cards.views.display name=included.card.name %}">{{ included.card.name }}</a>
|
||||||
|
<span class="cost">{% with included.card.get_cost as cost %}{% if cost.converted > 0 %}{% include 'cards/manacost.html' %}{% endif %}{% endwith %}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
</li>
|
||||||
|
</section>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
<title>{% block title %}MTG Armory{% endblock %}</title>
|
<title>{% block title %}MTG Armory{% endblock %}</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<div id="main">
|
||||||
<header>
|
<header>
|
||||||
<h1>MTG Armory</h1>
|
<h1>MTG Armory</h1>
|
||||||
</header>
|
</header>
|
||||||
|
@ -33,5 +34,6 @@
|
||||||
</section>
|
</section>
|
||||||
<footer>
|
<footer>
|
||||||
</footer>
|
</footer>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in a new issue