Fixed listings. Toggle if not auth.

This commit is contained in:
Felipe Martín 2015-09-09 00:01:03 +02:00
parent d649f11c32
commit 57b3036530
8 changed files with 148 additions and 69 deletions

View File

@ -15,10 +15,10 @@ urlpatterns = patterns(
'',
url(_('^cards$'),
CollectionCardView.as_view(),
name='cards-list'),
name='cards-all'),
url(_(r'^figures$'),
CollectionFigureView.as_view(),
name='figures-list'),
name='figures-all'),
url(_(r'^cards/(?P<collection>[\w\d\-]+)$'),
CollectionCardView.as_view(),
@ -27,9 +27,6 @@ urlpatterns = patterns(
CollectionFigureView.as_view(),
name='figures-list'),
url(_(r'^(?P<collection>[\w\d\-]+)/(?P<amiibo>[\w\d\-]+)$'),
AmiiboView.as_view(),
name='amiibo'),
url(_(r'^cards/(?P<collection>[\w\d\-]+)/(?P<amiibo>[\w\d\-]+)$'),
AmiiboCardView.as_view(),
name='card-detail'),

View File

@ -20,8 +20,8 @@ class CollectionView(View):
type = Amiibo.FIGURE
model = AmiiboFigure
def get(self, request, collection='all'):
if collection != _('all'):
def get(self, request, collection=None):
if collection:
collection = get_object_or_404(Collection, slug=collection)
if self.type == self.model.FIGURE:
amiibo_list = collection.figures
@ -31,7 +31,7 @@ class CollectionView(View):
amiibo_list = collection.amiibo
else:
collection = None
amiibo_list = self.model.objects.all().order_by('name_eu')
amiibo_list = self.model.objects.all()
return render(request, self.template, {
'selected_collection': collection,

View File

@ -3,7 +3,7 @@
from __future__ import unicode_literals
from django.utils.translation import activate, deactivate, get_language
from django.core.urlresolvers import resolve, reverse
from django.core.urlresolvers import resolve, reverse_lazy
from django.conf import settings
@ -29,7 +29,7 @@ def i18n(request):
this = {
'code': lang_code,
'name': name,
# 'url': reverse(res.url_name, args=res.args, kwargs=res.kwargs)
'url': reverse_lazy(res.view_name, args=res.args, kwargs=res.kwargs)
}
result.append(this)
deactivate()

View File

@ -9,5 +9,5 @@ from .views import HomeView
urlpatterns = patterns(
'',
url(r'^$', HomeView.as_view(), name='redirect'),
url(r'^$', HomeView.as_view(), name='home'),
)

View File

@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-09-07 22:33+0200\n"
"PO-Revision-Date: 2015-09-07 22:33+0200\n"
"POT-Creation-Date: 2015-09-08 23:54+0200\n"
"PO-Revision-Date: 2015-09-08 23:55+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: es\n"
@ -18,21 +18,33 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 1.8.4\n"
#: apps/amiibo/urls.py:13
msgid "^(?P<collection>[\\w\\d\\-]+)/$"
msgstr "^(?P<collection>[\\w\\d\\-]+)/$"
#: apps/amiibo/urls.py:16
msgid "^cards/(?P<collection>[\\w\\d\\-]+)/$"
msgstr "^tarjetas/(?P<collection>[\\w\\d\\-]+)/$"
msgid "^cards$"
msgstr "^tarjetas$"
#: apps/amiibo/urls.py:19
msgid "^figures/(?P<collection>[\\w\\d\\-]+)/$"
msgid "^figures$"
msgstr "^figuras$"
#: apps/amiibo/urls.py:23
msgid "^cards/(?P<collection>[\\w\\d\\-]+)$"
msgstr "^tarjetas/(?P<collection>[\\w\\d\\-]+)$"
#: apps/amiibo/urls.py:26
msgid "^figures/(?P<collection>[\\w\\d\\-]+)$"
msgstr "^figuras/(?P<collection>[\\w\\d\\-]+)/$"
#: apps/amiibo/views.py:15 apps/amiibo/views.py:19 templates/_layout.html:5
msgid "all"
msgstr "todas"
#: apps/amiibo/urls.py:30
msgid "^cards/(?P<collection>[\\w\\d\\-]+)/(?P<amiibo>[\\w\\d\\-]+)$"
msgstr "^tarjetas/(?P<collection>[\\w\\d\\-]+)/(?P<amiibo>[\\w\\d\\-]+)$"
#: apps/amiibo/urls.py:33
msgid "^figures/(?P<collection>[\\w\\d\\-]+)/(?P<amiibo>[\\w\\d\\-]+)$"
msgstr "^figuras/(?P<collection>[\\w\\d\\-]+)/(?P<amiibo>[\\w\\d\\-]+)$"
#: apps/amiibo/urls.py:37
msgid "^amiibo/(?P<amiibo>\\d+)/(?P<action>[\\w\\+\\-\\=]+)$"
msgstr "^amiibo/(?P<amiibo>\\d+)/(?P<action>[\\w\\+\\-\\=]+)$"
#: templates/404.html:10
msgid "Not found!"
@ -68,39 +80,48 @@ msgstr ""
"informados. Por favor, prueba refrescando la página o <a "
"href=“%(url_home)s”>vuelve a la home</a>."
#: templates/_layout.html:36 templates/_layout.html.py:94
#: templates/_layout.html:5
msgid "all"
msgstr "todas"
#: templates/_layout.html:36 templates/_layout.html.py:91
msgid "Figures"
msgstr "Figuras"
#: templates/_layout.html:39 templates/_layout.html.py:96
#: templates/_layout.html:39 templates/_layout.html.py:51
#: templates/_layout.html:93 templates/_layout.html.py:102
msgid "All"
msgstr "Todas"
#: templates/_layout.html:66 templates/account/password_reset_from_key.html:49
#: templates/_layout.html:48 templates/_layout.html.py:100
msgid "Cards"
msgstr "Tarjetas"
#: templates/_layout.html:63 templates/account/password_reset_from_key.html:49
msgid "Change password"
msgstr "Cambiar contraseña"
#: templates/_layout.html:67
#: templates/_layout.html:64
msgid "Emails"
msgstr "Emails"
#: templates/_layout.html:69
#: templates/_layout.html:66
msgid "Log out"
msgstr "Cerrar sesión"
#: templates/_layout.html:74
#: templates/_layout.html:71
msgid "Login"
msgstr "Iniciar sesión"
#: templates/_layout.html:77
#: templates/_layout.html:74
msgid "Register"
msgstr "Registrarse"
#: templates/_layout.html:141
#: templates/_layout.html:130
msgid "Select desired currency"
msgstr "Seleccionar moneda"
#: templates/_layout.html:149
#: templates/_layout.html:138
msgid "Language"
msgstr "Idioma"
@ -287,31 +308,70 @@ msgid ""
"Already have an account? Then please <a href=\"%(login_url)s\">sign in</a>."
msgstr "¿Ya tienes una cuenta? <a href=\"%(login_url)s\">Inicia sesión</a>."
#: templates/amiibo/amiibo.html:4 templates/amiibo/amiibo.html.py:6
#: templates/amiibo/amiibo.html:7
#: templates/amiibo/amiibo-figure.html:9 templates/amiibo/amiibo-figure.html:11
#: templates/amiibo/amiibo-figure.html:12
#, python-format
msgid "%(amiibo)s amiibo from %(collection)s in "
msgstr "%(amiibo)s amiibo de %(collection)s en "
#: templates/amiibo/amiibo.html:60
msgid "Shop"
msgstr "Tienda"
#: templates/amiibo/amiibo-figure.html:44
msgid "Available for trade"
msgstr "Disponible para cambio"
#: templates/amiibo/amiibo.html:61
msgid "Price"
msgstr "Precio"
#: templates/amiibo/amiibo-figure.html:46
msgid "I do not have it"
msgstr "No lo tengo"
#: templates/amiibo/amiibo.html:76
#: templates/amiibo/amiibo-figure.html:50
msgid "I do not want this"
msgstr "No lo quiero"
#: templates/amiibo/amiibo-figure.html:52
#: templates/amiibo/amiibo-figure.html:61
msgid "I want this"
msgstr "Lo quiero"
#: templates/amiibo/amiibo-figure.html:54
#: templates/amiibo/amiibo-figure.html:62
msgid "or"
msgstr "o"
#: templates/amiibo/amiibo-figure.html:55
#: templates/amiibo/amiibo-figure.html:63
msgid "I have this"
msgstr "Lo tengo"
#: templates/amiibo/amiibo-figure.html:66
msgid "Register and star collecting amiibo!"
msgstr "¡Regístrate y empieza a coleccionar Amiibo!"
#: templates/amiibo/amiibo-figure.html:85
msgid "Shops"
msgstr "Tiendas"
#: templates/amiibo/amiibo-figure.html:99
msgid "Buy now for"
msgstr "Comprar ahora por"
#: templates/amiibo/amiibo-figure.html:106
msgid "No stock"
msgstr "Sin stock"
#: templates/amiibo/amiibo-figure.html:114
msgid "Updated "
msgstr "Actualizado"
#: templates/amiibo/amiibo.html:82
#: templates/amiibo/amiibo-figure.html:117
msgid "This item had never been in stock"
msgstr "Este articulo nunca ha estado en stock"
#: templates/amiibo/amiibo-figure.html:123
msgid "This is a pack of various items"
msgstr "Este es un pack que contiene varios artículos"
#: templates/amiibo/amiibo.html:93
msgid "No stock"
msgstr "Sin stock"
#: templates/amiibo/collection-cards.html:9 templates/amiibo/collection.html:29
msgid "Search..."
msgstr "Buscar…"
#: templates/amiibo/collection.html:4 templates/amiibo/collection.html.py:6
#: templates/amiibo/collection.html:7
@ -323,9 +383,9 @@ msgstr "Amiibos de %(collection)s en "
msgid "All amiibo"
msgstr "Todos los amiibo"
#: templates/amiibo/collection.html:29
msgid "Search..."
msgstr "Buscar…"
#: templates/home/home.html:9
msgid "Welcome to amiibofindr!"
msgstr "¡Bienvenido a Amiibofindr!"
#: templates/socialaccount/connections.html:5
#: templates/socialaccount/connections.html:10
@ -352,3 +412,9 @@ msgstr "Asociar una red social"
#: urls.py:36
msgid "^account/"
msgstr "^mi-cuenta/"
#~ msgid "^(?P<collection>[\\w\\d\\-]+)/(?P<amiibo>[\\w\\d\\-]+)$"
#~ msgstr "^(?P<collection>[\\w\\d\\-]+)/(?P<amiibo>[\\w\\d\\-]+)$"
#~ msgid "Price"
#~ msgstr "Precio"

View File

@ -31,12 +31,12 @@
<div class="ui page grid">
<div class="computer tablet only row">
<div class="ui large menu navbar">
<a href="{% url 'home:redirect' %}" class="brand item">Amiibofindr</a>
<a href="{% url 'home:home' %}" class="brand item">Amiibofindr</a>
<div class="ui dropdown item">
{% trans "Figures" %}
<i class="dropdown icon"></i>
<div class="menu">
<a class="item" href="{% url 'amiibo:figures-list' %}">{% trans "All" %}</a>
<a class="item" href="{% url 'amiibo:figures-all' %}">{% trans "All" %}</a>
<div class="ui divider"></div>
{% for col in COLLECTIONS_FIGURES %}
<a class="item" href="{{ col.get_absolute_url }}">{{ col.name }}</a>
@ -48,7 +48,7 @@
{% trans "Cards" %}
<i class="dropdown icon"></i>
<div class="menu">
<a class="item" href="{% url 'amiibo:cards-list' %}">{% trans "All" %}</a>
<a class="item" href="{% url 'amiibo:cards-all' %}">{% trans "All" %}</a>
{% for col in COLLECTIONS_CARDS %}
<a class="item" href="{% url 'amiibo:cards-list' col.slug %}">{{ col.name }}</a>
{% endfor %}
@ -90,7 +90,7 @@
<div class="ui item">
<div class="text">{% trans 'Figures' %}</div>
<div class="menu">
<a class="item" href="{% url 'amiibo:figures-list' all_word %}">{% trans "All" %}</a>
<a class="item" href="{% url 'amiibo:figures-all' %}">{% trans "All" %}</a>
{% for col in COLLECTIONS_FIGURES %}
<a class="item" href="{% url 'amiibo:figures-list' col.slug %}">{{ col.name }}</a>
{% endfor %}
@ -99,7 +99,7 @@
<div class="ui item">
<div class="text">{% trans "Cards" %}</div>
<div class="menu">
<a class="item" href="{% url 'amiibo:cards-list' all_word %}">{% trans "All" %}</a>
<a class="item" href="{% url 'amiibo:cards-all' %}">{% trans "All" %}</a>
{% for col in COLLECTIONS_CARDS %}
<a class="item" href="{% url 'amiibo:cards-list' col.slug %}">{{ col.name }}</a>
{% endfor %}

View File

@ -38,22 +38,38 @@ AMIIBO FIGURE
</h2>
</div>
<div class="eight wide column right aligned">
{% if amiibo.pk in USER_AMIIBO_OWNED %}
<a href="{% url 'amiibo:user-action' amiibo=amiibo.pk action='=trade' %}" class="ui button {% if amiibo.pk in USER_AMIIBO_TRADE %}teal{% endif %}">
<i class="{% if amiibo.pk in USER_AMIIBO_TRADE %}check{% else %}cancel{% endif %} icon"></i> Available for trade
</a>
<a href="{% url 'amiibo:user-action' amiibo=amiibo.pk action='-owned' %}" class="ui button red">I do not have it</a>
{% if user.is_authenticated %}
{% if amiibo.pk in USER_AMIIBO_OWNED %}
<a href="{% url 'amiibo:user-action' amiibo=amiibo.pk action='=trade' %}" class="ui button {% if amiibo.pk in USER_AMIIBO_TRADE %}teal{% endif %}">
<i class="{% if amiibo.pk in USER_AMIIBO_TRADE %}check{% else %}cancel{% endif %} icon"></i> {% trans 'Available for trade' %}
</a>
<a href="{% url 'amiibo:user-action' amiibo=amiibo.pk action='-owned' %}" class="ui button red">{% trans 'I do not have it' %}</a>
{% else %}
<div class="ui buttons">
{% if amiibo.pk in USER_AMIIBO_WISHLIST %}
<a href="{% url 'amiibo:user-action' amiibo=amiibo.pk action='-wishlist' %}" class="ui button yellow">{% trans 'I do not want this' %}</a>
{% else %}
<a href="{% url 'amiibo:user-action' amiibo=amiibo.pk action='+wishlist' %}" class="ui button">{% trans 'I want this' %}</a>
{% endif %}
<div class="or" data-text="{% trans 'or' %}"></div>
<a href="{% url 'amiibo:user-action' amiibo=amiibo.pk action='+owned' %}" class="ui positive button">{% trans 'I have this' %}</a>
{% endif %}
</div>
{% else %}
<div class="ui buttons">
{% if amiibo.pk in USER_AMIIBO_WISHLIST %}
<a href="{% url 'amiibo:user-action' amiibo=amiibo.pk action='-wishlist' %}" class="ui button yellow">I do not want this</a>
{% else %}
<a href="{% url 'amiibo:user-action' amiibo=amiibo.pk action='+wishlist' %}" class="ui button">I want this</a>
{% endif %}
<div class="or" data-text="{% trans 'or' %}"></div>
<a href="{% url 'amiibo:user-action' amiibo=amiibo.pk action='+owned' %}" class="ui positive button">I have this</a>
<form action="{% url 'account_signup' %}" method="get">
<input type="hidden" name="next" value="{{ amiibo.get_absolute_url }}">
<button class="ui animated fade button standard">
<div class="visible content ui buttons">
<a href="#" class="ui button">{% trans 'I want this' %}</a>
<div class="or" data-text="{% trans 'or' %}"></div>
<a href="#" class="ui positive button">{% trans 'I have this' %}</a>
</div>
<div class="hidden content">
{% trans 'Register and star collecting amiibo!' %}
</div>
</button>
</form>
{% endif %}
</div>
</div>
</div>
</div>
@ -63,7 +79,7 @@ AMIIBO FIGURE
<div class="four wide column">
<div class="ui segment">
{% block amiibo_image %}
<img src="{% thumbnail amiibo.statue 340x340 crop %}" class="ui image centered" />
<img src="{% thumbnail amiibo.statue 340x340 crop %}" class="ui image centered" />
{% endblock %}
</div>
</div>

View File

@ -31,7 +31,7 @@
</div>
</div>
<div class="sixteen wide column">
<div class="ui four doubling cards" data-component="collectionList">
<div class="ui five doubling cards" data-component="collectionList">
{% for amiibo in amiibo_list %}
{% include "amiibo/widgets/amiibo-card.html" with amiibo=amiibo only %}
{% endfor %}