diff options
Diffstat (limited to 'ishtar_common')
-rw-r--r-- | ishtar_common/models_common.py | 24 | ||||
-rw-r--r-- | ishtar_common/templates/blocks/DataTables.html | 6 |
2 files changed, 24 insertions, 6 deletions
diff --git a/ishtar_common/models_common.py b/ishtar_common/models_common.py index 0d8eeac54..83955ab73 100644 --- a/ishtar_common/models_common.py +++ b/ishtar_common/models_common.py @@ -2701,7 +2701,14 @@ class QuickAction: """ def __init__( - self, url, icon_class="", text="", target=None, rights=None, module=None + self, + url, + icon_class="", + text="", + target=None, + rights=None, + module=None, + is_popup=True, ): self.url = url self.icon_class = icon_class @@ -2709,6 +2716,7 @@ class QuickAction: self.rights = rights self.target = target self.module = module + self.is_popup = is_popup assert self.target in ("one", "many", None) def is_available(self, user, session=None, obj=None): @@ -3255,8 +3263,13 @@ class ShortMenuItem: class SerializeItem: SERIALIZE_EXCLUDE = ["search_vector"] - SERIALIZE_PROPERTIES = ["external_id", "multi_polygon_geojson", "point_2d_geojson", - "images_number", "json_sections"] + SERIALIZE_PROPERTIES = [ + "external_id", + "multi_polygon_geojson", + "point_2d_geojson", + "images_number", + "json_sections", + ] SERIALIZE_CALL = {} SERIALIZE_DATES = [] SERIALIZATION_FILES = [] @@ -3284,7 +3297,7 @@ class SerializeItem: and hasattr(value, "full_serialize") and not recursion ): - #print(field.name, self.__class__, self) + # print(field.name, self.__class__, self) value = value.full_serialize(recursion=True) elif field_name in self.SERIALIZATION_FILES: try: @@ -3305,7 +3318,7 @@ class SerializeItem: and hasattr(first_value, "full_serialize") and not recursion ): - #print(field.name, self.__class__, self) + # print(field.name, self.__class__, self) values = [ v.full_serialize(recursion=True) for v in values.all() ] @@ -3400,6 +3413,7 @@ class MainItem(ShortMenuItem, SerializeItem): mark_safe(action.text), mark_safe(action.rendered_icon), action.target or "", + action.is_popup, ] ) return qas diff --git a/ishtar_common/templates/blocks/DataTables.html b/ishtar_common/templates/blocks/DataTables.html index 2719a9b46..a4b34cd04 100644 --- a/ishtar_common/templates/blocks/DataTables.html +++ b/ishtar_common/templates/blocks/DataTables.html @@ -223,7 +223,7 @@ jQuery(document).ready(function(){ "style": {% if multiple_select or quick_actions %}'multi'{% else %}'single'{% endif %} }, {% if multiple_select or quick_actions %}"buttons": [ - {% for url, title, icon, target in quick_actions %} + {% for url, title, icon, target, is_popup in quick_actions %} { {% if target == 'one' %}extend: 'selectedSingle', {% elif target == 'many' %}extend: 'selected', @@ -233,7 +233,11 @@ jQuery(document).ready(function(){ titleAttr: "{{title}}", action: function (e, dt, node, config) { var url = dt_generate_qa_url(dt, "{{url}}"); + {% if is_popup %} dt_qa_open(url); + {% else %} + window.location.href = url; + {% endif %} return false; } }, |