summaryrefslogtreecommitdiffstats
path: root/app/helpers/queries_helper.rb
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2020-12-02 13:32:10 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2020-12-02 13:32:10 +0000
commit3029b377c6afab1863679e70d1224b31400d1a90 (patch)
tree41256c05149dc42521328a9169d2bfb070f97200 /app/helpers/queries_helper.rb
parent22173ce0e6cba8f3bb7125b36425ccc605f9bfd7 (diff)
downloadredmine-3029b377c6afab1863679e70d1224b31400d1a90.tar.gz
redmine-3029b377c6afab1863679e70d1224b31400d1a90.zip
shorten long line of QueriesHelper
git-svn-id: http://svn.redmine.org/redmine/trunk@20545 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/helpers/queries_helper.rb')
-rw-r--r--app/helpers/queries_helper.rb59
1 files changed, 51 insertions, 8 deletions
diff --git a/app/helpers/queries_helper.rb b/app/helpers/queries_helper.rb
index 5d7c50f50..0d16c6962 100644
--- a/app/helpers/queries_helper.rb
+++ b/app/helpers/queries_helper.rb
@@ -92,7 +92,14 @@ module QueriesHelper
def available_block_columns_tags(query)
tags = ''.html_safe
query.available_block_columns.each do |column|
- tags << content_tag('label', check_box_tag('c[]', column.name.to_s, query.has_column?(column), :id => nil) + " #{column.caption}", :class => 'inline')
+ tags <<
+ content_tag(
+ 'label',
+ check_box_tag(
+ 'c[]', column.name.to_s,
+ query.has_column?(column), :id => nil
+ ) + " #{column.caption}", :class => 'inline'
+ )
end
tags
end
@@ -101,18 +108,27 @@ module QueriesHelper
tag_name = (options[:name] || 't') + '[]'
tags = ''.html_safe
query.available_totalable_columns.each do |column|
- tags << content_tag('label', check_box_tag(tag_name, column.name.to_s, query.totalable_columns.include?(column), :id => nil) + " #{column.caption}", :class => 'inline')
+ tags <<
+ content_tag(
+ 'label',
+ check_box_tag(
+ tag_name, column.name.to_s,
+ query.totalable_columns.include?(column), :id => nil
+ ) + " #{column.caption}", :class => 'inline'
+ )
end
tags << hidden_field_tag(tag_name, '')
tags
end
def query_available_inline_columns_options(query)
- (query.available_inline_columns - query.columns).reject(&:frozen?).collect {|column| [column.caption, column.name]}
+ (query.available_inline_columns - query.columns).
+ reject(&:frozen?).collect {|column| [column.caption, column.name]}
end
def query_selected_inline_columns_options(query)
- (query.inline_columns & query.available_inline_columns).reject(&:frozen?).collect {|column| [column.caption, column.name]}
+ (query.inline_columns & query.available_inline_columns).
+ reject(&:frozen?).collect {|column| [column.caption, column.name]}
end
def render_query_columns_selection(query, options={})
@@ -311,16 +327,35 @@ module QueriesHelper
@query.project = @project
session[session_key] = {:id => @query.id, :project_id => @query.project_id} if use_session
- elsif api_request? || params[:set_filter] || !use_session || session[session_key].nil? || session[session_key][:project_id] != (@project ? @project.id : nil)
+ elsif api_request? || params[:set_filter] || !use_session ||
+ session[session_key].nil? ||
+ session[session_key][:project_id] != (@project ? @project.id : nil)
# Give it a name, required to be valid
@query = klass.new(:name => "_", :project => @project)
@query.build_from_params(params, options[:defaults])
- session[session_key] = {:project_id => @query.project_id, :filters => @query.filters, :group_by => @query.group_by, :column_names => @query.column_names, :totalable_names => @query.totalable_names, :sort => @query.sort_criteria.to_a} if use_session
+ if use_session
+ session[session_key] = {
+ :project_id => @query.project_id,
+ :filters => @query.filters,
+ :group_by => @query.group_by,
+ :column_names => @query.column_names,
+ :totalable_names => @query.totalable_names,
+ :sort => @query.sort_criteria.to_a
+ }
+ end
else
# retrieve from session
@query = nil
@query = klass.find_by_id(session[session_key][:id]) if session[session_key][:id]
- @query ||= klass.new(:name => "_", :filters => session[session_key][:filters], :group_by => session[session_key][:group_by], :column_names => session[session_key][:column_names], :totalable_names => session[session_key][:totalable_names], :sort_criteria => session[session_key][:sort])
+ @query ||=
+ klass.new(
+ :name => "_",
+ :filters => session[session_key][:filters],
+ :group_by => session[session_key][:group_by],
+ :column_names => session[session_key][:column_names],
+ :totalable_names => session[session_key][:totalable_names],
+ :sort_criteria => session[session_key][:sort]
+ )
@query.project = @project
end
if params[:sort].present?
@@ -342,7 +377,15 @@ module QueriesHelper
@query = IssueQuery.find_by_id(session_data[:id])
return unless @query
else
- @query = IssueQuery.new(:name => "_", :filters => session_data[:filters], :group_by => session_data[:group_by], :column_names => session_data[:column_names], :totalable_names => session_data[:totalable_names], :sort_criteria => session[session_key][:sort])
+ @query =
+ IssueQuery.new(
+ :name => "_",
+ :filters => session_data[:filters],
+ :group_by => session_data[:group_by],
+ :column_names => session_data[:column_names],
+ :totalable_names => session_data[:totalable_names],
+ :sort_criteria => session[session_key][:sort]
+ )
end
if session_data.has_key?(:project_id)
@query.project_id = session_data[:project_id]