##// END OF EJS Templates
custom field tags...
Jean-Philippe Lang -
r18:54aeec7b5fcf
parent child
Show More
@@ -1,305 +1,305
1 1 # redMine - project management software
2 2 # Copyright (C) 2006 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 ProjectsController < ApplicationController
19 19 layout 'base'
20 20 before_filter :find_project, :authorize, :except => [ :index, :list, :add ]
21 21 before_filter :require_admin, :only => [ :add, :destroy ]
22 22
23 23 helper :sort
24 24 include SortHelper
25 25 helper :search_filter
26 26 include SearchFilterHelper
27 27 helper :custom_fields
28 28 include CustomFieldsHelper
29 29
30 30 def index
31 31 list
32 32 render :action => 'list'
33 33 end
34 34
35 35 # Lists public projects
36 36 def list
37 37 sort_init 'name', 'asc'
38 38 sort_update
39 39 @project_count = Project.count(["is_public=?", true])
40 40 @project_pages = Paginator.new self, @project_count,
41 41 15,
42 42 @params['page']
43 43 @projects = Project.find :all, :order => sort_clause,
44 44 :conditions => ["is_public=?", true],
45 45 :limit => @project_pages.items_per_page,
46 46 :offset => @project_pages.current.offset
47 47 end
48 48
49 49 # Add a new project
50 50 def add
51 51 @custom_fields = IssueCustomField.find(:all)
52 52 @root_projects = Project.find(:all, :conditions => "parent_id is null")
53 53 @project = Project.new(params[:project])
54 54 if request.get?
55 55 @custom_values = ProjectCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @project) }
56 56 else
57 57 @project.custom_fields = CustomField.find(@params[:custom_field_ids]) if @params[:custom_field_ids]
58 58 @custom_values = ProjectCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @project, :value => params["custom_fields"][x.id.to_s]) }
59 59 @project.custom_values = @custom_values
60 60 if @project.save
61 61 flash[:notice] = l(:notice_successful_create)
62 62 redirect_to :controller => 'admin', :action => 'projects'
63 63 end
64 64 end
65 65 end
66 66
67 67 # Show @project
68 68 def show
69 69 @custom_values = @project.custom_values.find(:all, :include => :custom_field)
70 70 @members = @project.members.find(:all, :include => [:user, :role])
71 71 @subprojects = @project.children if @project.children_count > 0
72 72 @news = @project.news.find(:all, :limit => 5, :include => [ :author, :project ], :order => "news.created_on DESC")
73 73 @trackers = Tracker.find(:all)
74 74 end
75 75
76 76 def settings
77 77 @root_projects = Project::find(:all, :conditions => ["parent_id is null and id <> ?", @project.id])
78 78 @custom_fields = IssueCustomField::find_all
79 79 @issue_category ||= IssueCategory.new
80 80 @member ||= @project.members.new
81 81 @roles = Role.find_all
82 82 @users = User.find_all - @project.members.find(:all, :include => :user).collect{|m| m.user }
83 @custom_values = ProjectCustomField.find(:all).collect { |x| @project.custom_values.find_by_custom_field_id(x.id) || CustomValue.new(:custom_field => x) }
83 @custom_values ||= ProjectCustomField.find(:all).collect { |x| @project.custom_values.find_by_custom_field_id(x.id) || CustomValue.new(:custom_field => x) }
84 84 end
85 85
86 86 # Edit @project
87 87 def edit
88 88 if request.post?
89 89 @project.custom_fields = IssueCustomField.find(@params[:custom_field_ids]) if @params[:custom_field_ids]
90 90 if params[:custom_fields]
91 91 @custom_values = ProjectCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @project, :value => params["custom_fields"][x.id.to_s]) }
92 92 @project.custom_values = @custom_values
93 93 end
94 94 if @project.update_attributes(params[:project])
95 95 flash[:notice] = l(:notice_successful_update)
96 96 redirect_to :action => 'settings', :id => @project
97 97 else
98 98 settings
99 99 render :action => 'settings'
100 100 end
101 101 end
102 102 end
103 103
104 104 # Delete @project
105 105 def destroy
106 106 if request.post? and params[:confirm]
107 107 @project.destroy
108 108 redirect_to :controller => 'admin', :action => 'projects'
109 109 end
110 110 end
111 111
112 112 # Add a new issue category to @project
113 113 def add_issue_category
114 114 if request.post?
115 115 @issue_category = @project.issue_categories.build(params[:issue_category])
116 116 if @issue_category.save
117 117 flash[:notice] = l(:notice_successful_create)
118 118 redirect_to :action => 'settings', :id => @project
119 119 else
120 120 settings
121 121 render :action => 'settings'
122 122 end
123 123 end
124 124 end
125 125
126 126 # Add a new version to @project
127 127 def add_version
128 128 @version = @project.versions.build(params[:version])
129 129 if request.post? and @version.save
130 130 flash[:notice] = l(:notice_successful_create)
131 131 redirect_to :action => 'settings', :id => @project
132 132 end
133 133 end
134 134
135 135 # Add a new member to @project
136 136 def add_member
137 137 @member = @project.members.build(params[:member])
138 138 if request.post?
139 139 if @member.save
140 140 flash[:notice] = l(:notice_successful_create)
141 141 redirect_to :action => 'settings', :id => @project
142 142 else
143 143 settings
144 144 render :action => 'settings'
145 145 end
146 146 end
147 147 end
148 148
149 149 # Show members list of @project
150 150 def list_members
151 151 @members = @project.members
152 152 end
153 153
154 154 # Add a new document to @project
155 155 def add_document
156 156 @categories = Enumeration::get_values('DCAT')
157 157 @document = @project.documents.build(params[:document])
158 158 if request.post?
159 159 # Save the attachment
160 160 if params[:attachment][:file].size > 0
161 161 @attachment = @document.attachments.build(params[:attachment])
162 162 @attachment.author_id = self.logged_in_user.id if self.logged_in_user
163 163 end
164 164 if @document.save
165 165 flash[:notice] = l(:notice_successful_create)
166 166 redirect_to :action => 'list_documents', :id => @project
167 167 end
168 168 end
169 169 end
170 170
171 171 # Show documents list of @project
172 172 def list_documents
173 173 @documents = @project.documents
174 174 end
175 175
176 176 # Add a new issue to @project
177 177 def add_issue
178 178 @tracker = Tracker.find(params[:tracker_id])
179 179 @priorities = Enumeration::get_values('IPRI')
180 180 @issue = Issue.new(:project => @project, :tracker => @tracker)
181 181 if request.get?
182 182 @custom_values = @project.custom_fields_for_issues(@tracker).collect { |x| CustomValue.new(:custom_field => x, :customized => @issue) }
183 183 else
184 184 @issue.attributes = params[:issue]
185 185 @issue.author_id = self.logged_in_user.id if self.logged_in_user
186 186 # Create the document if a file was sent
187 187 if params[:attachment][:file].size > 0
188 188 @attachment = @issue.attachments.build(params[:attachment])
189 189 @attachment.author_id = self.logged_in_user.id if self.logged_in_user
190 190 end
191 191 @custom_values = @project.custom_fields_for_issues(@tracker).collect { |x| CustomValue.new(:custom_field => x, :customized => @issue, :value => params["custom_fields"][x.id.to_s]) }
192 192 @issue.custom_values = @custom_values
193 193 if @issue.save
194 194 flash[:notice] = l(:notice_successful_create)
195 195 Mailer.deliver_issue_add(@issue) if Permission.find_by_controller_and_action(@params[:controller], @params[:action]).mail_enabled?
196 196 redirect_to :action => 'list_issues', :id => @project
197 197 end
198 198 end
199 199 end
200 200
201 201 # Show filtered/sorted issues list of @project
202 202 def list_issues
203 203 sort_init 'issues.id', 'desc'
204 204 sort_update
205 205
206 206 search_filter_init_list_issues
207 207 search_filter_update if params[:set_filter] or request.post?
208 208
209 209 @issue_count = Issue.count(:include => [:status, :project], :conditions => search_filter_clause)
210 210 @issue_pages = Paginator.new self, @issue_count, 15, @params['page']
211 211 @issues = Issue.find :all, :order => sort_clause,
212 212 :include => [ :author, :status, :tracker, :project ],
213 213 :conditions => search_filter_clause,
214 214 :limit => @issue_pages.items_per_page,
215 215 :offset => @issue_pages.current.offset
216 216 end
217 217
218 218 # Export filtered/sorted issues list to CSV
219 219 def export_issues_csv
220 220 sort_init 'issues.id', 'desc'
221 221 sort_update
222 222
223 223 search_filter_init_list_issues
224 224
225 225 @issues = Issue.find :all, :order => sort_clause,
226 226 :include => [ :author, :status, :tracker, :project ],
227 227 :conditions => search_filter_clause
228 228
229 229 export = StringIO.new
230 230 CSV::Writer.generate(export, ',') do |csv|
231 231 csv << %w(Id Status Tracker Subject Author Created Updated)
232 232 @issues.each do |issue|
233 233 csv << [issue.id, issue.status.name, issue.tracker.name, issue.subject, issue.author.display_name, l_datetime(issue.created_on), l_datetime(issue.updated_on)]
234 234 end
235 235 end
236 236 export.rewind
237 237 send_data(export.read,
238 238 :type => 'text/csv; charset=utf-8; header=present',
239 239 :filename => 'export.csv')
240 240 end
241 241
242 242 # Add a news to @project
243 243 def add_news
244 244 @news = News.new(:project => @project)
245 245 if request.post?
246 246 @news.attributes = params[:news]
247 247 @news.author_id = self.logged_in_user.id if self.logged_in_user
248 248 if @news.save
249 249 flash[:notice] = l(:notice_successful_create)
250 250 redirect_to :action => 'list_news', :id => @project
251 251 end
252 252 end
253 253 end
254 254
255 255 # Show news list of @project
256 256 def list_news
257 257 @news_pages, @news = paginate :news, :per_page => 10, :conditions => ["project_id=?", @project.id], :include => :author, :order => "news.created_on DESC"
258 258 end
259 259
260 260 def add_file
261 261 if request.post?
262 262 # Save the attachment
263 263 if params[:attachment][:file].size > 0
264 264 @attachment = @project.versions.find(params[:version_id]).attachments.build(params[:attachment])
265 265 @attachment.author_id = self.logged_in_user.id if self.logged_in_user
266 266 if @attachment.save
267 267 flash[:notice] = l(:notice_successful_create)
268 268 redirect_to :controller => 'projects', :action => 'list_files', :id => @project
269 269 end
270 270 end
271 271 end
272 272 @versions = @project.versions
273 273 end
274 274
275 275 def list_files
276 276 @versions = @project.versions
277 277 end
278 278
279 279 # Show changelog for @project
280 280 def changelog
281 281 @trackers = Tracker.find(:all, :conditions => ["is_in_chlog=?", true])
282 282 if request.get?
283 283 @selected_tracker_ids = @trackers.collect {|t| t.id.to_s }
284 284 else
285 285 @selected_tracker_ids = params[:tracker_ids].collect { |id| id.to_i.to_s } if params[:tracker_ids] and params[:tracker_ids].is_a? Array
286 286 end
287 287 @selected_tracker_ids ||= []
288 288 @fixed_issues = @project.issues.find(:all,
289 289 :include => [ :fixed_version, :status, :tracker ],
290 290 :conditions => [ "issue_statuses.is_closed=? and issues.tracker_id in (#{@selected_tracker_ids.join(',')}) and issues.fixed_version_id is not null", true],
291 291 :order => "versions.effective_date DESC, issues.id DESC"
292 292 ) unless @selected_tracker_ids.empty?
293 293 @fixed_issues ||= []
294 294 end
295 295
296 296 private
297 297 # Find project of id params[:id]
298 298 # if not found, redirect to project list
299 299 # Used as a before_filter
300 300 def find_project
301 301 @project = Project.find(params[:id])
302 302 rescue
303 303 redirect_to :action => 'list'
304 304 end
305 305 end
@@ -1,97 +1,107
1 1 # redMine - project management software
2 2 # Copyright (C) 2006 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 ApplicationHelper
19 19
20 # return current logged in user or nil
20 # Return current logged in user or nil
21 21 def loggedin?
22 22 @logged_in_user
23 23 end
24 24
25 # return true if user is loggend in and is admin, otherwise false
25 # Return true if user is logged in and is admin, otherwise false
26 26 def admin_loggedin?
27 27 @logged_in_user and @logged_in_user.admin?
28 28 end
29 29
30 # Return true if user is authorized for controller/action, otherwise false
30 31 def authorize_for(controller, action)
31 32 # check if action is allowed on public projects
32 33 if @project.is_public? and Permission.allowed_to_public "%s/%s" % [ controller, action ]
33 34 return true
34 35 end
35 36 # check if user is authorized
36 37 if @logged_in_user and (@logged_in_user.admin? or Permission.allowed_to_role( "%s/%s" % [ controller, action ], @logged_in_user.role_for_project(@project.id) ) )
37 38 return true
38 39 end
39 40 return false
40 41 end
41 42
42 43 # Display a link if user is authorized
43 44 def link_to_if_authorized(name, options = {}, html_options = nil, *parameters_for_method_reference)
44 45 link_to(name, options, html_options, *parameters_for_method_reference) if authorize_for(options[:controller], options[:action])
45 46 end
46 47
47 48 # Display a link to user's account page
48 49 def link_to_user(user)
49 50 link_to user.display_name, :controller => 'account', :action => 'show', :id => user
50 51 end
51 52
52 53 def format_date(date)
53 54 l_date(date) if date
54 55 end
55 56
56 57 def format_time(time)
57 58 l_datetime(time) if time
58 59 end
59 60
60 61 def pagination_links_full(paginator, options={}, html_options={})
61 62 html =''
62 63 html << link_to(('&#171; ' + l(:label_previous) ), { :page => paginator.current.previous }) + ' ' if paginator.current.previous
63 64 html << (pagination_links(paginator, options, html_options) || '')
64 65 html << ' ' + link_to((l(:label_next) + ' &#187;'), { :page => paginator.current.next }) if paginator.current.next
65 66 html
66 67 end
67 68
68 69 def error_messages_for(object_name, options = {})
69 70 options = options.symbolize_keys
70 71 object = instance_variable_get("@#{object_name}")
71 72 if object && !object.errors.empty?
72 73 # build full_messages here with controller current language
73 74 full_messages = []
74 75 object.errors.each do |attr, msg|
75 76 next if msg.nil?
76 77 if attr == "base"
77 78 full_messages << l(msg)
78 79 else
79 full_messages << "&#171; " + (l_has_string?("field_" + attr) ? l("field_" + attr) : object.class.human_attribute_name(attr)) + " &#187; " + l(msg)
80 full_messages << "&#171; " + (l_has_string?("field_" + attr) ? l("field_" + attr) : object.class.human_attribute_name(attr)) + " &#187; " + l(msg) unless attr == "custom_values"
80 81 end
81 end
82 end
83 # retrieve custom values error messages
84 if object.errors[:custom_values]
85 object.custom_values.each do |v|
86 v.errors.each do |attr, msg|
87 next if msg.nil?
88 full_messages << "&#171; " + v.custom_field.name + " &#187; " + l(msg)
89 end
90 end
91 end
82 92 content_tag("div",
83 93 content_tag(
84 options[:header_tag] || "h2", lwr(:gui_validation_error, object.errors.count) + " :"
94 options[:header_tag] || "h2", lwr(:gui_validation_error, full_messages.length) + " :"
85 95 ) +
86 96 content_tag("ul", full_messages.collect { |msg| content_tag("li", msg) }),
87 97 "id" => options[:id] || "errorExplanation", "class" => options[:class] || "errorExplanation"
88 98 )
89 99 else
90 100 ""
91 101 end
92 102 end
93 103
94 104 def lang_options_for_select
95 105 (GLoc.valid_languages.sort {|x,y| x.to_s <=> y.to_s }).collect {|lang| [ l_lang_name(lang.to_s, lang), lang.to_s]}
96 106 end
97 107 end
@@ -1,67 +1,70
1 1 # redMine - project management software
2 2 # Copyright (C) 2006 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 CustomFieldsHelper
19 19
20 # Return custom field html tag corresponding to its format
20 21 def custom_field_tag(custom_value)
21 22 custom_field = custom_value.custom_field
22 23 field_name = "custom_fields[#{custom_field.id}]"
23 24 field_id = "custom_fields_#{custom_field.id}"
24 25
25 26 case custom_field.field_format
26 27 when "string", "int", "date"
27 text_field_tag field_name, custom_value.value, :id => field_id
28 text_field 'custom_value', 'value', :name => field_name, :id => field_id
28 29 when "text"
29 text_area_tag field_name, custom_value.value, :id => field_id, :cols => 60, :rows => 3
30 text_area 'custom_value', 'value', :name => field_name, :id => field_id, :cols => 60, :rows => 3
30 31 when "bool"
31 check_box_tag(field_name, "1", custom_value.value == "1", :id => field_id) +
32 hidden_field_tag(field_name, "0")
32 check_box 'custom_value', 'value', :name => field_name, :id => field_id
33 33 when "list"
34 select_tag field_name,
35 "<option></option>" + options_for_select(custom_field.possible_values.split('|'),
36 custom_value.value), :id => field_id
34 select 'custom_value', 'value', custom_field.possible_values.split('|'), { :include_blank => true }, :name => field_name, :id => field_id
37 35 end
38 36 end
39 37
38 # Return custom field label tag
40 39 def custom_field_label_tag(custom_value)
41 40 content_tag "label", custom_value.custom_field.name +
42 41 (custom_value.custom_field.is_required? ? " <span class=\"required\">*</span>" : ""),
43 42 :for => "custom_fields_#{custom_value.custom_field.id}"
44 43 end
45 44
45 # Return custom field tag with its label tag
46 46 def custom_field_tag_with_label(custom_value)
47 47 case custom_value.custom_field.field_format
48 48 when "bool"
49 # label is displayed inline after the checkbox
49 50 custom_field_tag(custom_value) + " " + custom_field_label_tag(custom_value)
50 51 else
51 52 custom_field_label_tag(custom_value) + "<br />" + custom_field_tag(custom_value)
52 53 end
53 54 end
54 55
56 # Return a string used to display a custom value
55 57 def show_value(custom_value)
56 58 case custom_value.custom_field.field_format
57 59 when "bool"
58 60 l_YesNo(custom_value.value == "1")
59 61 else
60 62 custom_value.value
61 63 end
62 64 end
63 65
66 # Return an array of custom field formats which can be used in select_tag
64 67 def custom_field_formats_for_select
65 68 CustomField::FIELD_FORMATS.keys.collect { |k| [ l(CustomField::FIELD_FORMATS[k]), k ] }
66 69 end
67 70 end
@@ -1,43 +1,38
1 1 # redMine - project management software
2 2 # Copyright (C) 2006 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 CustomValue < ActiveRecord::Base
19 19 belongs_to :custom_field
20 20 belongs_to :customized, :polymorphic => true
21 21
22 22 protected
23 23 def validate
24 # errors are added to customized object unless it's nil
25 object = customized || self
26
27 object.errors.add(custom_field.name, :activerecord_error_blank) if custom_field.is_required? and value.empty?
28 object.errors.add(custom_field.name, :activerecord_error_invalid) unless custom_field.regexp.empty? or value =~ Regexp.new(custom_field.regexp)
29
30 object.errors.add(custom_field.name, :activerecord_error_too_short) if custom_field.min_length > 0 and value.length < custom_field.min_length and value.length > 0
31 object.errors.add(custom_field.name, :activerecord_error_too_long) if custom_field.max_length > 0 and value.length > custom_field.max_length
32
24 errors.add(:value, :activerecord_error_blank) and return if custom_field.is_required? and value.empty?
25 errors.add(:value, :activerecord_error_invalid) unless custom_field.regexp.empty? or value =~ Regexp.new(custom_field.regexp)
26 errors.add(:value, :activerecord_error_too_short) if custom_field.min_length > 0 and value.length < custom_field.min_length and value.length > 0
27 errors.add(:value, :activerecord_error_too_long) if custom_field.max_length > 0 and value.length > custom_field.max_length
33 28 case custom_field.field_format
34 29 when "int"
35 object.errors.add(custom_field.name, :activerecord_error_not_a_number) unless value =~ /^[0-9]*$/
30 errors.add(:value, :activerecord_error_not_a_number) unless value =~ /^[0-9]*$/
36 31 when "date"
37 object.errors.add(custom_field.name, :activerecord_error_invalid) unless value =~ /^(\d+)\/(\d+)\/(\d+)$/ or value.empty?
32 errors.add(:value, :activerecord_error_invalid) unless value =~ /^(\d+)\/(\d+)\/(\d+)$/ or value.empty?
38 33 when "list"
39 object.errors.add(custom_field.name, :activerecord_error_inclusion) unless custom_field.possible_values.split('|').include? value or value.empty?
34 errors.add(:value, :activerecord_error_inclusion) unless custom_field.possible_values.split('|').include? value or value.empty?
40 35 end
41 36 end
42 37 end
43 38
@@ -1,38 +1,38
1 1 <h2><%=l(:label_register)%></h2>
2 2
3 3 <%= start_form_tag %>
4 4 <%= error_messages_for 'user' %>
5 5
6 6 <div class="box">
7 7 <!--[form:user]-->
8 8 <p><label for="user_login"><%=l(:field_login)%></label> <span class="required">*</span><br/>
9 9 <%= text_field 'user', 'login', :size => 25 %></p>
10 10
11 11 <p><label for="password"><%=l(:field_password)%></label> <span class="required">*</span><br/>
12 12 <%= password_field_tag 'password', nil, :size => 25 %></p>
13 13
14 14 <p><label for="password_confirmation"><%=l(:field_password_confirmation)%></label> <span class="required">*</span><br/>
15 15 <%= password_field_tag 'password_confirmation', nil, :size => 25 %></p>
16 16
17 17 <p><label for="user_firstname"><%=l(:field_firstname)%></label> <span class="required">*</span><br/>
18 18 <%= text_field 'user', 'firstname' %></p>
19 19
20 20 <p><label for="user_lastname"><%=l(:field_lastname)%></label> <span class="required">*</span><br/>
21 21 <%= text_field 'user', 'lastname' %></p>
22 22
23 23 <p><label for="user_mail"><%=l(:field_mail)%></label> <span class="required">*</span><br/>
24 24 <%= text_field 'user', 'mail' %></p>
25 25
26 26 <p><label for="user_language"><%=l(:field_language)%></label><br/>
27 27 <%= select("user", "language", lang_options_for_select) %></p>
28 28
29 <% for custom_value in @custom_values %>
30 <p><%= custom_field_tag_with_label custom_value %></p>
29 <% for @custom_value in @custom_values %>
30 <p><%= custom_field_tag_with_label @custom_value %></p>
31 31 <% end %>
32 32
33 33 <p><%= check_box 'user', 'mail_notification' %> <label for="user_mail_notification"><%=l(:field_mail_notification)%></label></p>
34 34 <!--[eoform:user]-->
35 35 </div>
36 36
37 37 <%= submit_tag l(:button_submit) %>
38 38 <%= end_form_tag %>
@@ -1,56 +1,56
1 1 <h2><%= @issue.tracker.name %> #<%= @issue.id %> - <%= @issue.subject %></h2>
2 2
3 3 <%= error_messages_for 'issue' %>
4 4 <%= start_form_tag :action => 'edit', :id => @issue %>
5 5
6 6 <div class="box">
7 7 <!--[form:issue]-->
8 8 <p><%=l(:field_status)%>: <b><%= @issue.status.name %></b></p>
9 9
10 10 <div style="float:left;margin-right:10px;">
11 11 <p><label for="issue_priority_id"><%=l(:field_priority)%> <span class="required">*</span></label><br/>
12 12 <select name="issue[priority_id]">
13 13 <%= options_from_collection_for_select @priorities, "id", "name", @issue.priority_id %></p>
14 14 </select></p>
15 15 </div>
16 16
17 17 <div style="float:left;margin-right:10px;">
18 18 <p><label for="issue_assigned_to_id"><%=l(:field_assigned_to)%></label><br/>
19 19 <select name="issue[assigned_to_id]">
20 20 <option value=""></option>
21 21 <%= options_from_collection_for_select @issue.project.members, "user_id", "name", @issue.assigned_to_id %></p>
22 22 </select></p>
23 23 </div>
24 24
25 25 <div>
26 26 <p><label for="issue_category_id"><%=l(:field_category)%></label><br/>
27 27 <select name="issue[category_id]">
28 28 <option value=""></option>
29 29 <%= options_from_collection_for_select @project.issue_categories, "id", "name", @issue.category_id %></p>
30 30 </select></p>
31 31 </div>
32 32
33 33 <p><label for="issue_subject"><%=l(:field_subject)%></label><span class="required">*</span><br/>
34 34 <%= text_field 'issue', 'subject', :size => 60 %></p>
35 35
36 36 <p><label for="issue_description"><%=l(:field_description)%></label><span class="required">*</span><br/>
37 37 <%= text_area 'issue', 'description', :cols => 60, :rows => 10 %></p>
38 38
39 39 <p><label for="issue_due_date"><%=l(:field_due_date)%></label><br />
40 40 <%= date_select 'issue', 'due_date', :start_year => Date.today.year, :include_blank => true %></p>
41 41
42 <% for custom_value in @custom_values %>
43 <p><%= custom_field_tag_with_label custom_value %></p>
42 <% for @custom_value in @custom_values %>
43 <p><%= custom_field_tag_with_label @custom_value %></p>
44 44 <% end %>
45 45
46 46 <p><label for="issue_fixed_version"><%=l(:field_fixed_version)%></label><br/>
47 47 <select name="issue[fixed_version_id]">
48 48 <option value="">--none--</option>
49 49 <%= options_from_collection_for_select @project.versions, "id", "name", @issue.fixed_version_id %>
50 50 </select></p>
51 51
52 52 <!--[eoform:issue]-->
53 53 </div>
54 54
55 55 <%= submit_tag l(:button_save) %>
56 56 <%= end_form_tag %>
@@ -1,41 +1,41
1 1 <%= error_messages_for 'project' %>
2 2
3 3 <div class="box">
4 4 <!--[form:project]-->
5 5 <p><label for="project_name"><%=l(:field_name)%> <span class="required">*</span></label><br/>
6 6 <%= text_field 'project', 'name' %></p>
7 7
8 8 <% if admin_loggedin? %>
9 9 <p><label for="project_parent_id"><%=l(:field_parent)%></label><br/>
10 10 <select name="project[parent_id]">
11 11 <option value=""></option>
12 12 <%= options_from_collection_for_select @root_projects, "id", "name", @project.parent_id %>
13 13 </select></p>
14 14 <% end %>
15 15
16 16 <p><label for="project_description"><%=l(:field_description)%> <span class="required">*</span></label><br/>
17 17 <%= text_area 'project', 'description', :cols => 60, :rows => 3 %></p>
18 18
19 19 <p><label for="project_homepage"><%=l(:field_homepage)%></label><br/>
20 20 <%= text_field 'project', 'homepage', :size => 40 %></p>
21 21
22 22 <p><%= check_box 'project', 'is_public' %>
23 23 <label for="project_is_public"><%=l(:field_is_public)%></label></p>
24 24
25 <% for custom_value in @custom_values %>
26 <p><%= custom_field_tag_with_label custom_value %></p>
25 <% for @custom_value in @custom_values %>
26 <p><%= custom_field_tag_with_label @custom_value %></p>
27 27 <% end %>
28 28
29 29 <fieldset><legend><%=l(:label_custom_field_plural)%></legend>
30 30 <% for custom_field in @custom_fields %>
31 31 <input type="checkbox"
32 32
33 33 name="custom_field_ids[]"
34 34 value="<%= custom_field.id %>"
35 35 <%if @project.custom_fields.include? custom_field%>checked="checked"<%end%>
36 36 > <%= custom_field.name %>
37 37
38 38 <% end %></fieldset>
39 39
40 40 </div>
41 41 <!--[eoform:project]-->
@@ -1,52 +1,52
1 1 <h2><%=l(:label_issue_new)%>: <%= @tracker.name %></h2>
2 2
3 3 <%= start_form_tag( { :action => 'add_issue', :id => @project }, :multipart => true) %>
4 4 <%= error_messages_for 'issue' %>
5 5
6 6 <div class="box">
7 7 <!--[form:issue]-->
8 8
9 9 <%= hidden_field_tag 'tracker_id', @tracker.id %>
10 10
11 11 <div style="float:left;margin-right:10px;">
12 12 <p><label for="issue_priority_id"><%=l(:field_priority)%> <span class="required">*</span></label><br />
13 13 <select name="issue[priority_id]">
14 14 <%= options_from_collection_for_select @priorities, "id", "name", @issue.priority_id %></p>
15 15 </select></p>
16 16 </div>
17 17
18 18 <div style="float:left;margin-right:10px;">
19 19 <p><label for="issue_assigned_to_id"><%=l(:field_assigned_to)%></label><br />
20 20 <select name="issue[assigned_to_id]">
21 21 <option value=""></option>
22 22 <%= options_from_collection_for_select @issue.project.members, "user_id", "name", @issue.assigned_to_id %></p>
23 23 </select></p>
24 24 </div>
25 25
26 26 <div>
27 27 <p><label for="issue_category_id"><%=l(:field_category)%></label><br />
28 28 <select name="issue[category_id]">
29 29 <option value=""></option><%= options_from_collection_for_select @project.issue_categories, "id", "name", @issue.category_id %>
30 30 </select></p>
31 31 </div>
32 32
33 33 <p><label for="issue_subject"><%=l(:field_subject)%> <span class="required">*</span></label><br />
34 34 <%= text_field 'issue', 'subject', :size => 80 %></p>
35 35
36 36 <p><label for="issue_description"><%=l(:field_description)%> <span class="required">*</span></label><br />
37 37 <%= text_area 'issue', 'description', :cols => 60, :rows => 10 %></p>
38 38
39 39 <p><label for="issue_due_date"><%=l(:field_due_date)%></label><br />
40 40 <%= date_select 'issue', 'due_date', :start_year => Date.today.year, :include_blank => true %></p>
41 41
42 <% for custom_value in @custom_values %>
43 <p><%= custom_field_tag_with_label custom_value %></p>
42 <% for @custom_value in @custom_values %>
43 <p><%= custom_field_tag_with_label @custom_value %></p>
44 44 <% end %>
45 45
46 46 <p><label for="attachment_file"><%=l(:label_attachment)%></label><br />
47 47 <%= file_field 'attachment', 'file' %></p>
48 48 <!--[eoform:issue]-->
49 49 </div>
50 50
51 51 <%= submit_tag l(:button_create) %>
52 52 <%= end_form_tag %> No newline at end of file
@@ -1,37 +1,37
1 1 <%= error_messages_for 'user' %>
2 2
3 3 <div class="box">
4 4 <!--[form:user]-->
5 5 <p><label for="user_login"><%=l(:field_login)%></label> <span class="required">*</span><br/>
6 6 <%= text_field 'user', 'login', :size => 25 %></p>
7 7
8 8 <p><label for="password"><%=l(:field_password)%></label> <span class="required">*</span><br/>
9 9 <%= password_field_tag 'password', nil, :size => 25 %></p>
10 10
11 11 <p><label for="password_confirmation"><%=l(:field_password_confirmation)%></label> <span class="required">*</span><br/>
12 12 <%= password_field_tag 'password_confirmation', nil, :size => 25 %></p>
13 13
14 14 <p><label for="user_firstname"><%=l(:field_firstname)%></label> <span class="required">*</span><br/>
15 15 <%= text_field 'user', 'firstname' %></p>
16 16
17 17 <p><label for="user_lastname"><%=l(:field_lastname)%></label> <span class="required">*</span><br/>
18 18 <%= text_field 'user', 'lastname' %></p>
19 19
20 20 <p><label for="user_mail"><%=l(:field_mail)%></label> <span class="required">*</span><br/>
21 21 <%= text_field 'user', 'mail' %></p>
22 22
23 23 <p><label for="user_language"><%=l(:field_language)%></label><br/>
24 24 <%= select("user", "language", lang_options_for_select) %></p>
25 25
26 <% for custom_value in @custom_values %>
27 <p><%= custom_field_tag_with_label custom_value %></p>
26 <% for @custom_value in @custom_values %>
27 <p><%= custom_field_tag_with_label @custom_value %></p>
28 28 <% end %>
29 29
30 30 <div style="clear: both;"></div>
31 31
32 32 <p><%= check_box 'user', 'admin' %> <label for="user_admin"><%=l(:field_admin)%></label></p>
33 33
34 34 <p><%= check_box 'user', 'mail_notification' %> <label for="user_mail_notification"><%=l(:field_mail_notification)%></label></p>
35 35
36 36 <!--[eoform:user]-->
37 37 </div>
General Comments 0
You need to be logged in to leave comments. Login now