Added some attributes length validations.
Also added some information about attribute length constraints on forms. git-svn-id: http://redmine.rubyforge.org/svn/trunk@400 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
bd8de9a6f8
commit
791077c240
|
@ -35,8 +35,10 @@ class Project < ActiveRecord::Base
|
|||
validates_uniqueness_of :name, :identifier
|
||||
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 :identifier, :maximum => 12
|
||||
validates_length_of :description, :maximum => 255
|
||||
validates_length_of :identifier, :in => 3..12
|
||||
validates_format_of :identifier, :with => /^[a-z0-9\-]*$/
|
||||
|
||||
def identifier=(identifier)
|
||||
|
|
|
@ -33,9 +33,12 @@ class User < ActiveRecord::Base
|
|||
validates_presence_of :login, :firstname, :lastname, :mail
|
||||
validates_uniqueness_of :login, :mail
|
||||
# Login must contain lettres, numbers, underscores only
|
||||
validates_format_of :firstname, :lastname, :with => /^[\w\s\'\-]*$/i
|
||||
validates_format_of :login, :with => /^[a-z0-9_\-@\.]+$/i
|
||||
validates_length_of :login, :maximum => 30
|
||||
validates_format_of :firstname, :lastname, :with => /^[\w\s\'\-]*$/i
|
||||
validates_length_of :firstname, :lastname, :maximum => 30
|
||||
validates_format_of :mail, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i
|
||||
validates_length_of :mail, :maximum => 60
|
||||
# Password length between 4 and 12
|
||||
validates_length_of :password, :in => 4..12, :allow_nil => true
|
||||
validates_confirmation_of :password, :allow_nil => true
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
<% form_tag({:token => @token.value}, :class => "tabular") do %>
|
||||
|
||||
<p><label for="new_password"><%=l(:field_new_password)%> <span class="required">*</span></label>
|
||||
<%= password_field_tag 'new_password', nil, :size => 25 %></p>
|
||||
<%= password_field_tag 'new_password', nil, :size => 25 %><br />
|
||||
<em><%= l(:text_length_between, 4, 12) %></em></p>
|
||||
|
||||
<p><label for="new_password_confirmation"><%=l(:field_password_confirmation)%> <span class="required">*</span></label>
|
||||
<%= password_field_tag 'new_password_confirmation', nil, :size => 25 %></p>
|
||||
|
|
|
@ -35,7 +35,8 @@
|
|||
<%= password_field_tag 'password', nil, :size => 25 %></p>
|
||||
|
||||
<p><label for="new_password"><%=l(:field_new_password)%> <span class="required">*</span></label>
|
||||
<%= password_field_tag 'new_password', nil, :size => 25 %></p>
|
||||
<%= password_field_tag 'new_password', nil, :size => 25 %><br />
|
||||
<em><%= l(:text_length_between, 4, 12) %></em></p>
|
||||
|
||||
<p><label for="new_password_confirmation"><%=l(:field_password_confirmation)%> <span class="required">*</span></label>
|
||||
<%= password_field_tag 'new_password_confirmation', nil, :size => 25 %></p>
|
||||
|
|
|
@ -2,14 +2,14 @@
|
|||
|
||||
<div class="box">
|
||||
<!--[form:project]-->
|
||||
<p><%= f.text_field :name, :required => true %></p>
|
||||
<p><%= f.text_field :name, :required => true %><br /><em><%= l(:text_caracters_maximum, 30) %></em></p>
|
||||
|
||||
<% if admin_loggedin? and !@root_projects.empty? %>
|
||||
<p><%= f.select :parent_id, (@root_projects.collect {|p| [p.name, p.id]}), { :include_blank => true } %></p>
|
||||
<% end %>
|
||||
|
||||
<p><%= f.text_area :description, :required => true, :cols => 60, :rows => 3 %></p>
|
||||
<p><%= f.text_field :identifier, :required => true, :size => 15, :disabled => @project.identifier_frozen? %><br /><em><%= l(:text_project_identifier_info) unless @project.identifier_frozen? %></em></p>
|
||||
<p><%= f.text_area :description, :required => true, :cols => 60, :rows => 3 %><br /><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 :homepage, :size => 40 %></p>
|
||||
<p><%= f.check_box :is_public %></p>
|
||||
|
||||
|
|
|
@ -23,7 +23,8 @@
|
|||
<p><%= f.select :auth_source_id, [[l(:label_internal), ""]] + @auth_sources.collect { |a| [a.name, a.id] } %></p>
|
||||
<% end %>
|
||||
<p><label for="password"><%=l(:field_password)%><span class="required"> *</span></label>
|
||||
<%= password_field_tag 'password', nil, :size => 25 %></p>
|
||||
<%= password_field_tag 'password', nil, :size => 25 %><br />
|
||||
<em><%= l(:text_length_between, 4, 12) %></em></p>
|
||||
<p><label for="password_confirmation"><%=l(:field_password_confirmation)%><span class="required"> *</span></label>
|
||||
<%= password_field_tag 'password_confirmation', nil, :size => 25 %></p>
|
||||
</div>
|
||||
|
|
|
@ -397,7 +397,9 @@ text_journal_deleted: gelöscht
|
|||
text_tip_task_begin_day: Aufgabe, die an diesem Tag beginnt
|
||||
text_tip_task_end_day: Aufgabe, die an diesem Tag beendet
|
||||
text_tip_task_begin_end_day: Aufgabe, die an diesem Tag beginnt und beendet
|
||||
text_project_identifier_info: '12 characters maximum. Letters (a-z), numbers (0-9) and dashes allowed.<br />Once saved, the identifier can not be changed.'
|
||||
text_project_identifier_info: 'Lower case letters (a-z), numbers and dashes allowed.<br />Once saved, the identifier can not be changed.'
|
||||
text_caracters_maximum: %d characters maximum.
|
||||
text_length_between: Length between %d and %d characters.
|
||||
|
||||
default_role_manager: Manager
|
||||
default_role_developper: Developer
|
||||
|
|
|
@ -397,7 +397,9 @@ text_journal_deleted: deleted
|
|||
text_tip_task_begin_day: task beginning this day
|
||||
text_tip_task_end_day: task ending this day
|
||||
text_tip_task_begin_end_day: task beginning and ending this day
|
||||
text_project_identifier_info: '12 characters maximum. Letters (a-z), numbers (0-9) and dashes allowed.<br />Once saved, the identifier can not be changed.'
|
||||
text_project_identifier_info: 'Lower case letters (a-z), numbers and dashes allowed.<br />Once saved, the identifier can not be changed.'
|
||||
text_caracters_maximum: %d characters maximum.
|
||||
text_length_between: Length between %d and %d characters.
|
||||
|
||||
default_role_manager: Manager
|
||||
default_role_developper: Developer
|
||||
|
|
|
@ -397,7 +397,9 @@ text_journal_deleted: suprimido
|
|||
text_tip_task_begin_day: tarea que comienza este día
|
||||
text_tip_task_end_day: tarea que termina este día
|
||||
text_tip_task_begin_end_day: tarea que comienza y termina este día
|
||||
text_project_identifier_info: '12 characters maximum. Letters (a-z), numbers (0-9) and dashes allowed.<br />Once saved, the identifier can not be changed.'
|
||||
text_project_identifier_info: 'Lower case letters (a-z), numbers and dashes allowed.<br />Once saved, the identifier can not be changed.'
|
||||
text_caracters_maximum: %d characters maximum.
|
||||
text_length_between: Length between %d and %d characters.
|
||||
|
||||
default_role_manager: Manager
|
||||
default_role_developper: Desarrollador
|
||||
|
|
|
@ -397,7 +397,9 @@ text_journal_deleted: supprimé
|
|||
text_tip_task_begin_day: tâche commençant ce jour
|
||||
text_tip_task_end_day: tâche finissant ce jour
|
||||
text_tip_task_begin_end_day: tâche commençant et finissant ce jour
|
||||
text_project_identifier_info: '12 caractères maximum. Lettres (a-z), chiffres (0-9) et tirets autorisés.<br />Un fois sauvegardé, l''identifiant ne pourra plus être modifié.'
|
||||
text_project_identifier_info: 'Lettres minuscules (a-z), chiffres et tirets autorisés.<br />Un fois sauvegardé, l''identifiant ne pourra plus être modifié.'
|
||||
text_caracters_maximum: %d caractères maximum.
|
||||
text_length_between: Longueur comprise entre %d et %d caractères.
|
||||
|
||||
default_role_manager: Manager
|
||||
default_role_developper: Développeur
|
||||
|
|
|
@ -397,7 +397,9 @@ text_journal_deleted: deleted
|
|||
text_tip_task_begin_day: task beginning this day
|
||||
text_tip_task_end_day: task ending this day
|
||||
text_tip_task_begin_end_day: task beginning and ending this day
|
||||
text_project_identifier_info: '12 characters maximum. Letters (a-z), numbers (0-9) and dashes allowed.<br />Once saved, the identifier can not be changed.'
|
||||
text_project_identifier_info: 'Lower case letters (a-z), numbers and dashes allowed.<br />Once saved, the identifier can not be changed.'
|
||||
text_caracters_maximum: %d characters maximum.
|
||||
text_length_between: Length between %d and %d characters.
|
||||
|
||||
default_role_manager: Manager
|
||||
default_role_developper: Sviluppatore
|
||||
|
|
|
@ -398,7 +398,9 @@ text_journal_deleted: 削除
|
|||
text_tip_task_begin_day: この日に開始するタスク
|
||||
text_tip_task_end_day: この日に終了するタスク
|
||||
text_tip_task_begin_end_day: この日のうちに開始して終了するタスク
|
||||
text_project_identifier_info: '12 characters maximum. Letters (a-z), numbers (0-9) and dashes allowed.<br />Once saved, the identifier can not be changed.'
|
||||
text_project_identifier_info: 'Lower case letters (a-z), numbers and dashes allowed.<br />Once saved, the identifier can not be changed.'
|
||||
text_caracters_maximum: %d characters maximum.
|
||||
text_length_between: Length between %d and %d characters.
|
||||
|
||||
default_role_manager: 管理者
|
||||
default_role_developper: 開発者
|
||||
|
|
|
@ -400,7 +400,9 @@ text_journal_deleted: 已删除
|
|||
text_tip_task_begin_day: 开始于此
|
||||
text_tip_task_end_day: 在此结束
|
||||
text_tip_task_begin_end_day: 开始并结束于此
|
||||
text_project_identifier_info: '12 characters maximum. Letters (a-z), numbers (0-9) and dashes allowed.<br />Once saved, the identifier can not be changed.'
|
||||
text_project_identifier_info: 'Lower case letters (a-z), numbers and dashes allowed.<br />Once saved, the identifier can not be changed.'
|
||||
text_caracters_maximum: %d characters maximum.
|
||||
text_length_between: Length between %d and %d characters.
|
||||
|
||||
default_role_manager: 管理员
|
||||
default_role_developper: 开发人员
|
||||
|
|
Loading…
Reference in New Issue