Updated templates

This commit is contained in:
Felipe Martín 2015-08-27 18:44:11 +02:00
parent 13eece1e95
commit dfa5b3f773
5 changed files with 176 additions and 160 deletions

View File

@ -81,6 +81,14 @@ class Amiibo(models.Model):
visible = models.BooleanField(default=True)
def get_all_names(self):
result = u''
for key, value in self.__dict__.items():
if u'name_' in key and self.__dict__[key]:
result += u' {}'.format(self.__dict__[key])
return result
@models.permalink
def get_absolute_url(self):
return ('amiibo:amiibo', [self.collection.slug, self.slug])

View File

@ -2,82 +2,82 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<link rel="stylesheet" href="{% static "css/style.css" %}" charset="utf-8">
<!-- SEO -->
<meta name=”description” content=”{% block meta_description %}Amiibofindr{% endblock %}>
<!-- Twitter -->
<meta content="{% block meta_twitter_card %}summary{% endblock %}" name="twitter:card" />
<meta content="{% block meta_twitter_title %}{% endblock %}" name="twitter:title" />
<meta content="{% block meta_twitter_description %}{% endblock %}" name="twitter:description" />
<meta content="{% block meta_twitter_image %}{% endblock %}" name="twitter:image:src" />
<meta content="{% block meta_twitter_url %}{% endblock %}" property="twitter:url" />
<!-- Facebook -->
<meta content="{% block meta_og_title %}{% endblock %}" property="og:title" />
<meta content="{% block meta_og_type %}object{% endblock %}" property="og:type" />
<meta content="{% block meta_og_image %}{% endblock %}" property="og:image" />
<meta content="{% block meta_og_url %}{% endblock %}" property="og:url" />
<meta content="{% block meta_og_description %}{% endblock %}" property="og:description" />
<title>{% block page_title %}AmiiboFindr{% endblock %}</title>
</head>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<link rel="stylesheet" href="{% static "css/style.css" %}" charset="utf-8">
<!-- SEO -->
<meta name=”description” content=”{% block meta_description %}Amiibofindr{% endblock %}>
<!-- Twitter -->
<meta content="{% block meta_twitter_card %}summary{% endblock %}" name="twitter:card" />
<meta content="{% block meta_twitter_title %}{% endblock %}" name="twitter:title" />
<meta content="{% block meta_twitter_description %}{% endblock %}" name="twitter:description" />
<meta content="{% block meta_twitter_image %}{% endblock %}" name="twitter:image:src" />
<meta content="{% block meta_twitter_url %}{% endblock %}" property="twitter:url" />
<!-- Facebook -->
<meta content="{% block meta_og_title %}{% endblock %}" property="og:title" />
<meta content="{% block meta_og_type %}object{% endblock %}" property="og:type" />
<meta content="{% block meta_og_image %}{% endblock %}" property="og:image" />
<meta content="{% block meta_og_url %}{% endblock %}" property="og:url" />
<meta content="{% block meta_og_description %}{% endblock %}" property="og:description" />
<title>{% block page_title %}AmiiboFindr{% endblock %}</title>
</head>
<body data-views="{% block js_views %}{% endblock %}">
<div class="ui page grid">
<br />
<div class="sixteen wide column">
<div class="ui large menu">
<a class="item" href="/">
<i class="home icon"></i> AmiiboFindr
</a>
<div class="ui dropdown item">
{% trans "Collections" %}
<i class="dropdown icon"></i>
<div class="menu">
<a class="item" href="#">{% trans "All" %}</a>
{% for col in COLLECTIONS %}
<a class="item" href="{{ col.get_absolute_url }}">{{ col.name }}</a>
{% endfor %}
</div>
</div>
<div class="right menu"></div>
</div>
<div class="ui breadcrumb">
{% block breadcrumb %}
<a class="section" href="{% url 'amiibo:collection' 'all' %}">Home</a>
{% endblock %}
</div>
</div>
</div>
{% block main_content %}{% endblock %}
<div class="ui page grid">
<hr >
<div class="eight wide column">
<small>{% trans "CHANGE CURRENCY" %} {% for currency in CURRENCIES %}<a href="#" data-currency-change="{{ currency }}">{{ currency }}</a> {% endfor %}</small>
</div>
<div class="eight wide column right aligned">
<div class="">
AmiiboFindr &copy; 2015 | <a href="https://twitter.com/amiibofindr" target="_blank"><i class="ui icon twitter"></i>Twitter</a>
</div>
</div>
</div>
{% if not DEBUG %}
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-64407848-1', 'auto');
ga('send', 'pageview');
</script>
{% endif %}
<script type="text/javascript">
var DEBUG = {{ DEBUG|yesno:"true,false" }};
var MEDIA_URL = '{{ MEDIA_URL }}';
var CURRENCIES = ['{{ CURRENCIES|join:"', '" }}'];
</script>
<script type="text/javascript" src={% static "dist/app.js" %}></script>
</body>
<body data-views="{% block js_views %}{% endblock %}">
<div class="ui page grid">
<br />
<div class="sixteen wide column">
<div class="ui large menu">
<a class="item" href="/">
<i class="home icon"></i> AmiiboFindr
</a>
<div class="ui dropdown item">
{% trans "Collections" %}
<i class="dropdown icon"></i>
<div class="menu">
<a class="item" href="#">{% trans "All" %}</a>
{% for col in COLLECTIONS %}
<a class="item" href="{{ col.get_absolute_url }}">{{ col.name }}</a>
{% endfor %}
</div>
</div>
<div class="right menu"></div>
</div>
<div class="ui breadcrumb">
{% block breadcrumb %}
<a class="section" href="{% url 'amiibo:collection' 'all' %}">Home</a>
{% endblock %}
</div>
</div>
</div>
{% block main_content %}{% endblock %}
<div class="ui page grid">
<hr >
<div class="eight wide column">
<small>{% trans "CHANGE CURRENCY" %} {% for currency in CURRENCIES %}<a href="#" data-currency-change="{{ currency }}">{{ currency }}</a> {% endfor %}</small>
</div>
<div class="eight wide column right aligned">
<div class="">
AmiiboFindr &copy; 2015 | <a href="https://twitter.com/amiibofindr" target="_blank"><i class="ui icon twitter"></i>Twitter</a>
</div>
</div>
</div>
{% if not DEBUG %}
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-64407848-1', 'auto');
ga('send', 'pageview');
</script>
{% endif %}
<script type="text/javascript">
var DEBUG = {{ DEBUG|yesno:"true,false" }};
var MEDIA_URL = '{{ MEDIA_URL }}';
var CURRENCIES = ['{{ CURRENCIES|join:"', '" }}'];
</script>
<script type="text/javascript" src={% static "dist/app.js" %}></script>
</body>
</html>

