This commit is contained in:
Herculino Trotta
2024-10-09 00:31:21 -03:00
parent e78e4cc5e1
commit 3dde44b1cd
139 changed files with 4965 additions and 1004 deletions

View File

@@ -0,0 +1,8 @@
{% spaceless %}
<span class="tw-text-xs text-white-50 mx-1"
data-bs-toggle="tooltip"
data-bs-title="{{ content }}"
_="install toast">
<i class="fa-solid fa-circle-question fa-fw"></i>
</span>
{% endspaceless %}

View File

@@ -0,0 +1,59 @@
{% load i18n %}
{% load active_link %}
<nav class="navbar navbar-expand-lg border-bottom bg-body-tertiary" hx-boost="true">
<div class="container-fluid">
<a class="navbar-brand fw-bold text-primary font-base" href="#">WYGIWYH</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarContent" aria-controls="navbarContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0 nav-underline" hx-push-url="true">
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle {% active_link views='monthly_overview' %}"
href="#"
role="button"
data-bs-toggle="dropdown"
aria-expanded="false">
{% translate 'Overview' %}
</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item {% active_link views='monthly_overview' %}" href="{% url 'monthly_index' %}">{%translate 'Monthly' %}</a></li>
</ul>
</li>
<li class="nav-item">
<a class="nav-link {% active_link views='net_worth' %}"
href="{% url 'net_worth' %}">
{% translate 'Net Worth' %}
</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle {% active_link views='tags_list||categories_list||currencies_list' %}"
href="#" role="button"
data-bs-toggle="dropdown"
aria-expanded="false">
{% translate 'Management' %}
</a>
<ul class="dropdown-menu">
<li><h6 class="dropdown-header">{% trans 'Transactions' %}</h6></li>
<li><a class="dropdown-item {% active_link views='categories_list' %}" href="{% url 'categories_list' %}">{% translate 'Categories' %}</a></li>
<li><a class="dropdown-item {% active_link views='tags_list' %}" href="{% url 'tags_list' %}">{% translate 'Tags' %}</a></li>
<li><hr class="dropdown-divider"></li>
<li><h6 class="dropdown-header">{% trans 'Accounts' %}</h6></li>
<li><a class="dropdown-item {% active_link views='accounts_list' %}" href="{% url 'accounts_list' %}">{% translate 'Accounts' %}</a></li>
<li><a class="dropdown-item {% active_link views='account_groups_list' %}" href="{% url 'account_groups_list' %}">{% translate 'Account Groups' %}</a></li>
<li><a class="dropdown-item {% active_link views='currencies_list' %}" href="{% url 'currencies_list' %}">{% translate 'Currencies' %}</a></li>
</ul>
</li>
</ul>
{% spaceless %}
<a class="mx-3 tw-text-2xl" hx-get="{% url 'toggle_amount_visibility' %}">
{% if user.settings.hide_amounts %}
<i class="fa-solid fa-eye-slash fa-fw"></i><div id="settings-hide-amounts" class="d-inline tw-invisible"></div>
{% else %}
<i class="fa-solid fa-eye fa-fw"></i>
{% endif %}</a>
{% endspaceless %}
<a class="btn btn-outline-light btn-sm" href="{% url 'logout' %}"><i class="fa-solid fa-door-open me-2"></i>{% translate 'Logout' %}</a>
</div>
</div>
</nav>

View File

