]> source.dussan.org Git - redmine.git/commitdiff
Project name format limitation removed (name can now contain any character).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Mon, 3 Dec 2007 10:28:08 +0000 (10:28 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Mon, 3 Dec 2007 10:28:08 +0000 (10:28 +0000)
Project identifier maximum length changed from 12 to 20.

git-svn-id: http://redmine.rubyforge.org/svn/trunk@949 e93f8b46-1217-0410-a6f0-8f06a7374b81

15 files changed:
app/controllers/projects_controller.rb
app/helpers/queries_helper.rb
app/models/project.rb
app/views/admin/projects.rhtml
app/views/issues/_list_simple.rhtml
app/views/layouts/_project_selector.rhtml
app/views/my/account.rhtml
app/views/projects/_form.rhtml
app/views/projects/destroy.rhtml
app/views/projects/gantt.rhtml
app/views/projects/list.rhtml
app/views/projects/show.rhtml
lib/tasks/migrate_from_mantis.rake
public/themes/alternate/stylesheets/application.css
test/functional/projects_controller_test.rb

index 37a78869081d00b3754e8babf549822a1b6df46f..658e9d232228c4e3a4ec74227fe349a7da218e3c 100644 (file)
@@ -58,7 +58,9 @@ class ProjectsController < ApplicationController
   def add
     @custom_fields = IssueCustomField.find(:all, :order => "#{CustomField.table_name}.position")
     @trackers = Tracker.all
-    @root_projects = Project.find(:all, :conditions => "parent_id IS NULL AND status = #{Project::STATUS_ACTIVE}")
+    @root_projects = Project.find(:all,
+                                  :conditions => "parent_id IS NULL AND status = #{Project::STATUS_ACTIVE}",
+                                  :order => 'name')
     @project = Project.new(params[:project])
     @project.enabled_module_names = Redmine::AccessControl.available_project_modules
     if request.get?
@@ -90,7 +92,9 @@ class ProjectsController < ApplicationController
   end
 
   def settings
-    @root_projects = Project::find(:all, :conditions => ["parent_id IS NULL AND status = #{Project::STATUS_ACTIVE} AND id <> ?", @project.id])
+    @root_projects = Project.find(:all,
+                                  :conditions => ["parent_id IS NULL AND status = #{Project::STATUS_ACTIVE} AND id <> ?", @project.id],
+                                  :order => 'name')
     @custom_fields = IssueCustomField.find(:all)
     @issue_category ||= IssueCategory.new
     @member ||= @project.members.new
index f9278727832030ac1a4bf09b0c6104cffdc84661..3011d3aec7054bc12a89f0cc74f8993766bd45e5 100644 (file)
@@ -38,7 +38,7 @@ module QueriesHelper
       else
         case column.name
         when :subject
-        ((@project.nil? || @project != issue.project) ? "#{issue.project.name} - " : '') +
+        h((@project.nil? || @project != issue.project) ? "#{issue.project.name} - " : '') +
           link_to(h(value), :controller => 'issues', :action => 'show', :id => issue)
         when :done_ratio
           progress_bar(value, :width => '80px')
index 03ada035cbcc72bbf0f4eadc7ad1296febdfed50..5788732d720a51e9832018d3bb3c0d63f592e151 100644 (file)
@@ -57,10 +57,9 @@ class Project < ActiveRecord::Base
   validates_associated :custom_values, :on => :update
   validates_associated :repository, :wiki
   validates_length_of :name, :maximum => 30
-  validates_format_of :name, :with => /^[\w\s\'\-]*$/i
   validates_length_of :description, :maximum => 255
   validates_length_of :homepage, :maximum => 60
-  validates_length_of :identifier, :in => 3..12
+  validates_length_of :identifier, :in => 3..20
   validates_format_of :identifier, :with => /^[a-z0-9\-]*$/
   
   def identifier=(identifier)
index d231be102e86adfa99a57269c94fed1263b2aa5d..423d56ebe981e20a43a23afb4cf0dd4c7dda7335 100644 (file)
@@ -26,7 +26,7 @@
   <tbody>
 <% for project in @projects %>
   <tr class="<%= cycle("odd", "even") %>">
-       <td><%= project.active? ? link_to(project.name, :controller => 'projects', :action => 'settings', :id => project) : h(project.name) %>
+       <td><%= project.active? ? link_to(h(project.name), :controller => 'projects', :action => 'settings', :id => project) : h(project.name) %>
        <td><%= textilizable project.description, :project => project %>
        <td align="center"><%= image_tag 'true.png' if project.is_public? %>
        <td align="center"><%= project.children.size %>
index 517055e3a33bc13a12be07e12067ac432e897d54..eb93f8ea1eb59f44ab9d7fc7c82ab47c2df9a1e1 100644 (file)
@@ -11,7 +11,7 @@
                        <td class="id">
                                <%= link_to issue.id, :controller => 'issues', :action => 'show', :id => issue %>
                        </td>
-                       <td><%= issue.project.name %> - <%= issue.tracker.name %><br />
+                       <td><%=h issue.project.name %> - <%= issue.tracker.name %><br />
                 <%= issue.status.name %> - <%= format_time(issue.updated_on) %></td>
                        <td class="subject">
                 <%= link_to h(issue.subject), :controller => 'issues', :action => 'show', :id => issue %>
index 499879c8c56d76a6effcfe786fa2346a7d63efe4..ce2f15e03e0e236a29ca304df9dcc9ed3b983fb9 100644 (file)
@@ -3,10 +3,10 @@
 <option selected><%= l(:label_jump_to_a_project) %></option>
 <option disabled>---</option>
 <% user_projects_by_root.keys.sort.each do |root| %>
-    <%= content_tag('option', root.name, :value => url_for(:controller => 'projects', :action => 'show', :id => root)) %>
+    <%= content_tag('option', h(root.name), :value => url_for(:controller => 'projects', :action => 'show', :id => root)) %>
     <% user_projects_by_root[root].sort.each do |project| %>
         <% next if project == root %>
-        <%= content_tag('option', ('&#187; ' + project.name), :value => url_for(:controller => 'projects', :action => 'show', :id => project)) %>
+        <%= content_tag('option', ('&#187; ' + h(project.name)), :value => url_for(:controller => 'projects', :action => 'show', :id => project)) %>
     <% end %>
 <% end %>
 </select>
index e64051771c95fd91541e2a85342edb39513b9931..2dda62d70e0555f00697ce4a9546171144501bac 100644 (file)
@@ -29,7 +29,7 @@
                                       :onchange => 'if ($("notification_option").value == "selected") {Element.show("notified-projects")} else {Element.hide("notified-projects")}' %>
 <% content_tag 'div', :id => 'notified-projects', :style => (@notification_option == 'selected' ? '' : 'display:none;') do %>
 <p><% User.current.projects.each do |project| %>
-    <label><%= check_box_tag 'notified_project_ids[]', project.id, @user.notified_projects_ids.include?(project.id) %> <%= project.name %></label><br />
+    <label><%= check_box_tag 'notified_project_ids[]', project.id, @user.notified_projects_ids.include?(project.id) %> <%=h project.name %></label><br />
 <% end %></p>
 <p><em><%= l(:text_user_mail_option) %></em></p>
 <% end %>
index 885ccf4bd4be595e4cc8ec0fae967d441ed81b14..e29777af40124c9870934c9fce1381575aa59cf4 100644 (file)
@@ -9,7 +9,7 @@
 <% end %>
 
 <p><%= f.text_area :description, :required => true, :cols => 60, :rows => 5 %><em><%= l(:text_caracters_maximum, 255) %></em></p>
-<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>
+<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>
 <p><%= f.text_field :homepage, :size => 40 %></p>
 <p><%= f.check_box :is_public %></p>
 <%= wikitoolbar_for 'project_description' %>
index 8ef23197d22e2a4bf1f8c083ca7e8ab0d997a542..4531cb845d32904dd604147cc52619357f24855b 100644 (file)
@@ -1,7 +1,7 @@
 <h2><%=l(:label_confirmation)%></h2>
 <div class="box">
 <center>
-<p><strong><%= @project_to_destroy.name %></strong><br />
+<p><strong><%=h @project_to_destroy.name %></strong><br />
 <%=l(:text_project_destroy_confirmation)%></p>
 
 <p>
index 21ef600a8851122ce4ae15dc2606bd82552d0172..a667548427e38129fe4d0b129cf8db58b0effd9b 100644 (file)
@@ -72,8 +72,8 @@ top = headers_height + 8
 @events.each do |i| %>
     <div style="position: absolute;line-height:1.2em;height:16px;top:<%= top %>px;left:4px;overflow:hidden;"><small>    
     <% if i.is_a? Issue %>
-       <%= link_to_issue i %><%= " (#{i.project.name})" unless @project && @project == i.project %>:
-       <%=h i.subject %>
+       <%= h("#{i.project.name} -") unless @project && @project == i.project %>
+       <%= link_to_issue i %>: <%=h i.subject %>
        <% else %>
        <%= link_to_version i, :class => "icon icon-package" %>
        <% end %>       
index 51c1b544aaed9850ef04ea38f624b777d0d6ce9d..c6e5b4dec1e7d7f673c541c6c2a5e2d1f9c34b52 100644 (file)
@@ -1,13 +1,13 @@
 <h2><%=l(:label_project_plural)%></h2>
 
 <% @project_tree.keys.sort.each do |project| %>
-<h3><%= link_to project.name, {:action => 'show', :id => project}, :class => (User.current.member_of?(project) ? "icon icon-fav" : "") %></h3>
+<h3><%= link_to h(project.name), {:action => 'show', :id => project}, :class => (User.current.member_of?(project) ? "icon icon-fav" : "") %></h3>
 <%= textilizable(project.description, :project => project) %>
 
 <% if @project_tree[project].any? %>
     <p><%= l(:label_subproject_plural) %>:
     <%= @project_tree[project].sort.collect {|subproject| 
-       link_to(subproject.name, {:action => 'show', :id => subproject}, :class => (User.current.member_of?(subproject) ? "icon icon-fav" : ""))}.join(', ') %></p>
+       link_to(h(subproject.name), {:action => 'show', :id => subproject}, :class => (User.current.member_of?(subproject) ? "icon icon-fav" : ""))}.join(', ') %></p>
 <% end %>
 <% end %>
 
index 458e7975e0ed866139783989f244019fd43aaaf5..bb01df1f4b76cbfaeb60c856f07fe464dfe8d63c 100644 (file)
@@ -5,10 +5,10 @@
        <ul>
        <% unless @project.homepage.blank? %><li><%=l(:field_homepage)%>: <%= auto_link @project.homepage %></li><% end %>
     <% if @subprojects.any? %>
-       <li><%=l(:label_subproject_plural)%>: <%= @subprojects.collect{|p| link_to(p.name, :action => 'show', :id => p)}.join(", ") %></li>
+       <li><%=l(:label_subproject_plural)%>: <%= @subprojects.collect{|p| link_to(h(p.name), :action => 'show', :id => p)}.join(", ") %></li>
     <% end %>
        <% if @project.parent %>
-       <li><%=l(:field_parent)%>: <%= link_to @project.parent.name, :controller => 'projects', :action => 'show', :id => @project.parent %></li>
+       <li><%=l(:field_parent)%>: <%= link_to h(@project.parent.name), :controller => 'projects', :action => 'show', :id => @project.parent %></li>
        <% end %>
        <% for custom_value in @custom_values %>
        <% if !custom_value.value.empty? %>
index 593d59d82510f2cfa03c0c701b768a33ef4dafee..6d8d55e7c09a0c1b448555a0911cc816d1f32006 100644 (file)
@@ -115,7 +115,7 @@ task :migrate_from_mantis => :environment do
       has_many :members, :class_name => "MantisProjectUser", :foreign_key => :project_id\r
       \r
       def name\r
-        read_attribute(:name)[0..29].gsub(/[^\w\s\'\-]/, '-')\r
+        read_attribute(:name)[0..29]\r
       end\r
       \r
       def description\r
@@ -123,7 +123,7 @@ task :migrate_from_mantis => :environment do
       end\r
       \r
       def identifier\r
-        read_attribute(:name).underscore[0..11].gsub(/[^a-z0-9\-]/, '-')\r
+        read_attribute(:name).underscore[0..19].gsub(/[^a-z0-9\-]/, '-')\r
       end\r
     end\r
     \r
index ced63a4184c97c90ff079ae0a5fdcd92dd3a9535..af787ae710689073fa01583950b532ec97742958 100644 (file)
@@ -63,6 +63,7 @@ input[type="button"]:hover, input[type="submit"]:hover, input[type="reset"]:hove
 input[type="text"], textarea, select { padding: 2px; border: 1px solid #d7d7d7; }
 input[type="text"] { padding: 3px; }
 input[type="text"]:focus, textarea:focus, select:focus { border: 1px solid #888866; }
+option { border-bottom: 1px dotted #d7d7d7; }
 
 /* Misc */
 .box { background-color: #fcfcfc; }
index a48fa26bc5a1598ac32ff402f9bad325453f8602..d98e0d97b3eaa73e3dbab436a5509c64fc371e85 100644 (file)
@@ -103,9 +103,16 @@ class ProjectsControllerTest < Test::Unit::TestCase
                    }
                  }
                }
+               
+    get :activity, :id => 1, :year => 3.days.ago.to_date.year, :month => 3.days.ago.to_date.month
+    assert_response :success
+    assert_template 'activity'
+    assert_not_nil assigns(:events_by_day)
+               
     assert_tag :tag => "h3", 
                :content => /#{3.day.ago.to_date.day}/,
-               :sibling => { :tag => "ul",                 :child => { :tag => "li",
+               :sibling => { :tag => "ul",
+                 :child => { :tag => "li",
                    :child => { :tag => "p",
                      :content => /#{Issue.find(1).subject}/,
                    }