Skip to content

Commit 99f8616

Browse files
add_verbose for list add button (#94)
* add_verbose for list add button * triv(dashboar): #dev_ts - move add_label to admin_base_view * triv(dashboar): #dev_ts - default add_label to admin_base_view * triv(dashboar): #dev_ts - default add_label to admin_base_view * upgrade version --------- Co-authored-by: Timotej Siničák <timotej.sinicak@smartbase.sk>
1 parent 8222660 commit 99f8616

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "django-smartbase-admin"
3-
version = "1.0.35"
3+
version = "1.0.36"
44
description = ""
55
authors = ["SmartBase <info@smartbase.sk>"]
66
readme = "README.md"

src/django_smartbase_admin/engine/admin_base_view.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ class SBAdminBaseView(object):
6464
global_filter_data_map = None
6565
field_cache = None
6666
sbadmin_detail_actions = None
67+
add_label = None
6768
delete_confirmation_template = "sb_admin/actions/delete_confirmation.html"
6869

6970
def init_view_static(self, configuration, model, admin_site):
@@ -221,13 +222,17 @@ def get_color_scheme_context(self, request):
221222
"color_scheme_form": color_scheme_form,
222223
}
223224

225+
def get_add_label(self, request, object_id: int | str | None = None):
226+
return self.add_label
227+
224228
def get_global_context(
225229
self, request, object_id: int | str | None = None
226230
) -> dict[str, Any]:
227231
return {
228232
"view_id": self.get_id(),
229233
"configuration": request.request_data.configuration,
230234
"request_data": request.request_data,
235+
"add_label": self.get_add_label(request, object_id),
231236
"DETAIL_STRUCTURE_RIGHT_CLASS": DETAIL_STRUCTURE_RIGHT_CLASS,
232237
"OVERRIDE_CONTENT_OF_NOTIFICATION": OVERRIDE_CONTENT_OF_NOTIFICATION,
233238
"username_data": self.get_username_data(request),

src/django_smartbase_admin/templates/sb_admin/actions/list.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ <h1 class="text-24 md:text-30 text-dark-900 font-bold font-heading line-clamp-1
8888
<svg class="w-20 h-20 md:mr-8">
8989
<use xlink:href="#Plus"></use>
9090
</svg>
91-
<span>{% trans 'Add' %} {{ model_name }}</span>
91+
<span>{% trans 'Add' %}{% if add_label %} {{ add_label }}{% endif %}</span>
9292
</a>
9393
</li>
9494
{% endif %}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{% load i18n %}
22

33
{% if add %}
4-
{% blocktrans with name=opts.verbose_name %}Add {{ name }}{% endblocktrans %}
4+
{% trans 'Add' %}{% if add_label %} {{ add_label }}{% endif %}
55
{% else %}
66
{{ original|truncatewords:"18" }}
77
{% endif %}

0 commit comments

Comments
 (0)