From 7c91f0f8bc40cdfb5a63131509f79b97ad7b2a1b Mon Sep 17 00:00:00 2001 From: ishikawa Date: Wed, 28 Feb 2018 09:48:42 +0900 Subject: [PATCH 3/3] Fix changeable items on the queries/form --- app/views/gantts/show.html.erb | 21 +++++++++++---------- app/views/queries/_form.html.erb | 8 ++------ 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/app/views/gantts/show.html.erb b/app/views/gantts/show.html.erb index 63617ce65..f20cc888c 100644 --- a/app/views/gantts/show.html.erb +++ b/app/views/gantts/show.html.erb @@ -1,10 +1,4 @@ <% @gantt.view = self %> -
-<% if !@query.new_record? && @query.editable_by?(User.current) %> - <%= link_to l(:button_edit), edit_query_path(@query, :gantt => 1), :class => 'icon icon-edit' %> - <%= delete_link query_path(@query, :gantt => 1) %> -<% end %> -

<%= @query.new_record? ? l(:label_gantt) : @query.name %>

@@ -89,10 +83,17 @@ :class => 'icon icon-checked' %> <%= link_to l(:button_clear), { :project_id => @project, :set_filter => 1 }, :class => 'icon icon-reload' %> - <% if @query.new_record? && User.current.allowed_to?(:save_queries, @project, :global => true) %> - <%= link_to_function l(:button_save), - "$('#query_form').attr('action', '#{ @project ? new_project_query_path(@project) : new_query_path }').submit();", - :class => 'icon icon-save' %> + <% if @query.new_record? %> + <% if User.current.allowed_to?(:save_queries, @project, :global => true) %> + <%= link_to_function l(:button_save), + "$('#query_form').attr('action', '#{ @project ? new_project_query_path(@project) : new_query_path }').submit();", + :class => 'icon icon-save' %> + <% end %> + <% else %> + <% if @query.editable_by?(User.current) %> + <%= link_to l(:button_edit), edit_query_path(@query, :gantt => 1), :class => 'icon icon-edit' %> + <%= delete_link query_path(@query, :gantt => 1) %> + <% end %> <% end %>

diff --git a/app/views/queries/_form.html.erb b/app/views/queries/_form.html.erb index 094860865..ff94e58c6 100644 --- a/app/views/queries/_form.html.erb +++ b/app/views/queries/_form.html.erb @@ -22,12 +22,12 @@

<%= check_box_tag 'query_is_for_all', 1, @query.project.nil?, :class => (User.current.admin? ? '' : 'disable-unless-private') %>

-<% unless params[:gantt] %>
<%= l(:label_options) %>

<%= check_box_tag 'default_columns', 1, @query.has_default_columns?, :id => 'query_default_columns', :data => {:disables => "#columns, .block_columns input"} %>

+<% unless params[:gantt] %>

<%= select 'query', 'group_by', @query.groupable_columns.collect {|c| [c.caption, c.name.to_s]}, :include_blank => true %>

@@ -36,16 +36,14 @@

<%= available_totalable_columns_tags(@query) %>

-
<% else %> -
<%= l(:label_options) %>

-
<% end %> +
<%= l(:label_filter_plural) %> @@ -71,12 +69,10 @@
<% end %> -<% unless params[:gantt] %> <%= content_tag 'fieldset', :id => 'columns' do %> <%= l(:field_column_names) %> <%= render_query_columns_selection(query) %> <% end %> -<% end %> -- 2.14.3 (Apple Git-98)