diff options
| -rw-r--r-- | archaeological_warehouse/forms.py | 4 | ||||
| -rw-r--r-- | archaeological_warehouse/models.py | 6 | ||||
| -rw-r--r-- | archaeological_warehouse/templates/ishtar/sheet_container.html | 48 | ||||
| -rw-r--r-- | archaeological_warehouse/templates/ishtar/sheet_warehouse.html | 84 | 
4 files changed, 86 insertions, 56 deletions
| diff --git a/archaeological_warehouse/forms.py b/archaeological_warehouse/forms.py index 973da2014..5ace42a0e 100644 --- a/archaeological_warehouse/forms.py +++ b/archaeological_warehouse/forms.py @@ -78,6 +78,7 @@ SelectedDivisionFormset.form_slug = "warehouse-020-divisions"  class WarehouseSelect(TableSelect): +    search_vector = forms.CharField(label=_(u"Full text search"))      name = forms.CharField(label=_(u"Name"))      warehouse_type = forms.ChoiceField(label=_(u"Warehouse type"), choices=[])      towns = forms.CharField(label=_(u"Town")) @@ -91,6 +92,7 @@ class WarehouseSelect(TableSelect):  class WarehouseFormSelection(forms.Form): +    SEARCH_AND_SELECT = True      form_label = _("Warehouse search")      associated_models = {'pk': models.Warehouse}      currents = {'pk': models.Warehouse} @@ -243,6 +245,7 @@ class ContainerModifyForm(ContainerForm):  class ContainerSelect(TableSelect): +    search_vector = forms.CharField(label=_(u"Full text search"))      location = get_warehouse_field()      container_type = forms.ChoiceField(label=_(u"Container type"), choices=[])      reference = forms.CharField(label=_(u"Ref.")) @@ -254,6 +257,7 @@ class ContainerSelect(TableSelect):          self.fields['container_type'].help_text = \              models.ContainerType.get_help() +  ContainerFormSelection = get_form_selection(      'ContainerFormSelection', _(u"Container search"), 'container',      models.Container, ContainerSelect, 'get-container', diff --git a/archaeological_warehouse/models.py b/archaeological_warehouse/models.py index d6c33583f..1aad71111 100644 --- a/archaeological_warehouse/models.py +++ b/archaeological_warehouse/models.py @@ -63,6 +63,8 @@ class Warehouse(Address, DashboardFormItem, OwnPerms):          _(u"External ID is set automatically"), default=False)      TABLE_COLS = ['name', 'warehouse_type'] +    BASE_SEARCH_VECTORS = ['name', 'warehouse_type__label', "external_id", +                           "town", "comment"]      class Meta:          verbose_name = _(u"Warehouse") @@ -261,6 +263,10 @@ class Container(LightHistorizedItem, ImageModel):      TABLE_COLS = ['reference', 'container_type__label', 'cached_location',                    'divisions_lbl']      IMAGE_PREFIX = 'containers/' +    BASE_SEARCH_VECTORS = ['reference', 'container_type__label', +                           'cached_location'] +    M2M_SEARCH_VECTORS = ['division__reference', +                          'division__division__division__label']      # search parameters      EXTRA_REQUEST_KEYS = { diff --git a/archaeological_warehouse/templates/ishtar/sheet_container.html b/archaeological_warehouse/templates/ishtar/sheet_container.html index 7c9f84a32..b1e74fb88 100644 --- a/archaeological_warehouse/templates/ishtar/sheet_container.html +++ b/archaeological_warehouse/templates/ishtar/sheet_container.html @@ -1,29 +1,41 @@  {% extends "ishtar/sheet.html" %}  {% load i18n window_header window_field window_tables %} -{% block head_title %}{% trans "Container" %}{% endblock %} +{% block head_title %}<strong>{% trans "Container" %}</strong> - {{ item.reference|default:"" }} ({{ item.container_type|default:"" }}){% endblock %} -{% block content %} +{% block toolbar %}  {% window_nav item window_id 'show-container' 'container_modify' '' '' previous next 1 %} +{% endblock %} -{% if item.image %} -<a href='{{item.image.url}}' rel="prettyPhoto" title="{{item.label}}" class='photo'><img src='{{item.thumbnail.url}}'/></a> -{% endif%} - -<p class="window-refs">{{ item.reference|default:"" }}</p> -<p class="window-refs">{{ item.container_type|default:"" }}</p> -<p class="window-refs">{{ item.responsible.name }} - {{ item.index }}</p> -{% include "ishtar/blocks/sheet_external_id.html" %} - -<ul class='form-flex'> -    {% field_li_detail "Responsible warehouse" item.responsible %} -    {% field_li_detail "Location (warehouse)" item.location %} +{% block content %} +<div class="row"> +    <div class="offset-lg-4 col-lg-4 offset-md-3 col-md-6 offset-sm-1 col-sm-10 col-12"> +        <div class="card"> +            {% if item.image %} +            <img class='card-img-top' src="{{item.thumbnail.url}}"> +            {% endif%} +            <div class="card-body"> +                <p class="card-text"> +                    <p class="window-refs">{{ item.reference|default:"" }}</p> +                    <p class="window-refs">{{ item.container_type|default:"" }}</p> +                    <p class="window-refs">{{ item.responsible.name }} - {{ item.index }}</p> +                    {% include "ishtar/blocks/sheet_external_id.html" %} +                </p> +            </div> +        </div> +    </div> +</div> + + +<div class="row"> +    {% field_flex_detail "Responsible warehouse" item.responsible %} +    {% field_flex_detail "Location (warehouse)" item.location %}      {% include "ishtar/blocks/sheet_creation_section.html" %} -</ul> -{% field "Location" item.precise_location %} -{% field "Comment" item.comment "<pre>" "</pre>" %} +    {% field_flex "Location" item.precise_location %} +    {% field_flex_full "Comment" item.comment "<pre>" "</pre>" %} +    {% include "ishtar/blocks/sheet_json.html" %} +</div> -{% include "ishtar/blocks/sheet_json.html" %}  {% if item.finds.count %}  <h4>{% trans "Content" %}</h4> diff --git a/archaeological_warehouse/templates/ishtar/sheet_warehouse.html b/archaeological_warehouse/templates/ishtar/sheet_warehouse.html index de93f9af3..03a8eec5c 100644 --- a/archaeological_warehouse/templates/ishtar/sheet_warehouse.html +++ b/archaeological_warehouse/templates/ishtar/sheet_warehouse.html @@ -1,23 +1,39 @@  {% extends "ishtar/sheet.html" %}  {% load i18n window_header window_field window_tables %} -{% block head_title %}{% trans "Warehouse" %}{% endblock %} +{% block head_title %}<strong>{% trans "Warehouse" %}</strong> - {{item.name}} ({{item.warehouse_type}}){% endblock %} +{% block toolbar %} +{% window_nav item window_id 'show-warehouse' 'warehouse_modify' '' '' previous next 1 %} +{% endblock %}  {% block content %} -{% window_nav item window_id 'show-warehouse' 'warehouse_modify' '' '' previous next 1 %} -<p class="window-refs">{{ item.name|default:"" }}</p> -<p class="window-refs">{{ item.warehouse_type|default:"" }}</p> -{% include "ishtar/blocks/sheet_external_id.html" %} +<div class="row"> +    <div class="offset-lg-4 col-lg-4 offset-md-3 col-md-6 offset-sm-1 col-sm-10 col-12"> +        <div class="card"> +            {% if item.image %} +            <img class='card-img-top' src="{{item.thumbnail.url}}"> +            {% endif%} +            <div class="card-body"> +                <p class="card-text"> +                    <p class="window-refs">{{ item.name|default:"" }}</p> +                    <p class="window-refs">{{ item.warehouse_type|default:"" }}</p> +                    {% include "ishtar/blocks/sheet_external_id.html" %} +                </p> +            </div> +        </div> +    </div> +</div> + -<ul class='form-flex'> -    {% field_li "Person in charge" item.person_in_charge %} +<div class='row'> +    {% field_flex "Person in charge" item.person_in_charge %}      {% include "ishtar/blocks/sheet_creation_section.html" %} -</ul> -{% include "ishtar/blocks/sheet_address_section.html" %} -{% field "Comment" item.comment "<pre>" "</pre>" %} +    {% include "ishtar/blocks/sheet_address_section.html" %} +    {% field_flex_full "Comment" item.comment "<pre>" "</pre>" %} +    {% include "ishtar/blocks/sheet_json.html" %} +</div> -{% include "ishtar/blocks/sheet_json.html" %}  {% if item.containers.count %}  <h4>{% trans "Containers" %}</h4> @@ -33,44 +49,36 @@  <small class="centered"><em>{% trans "These numbers are updated hourly" %}</em></small>  <h4>{% trans "Finds" %}</h4> -<ul class='form-flex'> -    {% field_li "Number of attached finds" item.number_of_finds %} -    {% field_li "Number of hosted finds" item.number_of_finds_hosted %} -</ul> +<div class='row'> +    {% field_flex_2 "Number of attached finds" item.number_of_finds %} +    {% field_flex_2 "Number of hosted finds" item.number_of_finds_hosted %} +</div>  {% if item.number_of_finds_by_place %}  <h4>{% trans "Finds by location in the warehouse" %}</h4> -<ul class='form-flex'> -    {% for items in item.number_of_finds_by_place %} -    <li> -        <table class='clean-table small'> -            {% for item in items %} -                <tr><th>{{item.0}}</th><td>{{item.1}}</td></tr> -            {% endfor %} -        </table> -    </li> +{% for items in item.number_of_finds_by_place %} +<table class='table table-striped'> +    {% for item in items %} +    <tr><th>{{item.0}}</th><td>{{item.1}}</td></tr>      {% endfor %} -</ul> +</table> +{% endfor %}  {% endif %}  <h4>{% trans "Containers" %}</h4> -<ul class='form-flex'> -    {% field_li "Number of containers" item.number_of_containers %} -</ul> +<div class='row'> +    {% field_flex_2 "Number of containers" item.number_of_containers %} +</div>  {% if item.number_of_containers_by_place %}  <h4>{% trans "Containers by location in the warehouse" %}</h4> -<ul class='form-flex'> -    {% for items in item.number_of_containers_by_place %} -    <li> -        <table class='clean-table small'> -            {% for item in items %} -            <tr><th>{{item.0}}</th><td>{{item.1}}</td></tr> -            {% endfor %} -        </table> -    </li> +{% for items in item.number_of_containers_by_place %} +<table class='table table-striped'> +    {% for item in items %} +    <tr><th>{{item.0}}</th><td>{{item.1}}</td></tr>      {% endfor %} -</ul> +</table> +{% endfor %}  {% endif %}  {% endblock %} | 
