Project

General

Profile

Feature #6446 » redmine-project-name-and-identifier-limits.diff

Project name and identifier limit to 100 characters. TESTED - G N, 2010-10-30 02:34

View differences:

app/models/project.rb (working copy)
66 66
  validates_presence_of :name, :identifier
67 67
  validates_uniqueness_of :name, :identifier
68 68
  validates_associated :repository, :wiki
69
  validates_length_of :name, :maximum => 30
69
  validates_length_of :name, :maximum => 100
70 70
  validates_length_of :homepage, :maximum => 255
71
  validates_length_of :identifier, :in => 1..20
71
  validates_length_of :identifier, :in => 1..100
72 72
  # donwcase letters, digits, dashes but not digits only
73 73
  validates_format_of :identifier, :with => /^(?!\d+$)[a-z0-9\-]*$/, :if => Proc.new { |p| p.identifier_changed? }
74 74
  # reserved words
app/views/projects/_form.rhtml (working copy)
2 2

  
3 3
<div class="box">
4 4
<!--[form:project]-->
5
<p><%= f.text_field :name, :required => true, :maxlength => 30 %><br /><em><%= l(:text_caracters_maximum, 30) %></em></p>
5
<p><%= f.text_field :name, :required => true, :maxlength => 100 %><br /><em><%= l(:text_caracters_maximum, 100) %></em></p>
6 6

  
7 7
<% unless @project.allowed_parents.compact.empty? %>
8 8
    <p><%= label(:project, :parent_id, l(:field_parent)) %><%= parent_project_select_tag(@project) %></p>
9 9
<% end %>
10 10

  
11 11
<p><%= f.text_area :description, :rows => 5, :class => 'wiki-edit' %></p>
12
<p><%= f.text_field :identifier, :required => true, :disabled => @project.identifier_frozen?, :maxlength => 20 %>
12
<p><%= f.text_field :identifier, :required => true, :disabled => @project.identifier_frozen?, :maxlength => 100 %>
13 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 => 100) %> <%= l(:text_project_identifier_info) %></em>
15 15
<% end %></p>
16 16
<p><%= f.text_field :homepage, :size => 60 %></p>
17 17
<p><%= f.check_box :is_public %></p>
db/migrate/20101029235712_change_project_identifier_length_limit.rb (revision 0)
1
class ChangeProjectIdentifierLengthLimit < ActiveRecord::Migration
2

  
3
  def self.up
4
    change_column :projects, :identifier, :string, :limit => 100
5
  end
6

  
7
  def self.down
8
    change_column :projects, :identifier, :string, :limit => 20
9
  end
10

  
11
end
db/migrate/20101029235635_change_project_name_length_limit.rb (revision 0)
1
class ChangeProjectNameLengthLimit < ActiveRecord::Migration
2

  
3
  def self.up
4
    change_column :projects, :name, :string, :limit => 100
5
  end
6

  
7
  def self.down
8
    change_column :projects, :name, :string, :limit => 30
9
  end
10

  
11
end
(1-1/3)