Do not show expose_always, if set_system_default is not viewable

This commit is contained in:
Alexander Meindl 2020-08-01 19:04:59 +02:00
parent 58d6a206b2
commit 4c1951e79e
2 changed files with 13 additions and 1 deletions

View File

@ -49,6 +49,7 @@ class DashboardsController < ApplicationController
def show
respond_to do |format|
format.html { head 406 }
format.js if request.xhr?
format.api
end

View File

@ -52,7 +52,7 @@
- if User.current.allowed_to? :set_system_dashboards, @project, global: true
p = f.check_box :system_default
p = f.check_box :always_expose
p#always-expose = f.check_box :always_expose
- elsif @dashboard.system_default?
p = f.check_box :system_default, disabled: true
p = f.check_box :always_expose
@ -72,4 +72,15 @@ javascript:
var private_checked = $('#dashboard_visibility_0').is(':checked');
$("input[name='dashboard[role_ids][]'][type=checkbox]").attr('disabled', !roles_checked);
}).trigger('change');
$("input[name='dashboard[system_default]']").change(function(){
var selection = $('#dashboard_system_default').is(':checked');
console.log(selection)
if (selection) {
$('#always-expose').show();
}
else {
$('#always-expose').hide();
}
}).trigger('change');
});