summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2024-11-06 14:58:10 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2025-02-19 14:43:49 +0100
commitf5e0f52320fbf618b97e275c54f39176303d060d (patch)
treea5f0e6ad705dd935ad43122f578352d49f3b279b
parent6a26d7e015b00039f2c6754d828d79915fdc1c23 (diff)
downloadIshtar-f5e0f52320fbf618b97e275c54f39176303d060d.tar.bz2
Ishtar-f5e0f52320fbf618b97e275c54f39176303d060d.zip
💄 quick actions: put management actions in orange
-rw-r--r--archaeological_context_records/models.py2
-rw-r--r--archaeological_files/models.py1
-rw-r--r--archaeological_finds/models_finds.py2
-rw-r--r--archaeological_operations/models.py4
-rw-r--r--archaeological_warehouse/models.py4
-rw-r--r--ishtar_common/models_common.py3
-rw-r--r--ishtar_common/templates/blocks/DataTables.html4
-rw-r--r--scss/custom.scss8
8 files changed, 26 insertions, 2 deletions
diff --git a/archaeological_context_records/models.py b/archaeological_context_records/models.py
index a3219e76a..50b9bbf42 100644
--- a/archaeological_context_records/models.py
+++ b/archaeological_context_records/models.py
@@ -794,6 +794,7 @@ class ContextRecord(
"archaeological_context_records.change_contextrecord",
"archaeological_context_records.change_own_contextrecord"
],
+ btn_class="btn-warning"
)
QA_LINK = QuickAction(
url="contextrecord-qa-link",
@@ -801,6 +802,7 @@ class ContextRecord(
text=_("Link to account"),
target="many",
rights=["ishtaradmin"],
+ btn_class="btn-warning"
)
QA_EDIT = QuickAction(
url="contextrecord-qa-bulk-update",
diff --git a/archaeological_files/models.py b/archaeological_files/models.py
index 04481889f..125a61a80 100644
--- a/archaeological_files/models.py
+++ b/archaeological_files/models.py
@@ -626,6 +626,7 @@ class File(
text=_("Link to account"),
target="many",
rights=["ishtaradmin"],
+ btn_class="btn-warning"
)
QUICK_ACTIONS = [
QA_LINK
diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py
index e224dc48c..035f7717d 100644
--- a/archaeological_finds/models_finds.py
+++ b/archaeological_finds/models_finds.py
@@ -1873,6 +1873,7 @@ class Find(
text=_("Link to account"),
target="many",
rights=["ishtaradmin"],
+ btn_class="btn-warning"
)
QA_LOCK = QuickAction(
url="find-qa-lock",
@@ -1881,6 +1882,7 @@ class Find(
target="many",
rights=["archaeological_finds.change_find",
"archaeological_finds.change_own_find"],
+ btn_class="btn-warning"
)
QUICK_ACTIONS = [
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py
index debc26d8b..dd265fb1d 100644
--- a/archaeological_operations/models.py
+++ b/archaeological_operations/models.py
@@ -583,6 +583,7 @@ class ArchaeologicalSite(
"archaeological_operations.change_archaeologicalsite",
"archaeological_operations.change_own_archaeologicalsite"
],
+ btn_class="btn-warning"
)
QA_LINK = QuickAction(
url="site-qa-link",
@@ -590,6 +591,7 @@ class ArchaeologicalSite(
text=_("Link to account"),
target="many",
rights=["ishtaradmin"],
+ btn_class="btn-warning"
)
QA_EDIT = QuickAction(
url="site-qa-bulk-update",
@@ -1485,6 +1487,7 @@ class Operation(
"archaeological_operations.change_operation",
"archaeological_operations.change_own_operation"
],
+ btn_class="btn-warning"
)
QA_LINK = QuickAction(
url="operation-qa-link",
@@ -1492,6 +1495,7 @@ class Operation(
text=_("Link to account"),
target="many",
rights=["ishtaradmin"],
+ btn_class="btn-warning"
)
QUICK_ACTIONS = [
QA_EDIT,
diff --git a/archaeological_warehouse/models.py b/archaeological_warehouse/models.py
index 099d6a641..14711e046 100644
--- a/archaeological_warehouse/models.py
+++ b/archaeological_warehouse/models.py
@@ -393,6 +393,7 @@ class Warehouse(
"archaeological_warehouse.change_warehouse",
"archaeological_warehouse.change_own_warehouse"
],
+ btn_class="btn-warning"
)
QA_LINK = QuickAction(
url="warehouse-qa-link",
@@ -400,6 +401,7 @@ class Warehouse(
text=_("Link to account"),
target="many",
rights=["ishtaradmin"],
+ btn_class="btn-warning"
)
QUICK_ACTIONS = [
QA_EDIT,
@@ -1144,6 +1146,7 @@ class Container(
"archaeological_warehouse.change_container",
"archaeological_warehouse.change_own_container"
],
+ btn_class="btn-warning"
)
QA_LINK = QuickAction(
url="container-qa-link",
@@ -1151,6 +1154,7 @@ class Container(
text=_("Link to account"),
target="many",
rights=["ishtaradmin"],
+ btn_class="btn-warning"
)
QUICK_ACTIONS = [QA_EDIT, QA_MOVE, QA_LOCK, QA_LINK]
diff --git a/ishtar_common/models_common.py b/ishtar_common/models_common.py
index dee43d6f8..ed2d46305 100644
--- a/ishtar_common/models_common.py
+++ b/ishtar_common/models_common.py
@@ -3404,6 +3404,7 @@ class MainItem(ShortMenuItem, SerializeItem, SheetItem):
[
action.base_url,
mark_safe(action.text),
+ action.btn_class,
mark_safe(action.rendered_icon),
action.target or "",
action.is_popup,
@@ -4233,6 +4234,7 @@ class QuickAction:
rights=None,
module=None,
is_popup=True,
+ btn_class="btn-success"
):
self.url = url
self.icon_class = icon_class
@@ -4241,6 +4243,7 @@ class QuickAction:
self.target = target
self.module = module
self.is_popup = is_popup
+ self.btn_class = btn_class
if self.target not in ("one", "many", None):
raise AttributeError("target must be one, many or None")
diff --git a/ishtar_common/templates/blocks/DataTables.html b/ishtar_common/templates/blocks/DataTables.html
index 6e2b01d7a..d00609b32 100644
--- a/ishtar_common/templates/blocks/DataTables.html
+++ b/ishtar_common/templates/blocks/DataTables.html
@@ -285,12 +285,12 @@ 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, is_popup in quick_actions %}
+ {% for url, title, btn_class, icon, target, is_popup in quick_actions %}
{
{% if target == 'one' %}extend: 'selectedSingle',
{% elif target == 'many' %}extend: 'selected',
{% endif %}
- className: "btn btn-success",
+ className: "btn {{btn_class}}",
text: "{{icon}}",
titleAttr: "{{title}}",
action: function (e, dt, node, config) {
diff --git a/scss/custom.scss b/scss/custom.scss
index 58b81cae2..94a55cc98 100644
--- a/scss/custom.scss
+++ b/scss/custom.scss
@@ -443,6 +443,14 @@ div.dt-buttons{
@include button-variant($success, $success);
}
+.dt-button.btn-warning {
+ @include button-variant($warning, $warning);
+}
+
+.dt-button.btn-info {
+ @include button-variant($info, $info);
+}
+
.dt-button.disabled{
background-color: #f8f9fa;
border-color: #f8f9fa;