Feature #6446 » redmine-project-name-and-identifier-limits.diff
| app/models/project.rb (working copy) | ||
|---|---|---|
|
validates_presence_of :name, :identifier
|
||
|
validates_uniqueness_of :name, :identifier
|
||
|
validates_associated :repository, :wiki
|
||
|
validates_length_of :name, :maximum => 30
|
||
|
validates_length_of :name, :maximum => 100
|
||
|
validates_length_of :homepage, :maximum => 255
|
||
|
validates_length_of :identifier, :in => 1..20
|
||
|
validates_length_of :identifier, :in => 1..100
|
||
|
# 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
|
||
| app/views/projects/_form.rhtml (working copy) | ||
|---|---|---|
|
<div class="box">
|
||
|
<!--[form:project]-->
|
||
|
<p><%= f.text_field :name, :required => true, :maxlength => 30 %><br /><em><%= l(:text_caracters_maximum, 30) %></em></p>
|
||
|
<p><%= f.text_field :name, :required => true, :maxlength => 100 %><br /><em><%= l(:text_caracters_maximum, 100) %></em></p>
|
||
|
<% unless @project.allowed_parents.compact.empty? %>
|
||
|
<p><%= label(:project, :parent_id, l(:field_parent)) %><%= parent_project_select_tag(@project) %></p>
|
||
|
<% end %>
|
||
|
<p><%= f.text_area :description, :rows => 5, :class => 'wiki-edit' %></p>
|
||
|
<p><%= f.text_field :identifier, :required => true, :disabled => @project.identifier_frozen?, :maxlength => 20 %>
|
||
|
<p><%= f.text_field :identifier, :required => true, :disabled => @project.identifier_frozen?, :maxlength => 100 %>
|
||
|
<% unless @project.identifier_frozen? %>
|
||
|
<br /><em><%= l(:text_length_between, :min => 1, :max => 20) %> <%= l(:text_project_identifier_info) %></em>
|
||
|
<br /><em><%= l(:text_length_between, :min => 1, :max => 100) %> <%= l(:text_project_identifier_info) %></em>
|
||
|
<% end %></p>
|
||
|
<p><%= f.text_field :homepage, :size => 60 %></p>
|
||
|
<p><%= f.check_box :is_public %></p>
|
||
| db/migrate/20101029235712_change_project_identifier_length_limit.rb (revision 0) | ||
|---|---|---|
|
class ChangeProjectIdentifierLengthLimit < ActiveRecord::Migration
|
||
|
def self.up
|
||
|
change_column :projects, :identifier, :string, :limit => 100
|
||
|
end
|
||
|
def self.down
|
||
|
change_column :projects, :identifier, :string, :limit => 20
|
||
|
end
|
||
|
end
|
||
| db/migrate/20101029235635_change_project_name_length_limit.rb (revision 0) | ||
|---|---|---|
|
class ChangeProjectNameLengthLimit < ActiveRecord::Migration
|
||
|
def self.up
|
||
|
change_column :projects, :name, :string, :limit => 100
|
||
|
end
|
||
|
def self.down
|
||
|
change_column :projects, :name, :string, :limit => 30
|
||
|
end
|
||
|
end
|
||