Self hosted FLOSS fitness/workout, nutrition and weight tracker
Move more modal links to use HTMX
Roland Geider95abe8088f3d
diff --git a/wger/exercises/templates/categories/admin-overview.html b/wger/exercises/templates/categories/admin-overview.htmlindex e253d8bee..df61c874d 100644--- a/wger/exercises/templates/categories/admin-overview.html+++ b/wger/exercises/templates/categories/admin-overview.html@@ -9,14 +9,18 @@{% for category in exercisecategory_list %}<li class="list-group-item list-group-item-action"><div class="btn-group float-end">- <button type="button" class="btn btn-dark dropdown-toggle btn-sm" data-bs-toggle="dropdown">+ <button type="button" class="btn btn-dark dropdown-toggle btn-sm"+ data-bs-toggle="dropdown"><span class="{% fa_class 'cog' %}"></span></button><div class="dropdown-menu dropdown-menu-right" role="menu">- <a href="{% url 'exercise:category:edit' category.id %}"- class="wger-modal-dialog dropdown-item">{% translate 'Edit' %}</a>- <a href="{% url 'exercise:category:delete' category.id %}"- class="wger-modal-dialog dropdown-item">{% translate 'Delete' %}</a>+ {% translate 'Edit' as text %}+ {% url 'exercise:category:edit' category.id as url %}+ {% modal_link url=url text=text css_class='dropdown-item' %}++ {% translate 'Delete' as text %}+ {% url 'exercise:category:delete' category.id as url %}+ {% modal_link url=url text=text css_class='dropdown-item' %}</div></div>{{ category }}@@ -32,11 +36,8 @@{% block options %}- {% if perms.exercises.add_exercisecategory %}- <p>- <a href="{% url 'exercise:category:add' %}" class="btn btn-success btn-sm wger-modal-dialog">- {% translate "Add" %}- </a>- </p>- {% endif %}+{% if perms.exercises.add_exercisecategory %}+ {% translate 'Add' as text %}+ {% modal_link url='exercise:category:add' text=text %}+{% endif %}{% endblock %}diff --git a/wger/exercises/templates/equipment/admin-overview.html b/wger/exercises/templates/equipment/admin-overview.htmlindex b107b7fb4..8c61bd765 100644--- a/wger/exercises/templates/equipment/admin-overview.html+++ b/wger/exercises/templates/equipment/admin-overview.html@@ -9,14 +9,18 @@{% for equipment in equipment_list %}<li class="list-group-item list-group-item-action"><div class="btn-group float-end">- <button type="button" class="btn btn-dark dropdown-toggle btn-sm" data-bs-toggle="dropdown">+ <button type="button" class="btn btn-dark dropdown-toggle btn-sm"+ data-bs-toggle="dropdown"><span class="{% fa_class 'cog' %}"></span></button><div class="dropdown-menu dropdown-menu-right" role="menu">- <a href="{% url 'exercise:equipment:edit' equipment.id %}"- class="wger-modal-dialog dropdown-item">{% translate 'Edit' %}</a>- <a href="{% url 'exercise:equipment:delete' equipment.id %}"- class="wger-modal-dialog dropdown-item">{% translate 'Delete' %}</a>+ {% translate 'Edit' as text %}+ {% url 'exercise:equipment:edit' equipment.id as url %}+ {% modal_link url=url text=text css_class='dropdown-item' %}++ {% translate 'Delete' as text %}+ {% url 'exercise:equipment:delete' equipment.id as url %}+ {% modal_link url=url text=text css_class='dropdown-item' %}</div></div>{{ equipment.name }}@@ -30,14 +34,9 @@{% endblock %}---{% block sidebar %}+{% block options %}{% if perms.exercises.add_equipment %}- <p>- <a href="{% url 'exercise:equipment:add' %}" class="btn btn-success btn-sm wger-modal-dialog">- {% translate "Add new equipment" %}- </a>- </p>+ {% translate 'Add' as text %}+ {% modal_link url='exercise:equipment:add' text=text %}{% endif %}{% endblock %}diff --git a/wger/exercises/templates/muscles/admin-overview.html b/wger/exercises/templates/muscles/admin-overview.htmlindex b84370747..5c34f51ee 100644--- a/wger/exercises/templates/muscles/admin-overview.html+++ b/wger/exercises/templates/muscles/admin-overview.html@@ -13,10 +13,13 @@<span class="{% fa_class 'cog' %}"></span></button><div class="dropdown-menu dropdown-menu-right" role="menu">- <a href="{% url 'exercise:muscle:edit' muscle.id %}"- class="wger-modal-dialog dropdown-item">{% translate 'Edit' %}</a>- <a href="{% url 'exercise:muscle:delete' muscle.id %}"- class="wger-modal-dialog dropdown-item">{% translate 'Delete' %}</a>+ {% translate 'Edit' as text %}+ {% url 'exercise:muscle:edit' muscle.id as url %}+ {% modal_link url=url text=text css_class='dropdown-item' %}++ {% translate 'Delete' as text %}+ {% url 'exercise:muscle:delete' muscle.id as url %}+ {% modal_link url=url text=text css_class='dropdown-item' %}</div></div>{{ muscle }}@@ -34,8 +37,7 @@{% block options %}{% if perms.exercises.add_equipment %}- <a href="{% url 'exercise:muscle:add' %}" class="btn btn-success btn-sm wger-modal-dialog">- {% translate "Add muscle" %}- </a>+ {% translate 'Add' as text %}+ {% modal_link url='exercise:muscle:add' text=text %}{% endif %}{% endblock %}diff --git a/wger/gym/templates/admin_notes/list.html b/wger/gym/templates/admin_notes/list.htmlindex cd8f86b10..7b983e334 100644--- a/wger/gym/templates/admin_notes/list.html+++ b/wger/gym/templates/admin_notes/list.html@@ -22,29 +22,27 @@{% for note in adminusernote_list %}<li class="list-group-item "><div class="btn-group float-end">- <button type="button" class="btn btn-light dropdown-toggle btn-sm" data-bs-toggle="dropdown">+ <button type="button" class="btn btn-light dropdown-toggle btn-sm"+ data-bs-toggle="dropdown"><span class="{% fa_class 'cog' %}"></span></button>- <ul class="dropdown-menu" role="menu">+ <div class="dropdown-menu" role="menu">{% if perms.gym.change_adminusernote %}- <li>- <a href="{% url 'gym:admin_note:edit' note.pk %}" class="wger-modal-dialog">- {% translate 'Edit' %}- </a>- </li>+ {% translate 'Edit' as text %}+ {% url 'gym:admin_note:edit' note.pk as url %}+ {% modal_link url=url text=text css_class='dropdown-item' %}{% endif %}{% if perms.gym.delete_adminusernote %}- <li>- <a href="{% url 'gym:admin_note:delete' note.pk %}" class="wger-modal-dialog">- {% translate 'Delete' %}- </a>- <li>+ {% translate 'Delete' as text %}+ {% url 'gym:admin_note:delete' note.pk as url %}+ {% modal_link url=url text=text css_class='dropdown-item' %}{% endif %}- </ul>+ </div></div>- <h4 class="list-group-item-heading">{{ note.timestamp_created }} - {{ note.user|format_username }}</h4>+ <h4 class="list-group-item-heading">{{ note.timestamp_created }}+ - {{ note.user|format_username }}</h4><p class="list-group-item-text">{{ note.note }}</p></li>{% empty %}@@ -62,9 +60,9 @@{# Options #}{# #}{% block options %}- {% if perms.gym.add_adminusernote %}- <a href="{% url 'gym:admin_note:add' member.pk %}" class="wger-modal-dialog btn btn-success btn-sm">- {% translate "Add" %}- </a>- {% endif %}+{% if perms.gym.add_adminusernote %}+ {% translate 'Add' as text %}+ {% url 'gym:admin_note:add' member.pk as url %}+ {% modal_link url=url text=text %}+{% endif %}{% endblock %}diff --git a/wger/gym/templates/contract/list.html b/wger/gym/templates/contract/list.htmlindex caeee2299..bcf466bb0 100644--- a/wger/gym/templates/contract/list.html+++ b/wger/gym/templates/contract/list.html@@ -21,24 +21,21 @@{% for contract in contract_list %}<li class="list-group-item list-group-item-action"><div class="btn-group float-end">- <button type="button" class="btn btn-dark dropdown-toggle btn-sm" data-bs-toggle="dropdown">+ <button type="button" class="btn btn-dark dropdown-toggle btn-sm"+ data-bs-toggle="dropdown"><span class="{% fa_class 'cog' %}"></span></button>- <ul class="dropdown-menu" role="menu">+ <div class="dropdown-menu" role="menu">{% if perms.gym.change_contract %}- <li>- <a href="{% url 'gym:contract:edit' contract.pk %}">- {% translate 'Edit' %}- </a>- </li>- <li>- <a href="{% url 'gym:contract:view' contract.pk %}">- {% translate 'Show' %}- </a>- </li>- {% endif %}+ {% translate 'Edit' as text %}+ {% url 'gym:contract:edit' contract.pk as url %}+ {% modal_link url=url text=text css_class='dropdown-item' %}- </ul>+ {% translate 'Show' as text %}+ {% url 'gym:contract:view' contract.pk as url %}+ {% modal_link url=url text=text css_class='dropdown-item' %}+ {% endif %}+ </div></div>@@ -69,6 +66,7 @@{# Options #}{# #}{% block options %}- <a href="{% url 'gym:contract:add' member.pk %}"- class="wger-modal-dialog btn btn-sm btn-success">{% translate "Add" %}</a>+ {% translate 'Add' as text %}+ {% url 'gym:contract:add' member.pk as url %}+ {% modal_link url=url text=text %}{% endblock %}diff --git a/wger/gym/templates/contract/view.html b/wger/gym/templates/contract/view.htmlindex c9ea6aaab..e197a93b3 100644--- a/wger/gym/templates/contract/view.html+++ b/wger/gym/templates/contract/view.html@@ -102,7 +102,8 @@-{% block sidebar %}- <h4>{% translate 'Options' %}</h4>- <a href="{% url 'gym:contract:edit' object.pk %}" class="wger-modal-dialog">{% translate 'Edit' %}</a>+{% block options %}+ {% translate 'Edit' as text %}+ {% url 'gym:contract:edit' object.pk as url %}+ {% modal_link url=url text=text %}{% endblock %}diff --git a/wger/gym/templates/contract_option/list.html b/wger/gym/templates/contract_option/list.htmlindex e916fc5cc..ac3c4df93 100644--- a/wger/gym/templates/contract_option/list.html+++ b/wger/gym/templates/contract_option/list.html@@ -24,26 +24,20 @@<button type="button" class="btn btn-dark dropdown-toggle btn-sm" data-bs-toggle="dropdown"><span class="{% fa_class 'cog' %}"></span></button>- <ul class="dropdown-menu" role="menu">+ <div class="dropdown-menu" role="menu">{% if perms.gym.change_contracttype %}- <li>- <a href="{% url 'gym:contract-option:edit' option.pk %}"- class="wger-modal-dialog dropdown-item">- {% translate 'Edit' %}- </a>- </li>+ {% translate 'Edit' as text %}+ {% url 'gym:contract-option:edit' option.pk as url %}+ {% modal_link url=url text=text css_class='dropdown-item' %}{% endif %}{% if perms.gym.delete_contracttype %}- <li>- <a href="{% url 'gym:contract-option:delete' option.pk %}"- class="wger-modal-dialog dropdown-item">- {% translate 'Delete' %}- </a>- </li>+ {% translate 'Delete' as text %}+ {% url 'gym:contract-option:delete' option.pk as url %}+ {% modal_link url=url text=text css_class='dropdown-item' %}{% endif %}- </ul>+ </div></div>@@ -68,7 +62,7 @@{# Options #}{# #}{% block options %}- <a href="{% url 'gym:contract-option:add' gym.id %}" class="wger-modal-dialog btn btn-sm btn-success">- {% translate "Add" %}- </a>+ {% translate 'Add' as text %}+ {% url 'gym:contract-option:add' gym.id as url %}+ {% modal_link url=url text=text %}{% endblock %}diff --git a/wger/gym/templates/contract_type/list.html b/wger/gym/templates/contract_type/list.htmlindex c23481e57..6b059a38b 100644--- a/wger/gym/templates/contract_type/list.html+++ b/wger/gym/templates/contract_type/list.html@@ -21,29 +21,23 @@{% for contract_type in contracttype_list %}<li class="list-group-item list-group-item-action"><div class="btn-group float-end">- <button type="button" class="btn btn-dark dropdown-toggle btn-sm" data-bs-toggle="dropdown">+ <button type="button" class="btn btn-dark dropdown-toggle btn-sm"+ data-bs-toggle="dropdown"><span class="{% fa_class 'cog' %}"></span></button>- <ul class="dropdown-menu" role="menu">+ <div class="dropdown-menu" role="menu">{% if perms.gym.change_contracttype %}- <li>- <a href="{% url 'gym:contract_type:edit' contract_type.pk %}"- class="wger-modal-dialog dropdown-item">- {% translate 'Edit' %}- </a>- </li>+ {% translate 'Edit' as text %}+ {% url 'gym:contract_type:edit' contract_type.pk as url %}+ {% modal_link url=url text=text css_class='dropdown-item' %}{% endif %}{% if perms.gym.delete_contracttype %}- <li>- <a href="{% url 'gym:contract_type:delete' contract_type.pk %}"- class="wger-modal-dialog dropdown-item">- {% translate 'Delete' %}- </a>- </li>+ {% translate 'Delete' as text %}+ {% url 'gym:contract_type:delete' contract_type.pk as url %}+ {% modal_link url=url text=text css_class='dropdown-item' %}{% endif %}-- </ul>+ </div></div>@@ -51,7 +45,8 @@{{ contract_type.name }}</h4>- <p class="list-group-item-text" style="white-space: pre-line;">{{ contract_type.description }}</p>+ <p class="list-group-item-text"+ style="white-space: pre-line;">{{ contract_type.description }}</p></li>{% empty %}<li class="list-group-item">@@ -68,7 +63,7 @@{# Options #}{# #}{% block options %}- <a href="{% url 'gym:contract_type:add' gym.id %}" class="wger-modal-dialog btn btn-sm btn-success">- {% translate "Add" %}- </a>+ {% translate 'Add' as text %}+ {% url 'gym:contract_type:add' gym.id as url %}+ {% modal_link url=url text=text %}{% endblock %}diff --git a/wger/gym/templates/document/list.html b/wger/gym/templates/document/list.htmlindex 6a8ee80a3..0b13422c9 100644--- a/wger/gym/templates/document/list.html+++ b/wger/gym/templates/document/list.html@@ -22,32 +22,32 @@{% for document in userdocument_list %}<li class="list-group-item "><div class="btn-group float-end">- <button type="button" class="btn btn-light dropdown-toggle btn-sm" data-bs-toggle="dropdown">+ <button type="button" class="btn btn-light dropdown-toggle btn-sm"+ data-bs-toggle="dropdown"><span class="{% fa_class 'cog' %}"></span></button><ul class="dropdown-menu" role="menu"><li>- <a href="{{ document.document.url }}" download="{{ document.original_name }}">- <span class="glyphicon glyphicon-download"></span>+ <a href="{{ document.document.url }}"+ download="{{ document.original_name }}" class="dropdown-item">{% translate 'Download' %}</a></li>{% if perms.gym.change_userdocument %}<li>- <a href="{% url 'gym:document:edit' document.pk %}">- {% translate 'Edit' %}- </a>+ {% translate 'Edit' as text %}+ {% url 'gym:document:edit' document.pk as url %}+ {% modal_link url=url text=text css_class='dropdown-item' %}</li>{% endif %}{% if perms.gym.delete_userdocument %}<li>- <a href="{% url 'gym:document:delete' document.pk %}" class="wger-modal-dialog">- {% translate 'Delete' %}- </a>+ {% translate 'Delete' as text %}+ {% url 'gym:document:delete' document.pk as url %}+ {% modal_link url=url text=text css_class='dropdown-item' %}</li>{% endif %}-</ul></div>@@ -75,8 +75,8 @@{# #}{% block options %}{% if perms.gym.add_userdocument %}- <a href="{% url 'gym:document:add' member.pk %}" class="btn btn-sm btn-success">- {% translate "Add" %}- </a>+ {% translate 'Add' as text %}+ {% url 'gym:document:add' member.pk as url %}+ {% modal_link url=url text=text %}{% endif %}{% endblock %}diff --git a/wger/gym/templates/gym/list.html b/wger/gym/templates/gym/list.htmlindex 36fad3c14..0dae93ff8 100644--- a/wger/gym/templates/gym/list.html+++ b/wger/gym/templates/gym/list.html@@ -16,10 +16,13 @@<span class="{% fa_class 'cog' %}"></span></button><div class="dropdown-menu dropdown-menu-right" role="menu">- <a href="{% url 'gym:gym:edit' gym.id %}"- class="wger-modal-dialog dropdown-item">{% translate 'Edit' %}</a>- <a href="{% url 'gym:gym:delete' gym.id %}"- class="wger-modal-dialog dropdown-item">{% translate 'Delete' %}</a>+ {% translate 'Edit' as text %}+ {% url 'gym:gym:edit' gym.id as url %}+ {% modal_link url=url text=text css_class='dropdown-item' %}++ {% translate 'Delete' as text %}+ {% url 'gym:gym:delete' gym.id as url %}+ {% modal_link url=url text=text css_class='dropdown-item' %}</div></div><a href="{% url 'gym:gym:user-list' gym.pk %}">{{ gym }}</a>@@ -42,8 +45,8 @@{% translate "Actions" %} <span class="caret"></span></button><div class="dropdown-menu" role="menu">- <a href="{% url 'config:gym_config:edit' %}"- class="wger-modal-dialog dropdown-item">{% translate "Edit" %}</a>+ {% translate 'Edit' as text %}+ {% modal_link url='config:gym_config:edit' text=text css_class='dropdown-item' %}</div></div>{% endif %}@@ -62,9 +65,8 @@{# Options #}{# #}{% block options %}- {% if perms.gym.add_gym %}- <a href="{% url 'gym:gym:add' %}" class="btn btn-success btn-sm wger-modal-dialog">- {% translate "Add new gym" %}- </a>- {% endif %}+{% if perms.gym.add_gym %}+ {% translate 'Add new gym' as text %}+ {% modal_link url='gym:gym:add' text=text %}+{% endif %}{% endblock %}diff --git a/wger/gym/templates/gym/member_list.html b/wger/gym/templates/gym/member_list.htmlindex f1472df5f..948be3660 100644--- a/wger/gym/templates/gym/member_list.html+++ b/wger/gym/templates/gym/member_list.html@@ -58,7 +58,14 @@{% if perms.gym.manage_gym or perms.gym.manage_gyms %}<td style="text-align: right;">- <a href="{% url 'gym:gym:edit-user-permission' current_user.obj.pk %}" class="btn btn-light btn-sm wger-modal-dialog">+ <a+ href="{% url 'gym:gym:edit-user-permission' current_user.obj.pk %}"+ class="btn btn-light btn-sm "+ hx-get="{% url 'gym:gym:edit-user-permission' current_user.obj.pk %}"+ hx-target="#ajax-info-content"+ data-bs-toggle="modal"+ data-bs-target="#wger-ajax-info"+ ><span class="{% fa_class 'cog' %}"></span></a></td>@@ -84,8 +91,13 @@{% translate "Actions" %} <span class="caret"></span></a><div class="dropdown-menu dropdown-menu-right" role="menu">- <a href="{% url 'gym:gym:edit' gym.id %}" class="dropdown-item wger-modal-dialog">{% translate "Edit"%}</a>- <a href="{% url 'gym:export:users' gym.id %}" class="dropdown-item">{% translate "Export"%}</a>+ {% translate 'Edit' as text %}+ {% url 'gym:gym:edit' gym.id as url %}+ {% modal_link url=url text=text css_class='dropdown-item' %}++ {% translate 'Export' as text %}+ {% url 'gym:export:users' gym.id as url %}+ {% modal_link url=url text=text css_class='dropdown-item' %}</div></div>{% endif %}@@ -137,7 +149,9 @@{% translate "Actions" %} <span class="caret"></span></a><div class="dropdown-menu dropdown-menu-right">- <a href="{% url 'gym:config:edit' gym.config.id %}" class="wger-modal-dialog dropdown-item">{% translate "Edit"%}</a>+ {% translate 'Edit' as text %}+ {% url 'gym:config:edit' gym.config.id as url %}+ {% modal_link url=url text=text css_class='dropdown-item' %}</div></div>{% endif %}@@ -173,7 +187,9 @@{% translate "Actions" %} <span class="caret"></span></a><div class="dropdown-menu dropdown-menu-right" role="menu">- <a href="{% url 'gym:admin_config:edit' user.gymadminconfig.id %}" class="dropdown-item wger-modal-dialog">{% translate "Edit"%}</a>+ {% translate 'Edit' as text %}+ {% url 'gym:admin_config:edit' user.gymadminconfig.id as url %}+ {% modal_link url=url text=text css_class='dropdown-item' %}</div></div></div>@@ -208,7 +224,10 @@</a><div class="dropdown-menu dropdown-menu-right" role="menu"><a href="{% url 'gym:contract_type:list' gym.id %}" class="dropdown-item">{% translate "Overview" %}</a>- <a href="{% url 'gym:contract_type:add' gym.id %}" class="dropdown-item wger-modal-dialog">{% translate "Add" %}</a>++ {% translate 'Add' as text %}+ {% url 'gym:contract_type:add' gym.id as url %}+ {% modal_link url=url text=text css_class='dropdown-item' %}</div></div>@@ -241,7 +260,10 @@</button><div class="dropdown-menu dropdown-menu-right" role="menu"><a href="{% url 'gym:contract-option:list' gym.id %}" class="dropdown-item">{% translate "Overview" %}</a>- <a href="{% url 'gym:contract-option:add' gym.id %}" class="dropdown-item wger-modal-dialog">{% translate "Add" %}</a>++ {% translate 'Add' as text %}+ {% url 'gym:contract-option:add' gym.id as url %}+ {% modal_link url=url text=text css_class='dropdown-item' %}</div></div>@@ -311,8 +333,8 @@{# #}{% block options %}{% if perms.gym.manage_gym or perms.gym.manage_gyms %}- <a href="{% url 'gym:gym:add-user' gym.pk %}" class="btn btn-success btn-sm wger-modal-dialog">- {% translate "Add member" %}- </a>+ {% translate 'Add member' as text %}+ {% url 'gym:gym:add-user' gym.pk as url %}+ {% modal_link url=url text=text %}{% endif %}{% endblock %}diff --git a/wger/manager/templates/calendar/day.html b/wger/manager/templates/calendar/day.htmlindex bac14ecd5..f46fef71e 100644--- a/wger/manager/templates/calendar/day.html+++ b/wger/manager/templates/calendar/day.html@@ -59,19 +59,20 @@{% if is_owner %}<span class="dropdown"><div class="float-end">- <button type="button" class="btn btn-link dropdown-toggle btn-sm"+ <button type="button"+ class="btn btn-link dropdown-toggle btn-sm"data-bs-toggle="dropdown"></button><div class="dropdown-menu">- <a href="{% url 'manager:log:edit' log.pk %}"- class="wger-modal-dialog dropdown-item">- {% translate 'Edit' %}- </a>+ {% translate 'Edit' as text %}+ {% url 'manager:log:edit' log.pk as url %}+ {% modal_link url=url text=text css_class='dropdown-item' %}+<div class="dropdown-divider"></div>- <a href="{% url 'manager:log:delete' log.pk %}"- class="wger-modal-dialog dropdown-item">- {% translate 'Delete' %}- </a>++ {% translate 'Delete' as text %}+ {% url 'manager:log:delete' log.pk as url %}+ {% modal_link url=url text=text css_class='dropdown-item' %}</div></div></span>diff --git a/wger/manager/templates/calendar/month.html b/wger/manager/templates/calendar/month.htmlindex 2e046e40c..17e4f3e21 100644--- a/wger/manager/templates/calendar/month.html+++ b/wger/manager/templates/calendar/month.html@@ -81,13 +81,13 @@ $(document).ready(function() {<button type="button" class="btn btn-link dropdown-toggle btn-sm" data-bs-toggle="dropdown"></button><div class="dropdown-menu dropdown-menu-right" role="menu">- <a href="{% url 'manager:log:edit' log.pk %}" class="wger-modal-dialog dropdown-item">- {% translate 'Edit' %}- </a>- <div class="dropdown-divider"></div>- <a href="{% url 'manager:log:delete' log.pk %}" class="wger-modal-dialog dropdown-item">- {% translate 'Delete' %}- </a>+ {% translate 'Edit' as text %}+ {% url 'manager:log:edit' log.pk as url %}+ {% modal_link url=url text=text css_class='dropdown-item' %}++ {% translate 'Delete' as text %}+ {% url 'manager:log:delete' log.pk as url %}+ {% modal_link url=url text=text css_class='dropdown-item' %}</div></div>{% endif %}diff --git a/wger/manager/templates/calendar/partial_overview_table.html b/wger/manager/templates/calendar/partial_overview_table.htmlindex f821848ef..1d4a5c219 100644--- a/wger/manager/templates/calendar/partial_overview_table.html+++ b/wger/manager/templates/calendar/partial_overview_table.html@@ -13,24 +13,26 @@<span class="caret"></span></button><div class="dropdown-menu">- <a href="{% url 'manager:session:edit' value.session.pk %}" class="wger-modal-dialog dropdown-item">- <span class="{% fa_class 'edit-o' %}"></span>- {% translate "Edit" %}- </a>+ {% translate 'Edit' as text %}+ {% url 'manager:session:edit' value.session.pk as url %}+ {% modal_link url=url text=text css_class='dropdown-item' %}+<div class="dropdown-divider"></div>- <a href="{% url 'manager:session:delete' value.session.pk %}" class="wger-modal-dialog dropdown-item">- <span class="{% fa_class 'trash' %}"></span>- {% translate "Delete" %}- </a>- <a href="{% url 'manager:session:delete' value.session.pk 'logs' %}" class="wger-modal-dialog dropdown-item">- <span class="{% fa_class 'trash' %}"></span>- {% translate "Delete with logs" %}- </a>++ {% translate 'Delete' as text %}+ {% url 'manager:session:delete' value.session.pk as url %}+ {% modal_link url=url text=text css_class='dropdown-item' %}++ {% translate 'Delete with logs' as text %}+ {% url 'manager:session:delete' value.session.pk 'logs' as url %}+ {% modal_link url=url text=text css_class='dropdown-item' %}</div></div></div>{% else %}- <a href="{% url 'manager:session:add' value.workout.id date|date:'Y' date|date:'m' date|date:'d' %}" class="btn btn-light btn-block wger-modal-dialog">{% translate "Add workout impression" %}</a>+ {% translate 'Add workout impression' as text %}+ {% url 'manager:session:add' value.workout.id date|date:'Y' date|date:'m' date|date:'d' as url %}+ {% modal_link url=url text=text css_class='dropdown-item' %}{% endif %}{% endif %}</div>diff --git a/wger/manager/templates/schedule/overview.html b/wger/manager/templates/schedule/overview.htmlindex 03afdfe3d..321c695e4 100644--- a/wger/manager/templates/schedule/overview.html+++ b/wger/manager/templates/schedule/overview.html@@ -1,6 +1,5 @@{% extends "base.html" %}-{% load i18n %}-{% load static %}+{% load i18n static wger_extras %}{% block title %}{% translate "Your schedules" %}{% endblock %}@@ -11,7 +10,8 @@{% block content %}<div class="list-group">{% for schedule in schedules %}- <a href="{% url 'manager:schedule:view' schedule.id %}" class="list-group-item list-group-item-action">+ <a href="{% url 'manager:schedule:view' schedule.id %}"+ class="list-group-item list-group-item-action"><span class="glyphicon glyphicon-chevron-right float-end"></span>{% if schedule.is_active %}@@ -24,9 +24,9 @@<p class="list-group-item-text">{{ schedule.start_date }}</p></a>{% empty %}- <a href="{% url 'manager:schedule:add' %}" class="list-group-item list-group-item-action wger-modal-dialog">- {% translate "No schedules found." %}<br>{% translate "Add one now." %}- </a>+ {% translate "No schedules found." %}+ {% translate 'Add one now' as text %}+ {% modal_link url='manager:schedule:add' text=text css_class='dropdown-item' %}{% endfor %}</div>{% endblock %}@@ -38,7 +38,8 @@<p>{% blocktranslate %}You can indicate how long you want to do each workoutbefore jumping to the next. It is also possible to create a loop, so you- always do the same workouts in succession, e.g. A > B > C > A > B > C and so on.{% endblocktranslate %}</p>+ always do the same workouts in succession, e.g. A > B > C > A > B > C and so+ on.{% endblocktranslate %}</p><p>{% blocktranslate %}The currently active schedule will remain active (and beshown e.g. in your dashboard) till it reaches the last workout or till you@@ -47,7 +48,6 @@{% block options %}- <a href="{% url 'manager:schedule:add' %}" class="btn btn-success btn-sm wger-modal-dialog">- {% translate "Add schedule" %}- </a>+ {% translate 'Add schedule' as text %}+ {% modal_link url='manager:schedule:add' text=text %}{% endblock %}diff --git a/wger/manager/templates/schedule/view.html b/wger/manager/templates/schedule/view.htmlindex 61110dbe4..9cfe22609 100644--- a/wger/manager/templates/schedule/view.html+++ b/wger/manager/templates/schedule/view.html@@ -111,18 +111,31 @@</td>{% if is_owner %}<td style="min-width: 6em;">- <span class="editoptions">- <span title="{% translate 'Move me' %}" class="dragndrop-handle {% fa_class 'bars' %}"></span>+ <span class="editoptions">+ <span title="{% translate 'Move me' %}"+ class="dragndrop-handle {% fa_class 'bars' %}"></span>+ <a+ href="{% url 'manager:step:edit' step.id %}"+ class="{{ css_class }}"+ hx-get="{% url 'manager:step:edit' step.id %}"+ hx-target="#ajax-info-content"+ data-bs-toggle="modal"+ data-bs-target="#wger-ajax-info"+ >+ <span class="{% fa_class 'edit' %}"></span>+ </a>- <a href="{% url 'manager:step:edit' step.id %}"- title="{% translate 'Edit' %}"- class="wger-modal-dialog">- <span class="{% fa_class 'edit' %}"></span></a>- <a href="{% url 'manager:step:delete' step.id %}"- title="{% translate 'Delete' %}"- class="wger-modal-dialog">- <span class="{% fa_class 'trash' %}"></span></a>- </span>+ <a+ href="{% url 'manager:step:delete' step.id %}"+ class="{{ css_class }}"+ hx-get="{% url 'manager:step:delete' step.id %}"+ hx-target="#ajax-info-content"+ data-bs-toggle="modal"+ data-bs-target="#wger-ajax-info"+ >+ <span class="{% fa_class 'trash' %}"></span>+ </a>+ </span></td>{% endif %}<td>@@ -139,10 +152,9 @@{% if is_owner %}<tr><td colspan="4">- <a href="{% url 'manager:step:add' schedule.id %}"- class="wger-modal-dialog btn btn-block btn-light">- {% translate "No workouts found." %} {% translate "Add one now." %}- </a>+ {% translate 'Add one now.' as text %}+ {% url 'manager:step:add' schedule.id as url %}+ {% modal_link url=url text=text css_class='dropdown-item' %}</td></tr>{% endif %}@@ -151,17 +163,16 @@<tr><td colspan="4">{% if not schedule.is_active %}- <a href="{% url 'manager:schedule:start' schedule.pk %}" class="btn btn-success btn-sm">+ <a href="{% url 'manager:schedule:start' schedule.pk %}"+ class="btn btn-success btn-sm"><span class="{% fa_class 'play' %}"></span>{% translate "Start schedule" %}</a>{% endif %}- <a href="{% url 'manager:step:add' schedule.id %}"- class="wger-modal-dialog btn btn-light btn-sm">- <span class="{% fa_class 'plus' %}"></span>- {% translate "Add workout" %}- </a>+ {% translate 'Add workout' as text %}+ {% url 'manager:step:add' schedule.id as url %}+ {% modal_link url=url text=text css_class='btn btn-light btn-sm' %}</td><td colspan="2"></td>@@ -230,13 +241,16 @@<div class="modal-content"><div class="modal-header"><h4 class="modal-title">{% translate "Export calendar file" %}</h4>- <button type="button" class="close" data-bs-dismiss="modal" aria-hidden="true">×</button>+ <button type="button" class="close" data-bs-dismiss="modal" aria-hidden="true">+ ×+ </button></div><div class="modal-body"><p>{% translate "Export this schedule as a calendar file." %}</p><p>{% blocktranslate %}You can then import the file it into your calendarapplication for example google calendar, outlook or iCal. This will create- an appointment for each training day with the appropriate exercises.{% endblocktranslate %}</p>+ an appointment for each training day with the appropriate+ exercises.{% endblocktranslate %}</p><p><a href="{% url 'manager:schedule:ical' schedule.id uid token %}"class="btn btn-block btn-light">@@ -245,7 +259,8 @@</p></div><div class="modal-footer">- <button type="button" class="btn btn-light" data-bs-dismiss="modal">{% translate "Close" %}</button>+ <button type="button" class="btn btn-light"+ data-bs-dismiss="modal">{% translate "Close" %}</button></div></div></div>@@ -256,17 +271,21 @@<div class="modal-content"><div class="modal-header"><h4 class="modal-title">{% translate "Download as PDF" %}</h4>- <button type="button" class="close" data-bs-dismiss="modal" aria-hidden="true">×</button>+ <button type="button" class="close" data-bs-dismiss="modal" aria-hidden="true">+ ×+ </button></div><div class="modal-body"><form class="wger-form">{% crispy download_form %}- <div id="pdf-download-info" data-schedule-id="{{ schedule.id|unlocalize }}" data-uid="{{ uid }}"+ <div id="pdf-download-info" data-schedule-id="{{ schedule.id|unlocalize }}"+ data-uid="{{ uid }}"data-token="{{ token }}"></div></form></div><div class="modal-footer">- <button type="button" class="btn btn-light" data-bs-dismiss="modal">{% translate "Close" %}</button>+ <button type="button" class="btn btn-light"+ data-bs-dismiss="modal">{% translate "Close" %}</button></div></div></div>@@ -279,30 +298,33 @@{% block options %}<div class="btn-group"><div class="btn-group">- <button type="button" class="btn btn-primary btn-sm dropdown-toggle" data-bs-toggle="dropdown"+ <button type="button" class="btn btn-primary btn-sm dropdown-toggle"+ data-bs-toggle="dropdown"aria-haspopup="true" aria-expanded="false"><span class="{% fa_class 'cog' %}"></span>{% translate "Options" %}</button><div class="dropdown-menu">- <a href="#" data-bs-toggle="modal" data-bs-target="#export-ical-popup" class="dropdown-item">+ <a href="#" data-bs-toggle="modal" data-bs-target="#export-ical-popup"+ class="dropdown-item"><span class="{% fa_class 'calendar' %}"></span>{% translate "Export calendar file" %}</a>- <a data-bs-toggle="modal" data-bs-target="#download-pdf-popup" class="dropdown-item">+ <a data-bs-toggle="modal" data-bs-target="#download-pdf-popup"+ class="dropdown-item"><span class="{% fa_class 'download' %}"></span>{% translate "Download as PDF" %}</a>{% if is_owner %}- <a href="{% url 'manager:schedule:edit' schedule.id %}" class="wger-modal-dialog dropdown-item">- <span class="{% fa_class 'edit' %}"></span>- {% translate "Edit schedule" %}- </a>+ {% translate 'Edit' as text %}+ {% url 'manager:schedule:edit' schedule.id as url %}+ {% modal_link url=url text=text css_class='dropdown-item' %}+<div role="separator" class="dropdown-divider"></div>- <a href="{% url 'manager:schedule:delete' schedule.id %}" class="wger-modal-dialog dropdown-item">- <span class="{% fa_class 'trash' %}"></span>- {% translate "Delete schedule" %}- </a>++ {% translate 'Delete' as text %}+ {% url 'manager:schedule:delete' schedule.id as url %}+ {% modal_link url=url text=text css_class='dropdown-item' %}{% endif %}</div></div>diff --git a/wger/manager/templates/workout/view.html b/wger/manager/templates/workout/view.htmlindex 11fa48209..496fbaf03 100644--- a/wger/manager/templates/workout/view.html+++ b/wger/manager/templates/workout/view.html@@ -67,21 +67,26 @@<div class="modal-content"><div class="modal-header"><h4 class="modal-title">{% translate "Export calendar file" %}</h4>- <button type="button" class="close" data-bs-dismiss="modal" aria-hidden="true">×</button>+ <button type="button" class="close" data-bs-dismiss="modal" aria-hidden="true">+ ×+ </button></div><div class="modal-body"><p>{% translate "Export this workout as a calendar file." %}</p><p>{% blocktranslate %}You can then import the file it into your calendarapplication for example google calendar, outlook or iCal. This will create- an appointment for each training day with the appropriate exercises.{% endblocktranslate %}</p>+ an appointment for each training day with the appropriate+ exercises.{% endblocktranslate %}</p><p>- <a href="{% url 'manager:workout:ical' workout.id uid token %}" class="btn btn-block btn-light">+ <a href="{% url 'manager:workout:ical' workout.id uid token %}"+ class="btn btn-block btn-light">{% translate "Export calendar file" %}</a></p></div><div class="modal-footer">- <button type="button" class="btn btn-light" data-bs-dismiss="modal">{% translate "Close" %}</button>+ <button type="button" class="btn btn-light"+ data-bs-dismiss="modal">{% translate "Close" %}</button></div></div></div>@@ -92,35 +97,41 @@<div class="modal-content"><div class="modal-header"><h4 class="modal-title">{% translate "Download as PDF" %}</h4>- <button type="button" class="close float-end" data-bs-dismiss="modal" aria-hidden="true">×+ <button type="button" class="close float-end" data-bs-dismiss="modal"+ aria-hidden="true">×</button></div><div class="modal-body"><form class="wger-form">- <div id="pdf-download-info" data-workout-id="{{ workout.id|unlocalize }}" data-uid="{{ uid }}"+ <div id="pdf-download-info" data-workout-id="{{ workout.id|unlocalize }}"+ data-uid="{{ uid }}"data-token="{{ token }}"></div><div class="form-group form-check-inline">- <input type="radio" name="pdf_type" class="form-check-input" id="id_type_log" value="log"+ <input type="radio" name="pdf_type" class="form-check-input"+ id="id_type_log" value="log"checked><label class="form-check-label" for="id_type_log">{% translate "Log" %}</label></div><div class="form-group form-check-inline">- <input type="radio" name="pdf_type" id="id_type_table" class="form-check-input"+ <input type="radio" name="pdf_type" id="id_type_table"+ class="form-check-input"value="table"><label class="form-check-label" for="id_type_table">{% translate "Table" %}</label></div><div class="form-group form-check">- <input type="checkbox" class="form-check-input" name="images" id="id_images" checked>+ <input type="checkbox" class="form-check-input" name="images"+ id="id_images" checked><label for="id_images" class="form-check-label">{% translate "with images" %}</label></div><div class="form-group form-check">- <input type="checkbox" class="form-check-input" name="comments" id="id_comments" checked>+ <input type="checkbox" class="form-check-input" name="comments"+ id="id_comments" checked><label for="id_comments" class="form-check-label">{% translate "with comments" %}</label>@@ -134,7 +145,8 @@</p></div><div class="modal-footer">- <button type="button" class="btn btn-light" data-bs-dismiss="modal">{% translate "Close" %}</button>+ <button type="button" class="btn btn-light"+ data-bs-dismiss="modal">{% translate "Close" %}</button></div></div></div>@@ -143,7 +155,8 @@{% if workout.canonical_representation.day_list %}<h4>{% translate "Logs" %}</h4><p>- <a class="btn btn-primary btn-sm" href="{% url 'manager:log:log' workout.id %}">{% translate 'View logs' %}</a>+ <a class="btn btn-primary btn-sm"+ href="{% url 'manager:log:log' workout.id %}">{% translate 'View logs' %}</a></p>{% endif %}@@ -157,19 +170,20 @@{% block options %}<div class="btn-group" role="group"><div class="btn-group" role="group">- <button id="btnGroupWorkout" type="button" class="btn btn-primary btn-sm dropdown-toggle"+ <button id="btnGroupWorkout" type="button"+ class="btn btn-primary btn-sm dropdown-toggle"data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><span class="{% fa_class 'cog' %}"></span>{% translate "Options" %}</button><div class="dropdown-menu" aria-labelledby="btnGroupWorkout">{% if is_owner %}- <a href="{% url 'manager:workout:edit' workout.id %}" class="dropdown-item wger-modal-dialog">- <span class="{% fa_class 'edit' %}"></span>- {% translate "Edit workout" %}- </a>+ {% translate 'Edit' as text %}+ {% url 'manager:workout:edit' workout.id as url %}+ {% modal_link url=url text=text css_class='dropdown-item' %}{% endif %}- <a class="dropdown-item" data-bs-toggle="modal" data-bs-target="#download-pdf-popup">+ <a class="dropdown-item" data-bs-toggle="modal"+ data-bs-target="#download-pdf-popup"><span class="{% fa_class 'download' %}"></span>{% translate "Download as PDF" %}</a>@@ -177,16 +191,17 @@<span class="{% fa_class 'calendar' %}"></span>{% translate "Export calendar file" %}</a>- <a href="{% url 'manager:workout:make-template' workout.id %}" class="dropdown-item wger-modal-dialog">- <span class="{% fa_class 'clone' %}"></span>- {% translate "Mark as template" %}- </a>++ {% translate 'Mark as template' as text %}+ {% url 'manager:workout:make-template' workout.id as url %}+ {% modal_link url=url text=text css_class='dropdown-item' %}+{% if is_owner %}<div class="dropdown-divider"></div>- <a href="{% url 'manager:workout:delete' workout.id %}" class="dropdown-item wger-modal-dialog">- <span class="{% fa_class 'trash' %}"></span>- {% translate "Delete" %}- </a>++ {% translate 'Delete' as text %}+ {% url 'manager:workout:delete' workout.id as url %}+ {% modal_link url=url text=text css_class='dropdown-item' %}{% endif %}</div></div>diff --git a/wger/nutrition/templates/ingredient/overview.html b/wger/nutrition/templates/ingredient/overview.htmlindex 1e2733de3..dc3a67b07 100644--- a/wger/nutrition/templates/ingredient/overview.html+++ b/wger/nutrition/templates/ingredient/overview.html@@ -41,8 +41,8 @@{% endif %}- <div style="padding-top:3em;"></div>- {% pagination paginator page_obj %}+ <div style="padding-top:3em;"></div>+ {% pagination paginator page_obj %}{% endblock %}{% block sidebar %}@@ -56,10 +56,8 @@{# Options #}{# #}{% block options %}- {% if perms.nutrition.add_ingredient and user.is_authenticated and not user.userprofile.is_temporary %}- <a href="{% url 'nutrition:ingredient:add' %}"- class="btn btn-success btn-sm">- {% translate "Add ingredient" %}- </a>+ {% if perms.nutrition.add_ingredient %}+ {% translate 'Add' as text %}+ {% modal_link url='nutrition:ingredient:add' text=text %}{% endif %}{% endblock %}diff --git a/wger/nutrition/templates/ingredient/view.html b/wger/nutrition/templates/ingredient/view.htmlindex 65c2a8b1f..7cf64dfe8 100644--- a/wger/nutrition/templates/ingredient/view.html+++ b/wger/nutrition/templates/ingredient/view.html@@ -139,11 +139,10 @@ $(document).ready(function() {{% if perms.nutrition.delete_ingredient %}<h4>{% translate "Weight units" %}</h4>-<p>- <a href="{% url 'nutrition:unit_ingredient:add' ingredient.id %}" class="btn btn-success btn-sm wger-modal-dialog">- {% translate "Add new weight unit" %}- </a>-</p>++{% translate 'Add new weight unit' as text %}+{% url 'nutrition:unit_ingredient:add' ingredient.id as url %}+{% modal_link url=url text=text %}{% if ingredient.ingredientweightunit_set.exists %}<table class="table">@@ -162,8 +161,13 @@ $(document).ready(function() {<span class="{% fa_class 'cog' %}"></span></button><div class="dropdown-menu dropdown-menu-right" role="menu">- <a href="{% url 'nutrition:unit_ingredient:edit' unit.id %}" class="wger-modal-dialog dropdown-item">{% translate 'Edit' %}</a>- <a href="{% url 'nutrition:unit_ingredient:delete' unit.id %}" class="wger-modal-dialog dropdown-item">{% translate 'Delete' %}</a>+ {% translate 'Edit' as text %}+ {% url 'nutrition:unit_ingredient:edit' unit.id as url %}+ {% modal_link url=url text=text css_class='dropdown-item' %}++ {% translate 'Delete' as text %}+ {% url 'nutrition:unit_ingredient:delete' unit.id as url %}+ {% modal_link url=url text=text css_class='dropdown-item' %}</div></div></td>@@ -202,17 +206,15 @@ $(document).ready(function() {{% translate "Options" %}</button><div class="dropdown-menu">- <a href="{% url 'nutrition:ingredient:edit' ingredient.id %}"- title="{% translate 'Edit ingredient' %}"- class="dropdown-item">- <span class="{% fa_class 'edit' %}"></span>- {% translate 'Edit ingredient' %}- </a>+ {% translate 'Edit' as text %}+ {% url 'nutrition:ingredient:edit' ingredient.id as url %}+ {% modal_link url=url text=text css_class='dropdown-item' %}+<div role="separator" class="dropdown-divider"></div>- <a href="{% url 'nutrition:ingredient:delete' ingredient.id %}"- title="{% translate 'Delete ingredient' %}" class="wger-modal-dialog dropdown-item" >- <span class="{% fa_class 'trash' %}"></span>- {% translate 'Delete' %}++ {% translate 'Delete' as text %}+ {% url 'nutrition:ingredient:delete' ingredient.id as url %}+ {% modal_link url=url text=text css_class='dropdown-item' %}</a></div></div>diff --git a/wger/nutrition/templates/units/list.html b/wger/nutrition/templates/units/list.htmlindex 475518856..2dbc3fc32 100644--- a/wger/nutrition/templates/units/list.html+++ b/wger/nutrition/templates/units/list.html@@ -11,15 +11,20 @@{% for unit in unit_list %}<li class="list-group-item "><div class="btn-group float-end">- <button type="button" class="btn btn-light dropdown-toggle btn-sm" data-bs-toggle="dropdown">+ <button type="button" class="btn btn-light dropdown-toggle btn-sm"+ data-bs-toggle="dropdown"><span class="{% fa_class 'cog' %}"></span></button><div class="dropdown-menu dropdown-menu-right" role="menu">- <a href="{% url 'nutrition:weight_unit:edit' unit.id %}"- class="wger-modal-dialog dropdown-item">{% translate 'Edit' %}</a>+ {% translate 'Edit' as text %}+ {% url 'nutrition:weight_unit:edit' unit.id as url %}+ {% modal_link url=url text=text css_class='dropdown-item' %}+<div class="dropdown-divider"></div>- <a href="{% url 'nutrition:weight_unit:delete' unit.id %}"- class="wger-modal-dialog dropdown-item">{% translate 'Delete' %}</a>++ {% translate 'Delete' as text %}+ {% url 'nutrition:weight_unit:delete' unit.id as url %}+ {% modal_link url=url text=text css_class='dropdown-item' %}</div></div>{{ unit.name }}@@ -42,7 +47,6 @@{# Options #}{# #}{% block options %}- <a href="{% url 'nutrition:weight_unit:add' %}" class="btn btn-success btn-sm wger-modal-dialog">- {% translate "Add new weight unit" %}- </a>+ {% translate 'Add new weight unit' as text %}+ {% modal_link url='nutrition:weight_unit:add' text=text %}{% endblock %}diff --git a/wger/nutrition/tests/test_ingredient.py b/wger/nutrition/tests/test_ingredient.pyindex 5176d1749..240c68b7d 100644--- a/wger/nutrition/tests/test_ingredient.py+++ b/wger/nutrition/tests/test_ingredient.py@@ -205,11 +205,11 @@ class IngredientDetailTestCase(WgerTestCase):# Only authorized users see the edit linksif editor:- self.assertContains(response, 'Edit ingredient')- self.assertContains(response, 'Delete ingredient')+ self.assertContains(response, 'Edit')+ self.assertContains(response, 'Delete')else:- self.assertNotContains(response, 'Edit ingredient')- self.assertNotContains(response, 'Delete ingredient')+ self.assertNotContains(response, 'Edit')+ self.assertNotContains(response, 'Delete')# Non-existent ingredients throw a 404.response = self.client.get(reverse('nutrition:ingredient:view', kwargs={'pk': 42}))