@@ -1,10 +1,16 @@
<div id="generic-offcanvas" class="offcanvas offcanvas-end offcanvas-size-xl" data-bs-backdrop="static"
<div id="generic-offcanvas" class="offcanvas offcanvas-end offcanvas-size-xl"
data-bs-backdrop="static"
tabindex="-1"
_="on htmx:afterSettle call bootstrap.Offcanvas.getOrCreateInstance(me).show() end
on hide_offcanvas call bootstrap.Offcanvas.getOrCreateInstance(me).hide() end
on htmx:beforeOnLoad[detail.boosted] call bootstrap.Offcanvas.getOrCreateInstance(me).hide() then log event
on hidden.bs.offcanvas set my innerHTML to '' end">
</div>
<div id="generic-offcanvas-left" class="offcanvas offcanvas-start offcanvas-size-xl" data-bs-backdrop="static"
<div id="generic-offcanvas-left" class="offcanvas offcanvas-start offcanvas-size-xl"
data-bs-backdrop="static"
tabindex="-1"
_="on htmx:afterSettle call bootstrap.Offcanvas.getOrCreateInstance(me).show() end
on hide_offcanvas call bootstrap.Offcanvas.getOrCreateInstance(me).hide() end
on htmx:beforeOnLoad[detail.boosted] call bootstrap.Offcanvas.getOrCreateInstance(me).hide() then log event
on hidden.bs.offcanvas set my innerHTML to '' end">
</div>

View File

@@ -1,6 +1,20 @@
{% load webpack_loader %}
{% javascript_pack 'bootstrap' %}
{% javascript_pack 'sweetalert2' %}
{% javascript_pack 'htmx' %}
{% javascript_pack 'jquery' %}
{% javascript_pack 'bootstrap' attrs="defer" %}
{% javascript_pack 'sweetalert2' attrs="defer" %}
{% javascript_pack 'select' attrs="defer" %}
{% include 'includes/scripts/hyperscript/init_tom_select.html' %}
{% include 'includes/scripts/hyperscript/hide_amount.html' %}
{% include 'includes/scripts/hyperscript/toast.html' %}
{% include 'includes/scripts/hyperscript/htmx_error_handler.html' %}
{% javascript_pack 'htmx' attrs="defer" %}
<script>
let tz = Intl.DateTimeFormat().resolvedOptions().timeZone;
if (!tz) {
tz = "UTC"
}
document.cookie = "mytz=" + tz + ";path=/";
</script>

View File

@@ -0,0 +1,23 @@
<script type="text/hyperscript">
behavior hide_amounts
on load or htmx:afterSwap if I include #settings-hide-amounts
set elements to <.amount/> in me
for el in elements
set el.textContent to '•••••••••••'
end
end
on load or htmx:afterSwap if I do not include #settings-hide-amounts
set elements to <.amount/> in me
for el in elements
set el.textContent to el.dataset.originalValue
end
end
on click[target matches .amount] if I include #settings-hide-amounts
if event.target do not matches .revealed then set event.target.textContent to event.target.dataset.originalValue
else set event.target.textContent to '•••••••••••' end
then toggle .revealed on event.target
end
end
</script>

View File

@@ -0,0 +1,8 @@
<script type="text/hyperscript">
behavior htmx_error_handler
on htmx:responseError or htmx:afterRequest[detail.failed] remove .invisible .visually-hidden .swing-in-top-fwd from
#loading-error then log event
on htmx:afterRequest[detail.successful] add .invisible .visually-hidden .swing-in-top-fwd to #loading-error then
log 'oi'
end
</script>

View File

@@ -1,24 +0,0 @@
<script type="text/hyperscript">
behavior initTomSelect
init
set selectmultiple to .selectmultiple in me
set select to .select in me
set selectcsv to .csvselect in me
for x in selectmultiple
js(it)
new TomSelect(it, tomselect_multiple)
end
end
for x in select
js(it)
new TomSelect(it, tomselect_single)
end
end
for x in selectcsv
js(it)
new TomSelect(it, tomselect_single)
end
end
end
end
</script>

View File

@@ -0,0 +1,12 @@
<script type="text/hyperscript">
behavior init_tom_select
init
set selects to <select/> in me
for x in selects
js(it)
TomSelect(it)
end
end
end
end
</script>

View File

@@ -0,0 +1,6 @@
<script type="text/hyperscript">
behavior toast
on mouseenter call bootstrap.Tooltip.getOrCreateInstance(me).show() end
on mouseleave or click call bootstrap.Tooltip.getOrCreateInstance(me).dispose() end
end
</script>

View File

@@ -1,3 +1,3 @@
<div id="toasts" hx-get="{% url 'toasts' %}"
hx-trigger="load, toast from:window">
</div>
</div>