diff --git a/app/controllers/queries_controller.rb b/app/controllers/queries_controller.rb index e54c9bef..60f3b445 100644 --- a/app/controllers/queries_controller.rb +++ b/app/controllers/queries_controller.rb @@ -25,10 +25,11 @@ class QueriesController < ApplicationController @query.project = params[:query_is_for_all] ? nil : @project @query.user = User.current @query.is_public = false unless User.current.allowed_to?(:manage_public_queries, @project) || User.current.admin? - @query.column_names = nil if params[:default_columns] @query.add_filters(params[:fields] || params[:f], params[:operators] || params[:op], params[:values] || params[:v]) if params[:fields] || params[:f] @query.group_by ||= params[:group_by] + @query.column_names = params[:c] if params[:c] + @query.column_names = nil if params[:default_columns] if request.post? && params[:confirm] && @query.save flash[:notice] = l(:notice_successful_create) @@ -45,6 +46,8 @@ class QueriesController < ApplicationController @query.attributes = params[:query] @query.project = nil if params[:query_is_for_all] @query.is_public = false unless User.current.allowed_to?(:manage_public_queries, @project) || User.current.admin? + @query.group_by ||= params[:group_by] + @query.column_names = params[:c] if params[:c] @query.column_names = nil if params[:default_columns] if @query.save diff --git a/app/helpers/queries_helper.rb b/app/helpers/queries_helper.rb index b6dc697e..61a1846d 100644 --- a/app/helpers/queries_helper.rb +++ b/app/helpers/queries_helper.rb @@ -87,7 +87,7 @@ module QueriesHelper end end @query.group_by = params[:group_by] - @query.column_names = params[:query] && params[:query][:column_names] + @query.column_names = params[:c] || (params[:query] && params[:query][:column_names]) session[:query] = {:project_id => @query.project_id, :filters => @query.filters, :group_by => @query.group_by, :column_names => @query.column_names} else @query = Query.find_by_id(session[:query][:id]) if session[:query][:id] diff --git a/app/views/queries/_columns.rhtml b/app/views/queries/_columns.rhtml index 91ee627b..f96d87b0 100644 --- a/app/views/queries/_columns.rhtml +++ b/app/views/queries/_columns.rhtml @@ -10,7 +10,7 @@ -