@@ -0,0 +1,9 | |||||
|
1 | class ChangeProjectsNameLimit < ActiveRecord::Migration | |||
|
2 | def self.up | |||
|
3 | change_column :projects, :name, :string, :limit => nil, :default => '', :null => false | |||
|
4 | end | |||
|
5 | ||||
|
6 | def self.down | |||
|
7 | change_column :projects, :name, :string, :limit => 30, :default => '', :null => false | |||
|
8 | end | |||
|
9 | end |
@@ -0,0 +1,9 | |||||
|
1 | class ChangeProjectsIdentifierLimit < ActiveRecord::Migration | |||
|
2 | def self.up | |||
|
3 | change_column :projects, :identifier, :string, :limit => nil | |||
|
4 | end | |||
|
5 | ||||
|
6 | def self.down | |||
|
7 | change_column :projects, :identifier, :string, :limit => 20 | |||
|
8 | end | |||
|
9 | end |
@@ -20,6 +20,9 class Project < ActiveRecord::Base | |||||
20 | STATUS_ACTIVE = 1 |
|
20 | STATUS_ACTIVE = 1 | |
21 | STATUS_ARCHIVED = 9 |
|
21 | STATUS_ARCHIVED = 9 | |
22 |
|
22 | |||
|
23 | # Maximum length for project identifiers | |||
|
24 | IDENTIFIER_MAX_LENGTH = 100 | |||
|
25 | ||||
23 | # Specific overidden Activities |
|
26 | # Specific overidden Activities | |
24 | has_many :time_entry_activities |
|
27 | has_many :time_entry_activities | |
25 | has_many :members, :include => [:user, :roles], :conditions => "#{User.table_name}.type='User' AND #{User.table_name}.status=#{User::STATUS_ACTIVE}" |
|
28 | 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 | |||||
66 | validates_presence_of :name, :identifier |
|
69 | validates_presence_of :name, :identifier | |
67 | validates_uniqueness_of :identifier |
|
70 | validates_uniqueness_of :identifier | |
68 | validates_associated :repository, :wiki |
|
71 | validates_associated :repository, :wiki | |
69 |
validates_length_of :name, :maximum => |
|
72 | validates_length_of :name, :maximum => 255 | |
70 | validates_length_of :homepage, :maximum => 255 |
|
73 | validates_length_of :homepage, :maximum => 255 | |
71 |
validates_length_of :identifier, :in => 1.. |
|
74 | validates_length_of :identifier, :in => 1..IDENTIFIER_MAX_LENGTH | |
72 | # donwcase letters, digits, dashes but not digits only |
|
75 | # donwcase letters, digits, dashes but not digits only | |
73 | validates_format_of :identifier, :with => /^(?!\d+$)[a-z0-9\-]*$/, :if => Proc.new { |p| p.identifier_changed? } |
|
76 | validates_format_of :identifier, :with => /^(?!\d+$)[a-z0-9\-]*$/, :if => Proc.new { |p| p.identifier_changed? } | |
74 | # reserved words |
|
77 | # reserved words |
@@ -2,16 +2,16 | |||||
2 |
|
2 | |||
3 | <div class="box"> |
|
3 | <div class="box"> | |
4 | <!--[form:project]--> |
|
4 | <!--[form:project]--> | |
5 |
<p><%= f.text_field :name, :required => true, : |
|
5 | <p><%= f.text_field :name, :required => true, :size => 60 %></p> | |
6 |
|
6 | |||
7 | <% unless @project.allowed_parents.compact.empty? %> |
|
7 | <% unless @project.allowed_parents.compact.empty? %> | |
8 | <p><%= label(:project, :parent_id, l(:field_parent)) %><%= 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, :size => 60, :disabled => @project.identifier_frozen? %> | |
13 | <% unless @project.identifier_frozen? %> |
|
13 | <% unless @project.identifier_frozen? %> | |
14 |
<br /><em><%= l(:text_length_between, :min => 1, :max => |
|
14 | <br /><em><%= l(:text_length_between, :min => 1, :max => Project::IDENTIFIER_MAX_LENGTH) %> <%= 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> |
General Comments 0
You need to be logged in to leave comments.
Login now