Allow underscores in project identifiers (#1363).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8708 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2012-01-27 17:34:58 +00:00
parent ffbd3c0522
commit 9d372ce6f5
5 changed files with 5 additions and 4 deletions

View File

@ -76,7 +76,7 @@ class Project < ActiveRecord::Base
validates_length_of :homepage, :maximum => 255 validates_length_of :homepage, :maximum => 255
validates_length_of :identifier, :in => 1..IDENTIFIER_MAX_LENGTH validates_length_of :identifier, :in => 1..IDENTIFIER_MAX_LENGTH
# donwcase letters, digits, dashes but not digits only # donwcase letters, digits, dashes but not digits only
validates_format_of :identifier, :with => /^(?!\d+$)[a-z0-9\-]*$/, :if => Proc.new { |p| p.identifier_changed? } validates_format_of :identifier, :with => /^(?!\d+$)[a-z0-9\-_]*$/, :if => Proc.new { |p| p.identifier_changed? }
# reserved words # reserved words
validates_exclusion_of :identifier, :in => %w( new ) validates_exclusion_of :identifier, :in => %w( new )

View File

@ -879,7 +879,7 @@ en-GB:
text_tip_issue_begin_day: task beginning this day text_tip_issue_begin_day: task beginning this day
text_tip_issue_end_day: task ending this day text_tip_issue_end_day: task ending this day
text_tip_issue_begin_end_day: task beginning and ending this day text_tip_issue_begin_end_day: task beginning and ending this day
text_project_identifier_info: 'Only lower case letters (a-z), numbers and dashes are allowed.<br />Once saved, the identifier cannot be changed.' text_project_identifier_info: 'Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.'
text_caracters_maximum: "%{count} characters maximum." text_caracters_maximum: "%{count} characters maximum."
text_caracters_minimum: "Must be at least %{count} characters long." text_caracters_minimum: "Must be at least %{count} characters long."
text_length_between: "Length between %{min} and %{max} characters." text_length_between: "Length between %{min} and %{max} characters."

View File

@ -915,7 +915,7 @@ en:
text_tip_issue_begin_day: issue beginning this day text_tip_issue_begin_day: issue beginning this day
text_tip_issue_end_day: issue ending this day text_tip_issue_end_day: issue ending this day
text_tip_issue_begin_end_day: issue beginning and ending this day text_tip_issue_begin_end_day: issue beginning and ending this day
text_project_identifier_info: 'Only lower case letters (a-z), numbers and dashes are allowed.<br />Once saved, the identifier cannot be changed.' text_project_identifier_info: 'Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.'
text_caracters_maximum: "%{count} characters maximum." text_caracters_maximum: "%{count} characters maximum."
text_caracters_minimum: "Must be at least %{count} characters long." text_caracters_minimum: "Must be at least %{count} characters long."
text_length_between: "Length between %{min} and %{max} characters." text_length_between: "Length between %{min} and %{max} characters."

View File

@ -882,7 +882,7 @@ fr:
text_tip_issue_begin_day: tâche commençant ce jour text_tip_issue_begin_day: tâche commençant ce jour
text_tip_issue_end_day: tâche finissant ce jour text_tip_issue_end_day: tâche finissant ce jour
text_tip_issue_begin_end_day: tâche commençant et finissant ce jour text_tip_issue_begin_end_day: tâche commençant et finissant ce jour
text_project_identifier_info: 'Seuls les lettres minuscules (a-z), chiffres et tirets sont autorisés.<br />Un fois sauvegardé, l''identifiant ne pourra plus être modifié.' text_project_identifier_info: 'Seuls les lettres minuscules (a-z), chiffres, tirets et underscore sont autorisés.<br />Un fois sauvegardé, l''identifiant ne pourra plus être modifié.'
text_caracters_maximum: "%{count} caractères maximum." text_caracters_maximum: "%{count} caractères maximum."
text_caracters_minimum: "%{count} caractères minimum." text_caracters_minimum: "%{count} caractères minimum."
text_length_between: "Longueur comprise entre %{min} et %{max} caractères." text_length_between: "Longueur comprise entre %{min} et %{max} caractères."

View File

@ -119,6 +119,7 @@ class ProjectTest < ActiveSupport::TestCase
to_test = {"abc" => true, to_test = {"abc" => true,
"ab12" => true, "ab12" => true,
"ab-12" => true, "ab-12" => true,
"ab_12" => true,
"12" => false, "12" => false,
"new" => false} "new" => false}