Skip to content

Commit

Permalink
Merge pull request #3234 from Uninett/bugfix/hide-delete-dashboard-bu…
Browse files Browse the repository at this point in the history
…tton-for-default

Hide "Delete dashboard" button for default dashboard
  • Loading branch information
johannaengland authored Nov 26, 2024
2 parents 855819a + 2a3fe46 commit 49480a1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion python/nav/web/static/js/src/webfront.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,8 @@ require([
function addDefaultDashboardListener(feedback) {
var defaultDashboardContainer = $('#default-dashboard-container'),
setDefaultDashboardForm = $('#form-set-default-dashboard'),
isDefaultDashboardAlert = defaultDashboardContainer.find('.alert-box');
isDefaultDashboardAlert = defaultDashboardContainer.find('.alert-box'),
deleteDashboardForm = $('#form-delete-dashboard');

if (defaultDashboardContainer.data('is-default-dashboard')) {
setDefaultDashboardForm.hide();
Expand All @@ -226,6 +227,7 @@ require([
feedback.addFeedback(responseText);
setDefaultDashboardForm.hide();
isDefaultDashboardAlert.show();
deleteDashboardForm.hide();
$dashboardNavigator.find('.fa-star').addClass('hidden');
$dashboardNavigator.find('.current .fa-star').removeClass('hidden');
});
Expand Down
2 changes: 1 addition & 1 deletion python/nav/web/templates/webfront/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ <h4>Import dashboard</h4>
</div>

<div class="column medium-4">
{% if request.account.account_dashboards.count > 1 %}
{% if request.account.account_dashboards.count > 1 and not dashboard.is_default %}
<form id="form-delete-dashboard" method="post" action="{% url 'delete-dashboard' dashboard.pk %}">
<input type="submit" class="small button alert expand" value="Delete dashboard">
</form>
Expand Down

0 comments on commit 49480a1

Please sign in to comment.