diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2015-06-29 16:06:37 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2015-06-29 16:06:37 +0000 |
commit | 004fc8b84b1cebc521664ca3830f969a91244e67 (patch) | |
tree | f84169227818ebd9365df50aeb446a2c8b977fe5 /app/views/queries/_form.html.erb | |
parent | 3834b3d2ef2b7ceab8942e95b66e5a3cae63dce7 (diff) | |
download | redmine-004fc8b84b1cebc521664ca3830f969a91244e67.tar.gz redmine-004fc8b84b1cebc521664ca3830f969a91244e67.zip |
Fixed that user with "Manage public queries" permission, can create global public query (#19842).
git-svn-id: http://svn.redmine.org/redmine/trunk@14388 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/views/queries/_form.html.erb')
-rw-r--r-- | app/views/queries/_form.html.erb | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/app/views/queries/_form.html.erb b/app/views/queries/_form.html.erb index fc03b857d..753eaedab 100644 --- a/app/views/queries/_form.html.erb +++ b/app/views/queries/_form.html.erb @@ -7,21 +7,20 @@ <p><label for="query_name"><%=l(:field_name)%></label> <%= text_field 'query', 'name', :size => 80 %></p> -<% if User.current.admin? || User.current.allowed_to?(:manage_public_queries, @project) %> +<% if User.current.admin? || User.current.allowed_to?(:manage_public_queries, @query.project) %> <p><label><%=l(:field_visible)%></label> <label class="block"><%= radio_button 'query', 'visibility', Query::VISIBILITY_PRIVATE %> <%= l(:label_visibility_private) %></label> + <label class="block"><%= radio_button 'query', 'visibility', Query::VISIBILITY_PUBLIC %> <%= l(:label_visibility_public) %></label> <label class="block"><%= radio_button 'query', 'visibility', Query::VISIBILITY_ROLES %> <%= l(:label_visibility_roles) %>:</label> <% Role.givable.sorted.each do |role| %> <label class="block role-visibility"><%= check_box_tag 'query[role_ids][]', role.id, @query.roles.include?(role), :id => nil %> <%= role.name %></label> <% end %> - <label class="block"><%= radio_button 'query', 'visibility', Query::VISIBILITY_PUBLIC %> <%= l(:label_visibility_public) %></label> <%= hidden_field_tag 'query[role_ids][]', '' %> </p> <% end %> <p><label for="query_is_for_all"><%=l(:field_is_for_all)%></label> -<%= check_box_tag 'query_is_for_all', 1, @query.project.nil?, - :disabled => (!@query.new_record? && (@query.project.nil? || (@query.is_public? && !User.current.admin?))) %></p> +<%= check_box_tag 'query_is_for_all', 1, @query.project.nil?, :class => (User.current.admin? ? '' : 'disable-unless-private') %></p> <% unless params[:gantt] %> <fieldset><legend><%= l(:label_options) %></legend> @@ -80,8 +79,11 @@ <%= javascript_tag do %> $(document).ready(function(){ $("input[name='query[visibility]']").change(function(){ - var checked = $('#query_visibility_1').is(':checked'); - $("input[name='query[role_ids][]'][type=checkbox]").attr('disabled', !checked); + var roles_checked = $('#query_visibility_1').is(':checked'); + var private_checked = $('#query_visibility_0').is(':checked'); + $("input[name='query[role_ids][]'][type=checkbox]").attr('disabled', !roles_checked); + if (!private_checked) $("input.disable-unless-private").attr('checked', false); + $("input.disable-unless-private").attr('disabled', !private_checked); }).trigger('change'); }); <% end %> |