##// END OF EJS Templates
Fixed some labels to be more accessible....
Eric Davis -
r3222:d4525828b9d8
parent child
Show More
@@ -1,104 +1,104
1 # redMine - project management software
1 # redMine - project management software
2 # Copyright (C) 2006 Jean-Philippe Lang
2 # Copyright (C) 2006 Jean-Philippe Lang
3 #
3 #
4 # This program is free software; you can redistribute it and/or
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
7 # of the License, or (at your option) any later version.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU General Public License
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
17
18 module ProjectsHelper
18 module ProjectsHelper
19 def link_to_version(version, options = {})
19 def link_to_version(version, options = {})
20 return '' unless version && version.is_a?(Version)
20 return '' unless version && version.is_a?(Version)
21 link_to_if version.visible?, format_version_name(version), { :controller => 'versions', :action => 'show', :id => version }, options
21 link_to_if version.visible?, format_version_name(version), { :controller => 'versions', :action => 'show', :id => version }, options
22 end
22 end
23
23
24 def project_settings_tabs
24 def project_settings_tabs
25 tabs = [{:name => 'info', :action => :edit_project, :partial => 'projects/edit', :label => :label_information_plural},
25 tabs = [{:name => 'info', :action => :edit_project, :partial => 'projects/edit', :label => :label_information_plural},
26 {:name => 'modules', :action => :select_project_modules, :partial => 'projects/settings/modules', :label => :label_module_plural},
26 {:name => 'modules', :action => :select_project_modules, :partial => 'projects/settings/modules', :label => :label_module_plural},
27 {:name => 'members', :action => :manage_members, :partial => 'projects/settings/members', :label => :label_member_plural},
27 {:name => 'members', :action => :manage_members, :partial => 'projects/settings/members', :label => :label_member_plural},
28 {:name => 'versions', :action => :manage_versions, :partial => 'projects/settings/versions', :label => :label_version_plural},
28 {:name => 'versions', :action => :manage_versions, :partial => 'projects/settings/versions', :label => :label_version_plural},
29 {:name => 'categories', :action => :manage_categories, :partial => 'projects/settings/issue_categories', :label => :label_issue_category_plural},
29 {:name => 'categories', :action => :manage_categories, :partial => 'projects/settings/issue_categories', :label => :label_issue_category_plural},
30 {:name => 'wiki', :action => :manage_wiki, :partial => 'projects/settings/wiki', :label => :label_wiki},
30 {:name => 'wiki', :action => :manage_wiki, :partial => 'projects/settings/wiki', :label => :label_wiki},
31 {:name => 'repository', :action => :manage_repository, :partial => 'projects/settings/repository', :label => :label_repository},
31 {:name => 'repository', :action => :manage_repository, :partial => 'projects/settings/repository', :label => :label_repository},
32 {:name => 'boards', :action => :manage_boards, :partial => 'projects/settings/boards', :label => :label_board_plural},
32 {:name => 'boards', :action => :manage_boards, :partial => 'projects/settings/boards', :label => :label_board_plural},
33 {:name => 'activities', :action => :manage_project_activities, :partial => 'projects/settings/activities', :label => :enumeration_activities}
33 {:name => 'activities', :action => :manage_project_activities, :partial => 'projects/settings/activities', :label => :enumeration_activities}
34 ]
34 ]
35 tabs.select {|tab| User.current.allowed_to?(tab[:action], @project)}
35 tabs.select {|tab| User.current.allowed_to?(tab[:action], @project)}
36 end
36 end
37
37
38 def parent_project_select_tag(project)
38 def parent_project_select_tag(project)
39 selected = project.parent
39 selected = project.parent
40 # retrieve the requested parent project
40 # retrieve the requested parent project
41 parent_id = (params[:project] && params[:project][:parent_id]) || params[:parent_id]
41 parent_id = (params[:project] && params[:project][:parent_id]) || params[:parent_id]
42 if parent_id
42 if parent_id
43 selected = (parent_id.blank? ? nil : Project.find(parent_id))
43 selected = (parent_id.blank? ? nil : Project.find(parent_id))
44 end
44 end
45
45
46 options = ''
46 options = ''
47 options << "<option value=''></option>" if project.allowed_parents.include?(nil)
47 options << "<option value=''></option>" if project.allowed_parents.include?(nil)
48 options << project_tree_options_for_select(project.allowed_parents.compact, :selected => selected)
48 options << project_tree_options_for_select(project.allowed_parents.compact, :selected => selected)
49 content_tag('select', options, :name => 'project[parent_id]')
49 content_tag('select', options, :name => 'project[parent_id]', :id => 'project_parent_id')
50 end
50 end
51
51
52 # Renders a tree of projects as a nested set of unordered lists
52 # Renders a tree of projects as a nested set of unordered lists
53 # The given collection may be a subset of the whole project tree
53 # The given collection may be a subset of the whole project tree
54 # (eg. some intermediate nodes are private and can not be seen)
54 # (eg. some intermediate nodes are private and can not be seen)
55 def render_project_hierarchy(projects)
55 def render_project_hierarchy(projects)
56 s = ''
56 s = ''
57 if projects.any?
57 if projects.any?
58 ancestors = []
58 ancestors = []
59 projects.each do |project|
59 projects.each do |project|
60 if (ancestors.empty? || project.is_descendant_of?(ancestors.last))
60 if (ancestors.empty? || project.is_descendant_of?(ancestors.last))
61 s << "<ul class='projects #{ ancestors.empty? ? 'root' : nil}'>\n"
61 s << "<ul class='projects #{ ancestors.empty? ? 'root' : nil}'>\n"
62 else
62 else
63 ancestors.pop
63 ancestors.pop
64 s << "</li>"
64 s << "</li>"
65 while (ancestors.any? && !project.is_descendant_of?(ancestors.last))
65 while (ancestors.any? && !project.is_descendant_of?(ancestors.last))
66 ancestors.pop
66 ancestors.pop
67 s << "</ul></li>\n"
67 s << "</ul></li>\n"
68 end
68 end
69 end
69 end
70 classes = (ancestors.empty? ? 'root' : 'child')
70 classes = (ancestors.empty? ? 'root' : 'child')
71 s << "<li class='#{classes}'><div class='#{classes}'>" +
71 s << "<li class='#{classes}'><div class='#{classes}'>" +
72 link_to(h(project), {:controller => 'projects', :action => 'show', :id => project}, :class => "project #{User.current.member_of?(project) ? 'my-project' : nil}")
72 link_to(h(project), {:controller => 'projects', :action => 'show', :id => project}, :class => "project #{User.current.member_of?(project) ? 'my-project' : nil}")
73 s << "<div class='wiki description'>#{textilizable(project.short_description, :project => project)}</div>" unless project.description.blank?
73 s << "<div class='wiki description'>#{textilizable(project.short_description, :project => project)}</div>" unless project.description.blank?
74 s << "</div>\n"
74 s << "</div>\n"
75 ancestors << project
75 ancestors << project
76 end
76 end
77 s << ("</li></ul>\n" * ancestors.size)
77 s << ("</li></ul>\n" * ancestors.size)
78 end
78 end
79 s
79 s
80 end
80 end
81
81
82 # Returns a set of options for a select field, grouped by project.
82 # Returns a set of options for a select field, grouped by project.
83 def version_options_for_select(versions, selected=nil)
83 def version_options_for_select(versions, selected=nil)
84 grouped = Hash.new {|h,k| h[k] = []}
84 grouped = Hash.new {|h,k| h[k] = []}
85 versions.each do |version|
85 versions.each do |version|
86 grouped[version.project.name] << [version.name, version.id]
86 grouped[version.project.name] << [version.name, version.id]
87 end
87 end
88 # Add in the selected
88 # Add in the selected
89 if selected && !versions.include?(selected)
89 if selected && !versions.include?(selected)
90 grouped[selected.project.name] << [selected.name, selected.id]
90 grouped[selected.project.name] << [selected.name, selected.id]
91 end
91 end
92
92
93 if grouped.keys.size > 1
93 if grouped.keys.size > 1
94 grouped_options_for_select(grouped, selected && selected.id)
94 grouped_options_for_select(grouped, selected && selected.id)
95 else
95 else
96 options_for_select((grouped.values.first || []), selected && selected.id)
96 options_for_select((grouped.values.first || []), selected && selected.id)
97 end
97 end
98 end
98 end
99
99
100 def format_version_sharing(sharing)
100 def format_version_sharing(sharing)
101 sharing = 'none' unless Version::VERSION_SHARINGS.include?(sharing)
101 sharing = 'none' unless Version::VERSION_SHARINGS.include?(sharing)
102 l("label_version_sharing_#{sharing}")
102 l("label_version_sharing_#{sharing}")
103 end
103 end
104 end
104 end
@@ -1,49 +1,49
1 <%= error_messages_for 'project' %>
1 <%= error_messages_for 'project' %>
2
2
3 <div class="box">
3 <div class="box">
4 <!--[form:project]-->
4 <!--[form:project]-->
5 <p><%= f.text_field :name, :required => true %><br /><em><%= l(:text_caracters_maximum, 30) %></em></p>
5 <p><%= f.text_field :name, :required => true %><br /><em><%= l(:text_caracters_maximum, 30) %></em></p>
6
6
7 <% unless @project.allowed_parents.compact.empty? %>
7 <% unless @project.allowed_parents.compact.empty? %>
8 <p><label><%= l(:field_parent) %></label><%= parent_project_select_tag(@project) %></p>
8 <p><%= label(:project, :parent_id, l(:field_parent)) %><%= parent_project_select_tag(@project) %></p>
9 <% end %>
9 <% end %>
10
10
11 <p><%= f.text_area :description, :rows => 5, :class => 'wiki-edit' %></p>
11 <p><%= f.text_area :description, :rows => 5, :class => 'wiki-edit' %></p>
12 <p><%= f.text_field :identifier, :required => true, :disabled => @project.identifier_frozen? %>
12 <p><%= f.text_field :identifier, :required => true, :disabled => @project.identifier_frozen? %>
13 <% unless @project.identifier_frozen? %>
13 <% unless @project.identifier_frozen? %>
14 <br /><em><%= l(:text_length_between, :min => 1, :max => 20) %> <%= l(:text_project_identifier_info) %></em>
14 <br /><em><%= l(:text_length_between, :min => 1, :max => 20) %> <%= l(:text_project_identifier_info) %></em>
15 <% end %></p>
15 <% end %></p>
16 <p><%= f.text_field :homepage, :size => 60 %></p>
16 <p><%= f.text_field :homepage, :size => 60 %></p>
17 <p><%= f.check_box :is_public %></p>
17 <p><%= f.check_box :is_public %></p>
18 <%= wikitoolbar_for 'project_description' %>
18 <%= wikitoolbar_for 'project_description' %>
19
19
20 <% @project.custom_field_values.each do |value| %>
20 <% @project.custom_field_values.each do |value| %>
21 <p><%= custom_field_tag_with_label :project, value %></p>
21 <p><%= custom_field_tag_with_label :project, value %></p>
22 <% end %>
22 <% end %>
23 <%= call_hook(:view_projects_form, :project => @project, :form => f) %>
23 <%= call_hook(:view_projects_form, :project => @project, :form => f) %>
24 </div>
24 </div>
25
25
26 <% unless @trackers.empty? %>
26 <% unless @trackers.empty? %>
27 <fieldset class="box"><legend><%=l(:label_tracker_plural)%></legend>
27 <fieldset class="box"><legend><%=l(:label_tracker_plural)%></legend>
28 <% @trackers.each do |tracker| %>
28 <% @trackers.each do |tracker| %>
29 <label class="floating">
29 <label class="floating">
30 <%= check_box_tag 'project[tracker_ids][]', tracker.id, @project.trackers.include?(tracker) %>
30 <%= check_box_tag 'project[tracker_ids][]', tracker.id, @project.trackers.include?(tracker) %>
31 <%= tracker %>
31 <%= tracker %>
32 </label>
32 </label>
33 <% end %>
33 <% end %>
34 <%= hidden_field_tag 'project[tracker_ids][]', '' %>
34 <%= hidden_field_tag 'project[tracker_ids][]', '' %>
35 </fieldset>
35 </fieldset>
36 <% end %>
36 <% end %>
37
37
38 <% unless @issue_custom_fields.empty? %>
38 <% unless @issue_custom_fields.empty? %>
39 <fieldset class="box"><legend><%=l(:label_custom_field_plural)%></legend>
39 <fieldset class="box"><legend><%=l(:label_custom_field_plural)%></legend>
40 <% @issue_custom_fields.each do |custom_field| %>
40 <% @issue_custom_fields.each do |custom_field| %>
41 <label class="floating">
41 <label class="floating">
42 <%= check_box_tag 'project[issue_custom_field_ids][]', custom_field.id, (@project.all_issue_custom_fields.include? custom_field), (custom_field.is_for_all? ? {:disabled => "disabled"} : {}) %>
42 <%= check_box_tag 'project[issue_custom_field_ids][]', custom_field.id, (@project.all_issue_custom_fields.include? custom_field), (custom_field.is_for_all? ? {:disabled => "disabled"} : {}) %>
43 <%= custom_field.name %>
43 <%= custom_field.name %>
44 </label>
44 </label>
45 <% end %>
45 <% end %>
46 <%= hidden_field_tag 'project[issue_custom_field_ids][]', '' %>
46 <%= hidden_field_tag 'project[issue_custom_field_ids][]', '' %>
47 </fieldset>
47 </fieldset>
48 <% end %>
48 <% end %>
49 <!--[eoform:project]-->
49 <!--[eoform:project]-->
@@ -1,17 +1,19
1 <% form_for :project, @project,
1 <% form_for :project, @project,
2 :url => { :action => 'modules', :id => @project },
2 :url => { :action => 'modules', :id => @project },
3 :html => {:id => 'modules-form'} do |f| %>
3 :html => {:id => 'modules-form'} do |f| %>
4
4
5 <div class=box>
5 <div class="box">
6 <strong><%= l(:text_select_project_modules) %></strong>
6 <fieldset>
7 <legend><%= l(:text_select_project_modules) %></legend>
7
8
8 <% Redmine::AccessControl.available_project_modules.each do |m| %>
9 <% Redmine::AccessControl.available_project_modules.each do |m| %>
9 <p><label><%= check_box_tag 'enabled_modules[]', m, @project.module_enabled?(m) -%>
10 <p><label><%= check_box_tag 'enabled_modules[]', m, @project.module_enabled?(m) -%>
10 <%= l_or_humanize(m, :prefix => "project_module_") %></label></p>
11 <%= l_or_humanize(m, :prefix => "project_module_") %></label></p>
11 <% end %>
12 <% end %>
13 </fieldset>
12 </div>
14 </div>
13
15
14 <p><%= check_all_links 'modules-form' %></p>
16 <p><%= check_all_links 'modules-form' %></p>
15 <p><%= submit_tag l(:button_save) %></p>
17 <p><%= submit_tag l(:button_save) %></p>
16
18
17 <% end %>
19 <% end %>
@@ -1,24 +1,24
1 <% remote_form_for :repository, @repository,
1 <% remote_form_for :repository, @repository,
2 :url => { :controller => 'repositories', :action => 'edit', :id => @project },
2 :url => { :controller => 'repositories', :action => 'edit', :id => @project },
3 :builder => TabularFormBuilder,
3 :builder => TabularFormBuilder,
4 :lang => current_language do |f| %>
4 :lang => current_language do |f| %>
5
5
6 <%= error_messages_for 'repository' %>
6 <%= error_messages_for 'repository' %>
7
7
8 <div class="box tabular">
8 <div class="box tabular">
9 <p><label><%= l(:label_scm) %></label><%= scm_select_tag(@repository) %></p>
9 <p><%= label_tag('repository_scm', l(:label_scm)) %><%= scm_select_tag(@repository) %></p>
10 <%= repository_field_tags(f, @repository) if @repository %>
10 <%= repository_field_tags(f, @repository) if @repository %>
11 </div>
11 </div>
12
12
13 <div class="contextual">
13 <div class="contextual">
14 <% if @repository && !@repository.new_record? %>
14 <% if @repository && !@repository.new_record? %>
15 <%= link_to(l(:label_user_plural), {:controller => 'repositories', :action => 'committers', :id => @project}, :class => 'icon icon-user') %>
15 <%= link_to(l(:label_user_plural), {:controller => 'repositories', :action => 'committers', :id => @project}, :class => 'icon icon-user') %>
16 <%= link_to(l(:button_delete), {:controller => 'repositories', :action => 'destroy', :id => @project},
16 <%= link_to(l(:button_delete), {:controller => 'repositories', :action => 'destroy', :id => @project},
17 :confirm => l(:text_are_you_sure),
17 :confirm => l(:text_are_you_sure),
18 :method => :post,
18 :method => :post,
19 :class => 'icon icon-del') %>
19 :class => 'icon icon-del') %>
20 <% end %>
20 <% end %>
21 </div>
21 </div>
22
22
23 <%= submit_tag((@repository.nil? || @repository.new_record?) ? l(:button_create) : l(:button_save), :disabled => @repository.nil?) %>
23 <%= submit_tag((@repository.nil? || @repository.new_record?) ? l(:button_create) : l(:button_save), :disabled => @repository.nil?) %>
24 <% end %>
24 <% end %>
General Comments 0
You need to be logged in to leave comments. Login now