[UPDT] HORILLA_AUTOMATIONS: Updated horilla_automations app by merge with latest style

This commit is contained in:
Horilla
2025-06-23 11:15:32 +05:30
parent d4e5ccb0c9
commit 2879fde491
3 changed files with 39 additions and 24 deletions

View File

@@ -123,6 +123,16 @@ class MailAutomation(HorillaModel):
"horilla_automations/mail_cc.html", {"employees": employees}
)
def detail_actions(self):
"""
This method for get custom column for actions.
"""
return render_template(
path="horilla_automations/detail_action.html",
context={"instance": self},
)
def detailed_url(self):
return reverse("automation-detailed-view", kwargs={"pk": self.pk})

View File

@@ -0,0 +1,27 @@
{% load static i18n %}
{% if perms.horilla_automations.change_mailautomation %}
<!-- Start of Edit Button -->
<button hx-get="{{ instance.edit_url }}?instance_ids={{ instance.ordered_ids }}" hx-target='#genericModalBody'
data-toggle='oh-modal-toggle' data-target="#genericModal"
class="w-24 px-4 py-2 bg-primary-600 text-white rounded-md text-xs flex items-center justify-center gap-2 hover:bg-primary-800 transition duration-300">
<img src="{% static 'horilla_theme/assets/img/icons/edit.svg' %}" alt="{% trans 'Edit' %}" width="13"
class="filter brightness-0 invert">
{% trans 'Edit' %}
</button>
<!-- End of Edit Button -->
{% endif %}
{% if perms.horilla_automations.delete_mailautomation %}
<!-- Start of Delete Form -->
<form method="post" action="{{ instance.delete_url }}?instance_ids={{ instance.ordered_ids }}"
onsubmit="return confirm('{% trans 'Do you want to delete the automation?' %}');">
{% csrf_token %}
<button type="submit" data-action="delete"
class="w-24 px-4 py-2 bg-white rounded-md text-xs flex items-center justify-center gap-2 border border-primary-500 hover:border-primary-600 transition duration-300">
<img src="{% static 'horilla_theme/assets/img/icons/trash.svg' %}" alt="{% trans 'Delete' %}" width="16"
class="mt-[-1px]">
{% trans 'Delete' %}
</button>
</form>
<!-- End of Delete Form -->
{% endif %}

View File

@@ -194,7 +194,7 @@ class AutomationDetailedView(views.HorillaDetailedView):
"""
model = models.MailAutomation
title = "Detailed View"
title = _("Details")
header = {
"title": "title",
"subtitle": "title",
@@ -207,29 +207,7 @@ class AutomationDetailedView(views.HorillaDetailedView):
("Mail Cc", "get_mail_cc_display"),
("Trigger", "trigger_display"),
]
actions = [
{
"action": "Edit",
"icon": "create-outline",
"attrs": """
hx-get="{edit_url}?instance_ids={ordered_ids}"
hx-target="#genericModalBody"
data-toggle="oh-modal-toggle"
data-target="#genericModal"
class="oh-btn oh-btn--info w-50"
""",
},
{
"action": "Delete",
"icon": "trash-outline",
"attrs": """
class="oh-btn oh-btn--danger w-50"
onclick="
confirm('Do you want to delete the automation?','{delete_url}')
"
""",
},
]
action_method = "detail_actions"
@method_decorator(login_required, name="dispatch")