From af5fa073a5cf6ecd05dcc46890447930f4d2f328 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 12 Oct 2022 12:27:13 +0200 Subject: Geo: quick add geo action for context records, sites and finds --- archaeological_context_records/models.py | 3 +++ archaeological_finds/models_finds.py | 4 ++++ archaeological_operations/models.py | 3 +++ ishtar_common/templates/ishtar/blocks/sheet_map.html | 4 ++-- 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/archaeological_context_records/models.py b/archaeological_context_records/models.py index d4341e6cb..08e94af85 100644 --- a/archaeological_context_records/models.py +++ b/archaeological_context_records/models.py @@ -1092,6 +1092,9 @@ class ContextRecord( actions = super(ContextRecord, self).get_extra_actions(request) # is_locked = hasattr(self, "is_locked") and self.is_locked(request.user) + can_add_geo = self.can_do(request, "add_geovectordata") + if can_add_geo: + actions.append(self.get_add_geo_action()) can_create_find = self.can_do(request, "add_find") if can_create_find: actions += [ diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py index e1cb2e299..d53f45fdb 100644 --- a/archaeological_finds/models_finds.py +++ b/archaeological_finds/models_finds.py @@ -2304,6 +2304,10 @@ class Find( actions = super(Find, self).get_extra_actions(request) is_locked = hasattr(self, "is_locked") and self.is_locked(request.user) + can_add_geo = self.can_do(request, "add_geovectordata") + if can_add_geo: + if self.base_finds.count() == 1: + actions.append(self.base_finds.all()[0].get_add_geo_action()) can_edit_find = self.can_do(request, "change_find") if can_edit_find and not is_locked: actions += [ diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index 0b21df533..78ade77f8 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -592,6 +592,9 @@ class ArchaeologicalSite( # url, base_text, icon, extra_text, extra css class, is a quick action actions = super(ArchaeologicalSite, self).get_extra_actions(request) # is_locked = self.is_locked(request.user) + can_add_geo = self.can_do(request, "add_geovectordata") + if can_add_geo: + actions.append(self.get_add_geo_action()) can_edit_site = self.can_do(request, "change_archaeologicalsite") if can_edit_site: diff --git a/ishtar_common/templates/ishtar/blocks/sheet_map.html b/ishtar_common/templates/ishtar/blocks/sheet_map.html index bb143f1dc..ab4d2a4ee 100644 --- a/ishtar_common/templates/ishtar/blocks/sheet_map.html +++ b/ishtar_common/templates/ishtar/blocks/sheet_map.html @@ -15,8 +15,8 @@ {% if not forloop.counter0 %}checked{% endif %} >  
- {{geodata.name}} + {% if geodata.data_type %}{{geodata.data_type}}{% else %}{{geodata.name}}{% endif %}
+ {% if geodata.data_type %}{{geodata.name}}{% endif %} {% endfor %} {% if geo_item.SLUG == "operation" and display_context_records %}
  • -- cgit v1.2.3