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

View File

@@ -1,3 +1,4 @@
from crispy_forms.bootstrap import Alert
from apps.common.fields.forms.dynamic_select import DynamicModelChoiceField
from apps.common.widgets.crispy.daisyui import Switch
from apps.common.widgets.crispy.submit import NoClassSubmit
@@ -36,7 +37,6 @@ class TransactionRuleForm(forms.ModelForm):
self.helper = FormHelper()
self.helper.form_tag = False
self.helper.form_method = "post"
# TO-DO: Add helper with available commands
self.helper.layout = Layout(
Switch("active"),
"name",
@@ -49,6 +49,9 @@ class TransactionRuleForm(forms.ModelForm):
Switch("sequenced"),
"description",
"trigger",
Alert(
_("You can add actions to this rule in the next screen."), dismiss=True
),
)
if self.instance and self.instance.pk:

View File

@@ -1,4 +1,4 @@
<div class="alert {{ alert.css_class }}" role="alert"{% if alert.css_id %} id="{{ alert.css_id }}"{% endif %}>
{{ content|safe }}
{% if dismiss %}<button type="button" class="btn btn-sm btn-circle btn-ghost" data-bs-dismiss="alert" aria-label="Close"></button>{% endif %}
<span>{{ content|safe }}</span>
{% 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>

View File

@@ -10,9 +10,9 @@ behavior htmx_error_handler
icon: 'warning',
timer: 60000,
customClass: {
confirmButton: 'btn btn-warning' -- Optional: different button style
confirmButton: 'btn btn-warning'
},
buttonsStyling: true
buttonsStyling: false
})
else
call Swal.fire({
@@ -23,7 +23,7 @@ behavior htmx_error_handler
customClass: {
confirmButton: 'btn btn-primary'
},
buttonsStyling: true
buttonsStyling: false
})
end
then log event

View File

@@ -64,13 +64,13 @@
</div>
</td>
<td class="table-col-auto">
<a class="no-underline"
<a class="no-underline cursor-pointer"
role="button"
data-tippy-content="
{% if rule.active %}{% translate "Deactivate" %}{% else %}{% translate "Activate" %}{% endif %}"
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 %}
<i class="fa-solid fa-toggle-off text-red-400"></i>{% endif %}
{% if rule.active %}<i class="fa-solid fa-toggle-on text-success"></i>{% else %}
<i class="fa-solid fa-toggle-off text-error"></i>{% endif %}
</a>
</td>
<td class="table-col-auto text-center">

View File

@@ -110,8 +110,7 @@
</div>
{% endfor %}
</div>
<hr class="hr my-5">
<div class="grid grid-cols-1 lg:grid-cols-2 gap-2">
<div class="grid grid-cols-1 lg:grid-cols-2 gap-2 mt-5">
<div class="dropdown">
<button class="btn btn-secondary w-full" type="button" data-bs-toggle="dropdown"
aria-expanded="false">
@@ -138,7 +137,7 @@
<div class="dropdown">
<button class="btn btn-primary w-full" type="button" data-bs-toggle="dropdown"
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>
<ul class="dropdown-menu menu">
<li><a role="link" href="#"