View File

@ -15,80 +15,80 @@
{% block js_views %}money,time{% endblock %}
{% block breadcrumb %}
{{ block.super }}
<i class="right chevron icon divider"></i>
<a class="section" href="{{ selected_collection.get_absolute_url }}">{{ selected_collection.name }}</a>
<i class="right chevron icon divider"></i>
<span class="active section">{{ amiibo.name }}</span>
{{ block.super }}
<i class="right chevron icon divider"></i>
<a class="section" href="{{ selected_collection.get_absolute_url }}">{{ selected_collection.name }}</a>
<i class="right chevron icon divider"></i>
<span class="active section">{{ amiibo.name }}</span>
{% endblock %}
{% block main_content %}
<div class="ui page grid">
<div class="five wide column">
<div class="ui card">
<a class="image">
<img src="{{ amiibo.statue.url }}" />
</a>
<div class="content">
<!-- <i class="right floated like icon"></i> -->
<!-- <i class="right floated star icon"></i> -->
<div class="header">{{ amiibo.name }}</div>
<div class="meta">
<a href="{{ amiibo.collection.get_absolute_url }}">{{ amiibo.collection.name }}</a>
</div>
<!-- <div class="description">
<div class="ui page grid">
<div class="five wide column">
<div class="ui card">
<a class="image">
<img src="{{ amiibo.statue.url }}" />
</a>
<div class="content">
<!-- <i class="right floated like icon"></i> -->
<!-- <i class="right floated star icon"></i> -->
<div class="header">{{ amiibo.name }}</div>
<div class="meta">
<a href="{{ amiibo.collection.get_absolute_url }}">{{ amiibo.collection.name }}</a>
</div>
<!-- <div class="description">
<p>asd</p>
</div> -->
</div>
<!-- <div class="extra content">
</div> -->
</div>
<!-- <div class="extra content">
<span class="left floated like">
<i class="like icon"></i>
Like
<i class="like icon"></i>
Like
</span>
<span class="right floated star">
<i class="star icon"></i>
Favorite
<i class="star icon"></i>
Favorite
</span>
</div> -->
</div> -->
</div>
</div>
<div class="eleven wide column">
{% if amiibo.shops_set.exists %}
<table class="ui celled table">
<thead>
<tr>
<th>{% trans "Shop" %}</th>
<th class="center aligned">{% trans "Stock" %}</th>
<th class="center aligned">{% trans "Price" %}</th>
</tr>
</thead>
<tbody>
{% for relation in amiibo.shops_set.all %}
<tr>
{% with price=relation.last_price.price stock=relation.last_price.stock currency=relation.last_price.currency %}
{% spaceless %}
<td>
<a href="{{ relation.get_url }}" target="_blank">
<i class="{% if relation.shop.flag_code == 'uk' %}gb{% else %}{{ relation.shop.flag_code }}{% endif %} flag"></i> {{ relation.shop.name }}
</a>
{% if relation.last_price.date %}<em class="float-right">{% trans "Updated " %} <span data-relative="{{ relation.last_price.date.isoformat }}"></span></em>{% endif %}
</td>
{% endspaceless %}
<td class="center aligned {{ stock|yesno:'positive,negative' }}" {% if not price %}colspan="2"{% endif %}>
<i class="icon {{ stock|yesno:'checkmark,close' }}"></i>
{{ stock|yesno|capfirst }}
</td>
{% if price %}
<td class="center aligned" data-price="{{ price }}" data-currency="{{ currency }}" data-money>
{{ price }} {{ relation.last_price.currency }}
</td>
{% endif %}
{% endwith %}
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
</div>
</div>
<div class="eleven wide column">
{% if amiibo.shops_set.exists %}
<table class="ui celled table">
<thead>
<tr>
<th>{% trans "Shop" %}</th>
<th class="center aligned">{% trans "Stock" %}</th>
<th class="center aligned">{% trans "Price" %}</th>
</tr>
</thead>
<tbody>
{% for relation in amiibo.shops_set.all %}
<tr>
{% with price=relation.last_price.price stock=relation.last_price.stock currency=relation.last_price.currency %}
{% spaceless %}
<td>
<a href="{{ relation.get_url }}" target="_blank">
<i class="{% if relation.shop.flag_code == 'uk' %}gb{% else %}{{ relation.shop.flag_code }}{% endif %} flag"></i> {{ relation.shop.name }}
</a>
{% if relation.last_price.date %}<em class="float-right">{% trans "Updated " %} <span data-relative="{{ relation.last_price.date.isoformat }}"></span></em>{% endif %}
</td>
{% endspaceless %}
<td class="center aligned {{ stock|yesno:'positive,negative' }}" {% if not price %}colspan="2"{% endif %}>
<i class="icon {{ stock|yesno:'checkmark,close' }}"></i>
{{ stock|yesno|capfirst }}
</td>
{% if price %}
<td class="center aligned" data-price="{{ price }}" data-currency="{{ currency }}" data-money>
{{ price }} {{ relation.last_price.currency }}
</td>
{% endif %}
{% endwith %}
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
</div>
</div>
{% endblock %}

