##// END OF EJS Templates
Merged r2610, r2611 from trunk....
Jean-Philippe Lang -
r2565:16810acf015a
parent child
Show More
@@ -1,88 +1,90
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 CustomFieldsController < ApplicationController
19 19 before_filter :require_admin
20 20
21 21 def index
22 22 list
23 23 render :action => 'list' unless request.xhr?
24 24 end
25 25
26 26 def list
27 27 @custom_fields_by_type = CustomField.find(:all).group_by {|f| f.class.name }
28 28 @tab = params[:tab] || 'IssueCustomField'
29 29 render :action => "list", :layout => false if request.xhr?
30 30 end
31 31
32 32 def new
33 33 case params[:type]
34 34 when "IssueCustomField"
35 35 @custom_field = IssueCustomField.new(params[:custom_field])
36 36 @custom_field.trackers = Tracker.find(params[:tracker_ids]) if params[:tracker_ids]
37 37 when "UserCustomField"
38 38 @custom_field = UserCustomField.new(params[:custom_field])
39 39 when "ProjectCustomField"
40 40 @custom_field = ProjectCustomField.new(params[:custom_field])
41 41 when "TimeEntryCustomField"
42 42 @custom_field = TimeEntryCustomField.new(params[:custom_field])
43 43 else
44 44 redirect_to :action => 'list'
45 45 return
46 46 end
47 47 if request.post? and @custom_field.save
48 48 flash[:notice] = l(:notice_successful_create)
49 call_hook(:controller_custom_fields_new_after_save, :params => params, :custom_field => @custom_field)
49 50 redirect_to :action => 'list', :tab => @custom_field.class.name
50 51 end
51 52 @trackers = Tracker.find(:all, :order => 'position')
52 53 end
53 54
54 55 def edit
55 56 @custom_field = CustomField.find(params[:id])
56 57 if request.post? and @custom_field.update_attributes(params[:custom_field])
57 58 if @custom_field.is_a? IssueCustomField
58 59 @custom_field.trackers = params[:tracker_ids] ? Tracker.find(params[:tracker_ids]) : []
59 60 end
60 61 flash[:notice] = l(:notice_successful_update)
62 call_hook(:controller_custom_fields_edit_after_save, :params => params, :custom_field => @custom_field)
61 63 redirect_to :action => 'list', :tab => @custom_field.class.name
62 64 end
63 65 @trackers = Tracker.find(:all, :order => 'position')
64 66 end
65 67
66 68 def move
67 69 @custom_field = CustomField.find(params[:id])
68 70 case params[:position]
69 71 when 'highest'
70 72 @custom_field.move_to_top
71 73 when 'higher'
72 74 @custom_field.move_higher
73 75 when 'lower'
74 76 @custom_field.move_lower
75 77 when 'lowest'
76 78 @custom_field.move_to_bottom
77 79 end if params[:position]
78 80 redirect_to :action => 'list', :tab => @custom_field.class.name
79 81 end
80 82
81 83 def destroy
82 84 @custom_field = CustomField.find(params[:id]).destroy
83 85 redirect_to :action => 'list', :tab => @custom_field.class.name
84 86 rescue
85 87 flash[:error] = "Unable to delete custom field"
86 88 redirect_to :action => 'list'
87 89 end
88 90 end
@@ -1,113 +1,115
1 1 <%= error_messages_for 'custom_field' %>
2 2
3 3 <script type="text/javascript">
4 4 //<![CDATA[
5 5 function toggle_custom_field_format() {
6 6 format = $("custom_field_field_format");
7 7 p_length = $("custom_field_min_length");
8 8 p_regexp = $("custom_field_regexp");
9 9 p_values = $("custom_field_possible_values");
10 10 p_searchable = $("custom_field_searchable");
11 11 p_default = $("custom_field_default_value");
12 12
13 13 p_default.setAttribute('type','text');
14 14 Element.show(p_default.parentNode);
15 15
16 16 switch (format.value) {
17 17 case "list":
18 18 Element.hide(p_length.parentNode);
19 19 Element.hide(p_regexp.parentNode);
20 20 if (p_searchable) Element.show(p_searchable.parentNode);
21 21 Element.show(p_values);
22 22 break;
23 23 case "bool":
24 24 p_default.setAttribute('type','checkbox');
25 25 Element.hide(p_length.parentNode);
26 26 Element.hide(p_regexp.parentNode);
27 27 if (p_searchable) Element.hide(p_searchable.parentNode);
28 28 Element.hide(p_values);
29 29 break;
30 30 case "date":
31 31 Element.hide(p_length.parentNode);
32 32 Element.hide(p_regexp.parentNode);
33 33 if (p_searchable) Element.hide(p_searchable.parentNode);
34 34 Element.hide(p_values);
35 35 break;
36 36 case "float":
37 37 case "int":
38 38 Element.show(p_length.parentNode);
39 39 Element.show(p_regexp.parentNode);
40 40 if (p_searchable) Element.hide(p_searchable.parentNode);
41 41 Element.hide(p_values);
42 42 break;
43 43 default:
44 44 Element.show(p_length.parentNode);
45 45 Element.show(p_regexp.parentNode);
46 46 if (p_searchable) Element.show(p_searchable.parentNode);
47 47 Element.hide(p_values);
48 48 break;
49 49 }
50 50 }
51 51
52 52 function addValueField() {
53 53 var f = $$('p#custom_field_possible_values span');
54 54 p = document.getElementById("custom_field_possible_values");
55 55 var v = f[0].cloneNode(true);
56 56 v.childNodes[0].value = "";
57 57 p.appendChild(v);
58 58 }
59 59
60 60 function deleteValueField(e) {
61 61 var f = $$('p#custom_field_possible_values span');
62 62 if (f.length == 1) {
63 63 e.parentNode.childNodes[0].value = "";
64 64 } else {
65 65 Element.remove(e.parentNode);
66 66 }
67 67 }
68 68
69 69 //]]>
70 70 </script>
71 71
72 72 <div class="box">
73 73 <p><%= f.text_field :name, :required => true %></p>
74 74 <p><%= f.select :field_format, custom_field_formats_for_select, {}, :onchange => "toggle_custom_field_format();" %></p>
75 75 <p><label for="custom_field_min_length"><%=l(:label_min_max_length)%></label>
76 76 <%= f.text_field :min_length, :size => 5, :no_label => true %> -
77 77 <%= f.text_field :max_length, :size => 5, :no_label => true %><br>(<%=l(:text_min_max_length_info)%>)</p>
78 78 <p><%= f.text_field :regexp, :size => 50 %><br>(<%=l(:text_regexp_info)%>)</p>
79 79 <p id="custom_field_possible_values"><label><%= l(:field_possible_values) %> <%= image_to_function "add.png", "addValueField();return false" %></label>
80 80 <% (@custom_field.possible_values.to_a + [""]).each do |value| %>
81 81 <span><%= text_field_tag 'custom_field[possible_values][]', value, :size => 30 %> <%= image_to_function "delete.png", "deleteValueField(this);return false" %><br /></span>
82 82 <% end %>
83 83 </p>
84 84 <p><%= @custom_field.field_format == 'bool' ? f.check_box(:default_value) : f.text_field(:default_value) %></p>
85 <%= call_hook(:view_custom_fields_form_upper_box, :custom_field => @custom_field, :form => f) %>
85 86 </div>
86 87
87 88 <div class="box">
88 89 <% case @custom_field.type.to_s
89 90 when "IssueCustomField" %>
90 91
91 92 <fieldset><legend><%=l(:label_tracker_plural)%></legend>
92 93 <% for tracker in @trackers %>
93 94 <%= check_box_tag "tracker_ids[]", tracker.id, (@custom_field.trackers.include? tracker) %> <%= tracker.name %>
94 95 <% end %>
95 96 </fieldset>
96 97 &nbsp;
97 98 <p><%= f.check_box :is_required %></p>
98 99 <p><%= f.check_box :is_for_all %></p>
99 100 <p><%= f.check_box :is_filter %></p>
100 101 <p><%= f.check_box :searchable %></p>
101 102
102 103 <% when "UserCustomField" %>
103 104 <p><%= f.check_box :is_required %></p>
104 105
105 106 <% when "ProjectCustomField" %>
106 107 <p><%= f.check_box :is_required %></p>
107 108
108 109 <% when "TimeEntryCustomField" %>
109 110 <p><%= f.check_box :is_required %></p>
110 111
111 112 <% end %>
113 <%= call_hook(:"view_custom_fields_form_#{@custom_field.type.to_s.underscore}", :custom_field => @custom_field, :form => f) %>
112 114 </div>
113 115 <%= javascript_tag "toggle_custom_field_format();" %>
@@ -1,15 +1,17
1 1 <%= error_messages_for 'issue_status' %>
2 2
3 3 <div class="box">
4 4 <!--[form:issue_status]-->
5 5 <p><label for="issue_status_name"><%=l(:field_name)%><span class="required"> *</span></label>
6 6 <%= text_field 'issue_status', 'name' %></p>
7 7
8 8 <p><label for="issue_status_is_closed"><%=l(:field_is_closed)%></label>
9 9 <%= check_box 'issue_status', 'is_closed' %></p>
10 10
11 11 <p><label for="issue_status_is_default"><%=l(:field_is_default)%></label>
12 12 <%= check_box 'issue_status', 'is_default' %></p>
13 13
14 <%= call_hook(:view_issue_statuses_form, :issue_status => @issue_status) %>
15
14 16 <!--[eoform:issue_status]-->
15 17 </div>
@@ -1,90 +1,94
1 1 <ul>
2 <%= call_hook(:view_issues_context_menu_start, {:issues => @issues, :can => @can, :back => @back }) %>
3
2 4 <% if !@issue.nil? -%>
3 5 <li><%= context_menu_link l(:button_edit), {:controller => 'issues', :action => 'edit', :id => @issue},
4 6 :class => 'icon-edit', :disabled => !@can[:edit] %></li>
5 7 <li class="folder">
6 8 <a href="#" class="submenu" onclick="return false;"><%= l(:field_status) %></a>
7 9 <ul>
8 10 <% @statuses.each do |s| -%>
9 11 <li><%= context_menu_link s.name, {:controller => 'issues', :action => 'edit', :id => @issue, :issue => {:status_id => s}, :back_to => @back}, :method => :post,
10 12 :selected => (s == @issue.status), :disabled => !(@can[:update] && @allowed_statuses.include?(s)) %></li>
11 13 <% end -%>
12 14 </ul>
13 15 </li>
14 16 <% else %>
15 17 <li><%= context_menu_link l(:button_edit), {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id)},
16 18 :class => 'icon-edit', :disabled => !@can[:edit] %></li>
17 19 <% end %>
18 20
19 21 <li class="folder">
20 22 <a href="#" class="submenu"><%= l(:field_priority) %></a>
21 23 <ul>
22 24 <% @priorities.each do |p| -%>
23 25 <li><%= context_menu_link p.name, {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), 'priority_id' => p, :back_to => @back}, :method => :post,
24 26 :selected => (@issue && p == @issue.priority), :disabled => !@can[:edit] %></li>
25 27 <% end -%>
26 28 </ul>
27 29 </li>
28 30 <% unless @project.nil? || @project.versions.empty? -%>
29 31 <li class="folder">
30 32 <a href="#" class="submenu"><%= l(:field_fixed_version) %></a>
31 33 <ul>
32 34 <% @project.versions.sort.each do |v| -%>
33 35 <li><%= context_menu_link v.name, {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), 'fixed_version_id' => v, :back_to => @back}, :method => :post,
34 36 :selected => (@issue && v == @issue.fixed_version), :disabled => !@can[:update] %></li>
35 37 <% end -%>
36 38 <li><%= context_menu_link l(:label_none), {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), 'fixed_version_id' => 'none', :back_to => @back}, :method => :post,
37 39 :selected => (@issue && @issue.fixed_version.nil?), :disabled => !@can[:update] %></li>
38 40 </ul>
39 41 </li>
40 42 <% end %>
41 43 <% unless @assignables.nil? || @assignables.empty? -%>
42 44 <li class="folder">
43 45 <a href="#" class="submenu"><%= l(:field_assigned_to) %></a>
44 46 <ul>
45 47 <% @assignables.each do |u| -%>
46 48 <li><%= context_menu_link u.name, {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), 'assigned_to_id' => u, :back_to => @back}, :method => :post,
47 49 :selected => (@issue && u == @issue.assigned_to), :disabled => !@can[:update] %></li>
48 50 <% end -%>
49 51 <li><%= context_menu_link l(:label_nobody), {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), 'assigned_to_id' => 'none', :back_to => @back}, :method => :post,
50 52 :selected => (@issue && @issue.assigned_to.nil?), :disabled => !@can[:update] %></li>
51 53 </ul>
52 54 </li>
53 55 <% end %>
54 56 <% unless @project.nil? || @project.issue_categories.empty? -%>
55 57 <li class="folder">
56 58 <a href="#" class="submenu"><%= l(:field_category) %></a>
57 59 <ul>
58 60 <% @project.issue_categories.each do |u| -%>
59 61 <li><%= context_menu_link u.name, {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), 'category_id' => u, :back_to => @back}, :method => :post,
60 62 :selected => (@issue && u == @issue.category), :disabled => !@can[:update] %></li>
61 63 <% end -%>
62 64 <li><%= context_menu_link l(:label_none), {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), 'category_id' => 'none', :back_to => @back}, :method => :post,
63 65 :selected => (@issue && @issue.category.nil?), :disabled => !@can[:update] %></li>
64 66 </ul>
65 67 </li>
66 68 <% end -%>
67 69 <li class="folder">
68 70 <a href="#" class="submenu"><%= l(:field_done_ratio) %></a>
69 71 <ul>
70 72 <% (0..10).map{|x|x*10}.each do |p| -%>
71 73 <li><%= context_menu_link "#{p}%", {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), 'done_ratio' => p, :back_to => @back}, :method => :post,
72 74 :selected => (@issue && p == @issue.done_ratio), :disabled => !@can[:edit] %></li>
73 75 <% end -%>
74 76 </ul>
75 77 </li>
76 78
77 79 <% if !@issue.nil? %>
78 80 <li><%= context_menu_link l(:button_copy), {:controller => 'issues', :action => 'new', :project_id => @project, :copy_from => @issue},
79 81 :class => 'icon-copy', :disabled => !@can[:copy] %></li>
80 82 <% if @can[:log_time] -%>
81 83 <li><%= context_menu_link l(:button_log_time), {:controller => 'timelog', :action => 'edit', :issue_id => @issue},
82 84 :class => 'icon-time' %></li>
83 85 <% end %>
84 86 <% end %>
85 87
86 88 <li><%= context_menu_link l(:button_move), {:controller => 'issues', :action => 'move', :ids => @issues.collect(&:id)},
87 89 :class => 'icon-move', :disabled => !@can[:move] %></li>
88 90 <li><%= context_menu_link l(:button_delete), {:controller => 'issues', :action => 'destroy', :ids => @issues.collect(&:id)},
89 91 :method => :post, :confirm => l(:text_issues_destroy_confirmation), :class => 'icon-del', :disabled => !@can[:delete] %></li>
92
93 <%= call_hook(:view_issues_context_menu_end, {:issues => @issues, :can => @can, :back => @back }) %>
90 94 </ul>
@@ -1,126 +1,128
1 1 <div class="contextual">
2 2 <%= link_to_if_authorized(l(:button_update), {:controller => 'issues', :action => 'edit', :id => @issue }, :onclick => 'showAndScrollTo("update", "notes"); return false;', :class => 'icon icon-edit', :accesskey => accesskey(:edit)) %>
3 3 <%= link_to_if_authorized l(:button_log_time), {:controller => 'timelog', :action => 'edit', :issue_id => @issue}, :class => 'icon icon-time' %>
4 4 <%= watcher_tag(@issue, User.current) %>
5 5 <%= link_to_if_authorized l(:button_copy), {:controller => 'issues', :action => 'new', :project_id => @project, :copy_from => @issue }, :class => 'icon icon-copy' %>
6 6 <%= link_to_if_authorized l(:button_move), {:controller => 'issues', :action => 'move', :id => @issue }, :class => 'icon icon-move' %>
7 7 <%= link_to_if_authorized l(:button_delete), {:controller => 'issues', :action => 'destroy', :id => @issue}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %>
8 8 </div>
9 9
10 10 <h2><%= @issue.tracker.name %> #<%= @issue.id %></h2>
11 11
12 12 <div class="<%= css_issue_classes(@issue) %> details">
13 13 <%= avatar(@issue.author, :size => "64") %>
14 14 <h3><%=h @issue.subject %></h3>
15 15 <p class="author">
16 16 <%= authoring @issue.created_on, @issue.author %>.
17 17 <%= l(:label_updated_time, distance_of_time_in_words(Time.now, @issue.updated_on)) + '.' if @issue.created_on != @issue.updated_on %>
18 18 </p>
19 19
20 20 <table width="100%">
21 21 <tr>
22 22 <td style="width:15%" class="status"><b><%=l(:field_status)%>:</b></td><td style="width:35%" class="status"><%= @issue.status.name %></td>
23 23 <td style="width:15%" class="start-date"><b><%=l(:field_start_date)%>:</b></td><td style="width:35%"><%= format_date(@issue.start_date) %></td>
24 24 </tr>
25 25 <tr>
26 26 <td class="priority"><b><%=l(:field_priority)%>:</b></td><td class="priority"><%= @issue.priority.name %></td>
27 27 <td class="due-date"><b><%=l(:field_due_date)%>:</b></td><td class="due-date"><%= format_date(@issue.due_date) %></td>
28 28 </tr>
29 29 <tr>
30 30 <td class="assigned-to"><b><%=l(:field_assigned_to)%>:</b></td><td><%= avatar(@issue.assigned_to, :size => "14") %><%= @issue.assigned_to ? link_to_user(@issue.assigned_to) : "-" %></td>
31 31 <td class="progress"><b><%=l(:field_done_ratio)%>:</b></td><td class="progress"><%= progress_bar @issue.done_ratio, :width => '80px', :legend => "#{@issue.done_ratio}%" %></td>
32 32 </tr>
33 33 <tr>
34 34 <td class="category"><b><%=l(:field_category)%>:</b></td><td><%=h @issue.category ? @issue.category.name : "-" %></td>
35 35 <% if User.current.allowed_to?(:view_time_entries, @project) %>
36 36 <td class="spent-time"><b><%=l(:label_spent_time)%>:</b></td>
37 37 <td class="spent-hours"><%= @issue.spent_hours > 0 ? (link_to lwr(:label_f_hour, @issue.spent_hours), {:controller => 'timelog', :action => 'details', :project_id => @project, :issue_id => @issue}, :class => 'icon icon-time') : "-" %></td>
38 38 <% end %>
39 39 </tr>
40 40 <tr>
41 41 <td class="fixed-version"><b><%=l(:field_fixed_version)%>:</b></td><td><%= @issue.fixed_version ? link_to_version(@issue.fixed_version) : "-" %></td>
42 42 <% if @issue.estimated_hours %>
43 43 <td class="estimated-hours"><b><%=l(:field_estimated_hours)%>:</b></td><td><%= lwr(:label_f_hour, @issue.estimated_hours) %></td>
44 44 <% end %>
45 45 </tr>
46 46 <tr>
47 47 <% n = 0 -%>
48 48 <% @issue.custom_values.each do |value| -%>
49 49 <td valign="top"><b><%=h value.custom_field.name %>:</b></td><td valign="top"><%= simple_format(h(show_value(value))) %></td>
50 50 <% n = n + 1
51 51 if (n > 1)
52 52 n = 0 %>
53 53 </tr><tr>
54 54 <%end
55 55 end %>
56 56 </tr>
57 57 <%= call_hook(:view_issues_show_details_bottom, :issue => @issue) %>
58 58 </table>
59 59 <hr />
60 60
61 61 <div class="contextual">
62 62 <%= link_to_remote_if_authorized(l(:button_quote), { :url => {:action => 'reply', :id => @issue} }, :class => 'icon icon-comment') unless @issue.description.blank? %>
63 63 </div>
64 64
65 65 <p><strong><%=l(:field_description)%></strong></p>
66 66 <div class="wiki">
67 67 <%= textilizable @issue, :description, :attachments => @issue.attachments %>
68 68 </div>
69 69
70 70 <%= link_to_attachments @issue %>
71 71
72 <%= call_hook(:view_issues_show_description_bottom, :issue => @issue) %>
73
72 74 <% if authorize_for('issue_relations', 'new') || @issue.relations.any? %>
73 75 <hr />
74 76 <div id="relations">
75 77 <%= render :partial => 'relations' %>
76 78 </div>
77 79 <% end %>
78 80
79 81 <% if User.current.allowed_to?(:add_issue_watchers, @project) ||
80 82 (@issue.watchers.any? && User.current.allowed_to?(:view_issue_watchers, @project)) %>
81 83 <hr />
82 84 <div id="watchers">
83 85 <%= render :partial => 'watchers/watchers', :locals => {:watched => @issue} %>
84 86 </div>
85 87 <% end %>
86 88
87 89 </div>
88 90
89 91 <% if @issue.changesets.any? && User.current.allowed_to?(:view_changesets, @project) %>
90 92 <div id="issue-changesets">
91 93 <h3><%=l(:label_associated_revisions)%></h3>
92 94 <%= render :partial => 'changesets', :locals => { :changesets => @issue.changesets} %>
93 95 </div>
94 96 <% end %>
95 97
96 98 <% if @journals.any? %>
97 99 <div id="history">
98 100 <h3><%=l(:label_history)%></h3>
99 101 <%= render :partial => 'history', :locals => { :journals => @journals } %>
100 102 </div>
101 103 <% end %>
102 104 <div style="clear: both;"></div>
103 105
104 106 <% if authorize_for('issues', 'edit') %>
105 107 <div id="update" style="display:none;">
106 108 <h3><%= l(:button_update) %></h3>
107 109 <%= render :partial => 'edit' %>
108 110 </div>
109 111 <% end %>
110 112
111 113 <p class="other-formats">
112 114 <%= l(:label_export_to) %>
113 115 <span><%= link_to 'Atom', {:format => 'atom', :key => User.current.rss_key}, :class => 'feed' %></span>
114 116 <span><%= link_to 'PDF', {:format => 'pdf'}, :class => 'pdf' %></span>
115 117 </p>
116 118
117 119 <% html_title "#{@issue.tracker.name} ##{@issue.id}: #{@issue.subject}" %>
118 120
119 121 <% content_for :sidebar do %>
120 122 <%= render :partial => 'issues/sidebar' %>
121 123 <% end %>
122 124
123 125 <% content_for :header_tags do %>
124 126 <%= auto_discovery_link_tag(:atom, {:format => 'atom', :key => User.current.rss_key}, :title => "#{@issue.project} - #{@issue.tracker} ##{@issue.id}: #{@issue.subject}") %>
125 127 <%= stylesheet_link_tag 'scm' %>
126 128 <% end %>
@@ -1,52 +1,53
1 1 <div class="contextual">
2 2 <%= link_to(l(:button_change_password), :action => 'password') unless @user.auth_source_id %>
3 3 </div>
4 4 <h2><%=l(:label_my_account)%></h2>
5 5 <%= error_messages_for 'user' %>
6 6
7 7 <% form_for :user, @user, :url => { :action => "account" },
8 8 :builder => TabularFormBuilder,
9 9 :lang => current_language,
10 10 :html => { :id => 'my_account_form' } do |f| %>
11 11 <div class="splitcontentleft">
12 12 <h3><%=l(:label_information_plural)%></h3>
13 13 <div class="box tabular">
14 14 <p><%= f.text_field :firstname, :required => true %></p>
15 15 <p><%= f.text_field :lastname, :required => true %></p>
16 16 <p><%= f.text_field :mail, :required => true %></p>
17 17 <p><%= f.select :language, lang_options_for_select %></p>
18 <%= call_hook(:view_my_account, :user => @user, :form => f) %>
18 19 </div>
19 20
20 21 <%= submit_tag l(:button_save) %>
21 22 </div>
22 23
23 24 <div class="splitcontentright">
24 25 <h3><%=l(:field_mail_notification)%></h3>
25 26 <div class="box">
26 27 <%= select_tag 'notification_option', options_for_select(@notification_options, @notification_option),
27 28 :onchange => 'if ($("notification_option").value == "selected") {Element.show("notified-projects")} else {Element.hide("notified-projects")}' %>
28 29 <% content_tag 'div', :id => 'notified-projects', :style => (@notification_option == 'selected' ? '' : 'display:none;') do %>
29 30 <p><% User.current.projects.each do |project| %>
30 31 <label><%= check_box_tag 'notified_project_ids[]', project.id, @user.notified_projects_ids.include?(project.id) %> <%=h project.name %></label><br />
31 32 <% end %></p>
32 33 <p><em><%= l(:text_user_mail_option) %></em></p>
33 34 <% end %>
34 35 <p><label><%= check_box_tag 'no_self_notified', 1, @user.pref[:no_self_notified] %> <%= l(:label_user_mail_no_self_notified) %></label></p>
35 36 </div>
36 37
37 38 <h3><%=l(:label_preferences)%></h3>
38 39 <div class="box tabular">
39 40 <% fields_for :pref, @user.pref, :builder => TabularFormBuilder, :lang => current_language do |pref_fields| %>
40 41 <p><%= pref_fields.check_box :hide_mail %></p>
41 42 <p><%= pref_fields.select :time_zone, ActiveSupport::TimeZone.all.collect {|z| [ z.to_s, z.name ]}, :include_blank => true %></p>
42 43 <p><%= pref_fields.select :comments_sorting, [[l(:label_chronological_order), 'asc'], [l(:label_reverse_chronological_order), 'desc']] %></p>
43 44 <% end %>
44 45 </div>
45 46 </div>
46 47 <% end %>
47 48
48 49 <% content_for :sidebar do %>
49 50 <%= render :partial => 'sidebar' %>
50 51 <% end %>
51 52
52 53 <% html_title(l(:label_my_account)) -%>
@@ -1,31 +1,32
1 1 <%= error_messages_for 'user' %>
2 2
3 3 <!--[form:user]-->
4 4 <div class="box">
5 5 <p><%= f.text_field :login, :required => true, :size => 25 %></p>
6 6 <p><%= f.text_field :firstname, :required => true %></p>
7 7 <p><%= f.text_field :lastname, :required => true %></p>
8 8 <p><%= f.text_field :mail, :required => true %></p>
9 9 <p><%= f.select :language, lang_options_for_select %></p>
10 10
11 11 <% @user.custom_field_values.each do |value| %>
12 12 <p><%= custom_field_tag_with_label :user, value %></p>
13 13 <% end %>
14 14
15 15 <p><%= f.check_box :admin, :disabled => (@user == User.current) %></p>
16 <%= call_hook(:view_users_form, :user => @user, :form => f) %>
16 17 </div>
17 18
18 19 <div class="box">
19 20 <h3><%=l(:label_authentication)%></h3>
20 21 <% unless @auth_sources.empty? %>
21 22 <p><%= f.select :auth_source_id, ([[l(:label_internal), ""]] + @auth_sources.collect { |a| [a.name, a.id] }), {}, :onchange => "if (this.value=='') {Element.show('password_fields');} else {Element.hide('password_fields');}" %></p>
22 23 <% end %>
23 24 <div id="password_fields" style="<%= 'display:none;' if @user.auth_source %>">
24 25 <p><label for="password"><%=l(:field_password)%><span class="required"> *</span></label>
25 26 <%= password_field_tag 'password', nil, :size => 25 %><br />
26 27 <em><%= l(:text_caracters_minimum, 4) %></em></p>
27 28 <p><label for="password_confirmation"><%=l(:field_password_confirmation)%><span class="required"> *</span></label>
28 29 <%= password_field_tag 'password_confirmation', nil, :size => 25 %></p>
29 30 </div>
30 31 </div>
31 32 <!--[eoform:user]-->
General Comments 0
You need to be logged in to leave comments. Login now