diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2019-10-19 11:36:13 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2019-10-19 11:36:13 +0000 |
commit | 6c5440a21b491982c02531c82b4416ef212eb3dc (patch) | |
tree | 27d069aac9d26f8f6b76b697e8033b18fa65eaa3 /app/views/queries | |
parent | 868578c0f297875eeac324af8a8c7f1445593ecd (diff) | |
download | redmine-6c5440a21b491982c02531c82b4416ef212eb3dc.tar.gz redmine-6c5440a21b491982c02531c82b4416ef212eb3dc.zip |
Filters for Projects page (#29482).
Patch by Marius BALTEANU.
git-svn-id: http://svn.redmine.org/redmine/trunk@18761 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/views/queries')
-rw-r--r-- | app/views/queries/_form.html.erb | 38 | ||||
-rw-r--r-- | app/views/queries/_query_form.html.erb | 62 |
2 files changed, 57 insertions, 43 deletions
diff --git a/app/views/queries/_form.html.erb b/app/views/queries/_form.html.erb index f1ef5ecac..a2dd9f589 100644 --- a/app/views/queries/_form.html.erb +++ b/app/views/queries/_form.html.erb @@ -7,20 +7,26 @@ <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, @query.project) %> +<% if User.current.admin? || + User.current.allowed_to?(:manage_public_queries, @query.project) || + @query.type == 'ProjectQuery' && User.current.allowed_to?(:manage_public_queries, @query.project, :global => true) %> <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> + <% unless @query.type == 'ProjectQuery' %> + <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 %> + <%= hidden_field_tag 'query[role_ids][]', '' %> <% end %> - <%= 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?, :class => (User.current.admin? ? '' : 'disable-unless-private') %></p> +<% unless @query.type == 'ProjectQuery' %> + <p><label for="query_is_for_all"><%=l(:field_is_for_all)%></label> + <%= check_box_tag 'query_is_for_all', 1, @query.project.nil?, :class => (User.current.admin? ? '' : 'disable-unless-private') %></p> +<% end %> <fieldset id="options"><legend><%= l(:label_options) %></legend> <p><label for="query_default_columns"><%=l(:label_default_columns)%></label> @@ -28,14 +34,18 @@ :data => {:disables => "#columns, .block_columns input"} %></p> <% unless params[:gantt] %> -<p><label for="query_group_by"><%= l(:field_group_by) %></label> -<%= select 'query', 'group_by', @query.groupable_columns.collect {|c| [c.caption, c.name.to_s]}, :include_blank => true %></p> + <p><label for="query_group_by"><%= l(:field_group_by) %></label> + <%= select 'query', 'group_by', @query.groupable_columns.collect {|c| [c.caption, c.name.to_s]}, :include_blank => true %></p> -<p class="block_columns"><label><%= l(:button_show) %></label> -<%= available_block_columns_tags(@query) %></p> + <% unless @query.available_block_columns.empty? %> + <p class="block_columns"><label><%= l(:button_show) %></label> + <%= available_block_columns_tags(@query) %></p> + <% end %> -<p><label><%= l(:label_total_plural) %></label> -<%= available_totalable_columns_tags(@query) %></p> + <% unless @query.available_totalable_columns.empty? %> + <p class="totable_columns"><label><%= l(:label_total_plural) %></label> + <%= available_totalable_columns_tags(@query) %></p> + <% end %> <% else %> <p><label><%= l(:button_show) %></label> <%= hidden_field_tag 'query[draw_relations]', '0' %> @@ -54,7 +64,7 @@ </fieldset> <% unless params[:gantt] %> -<fieldset><legend><%= l(:label_sort) %></legend> +<fieldset id="sort"><legend><%= l(:label_sort) %></legend> <% 3.times do |i| %> <%= content_tag(:span, "#{i+1}:", :class => 'query_sort_criteria_count')%> <%= label_tag "query_sort_criteria_attribute_" + i.to_s, diff --git a/app/views/queries/_query_form.html.erb b/app/views/queries/_query_form.html.erb index c8be6b771..65bcc3eb5 100644 --- a/app/views/queries/_query_form.html.erb +++ b/app/views/queries/_query_form.html.erb @@ -11,35 +11,39 @@ </div> </fieldset> - <fieldset id="options" class="collapsible collapsed"> - <legend onclick="toggleFieldset(this);" class="icon icon-collapsed"><%= l(:label_options) %></legend> - <div style="display: none;"> - <table> - <tr> - <td class="field"><%= l(:field_column_names) %></td> - <td><%= render_query_columns_selection(@query) %></td> - </tr> - <% if @query.groupable_columns.any? %> - <tr> - <td class="field"><label for='group_by'><%= l(:field_group_by) %></label></td> - <td><%= group_by_column_select_tag(@query) %></td> - </tr> - <% end %> - <% if @query.available_block_columns.any? %> - <tr> - <td class="field"><%= l(:button_show) %></td> - <td><%= available_block_columns_tags(@query) %></td> - </tr> - <% end %> - <% if @query.available_totalable_columns.any? %> - <tr> - <td><%= l(:label_total_plural) %></td> - <td><%= available_totalable_columns_tags(@query) %></td> - </tr> - <% end %> - </table> - </div> - </fieldset> + <% if @query.available_columns.any? %> + <fieldset id="options" class="collapsible collapsed"> + <legend onclick="toggleFieldset(this);" class="icon icon-collapsed"><%= l(:label_options) %></legend> + <div style="display: none;"> + <table> + <% if @query.available_columns.any? %> + <tr> + <td class="field"><%= l(:field_column_names) %></td> + <td><%= render_query_columns_selection(@query) %></td> + </tr> + <% end %> + <% if @query.groupable_columns.any? %> + <tr> + <td class="field"><label for='group_by'><%= l(:field_group_by) %></label></td> + <td><%= group_by_column_select_tag(@query) %></td> + </tr> + <% end %> + <% if @query.available_block_columns.any? %> + <tr> + <td class="field"><%= l(:button_show) %></td> + <td><%= available_block_columns_tags(@query) %></td> + </tr> + <% end %> + <% if @query.available_totalable_columns.any? %> + <tr> + <td><%= l(:label_total_plural) %></td> + <td><%= available_totalable_columns_tags(@query) %></td> + </tr> + <% end %> + </table> + </div> + </fieldset> + <% end %> </div> <p class="buttons"> |