diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb
index 7f70f6255..5073571f6 100644
--- a/app/helpers/issues_helper.rb
+++ b/app/helpers/issues_helper.rb
@@ -371,12 +371,16 @@ module IssuesHelper
def issues_to_csv(issues, project, query, options={})
decimal_separator = l(:general_csv_decimal_separator)
encoding = l(:general_csv_encoding)
- columns = (options[:columns] == 'all' ? query.available_columns : query.columns)
+ columns = (options[:columns] == 'all' ? query.available_inline_columns : query.inline_columns)
+ if options[:description]
+ if description = query.available_columns.detect {|q| q.name == :description}
+ columns << description
+ end
+ end
export = FCSV.generate(:col_sep => l(:general_csv_separator)) do |csv|
# csv header fields
- csv << [ "#" ] + columns.collect {|c| Redmine::CodesetUtil.from_utf8(c.caption.to_s, encoding) } +
- (options[:description] ? [Redmine::CodesetUtil.from_utf8(l(:field_description), encoding)] : [])
+ csv << [ "#" ] + columns.collect {|c| Redmine::CodesetUtil.from_utf8(c.caption.to_s, encoding) }
# csv lines
issues.each do |issue|
@@ -398,8 +402,7 @@ module IssuesHelper
end
s.to_s
end
- csv << [ issue.id.to_s ] + col_values.collect {|c| Redmine::CodesetUtil.from_utf8(c.to_s, encoding) } +
- (options[:description] ? [Redmine::CodesetUtil.from_utf8(issue.description, encoding)] : [])
+ csv << [ issue.id.to_s ] + col_values.collect {|c| Redmine::CodesetUtil.from_utf8(c.to_s, encoding) }
end
end
export
diff --git a/app/helpers/queries_helper.rb b/app/helpers/queries_helper.rb
index 6ea879a35..6b9c0962d 100644
--- a/app/helpers/queries_helper.rb
+++ b/app/helpers/queries_helper.rb
@@ -50,6 +50,14 @@ module QueriesHelper
end
end
+ 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)) + " #{column.caption}", :class => 'inline')
+ end
+ tags
+ end
+
def column_header(column)
column.sortable ? sort_header_tag(column.name.to_s, :caption => column.caption,
:default_order => column.default_order) :
@@ -70,6 +78,8 @@ module QueriesHelper
when 'String'
if column.name == :subject
link_to(h(value), :controller => 'issues', :action => 'show', :id => issue)
+ elsif column.name == :description
+ issue.description? ? content_tag('div', textilizable(issue, :description), :class => "wiki") : ''
else
h(value)
end
diff --git a/app/models/query.rb b/app/models/query.rb
index 409095434..a4c9a53ed 100644
--- a/app/models/query.rb
+++ b/app/models/query.rb
@@ -27,6 +27,7 @@ class QueryColumn
self.groupable = name.to_s
end
self.default_order = options[:default_order]
+ @inline = options.key?(:inline) ? options[:inline] : true
@caption_key = options[:caption] || "field_#{name}"
end
@@ -43,6 +44,10 @@ class QueryColumn
@sortable.is_a?(Proc) ? @sortable.call : @sortable
end
+ def inline?
+ @inline
+ end
+
def value(issue)
issue.send name
end
@@ -58,6 +63,7 @@ class QueryCustomFieldColumn < QueryColumn
self.name = "cf_#{custom_field.id}".to_sym
self.sortable = custom_field.order_statement || false
self.groupable = custom_field.group_statement || false
+ @inline = true
@cf = custom_field
end
@@ -153,7 +159,8 @@ class Query < ActiveRecord::Base
QueryColumn.new(:estimated_hours, :sortable => "#{Issue.table_name}.estimated_hours"),
QueryColumn.new(:done_ratio, :sortable => "#{Issue.table_name}.done_ratio", :groupable => true),
QueryColumn.new(:created_on, :sortable => "#{Issue.table_name}.created_on", :default_order => 'desc'),
- QueryColumn.new(:relations, :caption => :label_related_issues)
+ QueryColumn.new(:relations, :caption => :label_related_issues),
+ QueryColumn.new(:description, :inline => false)
]
cattr_reader :available_columns
@@ -506,6 +513,22 @@ class Query < ActiveRecord::Base
end.compact
end
+ def inline_columns
+ columns.select(&:inline?)
+ end
+
+ def block_columns
+ columns.reject(&:inline?)
+ end
+
+ def available_inline_columns
+ available_columns.select(&:inline?)
+ end
+
+ def available_block_columns
+ available_columns.reject(&:inline?)
+ end
+
def default_columns_names
@default_columns_names ||= begin
default_columns = Setting.issue_list_default_columns.map(&:to_sym)
diff --git a/app/views/issues/_list.html.erb b/app/views/issues/_list.html.erb
index 0eda312ed..f3e8cae2c 100644
--- a/app/views/issues/_list.html.erb
+++ b/app/views/issues/_list.html.erb
@@ -10,7 +10,7 @@
:title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}" %>
<%= sort_header_tag('id', :caption => '#', :default_order => 'desc') %>
- <% query.columns.each do |column| %>
+ <% query.inline_columns.each do |column| %>
<%= column_header(column) %>
<% end %>
@@ -21,7 +21,7 @@
<% if @query.grouped? && (group = @query.group_by_column.value(issue)) != previous_group %>
<% reset_cycle %>
-
+ |
<%= group.blank? ? l(:label_none) : column_content(@query.group_by_column, issue) %> <%= @issue_count_by_group[group] %>
<%= link_to_function("#{l(:button_collapse_all)}/#{l(:button_expand_all)}",
@@ -33,8 +33,15 @@
|
+ <% @query.block_columns.each do |column|
+ if (text = column_content(column, issue)) && text.present? -%>
+
+ <%= text %> |
+
+ <% end -%>
+ <% end -%>
<% end -%>
diff --git a/app/views/issues/index.html.erb b/app/views/issues/index.html.erb
index d7679d65a..864c7d554 100644
--- a/app/views/issues/index.html.erb
+++ b/app/views/issues/index.html.erb
@@ -34,6 +34,10 @@
@query.group_by)
) %>
+
+ <%= l(:button_show) %> |
+ <%= available_block_columns_tags(@query) %> |
+
@@ -73,7 +77,7 @@
-
+
<%= submit_tag l(:button_export), :name => nil, :onclick => "hideModal(this);" %>
diff --git a/app/views/queries/_columns.html.erb b/app/views/queries/_columns.html.erb
index 5e665fd75..78d3c5703 100644
--- a/app/views/queries/_columns.html.erb
+++ b/app/views/queries/_columns.html.erb
@@ -4,7 +4,7 @@
<%= label_tag "available_columns", l(:description_available_columns) %>
<%= select_tag 'available_columns',
- options_for_select((query.available_columns - query.columns).collect {|column| [column.caption, column.name]}),
+ options_for_select((query.available_inline_columns - query.columns).collect {|column| [column.caption, column.name]}),
:multiple => true, :size => 10, :style => "width:150px",
:ondblclick => "moveOptions(this.form.available_columns, this.form.selected_columns);" %>
@@ -18,7 +18,7 @@
<%= label_tag "selected_columns", l(:description_selected_columns) %>
<%= select_tag((defined?(tag_name) ? tag_name : 'c[]'),
- options_for_select(query.columns.collect {|column| [column.caption, column.name]}),
+ options_for_select(query.inline_columns.collect {|column| [column.caption, column.name]}),
:id => 'selected_columns', :multiple => true, :size => 10, :style => "width:150px",
:ondblclick => "moveOptions(this.form.selected_columns, this.form.available_columns);") %>
diff --git a/app/views/queries/_form.html.erb b/app/views/queries/_form.html.erb
index 0e75d9418..32f6aab27 100644
--- a/app/views/queries/_form.html.erb
+++ b/app/views/queries/_form.html.erb
@@ -21,6 +21,9 @@
<%= select 'query', 'group_by', @query.groupable_columns.collect {|c| [c.caption, c.name.to_s]}, :include_blank => true %>
+
+
+<%= available_block_columns_tags(@query) %>