Adds helpers for query columns selection.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11451 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
998928ecdf
commit
1ac8fd8c42
|
@ -19,6 +19,8 @@ class SettingsController < ApplicationController
|
|||
layout 'admin'
|
||||
menu_item :plugins, :only => :plugin
|
||||
|
||||
helper :queries
|
||||
|
||||
before_filter :require_admin
|
||||
|
||||
def index
|
||||
|
|
|
@ -37,6 +37,14 @@ module QueriesHelper
|
|||
tags
|
||||
end
|
||||
|
||||
def query_available_inline_columns_options(query)
|
||||
(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]}
|
||||
end
|
||||
|
||||
def column_header(column)
|
||||
column.sortable ? sort_header_tag(column.name.to_s, :caption => column.caption,
|
||||
:default_order => column.default_order) :
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<%= label_tag "available_columns", l(:description_available_columns) %>
|
||||
<br />
|
||||
<%= select_tag 'available_columns',
|
||||
options_for_select((query.available_inline_columns - query.columns).reject(&:frozen?).collect {|column| [column.caption, column.name]}),
|
||||
options_for_select(query_available_inline_columns_options(query)),
|
||||
:multiple => true, :size => 10, :style => "width:150px",
|
||||
:ondblclick => "moveOptions(this.form.available_columns, this.form.selected_columns);" %>
|
||||
</td>
|
||||
|
@ -18,7 +18,7 @@
|
|||
<%= label_tag "selected_columns", l(:description_selected_columns) %>
|
||||
<br />
|
||||
<%= select_tag((defined?(tag_name) ? tag_name : 'c[]'),
|
||||
options_for_select((query.inline_columns & query.available_inline_columns).reject(&:frozen?).collect {|column| [column.caption, column.name]}),
|
||||
options_for_select(query_selected_inline_columns_options(query)),
|
||||
:id => 'selected_columns', :multiple => true, :size => 10, :style => "width:150px",
|
||||
:ondblclick => "moveOptions(this.form.selected_columns, this.form.available_columns);") %>
|
||||
</td>
|
||||
|
|
Loading…
Reference in New Issue