From de4f1f75bb57e53bee27d086c496d87f62cf3353 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 22 Mar 2017 18:44:27 +0100 Subject: Shortcut menu: hide/show information saved in the session --- ishtar_common/templates/ishtar/blocks/advanced_shortcut_menu.html | 6 +++++- ishtar_common/templates/ishtar/blocks/shortcut_menu.html | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'ishtar_common/templates') diff --git a/ishtar_common/templates/ishtar/blocks/advanced_shortcut_menu.html b/ishtar_common/templates/ishtar/blocks/advanced_shortcut_menu.html index 1758bcf54..5cea8b5a7 100644 --- a/ishtar_common/templates/ishtar/blocks/advanced_shortcut_menu.html +++ b/ishtar_common/templates/ishtar/blocks/advanced_shortcut_menu.html @@ -42,5 +42,9 @@ - + {% endif %} diff --git a/ishtar_common/templates/ishtar/blocks/shortcut_menu.html b/ishtar_common/templates/ishtar/blocks/shortcut_menu.html index 5973eba3f..c03cb3806 100644 --- a/ishtar_common/templates/ishtar/blocks/shortcut_menu.html +++ b/ishtar_common/templates/ishtar/blocks/shortcut_menu.html @@ -38,5 +38,8 @@ - + {% endif %} -- cgit v1.2.3 From 373169f3fa7682f8d260080a39261fc6216b9a21 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 23 Mar 2017 18:50:31 +0100 Subject: UI: use the url to detect the current action (more accurate) (refs #3357) --- ishtar_common/context_processors.py | 3 ++- ishtar_common/templates/base.html | 15 +++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) (limited to 'ishtar_common/templates') diff --git a/ishtar_common/context_processors.py b/ishtar_common/context_processors.py index 8e14d8506..5050d667e 100644 --- a/ishtar_common/context_processors.py +++ b/ishtar_common/context_processors.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# Copyright (C) 2010-2013 Étienne Loks +# Copyright (C) 2010-2017 Étienne Loks # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -44,6 +44,7 @@ def get_base_context(request): if 'CURRENT_ACTION' in request.session: dct['CURRENT_ACTION'] = request.session['CURRENT_ACTION'] current_action = dct['CURRENT_ACTION'] + dct['CURRENT_PATH'] = request.path menu = Menu(request.user, current_action=current_action, session=request.session) menu.init() diff --git a/ishtar_common/templates/base.html b/ishtar_common/templates/base.html index 614a83595..b20cb1ccb 100644 --- a/ishtar_common/templates/base.html +++ b/ishtar_common/templates/base.html @@ -90,15 +90,18 @@
  • {{section.label}}
      - {% for menu_item in section.childs %}{%if menu_item.available%} - {% if menu_item.childs %}
    • {{menu_item.label}} + {% for menu_item in section.childs %}{%if menu_item.available%} + {% if menu_item.childs %}
    • {{menu_item.label}}
        - {% for menu_subitem in menu_item.childs %}{%if menu_subitem.available%} -
      • {{menu_subitem.label}}
      • + {% for menu_subitem in menu_item.childs %}{% if menu_subitem.available %} + {% url 'action' menu_subitem.idx as item_url %} +
      • {{menu_subitem.label}}
      • {%endif%}{% endfor %}
    • - {%else%} + {% else %} + {% url 'action' menu_item.idx as item_url %} + class="{% if item_url in CURRENT_PATH %}selected{% endif %} {% if menu_item.css %}{{menu_item.css}}{% endif %}">{{menu_item.label}} {%endif%}{% endif %}{% endfor %}
  • {%endif%} -- cgit v1.2.3 From 8e43fd466902833c3354869758cfb5161b46aae5 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 6 Apr 2017 16:40:42 +0200 Subject: Enlarge your tables - twice the size (refs #3420) --- archaeological_finds/templates/ishtar/sheet_findbasket.html | 2 +- .../templates/ishtar/blocks/window_tables/dynamic_documents.html | 2 +- ishtar_common/templatetags/window_tables.py | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'ishtar_common/templates') diff --git a/archaeological_finds/templates/ishtar/sheet_findbasket.html b/archaeological_finds/templates/ishtar/sheet_findbasket.html index 6f8b12e6d..b6d4ffd42 100644 --- a/archaeological_finds/templates/ishtar/sheet_findbasket.html +++ b/archaeological_finds/templates/ishtar/sheet_findbasket.html @@ -9,5 +9,5 @@

    {{ item.label|default:"" }}

    {% field "Owned by" item.user %} {% field "Comment" item.comment %} -{% dynamic_table_document_large finds 'finds_for_ope' 'basket' item.pk 'TABLE_COLS_FOR_OPE' output %} +{% dynamic_table_document finds 'finds_for_ope' 'basket' item.pk 'TABLE_COLS_FOR_OPE' output %} {% endblock %} diff --git a/ishtar_common/templates/ishtar/blocks/window_tables/dynamic_documents.html b/ishtar_common/templates/ishtar/blocks/window_tables/dynamic_documents.html index f751cebe3..891cd0f6f 100644 --- a/ishtar_common/templates/ishtar/blocks/window_tables/dynamic_documents.html +++ b/ishtar_common/templates/ishtar/blocks/window_tables/dynamic_documents.html @@ -41,7 +41,7 @@ setTimeout( alert("{% trans "An error as occured during search. Check your query fields." %}"); } }); - {% if large %}jQuery("#grid_{{name}}").jqGrid('setGridHeight', 400);{% endif %} + {% if large %}jQuery("#grid_{{name}}").jqGrid('setGridHeight', 272);{% endif %} }, 200); diff --git a/ishtar_common/templatetags/window_tables.py b/ishtar_common/templatetags/window_tables.py index 960bc7184..bf4dd2b1a 100644 --- a/ishtar_common/templatetags/window_tables.py +++ b/ishtar_common/templatetags/window_tables.py @@ -71,7 +71,7 @@ ASSOCIATED_MODELS['containers'] = ( @register.simple_tag(takes_context=True) def dynamic_table_document( context, caption, associated_model, key, value, - table_cols='TABLE_COLS', output='html', large=False, + table_cols='TABLE_COLS', output='html', large=True, col_prefix=''): if not table_cols: table_cols = 'TABLE_COLS' @@ -135,9 +135,9 @@ def dynamic_table_document( @register.simple_tag(takes_context=True) -def dynamic_table_document_large( +def dynamic_table_document_small( context, caption, associated_model, key, value, table_cols='TABLE_COLS', output='html'): return dynamic_table_document( context, caption, associated_model, key, - value, table_cols, output, large=True) + value, table_cols, output, large=False) -- cgit v1.2.3 From da4af2ab5d105f6d2ce442b517e532b7570616e3 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Fri, 7 Apr 2017 10:47:39 +0200 Subject: Treatment - Treatment files dashboard: first overview (refs #3381) --- archaeological_finds/models_treatments.py | 10 +++++----- ishtar_common/models.py | 10 ++++------ .../templates/ishtar/dashboards/dashboard_main.html | 11 ++++++++++- ishtar_common/views.py | 18 +++++++++++++++--- 4 files changed, 34 insertions(+), 15 deletions(-) (limited to 'ishtar_common/templates') diff --git a/archaeological_finds/models_treatments.py b/archaeological_finds/models_treatments.py index 0f7c56678..20e91155a 100644 --- a/archaeological_finds/models_treatments.py +++ b/archaeological_finds/models_treatments.py @@ -30,7 +30,7 @@ from django.utils.translation import ugettext_lazy as _, ugettext from ishtar_common.utils import cached_label_changed from ishtar_common.models import GeneralType, ImageModel, BaseHistorizedItem, \ OwnPerms, HistoricalRecords, Person, Organization, Source, \ - ValueGetter, post_save_cache, ShortMenuItem + ValueGetter, post_save_cache, ShortMenuItem, DashboardFormItem from archaeological_warehouse.models import Warehouse, Container from archaeological_finds.models_finds import Find, FindBasket from archaeological_operations.models import ClosedItem, Operation @@ -69,8 +69,8 @@ post_save.connect(post_save_cache, sender=TreatmentState) post_delete.connect(post_save_cache, sender=TreatmentState) -class Treatment(ValueGetter, BaseHistorizedItem, ImageModel, OwnPerms, - ShortMenuItem): +class Treatment(DashboardFormItem, ValueGetter, BaseHistorizedItem, + ImageModel, OwnPerms, ShortMenuItem): SHOW_URL = 'show-treatment' TABLE_COLS = ('year', 'index', 'treatment_types__label', 'treatment_state__label', @@ -472,8 +472,8 @@ post_save.connect(post_save_cache, sender=TreatmentFileType) post_delete.connect(post_save_cache, sender=TreatmentFileType) -class TreatmentFile(ClosedItem, BaseHistorizedItem, OwnPerms, ValueGetter, - ShortMenuItem): +class TreatmentFile(DashboardFormItem, ClosedItem, BaseHistorizedItem, + OwnPerms, ValueGetter, ShortMenuItem): SLUG = 'treatmentfile' SHOW_URL = 'show-treatmentfile' TABLE_COLS = ['type', 'year', 'index', 'internal_reference', 'name'] diff --git a/ishtar_common/models.py b/ishtar_common/models.py index d8ba637db..988254359 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -2323,14 +2323,12 @@ class Import(models.Model): conservative_import = models.BooleanField( _(u"Conservative import"), default=False, help_text='If set to true, do not overload existing values') - creation_date = models.DateTimeField(_(u"Creation date"), - auto_now_add=True, blank=True, - null=True) + creation_date = models.DateTimeField( + _(u"Creation date"), auto_now_add=True, blank=True, null=True) end_date = models.DateTimeField(_(u"End date"), blank=True, null=True, editable=False) - seconds_remaining = models.IntegerField(_(u"Remaining seconds"), - blank=True, null=True, - editable=False) + seconds_remaining = models.IntegerField( + _(u"Remaining seconds"), blank=True, null=True, editable=False) class Meta: verbose_name = _(u"Import") diff --git a/ishtar_common/templates/ishtar/dashboards/dashboard_main.html b/ishtar_common/templates/ishtar/dashboards/dashboard_main.html index 93e11d604..6a5a67a63 100644 --- a/ishtar_common/templates/ishtar/dashboards/dashboard_main.html +++ b/ishtar_common/templates/ishtar/dashboards/dashboard_main.html @@ -15,7 +15,16 @@ {% endblock %} {% block content %}
    diff --git a/ishtar_common/views.py b/ishtar_common/views.py index 4732313ea..e8a2c9e12 100644 --- a/ishtar_common/views.py +++ b/ishtar_common/views.py @@ -1451,6 +1451,9 @@ def dashboard_main(request, dct, obj_id=None, *args, **kwargs): app_list.append((_(u"Context records"), 'contextrecords')) if profile.find: app_list.append((_(u"Finds"), 'finds')) + if profile.warehouse: + app_list.append((_(u"Treatment requests"), 'treatmentfiles')) + app_list.append((_(u"Treatments"), 'treatments')) dct = {'app_list': app_list} return render_to_response('ishtar/dashboards/dashboard_main.html', dct, context_instance=RequestContext(request)) @@ -1497,18 +1500,27 @@ def dashboard_main_detail(request, item_name): if item_name == 'files' and profile.files: lbl, dashboard = (_(u"Archaeological files"), models.Dashboard(File, **dashboard_kwargs)) - if item_name == 'operations': + elif item_name == 'operations': from archaeological_operations.models import Operation lbl, dashboard = (_(u"Operations"), models.Dashboard(Operation, **dashboard_kwargs)) - if item_name == 'contextrecords' and profile.context_record: + elif item_name == 'contextrecords' and profile.context_record: lbl, dashboard = ( _(u"Context records"), models.Dashboard(ContextRecord, slice=slicing, fltr=fltr)) - if item_name == 'finds' and profile.find: + elif item_name == 'finds' and profile.find: lbl, dashboard = (_(u"Finds"), models.Dashboard(Find, slice=slicing, fltr=fltr)) + elif item_name == 'treatmentfiles' and profile.warehouse: + lbl, dashboard = ( + _(u"Treatment requests"), + models.Dashboard(TreatmentFile, slice=slicing, fltr=fltr)) + elif item_name == 'treatments' and profile.warehouse: + lbl, dashboard = ( + _(u"Treatments"), + models.Dashboard(Treatment, slice=slicing, fltr=fltr, + date_source='start')) if not lbl: raise Http404 dct = {'lbl': lbl, 'dashboard': dashboard, -- cgit v1.2.3