From: Jean-Philippe Lang Date: Sun, 14 Nov 2010 12:33:14 +0000 (+0000) Subject: Raised maximum length of project names and identifiers to 255 and 100 respectively... X-Git-Tag: 1.1.0~178 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=8ef06826c31b3042f6720c249199504a49e08c01;p=redmine.git Raised maximum length of project names and identifiers to 255 and 100 respectively (#6446). git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4402 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/models/project.rb b/app/models/project.rb index 43e0ce8dc..6eb41cc84 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -20,6 +20,9 @@ class Project < ActiveRecord::Base STATUS_ACTIVE = 1 STATUS_ARCHIVED = 9 + # Maximum length for project identifiers + IDENTIFIER_MAX_LENGTH = 100 + # Specific overidden Activities has_many :time_entry_activities has_many :members, :include => [:user, :roles], :conditions => "#{User.table_name}.type='User' AND #{User.table_name}.status=#{User::STATUS_ACTIVE}" @@ -66,9 +69,9 @@ class Project < ActiveRecord::Base validates_presence_of :name, :identifier validates_uniqueness_of :identifier validates_associated :repository, :wiki - validates_length_of :name, :maximum => 30 + validates_length_of :name, :maximum => 255 validates_length_of :homepage, :maximum => 255 - validates_length_of :identifier, :in => 1..20 + validates_length_of :identifier, :in => 1..IDENTIFIER_MAX_LENGTH # donwcase letters, digits, dashes but not digits only validates_format_of :identifier, :with => /^(?!\d+$)[a-z0-9\-]*$/, :if => Proc.new { |p| p.identifier_changed? } # reserved words diff --git a/app/views/projects/_form.rhtml b/app/views/projects/_form.rhtml index fbc6714c8..e8045bf2c 100644 --- a/app/views/projects/_form.rhtml +++ b/app/views/projects/_form.rhtml @@ -2,16 +2,16 @@
-

<%= f.text_field :name, :required => true, :maxlength => 30 %>
<%= l(:text_caracters_maximum, 30) %>

+

<%= f.text_field :name, :required => true, :size => 60 %>

<% unless @project.allowed_parents.compact.empty? %>

<%= label(:project, :parent_id, l(:field_parent)) %><%= parent_project_select_tag(@project) %>

<% end %>

<%= f.text_area :description, :rows => 5, :class => 'wiki-edit' %>

-

<%= f.text_field :identifier, :required => true, :disabled => @project.identifier_frozen?, :maxlength => 20 %> +

<%= f.text_field :identifier, :required => true, :size => 60, :disabled => @project.identifier_frozen? %> <% unless @project.identifier_frozen? %> -
<%= l(:text_length_between, :min => 1, :max => 20) %> <%= l(:text_project_identifier_info) %> +
<%= l(:text_length_between, :min => 1, :max => Project::IDENTIFIER_MAX_LENGTH) %> <%= l(:text_project_identifier_info) %> <% end %>

<%= f.text_field :homepage, :size => 60 %>

<%= f.check_box :is_public %>

diff --git a/db/migrate/20101114115114_change_projects_name_limit.rb b/db/migrate/20101114115114_change_projects_name_limit.rb new file mode 100644 index 000000000..fabc3c9d8 --- /dev/null +++ b/db/migrate/20101114115114_change_projects_name_limit.rb @@ -0,0 +1,9 @@ +class ChangeProjectsNameLimit < ActiveRecord::Migration + def self.up + change_column :projects, :name, :string, :limit => nil, :default => '', :null => false + end + + def self.down + change_column :projects, :name, :string, :limit => 30, :default => '', :null => false + end +end diff --git a/db/migrate/20101114115359_change_projects_identifier_limit.rb b/db/migrate/20101114115359_change_projects_identifier_limit.rb new file mode 100644 index 000000000..79426fadf --- /dev/null +++ b/db/migrate/20101114115359_change_projects_identifier_limit.rb @@ -0,0 +1,9 @@ +class ChangeProjectsIdentifierLimit < ActiveRecord::Migration + def self.up + change_column :projects, :identifier, :string, :limit => nil + end + + def self.down + change_column :projects, :identifier, :string, :limit => 20 + end +end