View File

@ -10,22 +10,30 @@
{% block meta_og_url %}{{ amiibo.get_absolute_url }}{% endblock %}
{% block breadcrumb %}
{{ block.super }}
<i class="right chevron icon divider"></i>
{% if selected_collection %}
<span class="active section">{{ selected_collection.name }}</span>
{% else %}
<span class="active section">{% trans "All amiibo" %}</span>
{% endif %}
{{ block.super }}
<i class="right chevron icon divider"></i>
{% if selected_collection %}
<span class="active section">{{ selected_collection.name }}</span>
{% else %}
<span class="active section">{% trans "All amiibo" %}</span>
{% endif %}
{% endblock %}
{% block main_content %}
<div class="ui page grid">
<h1>{{ selected_collection.name }}</h1>
<div class="ui six doubling cards">
{% for amiibo in amiibo_list %}
{% include "amiibo/widgets/amiibo-card.html" with amiibo=amiibo only %}
{% endfor %}
</div>
</div>
<div class="ui page grid">
<div class="sixteen wide column">
{% if selected_collection.name %}<h1>{{ selected_collection.name }}</h1>{% endif %}
<div class="ui icon big fluid input">
<input type="text" placeholder="Search...">
<i class="inverted circular search link icon"></i>
</div>
</div>
<div class="sixteen wide column">
<div class="ui six doubling cards" data-amiibo-list>
{% for amiibo in amiibo_list %}
{% include "amiibo/widgets/amiibo-card.html" with amiibo=amiibo only %}
{% endfor %}
</div>
</div>
</div>
{% endblock %}

View File

@ -1,6 +1,6 @@
{% load staticfiles thumbnail %}
<div class="special card">
<div class="dimmable image">
<div class="special card" data-amiibo-name="{{ amiibo.get_all_names }}">
<div class="dimmable image">
<div class="ui dimmer">
<div class="content">
<div class="center">
@ -8,7 +8,7 @@
</div>
</div>
</div>
<img src="{% thumbnail amiibo.statue 340x340 %}">
<img src="{% thumbnail amiibo.statue 340x340 %}">
</div>
<div class="content">
<a class="header">{{ amiibo.name }}</a>