Skip to content

Commit 5c6189e

Browse files
committed
Refine the warning message UI and disable actions buttons #310
Signed-off-by: tdruez <[email protected]>
1 parent c793044 commit 5c6189e

File tree

4 files changed

+33
-10
lines changed

4 files changed

+33
-10
lines changed

dje/templates/object_details_base.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<h1 class="header-title text-break">
2323
{% block header_title %}
2424
{{ object|truncatechars:100 }}
25-
<small class="ms-1" style="font-size: 70%">
25+
<small class="ms-1" style="font-size: 65%">
2626
{% if is_user_dataspace %}
2727
{% if has_change_permission %}
2828
{% with object.get_change_url as object_change_url %}

product_portfolio/templates/product_portfolio/product_details.html

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,13 @@
44

55
{% block pager-toolbar %}
66
{% if is_user_dataspace %}
7-
{% if has_edit_productcomponent or has_edit_productpackage or has_change_codebaseresource_permission or has_add_productcomponent %}
7+
{% if product.is_locked %}
8+
<span class="d-inline-block" data-bs-toggle="tooltip" title="Inventory is locked">
9+
<button type="button" class="btn btn-outline-dark dropdown-toggle" disabled>
10+
<i class="fas fa-tasks"></i> Manage
11+
</button>
12+
</span>
13+
{% elif has_edit_productcomponent or has_edit_productpackage or has_change_codebaseresource_permission or has_add_productcomponent %}
814
<div class="dropdown btn-group">
915
<a class="btn btn-outline-dark dropdown-toggle" data-bs-toggle="dropdown" role="button" href="#"><i class="fas fa-tasks"></i> {% trans 'Manage' %}</a>
1016
<div class="dropdown-menu dropdown-menu-end">
@@ -31,9 +37,17 @@
3137
</div>
3238
{% endif %}
3339

34-
{% if has_scan_all_packages or has_change_permission %}
40+
{% if product.is_locked %}
41+
<span class="d-inline-block" data-bs-toggle="tooltip" title="Inventory is locked">
42+
<button type="button" class="btn btn-outline-dark dropdown-toggle" disabled>
43+
<i class="fas fa-toolbox"></i> Actions
44+
</button>
45+
</span>
46+
{% elif has_scan_all_packages or has_change_permission %}
3547
<div class="dropdown btn-group">
36-
<a class="btn btn-outline-dark dropdown-toggle" data-bs-toggle="dropdown" role="button" href="#"><i class="fas fa-toolbox"></i>&nbsp;Actions</a>
48+
<a class="btn btn-outline-dark dropdown-toggle" data-bs-toggle="dropdown" role="button" href="#">
49+
<i class="fas fa-toolbox"></i> Actions
50+
</a>
3751
<div class="dropdown-menu dropdown-menu-end">
3852
<div class="dropdown-header">Import</div>
3953
{% if has_change_permission %}
@@ -111,11 +125,6 @@
111125
{% endblock %}
112126

113127
{% block content %}
114-
{% if product.is_locked %}
115-
<small class="d-inline-flex mb-3 px-2 py-1 fw-semibold text-warning-emphasis bg-warning-subtle border border-warning-subtle rounded-2">
116-
This product version is marked as read-only, preventing any modifications to its inventory.
117-
</small>
118-
{% endif %}
119128
{{ block.super }}
120129
{% if has_scan_all_packages %}
121130
{% include 'product_portfolio/modals/scan_all_packages_modal.html' %}
@@ -138,6 +147,19 @@
138147
{% endif %}
139148
{% endblock %}
140149

150+
{% block messages-alert %}
151+
{% if product.is_locked %}
152+
<div class="container pe-0">
153+
<div class="alert alert-warning alert-dismissible mb-2 py-2" role="alert">
154+
<strong>
155+
This product version is marked as read-only, preventing any modifications to its inventory.
156+
</strong>
157+
</div>
158+
</div>
159+
{% endif %}
160+
{{ block.super }}
161+
{% endblock %}
162+
141163
{% block extrastyle %}
142164
{{ block.super }}
143165
{% if has_edit_productpackage or has_edit_productcomponent %}

product_portfolio/views.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ def get_queryset(self):
194194
"primary_language",
195195
"keywords",
196196
"configuration_status",
197+
"is_locked",
197198
"request_count",
198199
"dataspace",
199200
)

reporting/templates/reporting/report_run.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
</div>
1616
<h1 class="header-title">
1717
{{ object.name }}
18-
<small class="ms-1" style="font-size: 70%">
18+
<small class="ms-1" style="font-size: 65%">
1919
{% if user.is_staff and has_change_permission %}
2020
<a href="{{ object.get_admin_url }}" data-bs-toggle="tooltip" title="Edit" target="_blank"><i class="far fa-edit"></i></a>
2121
{% endif %}

0 commit comments

Comments
 (0)