feat: improve text for rules

This commit is contained in:
Herculino Trotta
2025-12-14 11:42:51 -03:00
parent 4aa29545ec
commit c168886968
5 changed files with 14 additions and 12 deletions
+4 -1
View File
@@ -1,3 +1,4 @@
from crispy_forms.bootstrap import Alert
from apps.common.fields.forms.dynamic_select import DynamicModelChoiceField from apps.common.fields.forms.dynamic_select import DynamicModelChoiceField
from apps.common.widgets.crispy.daisyui import Switch from apps.common.widgets.crispy.daisyui import Switch
from apps.common.widgets.crispy.submit import NoClassSubmit from apps.common.widgets.crispy.submit import NoClassSubmit
@@ -36,7 +37,6 @@ class TransactionRuleForm(forms.ModelForm):
self.helper = FormHelper() self.helper = FormHelper()
self.helper.form_tag = False self.helper.form_tag = False
self.helper.form_method = "post" self.helper.form_method = "post"
# TO-DO: Add helper with available commands
self.helper.layout = Layout( self.helper.layout = Layout(
Switch("active"), Switch("active"),
"name", "name",
@@ -49,6 +49,9 @@ class TransactionRuleForm(forms.ModelForm):
Switch("sequenced"), Switch("sequenced"),
"description", "description",
"trigger", "trigger",
Alert(
_("You can add actions to this rule in the next screen."), dismiss=True
),
) )
if self.instance and self.instance.pk: if self.instance and self.instance.pk:
@@ -1,4 +1,4 @@
<div class="alert {{ alert.css_class }}" role="alert"{% if alert.css_id %} id="{{ alert.css_id }}"{% endif %}> <div class="alert {{ alert.css_class }}" role="alert"{% if alert.css_id %} id="{{ alert.css_id }}"{% endif %}>
{{ content|safe }} <span>{{ content|safe }}</span>
{% if dismiss %}<button type="button" class="btn btn-sm btn-circle btn-ghost" data-bs-dismiss="alert" aria-label="Close"></button>{% endif %} {% if dismiss %}<button type="button" class="btn btn-sm btn-circle btn-ghost ml-auto" aria-label="Close" _="on click remove closest .alert"></button>{% endif %}
</div> </div>
@@ -10,9 +10,9 @@ behavior htmx_error_handler
icon: 'warning', icon: 'warning',
timer: 60000, timer: 60000,
customClass: { customClass: {
confirmButton: 'btn btn-warning' -- Optional: different button style confirmButton: 'btn btn-warning'
}, },
buttonsStyling: true buttonsStyling: false
}) })
else else
call Swal.fire({ call Swal.fire({
@@ -23,7 +23,7 @@ behavior htmx_error_handler
customClass: { customClass: {
confirmButton: 'btn btn-primary' confirmButton: 'btn btn-primary'
}, },
buttonsStyling: true buttonsStyling: false
}) })
end end
then log event then log event
+3 -3
View File
@@ -64,13 +64,13 @@
</div> </div>
</td> </td>
<td class="table-col-auto"> <td class="table-col-auto">
<a class="no-underline" <a class="no-underline cursor-pointer"
role="button" role="button"
data-tippy-content=" data-tippy-content="
{% if rule.active %}{% translate "Deactivate" %}{% else %}{% translate "Activate" %}{% endif %}" {% if rule.active %}{% translate "Deactivate" %}{% else %}{% translate "Activate" %}{% endif %}"
hx-get="{% url 'transaction_rule_toggle_activity' transaction_rule_id=rule.id %}"> hx-get="{% url 'transaction_rule_toggle_activity' transaction_rule_id=rule.id %}">
{% if rule.active %}<i class="fa-solid fa-toggle-on text-green-400"></i>{% else %} {% if rule.active %}<i class="fa-solid fa-toggle-on text-success"></i>{% else %}
<i class="fa-solid fa-toggle-off text-red-400"></i>{% endif %} <i class="fa-solid fa-toggle-off text-error"></i>{% endif %}
</a> </a>
</td> </td>
<td class="table-col-auto text-center"> <td class="table-col-auto text-center">
@@ -110,8 +110,7 @@
</div> </div>
{% endfor %} {% endfor %}
</div> </div>
<hr class="hr my-5"> <div class="grid grid-cols-1 lg:grid-cols-2 gap-2 mt-5">
<div class="grid grid-cols-1 lg:grid-cols-2 gap-2">
<div class="dropdown"> <div class="dropdown">
<button class="btn btn-secondary w-full" type="button" data-bs-toggle="dropdown" <button class="btn btn-secondary w-full" type="button" data-bs-toggle="dropdown"
aria-expanded="false"> aria-expanded="false">
@@ -138,7 +137,7 @@
<div class="dropdown"> <div class="dropdown">
<button class="btn btn-primary w-full" type="button" data-bs-toggle="dropdown" <button class="btn btn-primary w-full" type="button" data-bs-toggle="dropdown"
aria-expanded="false"> aria-expanded="false">
<i class="fa-solid fa-circle-plus me-2"></i>{% translate 'Add new' %} <i class="fa-solid fa-circle-plus me-2"></i>{% translate 'Add new action' %}
</button> </button>
<ul class="dropdown-menu menu"> <ul class="dropdown-menu menu">
<li><a role="link" href="#" <li><a role="link" href="#"