Add cell hilighting function when jumping to a container from a search result
This commit is contained in:
parent
558033e67e
commit
a35537d52c
15 changed files with 36 additions and 31 deletions
|
@ -46,6 +46,10 @@ td.disabled {
|
|||
align-items: center;
|
||||
}
|
||||
|
||||
.search-hilight {
|
||||
background-color: #ffa0a0;
|
||||
}
|
||||
|
||||
.cell:nth-child(2n) {
|
||||
background-color: #f8f8f8;
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<h3>Items</h3>
|
||||
<ul>
|
||||
{% for item in box.item_related.all %}
|
||||
<li><a href="{% url 'item-detail' item.id %}" title="{{ item.description }}">{{ item.name }}</a></li>
|
||||
<li {% if hilight == item.id %}class="hilighted"{% endif %}><a href="{% url 'item-detail' item.id %}" title="{{ item.description }}">{{ item.name }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<td rowspan="2">
|
||||
<div class="compartments-vertical">
|
||||
{% for compartment in layouted.0.0 %}
|
||||
{% include "inventory/cell.html" with item=compartment %}
|
||||
{% include "inventory/cell.html" with item=compartment hilight=hilight %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</td>
|
||||
|
@ -17,7 +17,7 @@
|
|||
<td class="triple-height" colspan="3">
|
||||
<div class="compartments">
|
||||
{% for compartment in layouted.0.1 %}
|
||||
{% include "inventory/cell.html" with item=compartment %}
|
||||
{% include "inventory/cell.html" with item=compartment hilight=hilight %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</td>
|
||||
|
@ -27,7 +27,7 @@
|
|||
<td class="triple-height">
|
||||
<div class="compartments">
|
||||
{% for compartment in item %}
|
||||
{% include "inventory/cell.html" with item=compartment %}
|
||||
{% include "inventory/cell.html" with item=compartment hilight=hilight %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</td>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<td>
|
||||
<div class="compartments">
|
||||
{% for compartment in layouted.0 %}
|
||||
{% include "inventory/cell.html" with item=compartment %}
|
||||
{% include "inventory/cell.html" with item=compartment hilight=hilight %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</td>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<td class="double-height">
|
||||
<div class="compartments">
|
||||
{% for compartment in item %}
|
||||
{% include "inventory/cell.html" with item=compartment %}
|
||||
{% include "inventory/cell.html" with item=compartment hilight=hilight %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</td>
|
||||
|
@ -20,7 +20,7 @@
|
|||
<td rowspan="2">
|
||||
<div class="compartments-vertical">
|
||||
{% for compartment in layouted.1.0 %}
|
||||
{% include "inventory/cell.html" with item=compartment %}
|
||||
{% include "inventory/cell.html" with item=compartment hilight=hilight %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</td>
|
||||
|
@ -29,7 +29,7 @@
|
|||
<td class="double-height">
|
||||
<div class="compartments">
|
||||
{% for compartment in item %}
|
||||
{% include "inventory/cell.html" with item=compartment %}
|
||||
{% include "inventory/cell.html" with item=compartment hilight=hilight %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</td>
|
||||
|
@ -40,7 +40,7 @@
|
|||
<td class="double-height">
|
||||
<div class="compartments">
|
||||
{% for compartment in item %}
|
||||
{% include "inventory/cell.html" with item=compartment %}
|
||||
{% include "inventory/cell.html" with item=compartment hilight=hilight %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</td>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<td>
|
||||
<div class="compartments">
|
||||
{% for compartment in item %}
|
||||
{% include "inventory/cell.html" with item=compartment %}
|
||||
{% include "inventory/cell.html" with item=compartment hilight=hilight %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</td>
|
||||
|
@ -27,7 +27,7 @@
|
|||
<td>
|
||||
<div class="compartments">
|
||||
{% for compartment in item %}
|
||||
{% include "inventory/cell.html" with item=compartment %}
|
||||
{% include "inventory/cell.html" with item=compartment hilight=hilight %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</td>
|
||||
|
@ -42,7 +42,7 @@
|
|||
<td>
|
||||
<div class="compartments">
|
||||
{% for compartment in item %}
|
||||
{% include "inventory/cell.html" with item=compartment %}
|
||||
{% include "inventory/cell.html" with item=compartment hilight=hilight %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</td>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<td class="double-height">
|
||||
<div class="compartments">
|
||||
{% for compartment in item %}
|
||||
{% include "inventory/cell.html" with item=compartment %}
|
||||
{% include "inventory/cell.html" with item=compartment hilight=hilight %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</td>
|
||||
|
@ -27,7 +27,7 @@
|
|||
<td class="double-height">
|
||||
<div class="compartments">
|
||||
{% for compartment in item %}
|
||||
{% include "inventory/cell.html" with item=compartment %}
|
||||
{% include "inventory/cell.html" with item=compartment hilight=hilight %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</td>
|
||||
|
@ -42,7 +42,7 @@
|
|||
<td class="double-height">
|
||||
<div class="compartments">
|
||||
{% for compartment in item %}
|
||||
{% include "inventory/cell.html" with item=compartment %}
|
||||
{% include "inventory/cell.html" with item=compartment hilight=hilight %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</td>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<td>
|
||||
<div class="compartments">
|
||||
{% for compartment in item %}
|
||||
{% include "inventory/cell.html" with item=compartment %}
|
||||
{% include "inventory/cell.html" with item=compartment hilight=hilight %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</td>
|
||||
|
@ -27,7 +27,7 @@
|
|||
<td>
|
||||
<div class="compartments">
|
||||
{% for compartment in item %}
|
||||
{% include "inventory/cell.html" with item=compartment %}
|
||||
{% include "inventory/cell.html" with item=compartment hilight=hilight %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</td>
|
||||
|
@ -42,7 +42,7 @@
|
|||
<td>
|
||||
<div class="compartments">
|
||||
{% for compartment in item %}
|
||||
{% include "inventory/cell.html" with item=compartment %}
|
||||
{% include "inventory/cell.html" with item=compartment hilight=hilight %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</td>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<td>
|
||||
<div class="compartments">
|
||||
{% for compartment in item %}
|
||||
{% include "inventory/cell.html" with item=compartment %}
|
||||
{% include "inventory/cell.html" with item=compartment hilight=hilight %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</td>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<td>
|
||||
<div class="compartments">
|
||||
{% for compartment in item %}
|
||||
{% include "inventory/cell.html" with item=compartment %}
|
||||
{% include "inventory/cell.html" with item=compartment hilight=hilight %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</td>
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
<td>
|
||||
<div class="compartments">
|
||||
{% for compartment in item %}
|
||||
{% include "inventory/cell.html" with item=compartment %}
|
||||
{% include "inventory/cell.html" with item=compartment hilight=hilight %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</td>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<td class="double-height">
|
||||
<div class="compartments">
|
||||
{% for compartment in item %}
|
||||
{% include "inventory/cell.html" with item=compartment %}
|
||||
{% include "inventory/cell.html" with item=compartment hilight=hilight %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</td>
|
||||
|
@ -21,7 +21,7 @@
|
|||
<td class="double-height">
|
||||
<div class="compartments">
|
||||
{% for compartment in item %}
|
||||
{% include "inventory/cell.html" with item=compartment %}
|
||||
{% include "inventory/cell.html" with item=compartment hilight=hilight %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</td>
|
||||
|
@ -32,7 +32,7 @@
|
|||
<td class="double-height">
|
||||
<div class="compartments">
|
||||
{% for compartment in item %}
|
||||
{% include "inventory/cell.html" with item=compartment %}
|
||||
{% include "inventory/cell.html" with item=compartment hilight=hilight %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</td>
|
||||
|
@ -45,7 +45,7 @@
|
|||
<td class="double-height">
|
||||
<div class="compartments">
|
||||
{% for compartment in item %}
|
||||
{% include "inventory/cell.html" with item=compartment %}
|
||||
{% include "inventory/cell.html" with item=compartment hilight=hilight %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</td>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<td class="double-height">
|
||||
<div class="compartments">
|
||||
{% for compartment in item %}
|
||||
{% include "inventory/cell.html" with item=compartment %}
|
||||
{% include "inventory/cell.html" with item=compartment hilight=hilight %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</td>
|
||||
|
@ -21,7 +21,7 @@
|
|||
<td class="double-height">
|
||||
<div class="compartments">
|
||||
{% for compartment in item %}
|
||||
{% include "inventory/cell.html" with item=compartment %}
|
||||
{% include "inventory/cell.html" with item=compartment hilight=hilight %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</td>
|
||||
|
@ -32,7 +32,7 @@
|
|||
<td class="double-height">
|
||||
<div class="compartments">
|
||||
{% for compartment in item %}
|
||||
{% include "inventory/cell.html" with item=compartment %}
|
||||
{% include "inventory/cell.html" with item=compartment hilight=hilight %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</td>
|
||||
|
@ -45,7 +45,7 @@
|
|||
<td class="double-height">
|
||||
<div class="compartments">
|
||||
{% for compartment in item %}
|
||||
{% include "inventory/cell.html" with item=compartment %}
|
||||
{% include "inventory/cell.html" with item=compartment hilight=hilight %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</td>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
{% load static %}
|
||||
{% load admin_urls %}
|
||||
|
||||
<div class="cell">
|
||||
<div class="cell{% if hilight == item.id %} search-hilight{% endif %}">
|
||||
{% if item.name %}
|
||||
{% if item.metadata.package %}
|
||||
<div class="package">{{ item.metadata.package }}</div>
|
||||
|
|
|
@ -49,9 +49,11 @@ class BoxView(CanBeIndexMixin, DetailView):
|
|||
return result, idx
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
hilighted = int(request.GET.get('hilight', "0"))
|
||||
self.object = cast(Box, self.get_object())
|
||||
context = self.get_context_data(object=self.object)
|
||||
context['layouted'], _ = self.layout(self.object.item_related.all().order_by('index'), self.object.layout.data)
|
||||
context['hilight'] = hilighted
|
||||
return self.render_to_response(context)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue