##// END OF EJS Templates
Project name format limitation removed (name can now contain any character)....
Jean-Philippe Lang -
r936:92a23c05bb71
parent child
Show More
@@ -58,7 +58,9 class ProjectsController < ApplicationController
58 def add
58 def add
59 @custom_fields = IssueCustomField.find(:all, :order => "#{CustomField.table_name}.position")
59 @custom_fields = IssueCustomField.find(:all, :order => "#{CustomField.table_name}.position")
60 @trackers = Tracker.all
60 @trackers = Tracker.all
61 @root_projects = Project.find(:all, :conditions => "parent_id IS NULL AND status = #{Project::STATUS_ACTIVE}")
61 @root_projects = Project.find(:all,
62 :conditions => "parent_id IS NULL AND status = #{Project::STATUS_ACTIVE}",
63 :order => 'name')
62 @project = Project.new(params[:project])
64 @project = Project.new(params[:project])
63 @project.enabled_module_names = Redmine::AccessControl.available_project_modules
65 @project.enabled_module_names = Redmine::AccessControl.available_project_modules
64 if request.get?
66 if request.get?
@@ -90,7 +92,9 class ProjectsController < ApplicationController
90 end
92 end
91
93
92 def settings
94 def settings
93 @root_projects = Project::find(:all, :conditions => ["parent_id IS NULL AND status = #{Project::STATUS_ACTIVE} AND id <> ?", @project.id])
95 @root_projects = Project.find(:all,
96 :conditions => ["parent_id IS NULL AND status = #{Project::STATUS_ACTIVE} AND id <> ?", @project.id],
97 :order => 'name')
94 @custom_fields = IssueCustomField.find(:all)
98 @custom_fields = IssueCustomField.find(:all)
95 @issue_category ||= IssueCategory.new
99 @issue_category ||= IssueCategory.new
96 @member ||= @project.members.new
100 @member ||= @project.members.new
@@ -38,7 +38,7 module QueriesHelper
38 else
38 else
39 case column.name
39 case column.name
40 when :subject
40 when :subject
41 ((@project.nil? || @project != issue.project) ? "#{issue.project.name} - " : '') +
41 h((@project.nil? || @project != issue.project) ? "#{issue.project.name} - " : '') +
42 link_to(h(value), :controller => 'issues', :action => 'show', :id => issue)
42 link_to(h(value), :controller => 'issues', :action => 'show', :id => issue)
43 when :done_ratio
43 when :done_ratio
44 progress_bar(value, :width => '80px')
44 progress_bar(value, :width => '80px')
@@ -57,10 +57,9 class Project < ActiveRecord::Base
57 validates_associated :custom_values, :on => :update
57 validates_associated :custom_values, :on => :update
58 validates_associated :repository, :wiki
58 validates_associated :repository, :wiki
59 validates_length_of :name, :maximum => 30
59 validates_length_of :name, :maximum => 30
60 validates_format_of :name, :with => /^[\w\s\'\-]*$/i
61 validates_length_of :description, :maximum => 255
60 validates_length_of :description, :maximum => 255
62 validates_length_of :homepage, :maximum => 60
61 validates_length_of :homepage, :maximum => 60
63 validates_length_of :identifier, :in => 3..12
62 validates_length_of :identifier, :in => 3..20
64 validates_format_of :identifier, :with => /^[a-z0-9\-]*$/
63 validates_format_of :identifier, :with => /^[a-z0-9\-]*$/
65
64
66 def identifier=(identifier)
65 def identifier=(identifier)
@@ -26,7 +26,7
26 <tbody>
26 <tbody>
27 <% for project in @projects %>
27 <% for project in @projects %>
28 <tr class="<%= cycle("odd", "even") %>">
28 <tr class="<%= cycle("odd", "even") %>">
29 <td><%= project.active? ? link_to(project.name, :controller => 'projects', :action => 'settings', :id => project) : h(project.name) %>
29 <td><%= project.active? ? link_to(h(project.name), :controller => 'projects', :action => 'settings', :id => project) : h(project.name) %>
30 <td><%= textilizable project.description, :project => project %>
30 <td><%= textilizable project.description, :project => project %>
31 <td align="center"><%= image_tag 'true.png' if project.is_public? %>
31 <td align="center"><%= image_tag 'true.png' if project.is_public? %>
32 <td align="center"><%= project.children.size %>
32 <td align="center"><%= project.children.size %>
@@ -11,7 +11,7
11 <td class="id">
11 <td class="id">
12 <%= link_to issue.id, :controller => 'issues', :action => 'show', :id => issue %>
12 <%= link_to issue.id, :controller => 'issues', :action => 'show', :id => issue %>
13 </td>
13 </td>
14 <td><%= issue.project.name %> - <%= issue.tracker.name %><br />
14 <td><%=h issue.project.name %> - <%= issue.tracker.name %><br />
15 <%= issue.status.name %> - <%= format_time(issue.updated_on) %></td>
15 <%= issue.status.name %> - <%= format_time(issue.updated_on) %></td>
16 <td class="subject">
16 <td class="subject">
17 <%= link_to h(issue.subject), :controller => 'issues', :action => 'show', :id => issue %>
17 <%= link_to h(issue.subject), :controller => 'issues', :action => 'show', :id => issue %>
@@ -3,10 +3,10
3 <option selected><%= l(:label_jump_to_a_project) %></option>
3 <option selected><%= l(:label_jump_to_a_project) %></option>
4 <option disabled>---</option>
4 <option disabled>---</option>
5 <% user_projects_by_root.keys.sort.each do |root| %>
5 <% user_projects_by_root.keys.sort.each do |root| %>
6 <%= content_tag('option', root.name, :value => url_for(:controller => 'projects', :action => 'show', :id => root)) %>
6 <%= content_tag('option', h(root.name), :value => url_for(:controller => 'projects', :action => 'show', :id => root)) %>
7 <% user_projects_by_root[root].sort.each do |project| %>
7 <% user_projects_by_root[root].sort.each do |project| %>
8 <% next if project == root %>
8 <% next if project == root %>
9 <%= content_tag('option', ('&#187; ' + project.name), :value => url_for(:controller => 'projects', :action => 'show', :id => project)) %>
9 <%= content_tag('option', ('&#187; ' + h(project.name)), :value => url_for(:controller => 'projects', :action => 'show', :id => project)) %>
10 <% end %>
10 <% end %>
11 <% end %>
11 <% end %>
12 </select>
12 </select>
@@ -29,7 +29,7
29 :onchange => 'if ($("notification_option").value == "selected") {Element.show("notified-projects")} else {Element.hide("notified-projects")}' %>
29 :onchange => 'if ($("notification_option").value == "selected") {Element.show("notified-projects")} else {Element.hide("notified-projects")}' %>
30 <% content_tag 'div', :id => 'notified-projects', :style => (@notification_option == 'selected' ? '' : 'display:none;') do %>
30 <% content_tag 'div', :id => 'notified-projects', :style => (@notification_option == 'selected' ? '' : 'display:none;') do %>
31 <p><% User.current.projects.each do |project| %>
31 <p><% User.current.projects.each do |project| %>
32 <label><%= check_box_tag 'notified_project_ids[]', project.id, @user.notified_projects_ids.include?(project.id) %> <%= project.name %></label><br />
32 <label><%= check_box_tag 'notified_project_ids[]', project.id, @user.notified_projects_ids.include?(project.id) %> <%=h project.name %></label><br />
33 <% end %></p>
33 <% end %></p>
34 <p><em><%= l(:text_user_mail_option) %></em></p>
34 <p><em><%= l(:text_user_mail_option) %></em></p>
35 <% end %>
35 <% end %>
@@ -9,7 +9,7
9 <% end %>
9 <% end %>
10
10
11 <p><%= f.text_area :description, :required => true, :cols => 60, :rows => 5 %><em><%= l(:text_caracters_maximum, 255) %></em></p>
11 <p><%= f.text_area :description, :required => true, :cols => 60, :rows => 5 %><em><%= l(:text_caracters_maximum, 255) %></em></p>
12 <p><%= f.text_field :identifier, :required => true, :size => 15, :disabled => @project.identifier_frozen? %><br /><em><%= l(:text_length_between, 3, 12) %> <%= l(:text_project_identifier_info) unless @project.identifier_frozen? %></em></p>
12 <p><%= f.text_field :identifier, :required => true, :disabled => @project.identifier_frozen? %><br /><em><%= l(:text_length_between, 3, 20) %> <%= l(:text_project_identifier_info) unless @project.identifier_frozen? %></em></p>
13 <p><%= f.text_field :homepage, :size => 40 %></p>
13 <p><%= f.text_field :homepage, :size => 40 %></p>
14 <p><%= f.check_box :is_public %></p>
14 <p><%= f.check_box :is_public %></p>
15 <%= wikitoolbar_for 'project_description' %>
15 <%= wikitoolbar_for 'project_description' %>
@@ -1,7 +1,7
1 <h2><%=l(:label_confirmation)%></h2>
1 <h2><%=l(:label_confirmation)%></h2>
2 <div class="box">
2 <div class="box">
3 <center>
3 <center>
4 <p><strong><%= @project_to_destroy.name %></strong><br />
4 <p><strong><%=h @project_to_destroy.name %></strong><br />
5 <%=l(:text_project_destroy_confirmation)%></p>
5 <%=l(:text_project_destroy_confirmation)%></p>
6
6
7 <p>
7 <p>
@@ -72,8 +72,8 top = headers_height + 8
72 @events.each do |i| %>
72 @events.each do |i| %>
73 <div style="position: absolute;line-height:1.2em;height:16px;top:<%= top %>px;left:4px;overflow:hidden;"><small>
73 <div style="position: absolute;line-height:1.2em;height:16px;top:<%= top %>px;left:4px;overflow:hidden;"><small>
74 <% if i.is_a? Issue %>
74 <% if i.is_a? Issue %>
75 <%= link_to_issue i %><%= " (#{i.project.name})" unless @project && @project == i.project %>:
75 <%= h("#{i.project.name} -") unless @project && @project == i.project %>
76 <%=h i.subject %>
76 <%= link_to_issue i %>: <%=h i.subject %>
77 <% else %>
77 <% else %>
78 <%= link_to_version i, :class => "icon icon-package" %>
78 <%= link_to_version i, :class => "icon icon-package" %>
79 <% end %>
79 <% end %>
@@ -1,13 +1,13
1 <h2><%=l(:label_project_plural)%></h2>
1 <h2><%=l(:label_project_plural)%></h2>
2
2
3 <% @project_tree.keys.sort.each do |project| %>
3 <% @project_tree.keys.sort.each do |project| %>
4 <h3><%= link_to project.name, {:action => 'show', :id => project}, :class => (User.current.member_of?(project) ? "icon icon-fav" : "") %></h3>
4 <h3><%= link_to h(project.name), {:action => 'show', :id => project}, :class => (User.current.member_of?(project) ? "icon icon-fav" : "") %></h3>
5 <%= textilizable(project.description, :project => project) %>
5 <%= textilizable(project.description, :project => project) %>
6
6
7 <% if @project_tree[project].any? %>
7 <% if @project_tree[project].any? %>
8 <p><%= l(:label_subproject_plural) %>:
8 <p><%= l(:label_subproject_plural) %>:
9 <%= @project_tree[project].sort.collect {|subproject|
9 <%= @project_tree[project].sort.collect {|subproject|
10 link_to(subproject.name, {:action => 'show', :id => subproject}, :class => (User.current.member_of?(subproject) ? "icon icon-fav" : ""))}.join(', ') %></p>
10 link_to(h(subproject.name), {:action => 'show', :id => subproject}, :class => (User.current.member_of?(subproject) ? "icon icon-fav" : ""))}.join(', ') %></p>
11 <% end %>
11 <% end %>
12 <% end %>
12 <% end %>
13
13
@@ -5,10 +5,10
5 <ul>
5 <ul>
6 <% unless @project.homepage.blank? %><li><%=l(:field_homepage)%>: <%= auto_link @project.homepage %></li><% end %>
6 <% unless @project.homepage.blank? %><li><%=l(:field_homepage)%>: <%= auto_link @project.homepage %></li><% end %>
7 <% if @subprojects.any? %>
7 <% if @subprojects.any? %>
8 <li><%=l(:label_subproject_plural)%>: <%= @subprojects.collect{|p| link_to(p.name, :action => 'show', :id => p)}.join(", ") %></li>
8 <li><%=l(:label_subproject_plural)%>: <%= @subprojects.collect{|p| link_to(h(p.name), :action => 'show', :id => p)}.join(", ") %></li>
9 <% end %>
9 <% end %>
10 <% if @project.parent %>
10 <% if @project.parent %>
11 <li><%=l(:field_parent)%>: <%= link_to @project.parent.name, :controller => 'projects', :action => 'show', :id => @project.parent %></li>
11 <li><%=l(:field_parent)%>: <%= link_to h(@project.parent.name), :controller => 'projects', :action => 'show', :id => @project.parent %></li>
12 <% end %>
12 <% end %>
13 <% for custom_value in @custom_values %>
13 <% for custom_value in @custom_values %>
14 <% if !custom_value.value.empty? %>
14 <% if !custom_value.value.empty? %>
@@ -115,7 +115,7 task :migrate_from_mantis => :environment do
115 has_many :members, :class_name => "MantisProjectUser", :foreign_key => :project_id
115 has_many :members, :class_name => "MantisProjectUser", :foreign_key => :project_id
116
116
117 def name
117 def name
118 read_attribute(:name)[0..29].gsub(/[^\w\s\'\-]/, '-')
118 read_attribute(:name)[0..29]
119 end
119 end
120
120
121 def description
121 def description
@@ -123,7 +123,7 task :migrate_from_mantis => :environment do
123 end
123 end
124
124
125 def identifier
125 def identifier
126 read_attribute(:name).underscore[0..11].gsub(/[^a-z0-9\-]/, '-')
126 read_attribute(:name).underscore[0..19].gsub(/[^a-z0-9\-]/, '-')
127 end
127 end
128 end
128 end
129
129
@@ -63,6 +63,7 input[type="button"]:hover, input[type="submit"]:hover, input[type="reset"]:hove
63 input[type="text"], textarea, select { padding: 2px; border: 1px solid #d7d7d7; }
63 input[type="text"], textarea, select { padding: 2px; border: 1px solid #d7d7d7; }
64 input[type="text"] { padding: 3px; }
64 input[type="text"] { padding: 3px; }
65 input[type="text"]:focus, textarea:focus, select:focus { border: 1px solid #888866; }
65 input[type="text"]:focus, textarea:focus, select:focus { border: 1px solid #888866; }
66 option { border-bottom: 1px dotted #d7d7d7; }
66
67
67 /* Misc */
68 /* Misc */
68 .box { background-color: #fcfcfc; }
69 .box { background-color: #fcfcfc; }
@@ -103,9 +103,16 class ProjectsControllerTest < Test::Unit::TestCase
103 }
103 }
104 }
104 }
105 }
105 }
106
107 get :activity, :id => 1, :year => 3.days.ago.to_date.year, :month => 3.days.ago.to_date.month
108 assert_response :success
109 assert_template 'activity'
110 assert_not_nil assigns(:events_by_day)
111
106 assert_tag :tag => "h3",
112 assert_tag :tag => "h3",
107 :content => /#{3.day.ago.to_date.day}/,
113 :content => /#{3.day.ago.to_date.day}/,
108 :sibling => { :tag => "ul", :child => { :tag => "li",
114 :sibling => { :tag => "ul",
115 :child => { :tag => "li",
109 :child => { :tag => "p",
116 :child => { :tag => "p",
110 :content => /#{Issue.find(1).subject}/,
117 :content => /#{Issue.find(1).subject}/,
111 }
118 }
General Comments 0
You need to be logged in to leave comments. Login now