diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-04-07 10:47:39 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-04-07 10:47:39 +0200 |
commit | da4af2ab5d105f6d2ce442b517e532b7570616e3 (patch) | |
tree | e433f02a5f75ccce6b9de8f6d79dfb23a4a9142e | |
parent | e5ebf3169e52e5a425a56d7c908ba422969443de (diff) | |
download | Ishtar-da4af2ab5d105f6d2ce442b517e532b7570616e3.tar.bz2 Ishtar-da4af2ab5d105f6d2ce442b517e532b7570616e3.zip |
Treatment - Treatment files dashboard: first overview (refs #3381)
-rw-r--r-- | archaeological_finds/models_treatments.py | 10 | ||||
-rw-r--r-- | ishtar_common/models.py | 10 | ||||
-rw-r--r-- | ishtar_common/templates/ishtar/dashboards/dashboard_main.html | 11 | ||||
-rw-r--r-- | ishtar_common/views.py | 18 |
4 files changed, 34 insertions, 15 deletions
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 %} <script> -$(function() { $( "#dash-tabs" ).tabs(); }); +$(function() { + $( "#dash-tabs" ).tabs({ + beforeActivate: function( event, ui ) { + $("#progress").show(); + }, + load: function( event, ui ) { + $("#progress").hide(); + } + }); +}); </script> <div id='dashboard'> <div id="dash-tabs"> 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, |