Skip to content

Commit

Permalink
Improve dashboard results template
Browse files Browse the repository at this point in the history
  • Loading branch information
artursmet committed Dec 14, 2016
1 parent bda7d64 commit 696b550
Showing 1 changed file with 30 additions and 38 deletions.
68 changes: 30 additions & 38 deletions templates/dashboard/search/results.html
Expand Up @@ -3,6 +3,7 @@
{% load prices_i18n %}
{% load materializecss %}
{% load staticfiles %}
{% load product_first_image from product_images %}

{% block title %}{% trans "Search results" %} - {{ block.super }}{% endblock %}

Expand All @@ -27,53 +28,44 @@
<div class="col s12">
<form class="row" method="get" action="{% url "dashboard:search" %}">
<input type="hidden" class="validate" name="q" value="{% if query %}{{ query }}{% endif %}">
<div class="row">
{{ form.search_in|materializecss:"s8 m4" }}
<div class="col s4 m2 left-align">
<button type="submit" class="btn btn--inline">
{% trans "Filter" %}
</button>
</div>
</div>
</form>
</div>
</div>
{% if results %}
<ul class="collection list">
{% for product in results %}
{% for result in results %}
<li class="collection-item avatar list-item">
{% if product.images.exists %}
<img src="{{ product.images.first.image.crop.100x100 }}" alt="" class="circle teal">
{% else %}
<img src="{% static 'images/product-image-placeholder-small.png' %}" alt="" class="circle teal">
{% endif %}
<a class="title" href="{% url 'dashboard:product-update' pk=product.pk %}">
<span class="list-item-name">{{ product.name }}</span>
{% if result.content_type == 'product_product' %}
{% with product=result %}
<img src="{% product_first_image product size="100x100" method="crop" %}" class="circle teal" alt="{{ product.name }}">
<a class="title" href="{% url 'dashboard:product-update' pk=product.pk %}">
<span class="list-item-name">{{ product.name }}</span>
</a>
<p class="list-item-price">
<small>{% gross product.price %}</small>
</p>
{% endwith %}
{% elif result.content_type == 'order_order' %}
<img src="{% static 'images/product-image-placeholder-small.png' %}" alt="" class="circle teal">
<a class="title" href="{% url 'dashboard:order-details' order_pk=result.pk %}">
<span class="list-item-name">Order #{{ result.pk }}</span>
</a>
<p class="list-item-price">
<small>{% gross product.price %}</small>
<small>Customer: {{ result.user_email }}</small>
<small>
Placed: {{ result.created }}
</small>

</p>
{% elif result.content_type == 'userprofile_user' %}
<img src="{% static 'images/product-image-placeholder-small.png' %}" alt="" class="circle teal">
<a class="title" href="{% url 'dashboard:order-details' order_pk=result.pk %}">
<span class="list-item-name">User {{ result.get_full_name }}</span>
</a>
<p class="list-item-price">
<small>Customer</small>
</p>
{# {% elif result.model_name == 'order' %}#}
{# <img src="{% static 'images/product-image-placeholder-small.png' %}" alt="" class="circle teal">#}
{# <a class="title" href="{% url 'dashboard:order-details' order_pk=result.pk %}">#}
{# <span class="list-item-name">Order #{{ result.object.pk }}</span>#}
{# </a>#}
{# <p class="list-item-price">#}
{# <small>Customer: {{ result.object.user_email }}</small>#}
{# <small>#}
{# Placed: {{ result.object.created }}#}
{# </small>#}
{##}
{# </p>#}
{# {% elif result.model_name == 'user' %}#}
{# <img src="{% static 'images/product-image-placeholder-small.png' %}" alt="" class="circle teal">#}
{# <a class="title" href="{% url 'dashboard:order-details' order_pk=result.pk %}">#}
{# <span class="list-item-name">User {{ result.object.get_full_name }}</span>#}
{# </a>#}
{# <p class="list-item-price">#}
{# <small>Customer</small>#}
{# </p>#}
{# {% endif %}#}
{% endif %}
</li>
{% endfor %}
</ul>
Expand Down

0 comments on commit 696b550

Please sign in to comment.