##// END OF EJS Templates
Custom fields can now be displayed as columns on the issue list....
Jean-Philippe Lang -
r876:63ceea2e2183
parent child
Show More
@@ -1,45 +1,46
1 1 # redMine - project management software
2 2 # Copyright (C) 2006-2007 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 module QueriesHelper
19 19
20 20 def operators_for_select(filter_type)
21 21 Query.operators_by_filter_type[filter_type].collect {|o| [l(Query.operators[o]), o]}
22 22 end
23 23
24 24 def column_header(column)
25 if column.sortable
26 sort_header_tag(column.sortable, :caption => l("field_#{column.name}"))
27 else
28 content_tag('th', l("field_#{column.name}"))
29 end
25 column.sortable ? sort_header_tag(column.sortable, :caption => column.caption) : content_tag('th', column.caption)
30 26 end
31 27
32 28 def column_content(column, issue)
33 value = issue.send(column.name)
34 if value.is_a?(Date)
35 format_date(value)
36 elsif value.is_a?(Time)
37 format_time(value)
38 elsif column.name == :subject
39 ((@project.nil? || @project != issue.project) ? "#{issue.project.name} - " : '') +
40 link_to(h(value), :controller => 'issues', :action => 'show', :id => issue)
29 if column.is_a?(QueryCustomFieldColumn)
30 cv = issue.custom_values.detect {|v| v.custom_field_id == column.custom_field.id}
31 show_value(cv)
41 32 else
42 h(value)
33 value = issue.send(column.name)
34 if value.is_a?(Date)
35 format_date(value)
36 elsif value.is_a?(Time)
37 format_time(value)
38 elsif column.name == :subject
39 ((@project.nil? || @project != issue.project) ? "#{issue.project.name} - " : '') +
40 link_to(h(value), :controller => 'issues', :action => 'show', :id => issue)
41 else
42 h(value)
43 end
43 44 end
44 45 end
45 46 end
@@ -1,320 +1,345
1 1 # redMine - project management software
2 2 # Copyright (C) 2006-2007 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 class QueryColumn
19 19 attr_accessor :name, :sortable
20 include GLoc
20 21
21 22 def initialize(name, options={})
22 23 self.name = name
23 24 self.sortable = options[:sortable]
24 25 end
25 26
26 def default?; default end
27 def caption
28 l("field_#{name}")
29 end
30 end
31
32 class QueryCustomFieldColumn < QueryColumn
33
34 def initialize(custom_field)
35 self.name = "cf_#{custom_field.id}".to_sym
36 self.sortable = false
37 @cf = custom_field
38 end
39
40 def caption
41 @cf.name
42 end
43
44 def custom_field
45 @cf
46 end
27 47 end
28 48
29 49 class Query < ActiveRecord::Base
30 50 belongs_to :project
31 51 belongs_to :user
32 52 serialize :filters
33 53 serialize :column_names
34 54
35 55 attr_protected :project, :user
36 56 attr_accessor :executed_by
37 57
38 58 validates_presence_of :name, :on => :save
39 59 validates_length_of :name, :maximum => 255
40 60
41 61 @@operators = { "=" => :label_equals,
42 62 "!" => :label_not_equals,
43 63 "o" => :label_open_issues,
44 64 "c" => :label_closed_issues,
45 65 "!*" => :label_none,
46 66 "*" => :label_all,
47 67 ">=" => '>=',
48 68 "<=" => '<=',
49 69 "<t+" => :label_in_less_than,
50 70 ">t+" => :label_in_more_than,
51 71 "t+" => :label_in,
52 72 "t" => :label_today,
53 73 "w" => :label_this_week,
54 74 ">t-" => :label_less_than_ago,
55 75 "<t-" => :label_more_than_ago,
56 76 "t-" => :label_ago,
57 77 "~" => :label_contains,
58 78 "!~" => :label_not_contains }
59 79
60 80 cattr_reader :operators
61 81
62 82 @@operators_by_filter_type = { :list => [ "=", "!" ],
63 83 :list_status => [ "o", "=", "!", "c", "*" ],
64 84 :list_optional => [ "=", "!", "!*", "*" ],
65 85 :list_one_or_more => [ "*", "=" ],
66 86 :date => [ "<t+", ">t+", "t+", "t", "w", ">t-", "<t-", "t-" ],
67 87 :date_past => [ ">t-", "<t-", "t-", "t", "w" ],
68 88 :string => [ "=", "~", "!", "!~" ],
69 89 :text => [ "~", "!~" ],
70 90 :integer => [ "=", ">=", "<=" ] }
71 91
72 92 cattr_reader :operators_by_filter_type
73 93
74 94 @@available_columns = [
75 95 QueryColumn.new(:tracker, :sortable => "#{Tracker.table_name}.position"),
76 96 QueryColumn.new(:status, :sortable => "#{IssueStatus.table_name}.position"),
77 97 QueryColumn.new(:priority, :sortable => "#{Enumeration.table_name}.position"),
78 98 QueryColumn.new(:subject),
79 99 QueryColumn.new(:assigned_to, :sortable => "#{User.table_name}.lastname"),
80 100 QueryColumn.new(:updated_on, :sortable => "#{Issue.table_name}.updated_on"),
81 101 QueryColumn.new(:category, :sortable => "#{IssueCategory.table_name}.name"),
82 102 QueryColumn.new(:start_date, :sortable => "#{Issue.table_name}.start_date"),
83 103 QueryColumn.new(:due_date, :sortable => "#{Issue.table_name}.due_date"),
84 104 QueryColumn.new(:estimated_hours, :sortable => "#{Issue.table_name}.estimated_hours"),
85 105 QueryColumn.new(:done_ratio, :sortable => "#{Issue.table_name}.done_ratio"),
86 106 QueryColumn.new(:created_on, :sortable => "#{Issue.table_name}.created_on"),
87 107 ]
88 108 cattr_reader :available_columns
89 109
90 110 def initialize(attributes = nil)
91 111 super attributes
92 112 self.filters ||= { 'status_id' => {:operator => "o", :values => [""]} }
93 113 end
94 114
95 115 def executed_by=(user)
96 116 @executed_by = user
97 117 set_language_if_valid(user.language) if user
98 118 end
99 119
100 120 def validate
101 121 filters.each_key do |field|
102 122 errors.add label_for(field), :activerecord_error_blank unless
103 123 # filter requires one or more values
104 124 (values_for(field) and !values_for(field).first.empty?) or
105 125 # filter doesn't require any value
106 126 ["o", "c", "!*", "*", "t", "w"].include? operator_for(field)
107 127 end if filters
108 128 end
109 129
110 130 def editable_by?(user)
111 131 return false unless user
112 132 return true if !is_public && self.user_id == user.id
113 133 is_public && user.allowed_to?(:manage_public_queries, project)
114 134 end
115 135
116 136 def available_filters
117 137 return @available_filters if @available_filters
118 138 @available_filters = { "status_id" => { :type => :list_status, :order => 1, :values => IssueStatus.find(:all, :order => 'position').collect{|s| [s.name, s.id.to_s] } },
119 139 "tracker_id" => { :type => :list, :order => 2, :values => Tracker.find(:all, :order => 'position').collect{|s| [s.name, s.id.to_s] } },
120 140 "priority_id" => { :type => :list, :order => 3, :values => Enumeration.find(:all, :conditions => ['opt=?','IPRI']).collect{|s| [s.name, s.id.to_s] } },
121 141 "subject" => { :type => :text, :order => 8 },
122 142 "created_on" => { :type => :date_past, :order => 9 },
123 143 "updated_on" => { :type => :date_past, :order => 10 },
124 144 "start_date" => { :type => :date, :order => 11 },
125 145 "due_date" => { :type => :date, :order => 12 },
126 146 "done_ratio" => { :type => :integer, :order => 13 }}
127 147
128 148 user_values = []
129 149 user_values << ["<< #{l(:label_me)} >>", "me"] if executed_by
130 150 if project
131 151 user_values += project.users.collect{|s| [s.name, s.id.to_s] }
132 152 elsif executed_by
133 153 # members of the user's projects
134 154 user_values += executed_by.projects.collect(&:users).flatten.uniq.sort.collect{|s| [s.name, s.id.to_s] }
135 155 end
136 156 @available_filters["assigned_to_id"] = { :type => :list_optional, :order => 4, :values => user_values } unless user_values.empty?
137 157 @available_filters["author_id"] = { :type => :list, :order => 5, :values => user_values } unless user_values.empty?
138 158
139 159 if project
140 160 # project specific filters
141 161 @available_filters["category_id"] = { :type => :list_optional, :order => 6, :values => @project.issue_categories.collect{|s| [s.name, s.id.to_s] } }
142 162 @available_filters["fixed_version_id"] = { :type => :list_optional, :order => 7, :values => @project.versions.sort.collect{|s| [s.name, s.id.to_s] } }
143 163 unless @project.active_children.empty?
144 164 @available_filters["subproject_id"] = { :type => :list_one_or_more, :order => 13, :values => @project.active_children.collect{|s| [s.name, s.id.to_s] } }
145 165 end
146 166 @project.all_custom_fields.select(&:is_filter?).each do |field|
147 167 case field.field_format
148 168 when "string", "int"
149 169 options = { :type => :string, :order => 20 }
150 170 when "text"
151 171 options = { :type => :text, :order => 20 }
152 172 when "list"
153 173 options = { :type => :list_optional, :values => field.possible_values, :order => 20}
154 174 when "date"
155 175 options = { :type => :date, :order => 20 }
156 176 when "bool"
157 177 options = { :type => :list, :values => [[l(:general_text_yes), "1"], [l(:general_text_no), "0"]], :order => 20 }
158 178 end
159 179 @available_filters["cf_#{field.id}"] = options.merge({ :name => field.name })
160 180 end
161 181 # remove category filter if no category defined
162 182 @available_filters.delete "category_id" if @available_filters["category_id"][:values].empty?
163 183 end
164 184 @available_filters
165 185 end
166 186
167 187 def add_filter(field, operator, values)
168 188 # values must be an array
169 189 return unless values and values.is_a? Array # and !values.first.empty?
170 190 # check if field is defined as an available filter
171 191 if available_filters.has_key? field
172 192 filter_options = available_filters[field]
173 193 # check if operator is allowed for that filter
174 194 #if @@operators_by_filter_type[filter_options[:type]].include? operator
175 195 # allowed_values = values & ([""] + (filter_options[:values] || []).collect {|val| val[1]})
176 196 # filters[field] = {:operator => operator, :values => allowed_values } if (allowed_values.first and !allowed_values.first.empty?) or ["o", "c", "!*", "*", "t"].include? operator
177 197 #end
178 198 filters[field] = {:operator => operator, :values => values }
179 199 end
180 200 end
181 201
182 202 def add_short_filter(field, expression)
183 203 return unless expression
184 204 parms = expression.scan(/^(o|c|\!|\*)?(.*)$/).first
185 205 add_filter field, (parms[0] || "="), [parms[1] || ""]
186 206 end
187 207
188 208 def has_filter?(field)
189 209 filters and filters[field]
190 210 end
191 211
192 212 def operator_for(field)
193 213 has_filter?(field) ? filters[field][:operator] : nil
194 214 end
195 215
196 216 def values_for(field)
197 217 has_filter?(field) ? filters[field][:values] : nil
198 218 end
199 219
200 220 def label_for(field)
201 221 label = @available_filters[field][:name] if @available_filters.has_key?(field)
202 222 label ||= field.gsub(/\_id$/, "")
203 223 end
204 224
205 225 def available_columns
206 cols = Query.available_columns
226 return @available_columns if @available_columns
227 @available_columns = Query.available_columns
228 @available_columns += (project ?
229 project.custom_fields :
230 IssueCustomField.find(:all, :conditions => {:is_for_all => true})
231 ).collect {|cf| QueryCustomFieldColumn.new(cf) }
207 232 end
208 233
209 234 def columns
210 235 if has_default_columns?
211 236 available_columns.select {|c| Setting.issue_list_default_columns.include?(c.name.to_s) }
212 237 else
213 238 # preserve the column_names order
214 239 column_names.collect {|name| available_columns.find {|col| col.name == name}}.compact
215 240 end
216 241 end
217 242
218 243 def column_names=(names)
219 244 names = names.select {|n| n.is_a?(Symbol) || !n.blank? } if names
220 245 names = names.collect {|n| n.is_a?(Symbol) ? n : n.to_sym } if names
221 246 write_attribute(:column_names, names)
222 247 end
223 248
224 249 def has_column?(column)
225 250 column_names && column_names.include?(column.name)
226 251 end
227 252
228 253 def has_default_columns?
229 254 column_names.nil? || column_names.empty?
230 255 end
231 256
232 257 def statement
233 258 # project/subprojects clause
234 259 clause = ''
235 260 if project && has_filter?("subproject_id")
236 261 subproject_ids = []
237 262 if operator_for("subproject_id") == "="
238 263 subproject_ids = values_for("subproject_id").each(&:to_i)
239 264 else
240 265 subproject_ids = project.active_children.collect{|p| p.id}
241 266 end
242 267 clause << "#{Issue.table_name}.project_id IN (%d,%s)" % [project.id, subproject_ids.join(",")] if project
243 268 elsif project
244 269 clause << "#{Issue.table_name}.project_id=%d" % project.id
245 270 else
246 271 clause << Project.visible_by(executed_by)
247 272 end
248 273
249 274 # filters clauses
250 275 filters_clauses = []
251 276 filters.each_key do |field|
252 277 next if field == "subproject_id"
253 278 v = values_for(field).clone
254 279 next unless v and !v.empty?
255 280
256 281 sql = ''
257 282 if field =~ /^cf_(\d+)$/
258 283 # custom field
259 284 db_table = CustomValue.table_name
260 285 db_field = 'value'
261 286 sql << "#{Issue.table_name}.id IN (SELECT #{db_table}.customized_id FROM #{db_table} where #{db_table}.customized_type='Issue' AND #{db_table}.customized_id=#{Issue.table_name}.id AND #{db_table}.custom_field_id=#{$1} AND "
262 287 else
263 288 # regular field
264 289 db_table = Issue.table_name
265 290 db_field = field
266 291 sql << '('
267 292 end
268 293
269 294 # "me" value subsitution
270 295 if %w(assigned_to_id author_id).include?(field)
271 296 v.push(executed_by ? executed_by.id.to_s : "0") if v.delete("me")
272 297 end
273 298
274 299 case operator_for field
275 300 when "="
276 301 sql = sql + "#{db_table}.#{db_field} IN (" + v.collect{|val| "'#{connection.quote_string(val)}'"}.join(",") + ")"
277 302 when "!"
278 303 sql = sql + "#{db_table}.#{db_field} NOT IN (" + v.collect{|val| "'#{connection.quote_string(val)}'"}.join(",") + ")"
279 304 when "!*"
280 305 sql = sql + "#{db_table}.#{db_field} IS NULL"
281 306 when "*"
282 307 sql = sql + "#{db_table}.#{db_field} IS NOT NULL"
283 308 when ">="
284 309 sql = sql + "#{db_table}.#{db_field} >= #{v.first.to_i}"
285 310 when "<="
286 311 sql = sql + "#{db_table}.#{db_field} <= #{v.first.to_i}"
287 312 when "o"
288 313 sql = sql + "#{IssueStatus.table_name}.is_closed=#{connection.quoted_false}" if field == "status_id"
289 314 when "c"
290 315 sql = sql + "#{IssueStatus.table_name}.is_closed=#{connection.quoted_true}" if field == "status_id"
291 316 when ">t-"
292 317 sql = sql + "#{db_table}.#{db_field} BETWEEN '%s' AND '%s'" % [connection.quoted_date((Date.today - v.first.to_i).to_time), connection.quoted_date((Date.today + 1).to_time)]
293 318 when "<t-"
294 319 sql = sql + "#{db_table}.#{db_field} <= '%s'" % connection.quoted_date((Date.today - v.first.to_i).to_time)
295 320 when "t-"
296 321 sql = sql + "#{db_table}.#{db_field} BETWEEN '%s' AND '%s'" % [connection.quoted_date((Date.today - v.first.to_i).to_time), connection.quoted_date((Date.today - v.first.to_i + 1).to_time)]
297 322 when ">t+"
298 323 sql = sql + "#{db_table}.#{db_field} >= '%s'" % connection.quoted_date((Date.today + v.first.to_i).to_time)
299 324 when "<t+"
300 325 sql = sql + "#{db_table}.#{db_field} BETWEEN '%s' AND '%s'" % [connection.quoted_date(Date.today.to_time), connection.quoted_date((Date.today + v.first.to_i + 1).to_time)]
301 326 when "t+"
302 327 sql = sql + "#{db_table}.#{db_field} BETWEEN '%s' AND '%s'" % [connection.quoted_date((Date.today + v.first.to_i).to_time), connection.quoted_date((Date.today + v.first.to_i + 1).to_time)]
303 328 when "t"
304 329 sql = sql + "#{db_table}.#{db_field} BETWEEN '%s' AND '%s'" % [connection.quoted_date(Date.today.to_time), connection.quoted_date((Date.today+1).to_time)]
305 330 when "w"
306 331 sql = sql + "#{db_table}.#{db_field} BETWEEN '%s' AND '%s'" % [connection.quoted_date(Time.now.at_beginning_of_week), connection.quoted_date(Time.now.next_week.yesterday)]
307 332 when "~"
308 333 sql = sql + "#{db_table}.#{db_field} LIKE '%#{connection.quote_string(v.first)}%'"
309 334 when "!~"
310 335 sql = sql + "#{db_table}.#{db_field} NOT LIKE '%#{connection.quote_string(v.first)}%'"
311 336 end
312 337 sql << ')'
313 338 filters_clauses << sql
314 339 end if filters and valid?
315 340
316 341 clause << ' AND ' unless clause.empty?
317 342 clause << filters_clauses.join(' AND ') unless filters_clauses.empty?
318 343 clause
319 344 end
320 345 end
@@ -1,27 +1,27
1 1 <% content_tag 'fieldset', :id => 'columns', :style => (query.has_default_columns? ? 'display:none;' : nil) do %>
2 2 <legend><%= l(:field_column_names) %></legend>
3 3
4 4 <%= hidden_field_tag 'query[column_names][]', '' %>
5 5 <table margin=0>
6 6 <tr>
7 7 <td><%= select_tag 'available_columns',
8 options_for_select((query.available_columns - query.columns).collect {|column| [l("field_#{column.name}"), column.name]}),
8 options_for_select((query.available_columns - query.columns).collect {|column| [column.caption, column.name]}),
9 9 :multiple => true, :size => 10, :style => "width:150px" %>
10 10 </td>
11 11 <td align="center" valign="middle">
12 12 <input type="button" value="--&gt;"
13 13 onclick="moveOptions(this.form.available_columns, this.form.selected_columns);" /><br />
14 14 <input type="button" value="&lt;--"
15 15 onclick="moveOptions(this.form.selected_columns, this.form.available_columns);" />
16 16 </td>
17 17 <td><%= select_tag 'query[column_names][]',
18 options_for_select(@query.columns.collect {|column| [l("field_#{column.name}"), column.name]}),
18 options_for_select(@query.columns.collect {|column| [column.caption, column.name]}),
19 19 :id => 'selected_columns', :multiple => true, :size => 10, :style => "width:150px" %>
20 20 </td>
21 21 </tr>
22 22 </table>
23 23 <% end %>
24 24
25 25 <% content_for :header_tags do %>
26 26 <%= javascript_include_tag 'select_list_move' %>
27 27 <% end %>
@@ -1,97 +1,97
1 1 <h2><%= l(:label_settings) %></h2>
2 2
3 3 <div id="settings">
4 4 <% form_tag({:action => 'edit'}) do %>
5 5 <div class="box tabular">
6 6 <p><label><%= l(:setting_app_title) %></label>
7 7 <%= text_field_tag 'settings[app_title]', Setting.app_title, :size => 30 %></p>
8 8
9 9 <p><label><%= l(:setting_app_subtitle) %></label>
10 10 <%= text_field_tag 'settings[app_subtitle]', Setting.app_subtitle, :size => 60 %></p>
11 11
12 12 <p><label><%= l(:setting_welcome_text) %></label>
13 13 <%= text_area_tag 'settings[welcome_text]', Setting.welcome_text, :cols => 60, :rows => 5, :class => 'wiki-edit' %></p>
14 14 <%= wikitoolbar_for 'settings[welcome_text]' %>
15 15
16 16 <p><label><%= l(:label_theme) %></label>
17 17 <%= select_tag 'settings[ui_theme]', options_for_select( ([[l(:label_default), '']] + Redmine::Themes.themes.collect {|t| [t.name, t.id]}), Setting.ui_theme) %></p>
18 18
19 19 <p><label><%= l(:setting_default_language) %></label>
20 20 <%= select_tag 'settings[default_language]', options_for_select( lang_options_for_select(false), Setting.default_language) %></p>
21 21
22 22 <p><label><%= l(:setting_date_format) %></label>
23 23 <%= select_tag 'settings[date_format]', options_for_select( [[l(:label_language_based), '0'], ['ISO 8601 (YYYY-MM-DD)', '1']], Setting.date_format) %></p>
24 24
25 25 <p><label><%= l(:setting_attachment_max_size) %></label>
26 26 <%= text_field_tag 'settings[attachment_max_size]', Setting.attachment_max_size, :size => 6 %> KB</p>
27 27
28 28 <p><label><%= l(:setting_issues_export_limit) %></label>
29 29 <%= text_field_tag 'settings[issues_export_limit]', Setting.issues_export_limit, :size => 6 %></p>
30 30
31 31 <p><label><%= l(:setting_cross_project_issue_relations) %></label>
32 32 <%= check_box_tag 'settings[cross_project_issue_relations]', 1, Setting.cross_project_issue_relations? %><%= hidden_field_tag 'settings[cross_project_issue_relations]', 0 %></p>
33 33
34 34 <p><label><%= l(:setting_mail_from) %></label>
35 35 <%= text_field_tag 'settings[mail_from]', Setting.mail_from, :size => 60 %></p>
36 36
37 37 <p><label><%= l(:setting_host_name) %></label>
38 38 <%= text_field_tag 'settings[host_name]', Setting.host_name, :size => 60 %></p>
39 39
40 40 <p><label><%= l(:setting_protocol) %></label>
41 41 <%= select_tag 'settings[protocol]', options_for_select(['http', 'https'], Setting.protocol) %></p>
42 42
43 43 <p><label><%= l(:setting_text_formatting) %></label>
44 44 <%= select_tag 'settings[text_formatting]', options_for_select([[l(:label_none), "0"], ["textile", "textile"]], Setting.text_formatting) %></p>
45 45
46 46 <p><label><%= l(:setting_wiki_compression) %></label>
47 47 <%= select_tag 'settings[wiki_compression]', options_for_select( [[l(:label_none), 0], ["gzip", "gzip"]], Setting.wiki_compression) %></p>
48 48
49 49 <p><label><%= l(:setting_feeds_limit) %></label>
50 50 <%= text_field_tag 'settings[feeds_limit]', Setting.feeds_limit, :size => 6 %></p>
51 51
52 52 <p><label><%= l(:setting_autofetch_changesets) %></label>
53 53 <%= check_box_tag 'settings[autofetch_changesets]', 1, Setting.autofetch_changesets? %><%= hidden_field_tag 'settings[autofetch_changesets]', 0 %></p>
54 54
55 55 <p><label><%= l(:setting_sys_api_enabled) %></label>
56 56 <%= check_box_tag 'settings[sys_api_enabled]', 1, Setting.sys_api_enabled? %><%= hidden_field_tag 'settings[sys_api_enabled]', 0 %></p>
57 57
58 58 <p><label><%= l(:setting_repositories_encodings) %></label>
59 59 <%= text_field_tag 'settings[repositories_encodings]', Setting.repositories_encodings, :size => 60 %><br /><em><%= l(:text_comma_separated) %></em></p>
60 60 </div>
61 61
62 62 <fieldset class="box"><legend><%= l(:setting_issue_list_default_columns) %></legend>
63 63 <%= hidden_field_tag 'settings[issue_list_default_columns][]', '' %>
64 <p><% Query.available_columns.each do |column| %>
64 <p><% Query.new.available_columns.each do |column| %>
65 65 <label><%= check_box_tag 'settings[issue_list_default_columns][]', column.name, Setting.issue_list_default_columns.include?(column.name.to_s) %>
66 <%= l("field_#{column.name}") %></label>
66 <%= column.caption %></label>
67 67 <% end %></p>
68 68 </fieldset>
69 69
70 70 <fieldset class="box tabular"><legend><%= l(:label_authentication) %></legend>
71 71 <p><label><%= l(:setting_login_required) %></label>
72 72 <%= check_box_tag 'settings[login_required]', 1, Setting.login_required? %><%= hidden_field_tag 'settings[login_required]', 0 %></p>
73 73
74 74 <p><label><%= l(:setting_autologin) %></label>
75 75 <%= select_tag 'settings[autologin]', options_for_select( [[l(:label_disabled), "0"]] + [1, 7, 30, 365].collect{|days| [lwr(:actionview_datehelper_time_in_words_day, days), days.to_s]}, Setting.autologin) %></p>
76 76
77 77 <p><label><%= l(:setting_self_registration) %></label>
78 78 <%= check_box_tag 'settings[self_registration]', 1, Setting.self_registration? %><%= hidden_field_tag 'settings[self_registration]', 0 %></p>
79 79
80 80 <p><label><%= l(:label_password_lost) %></label>
81 81 <%= check_box_tag 'settings[lost_password]', 1, Setting.lost_password? %><%= hidden_field_tag 'settings[lost_password]', 0 %></p>
82 82 </fieldset>
83 83
84 84 <fieldset class="box tabular"><legend><%= l(:text_issues_ref_in_commit_messages) %></legend>
85 85 <p><label><%= l(:setting_commit_ref_keywords) %></label>
86 86 <%= text_field_tag 'settings[commit_ref_keywords]', Setting.commit_ref_keywords, :size => 30 %><br /><em><%= l(:text_comma_separated) %></em></p>
87 87
88 88 <p><label><%= l(:setting_commit_fix_keywords) %></label>
89 89 <%= text_field_tag 'settings[commit_fix_keywords]', Setting.commit_fix_keywords, :size => 30 %>
90 90 &nbsp;<%= l(:label_applied_status) %>: <%= select_tag 'settings[commit_fix_status_id]', options_for_select( [["", 0]] + IssueStatus.find(:all).collect{|status| [status.name, status.id.to_s]}, Setting.commit_fix_status_id) %>
91 91 &nbsp;<%= l(:field_done_ratio) %>: <%= select_tag 'settings[commit_fix_done_ratio]', options_for_select( [[l(:label_no_change_option), '']] + ((0..10).to_a.collect {|r| ["#{r*10} %", "#{r*10}"] }), Setting.commit_fix_done_ratio) %>
92 92 <br /><em><%= l(:text_comma_separated) %></em></p>
93 93 </fieldset>
94 94
95 95 <%= submit_tag l(:button_save) %>
96 96 </div>
97 97 <% end %>
General Comments 0
You need to be logged in to leave comments. Login now