summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/models/repository.rb13
-rw-r--r--app/views/repositories/_form.html.erb5
-rw-r--r--config/locales/ar.yml1
-rw-r--r--config/locales/bg.yml1
-rw-r--r--config/locales/bs.yml1
-rw-r--r--config/locales/ca.yml1
-rw-r--r--config/locales/cs.yml1
-rw-r--r--config/locales/da.yml1
-rw-r--r--config/locales/de.yml1
-rw-r--r--config/locales/el.yml1
-rw-r--r--config/locales/en-GB.yml1
-rw-r--r--config/locales/en.yml1
-rw-r--r--config/locales/es.yml1
-rw-r--r--config/locales/et.yml1
-rw-r--r--config/locales/eu.yml1
-rw-r--r--config/locales/fa.yml1
-rw-r--r--config/locales/fi.yml1
-rw-r--r--config/locales/fr.yml1
-rw-r--r--config/locales/gl.yml1
-rw-r--r--config/locales/he.yml1
-rw-r--r--config/locales/hr.yml1
-rw-r--r--config/locales/hu.yml1
-rw-r--r--config/locales/id.yml1
-rw-r--r--config/locales/it.yml1
-rw-r--r--config/locales/ja.yml1
-rw-r--r--config/locales/ko.yml1
-rw-r--r--config/locales/lt.yml1
-rw-r--r--config/locales/lv.yml1
-rw-r--r--config/locales/mk.yml1
-rw-r--r--config/locales/mn.yml1
-rw-r--r--config/locales/nl.yml1
-rw-r--r--config/locales/no.yml1
-rw-r--r--config/locales/pl.yml1
-rw-r--r--config/locales/pt-BR.yml1
-rw-r--r--config/locales/pt.yml1
-rw-r--r--config/locales/ro.yml1
-rw-r--r--config/locales/ru.yml1
-rw-r--r--config/locales/sk.yml1
-rw-r--r--config/locales/sl.yml1
-rw-r--r--config/locales/sq.yml1
-rw-r--r--config/locales/sr-YU.yml1
-rw-r--r--config/locales/sr.yml1
-rw-r--r--config/locales/sv.yml1
-rw-r--r--config/locales/th.yml1
-rw-r--r--config/locales/tr.yml1
-rw-r--r--config/locales/uk.yml1
-rw-r--r--config/locales/vi.yml1
-rw-r--r--config/locales/zh-TW.yml1
-rw-r--r--config/locales/zh.yml1
-rw-r--r--test/unit/repository_test.rb32
50 files changed, 95 insertions, 2 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb
index c81979a26..9a6891a90 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -20,6 +20,9 @@ class ScmFetchError < Exception; end
class Repository < ActiveRecord::Base
include Redmine::Ciphering
include Redmine::SafeAttributes
+
+ # Maximum length for repository identifiers
+ IDENTIFIER_MAX_LENGTH = 255
belongs_to :project
has_many :changesets, :order => "#{Changeset.table_name}.committed_on DESC, #{Changeset.table_name}.id DESC"
@@ -34,7 +37,7 @@ class Repository < ActiveRecord::Base
before_destroy :clear_changesets
validates_length_of :password, :maximum => 255, :allow_nil => true
- validates_length_of :identifier, :maximum => 255, :allow_blank => true
+ validates_length_of :identifier, :maximum => IDENTIFIER_MAX_LENGTH, :allow_blank => true
validates_presence_of :identifier, :unless => Proc.new { |r| r.is_default? || r.set_as_default? }
validates_uniqueness_of :identifier, :scope => :project_id, :allow_blank => true
validates_exclusion_of :identifier, :in => %w(show entry raw changes annotate diff show stats graph)
@@ -114,6 +117,14 @@ class Repository < ActiveRecord::Base
end
end
+ def identifier=(identifier)
+ super unless identifier_frozen?
+ end
+
+ def identifier_frozen?
+ errors[:identifier].blank? && !(new_record? || identifier.blank?)
+ end
+
def identifier_param
if is_default?
nil
diff --git a/app/views/repositories/_form.html.erb b/app/views/repositories/_form.html.erb
index 91a19ca43..1554eb56f 100644
--- a/app/views/repositories/_form.html.erb
+++ b/app/views/repositories/_form.html.erb
@@ -9,7 +9,10 @@
</p>
<p><%= f.check_box :is_default, :label => :field_repository_is_default %></p>
-<p><%= f.text_field :identifier %></p>
+<p><%= f.text_field :identifier, :disabled => @repository.identifier_frozen? %>
+<% unless @repository.identifier_frozen? %>
+ <em class="info"><%= l(:text_length_between, :min => 1, :max => Repository::IDENTIFIER_MAX_LENGTH) %> <%= l(:text_repository_identifier_info).html_safe %></em>
+<% end %></p>
<% button_disabled = true %>
<% if @repository %>
diff --git a/config/locales/ar.yml b/config/locales/ar.yml
index f0acf6d13..095a3d8e7 100644
--- a/config/locales/ar.yml
+++ b/config/locales/ar.yml
@@ -1056,3 +1056,4 @@ ar:
label_fields_permissions: Fields permissions
label_readonly: Read-only
label_required: Required
+ text_repository_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
diff --git a/config/locales/bg.yml b/config/locales/bg.yml
index 374c501c9..79c1d99ac 100644
--- a/config/locales/bg.yml
+++ b/config/locales/bg.yml
@@ -1054,3 +1054,4 @@ bg:
description_date_range_interval: Изберете диапазон чрез задаване на начална и крайна дати
description_date_from: Въведете начална дата
description_date_to: Въведете крайна дата
+ text_repository_identifier_info: 'Позволени са малки букви (a-z), цифри, тирета и _.<br />Промяна след създаването му не е възможна.'
diff --git a/config/locales/bs.yml b/config/locales/bs.yml
index 87e4d42a2..32a00411f 100644
--- a/config/locales/bs.yml
+++ b/config/locales/bs.yml
@@ -1070,3 +1070,4 @@ bs:
label_fields_permissions: Fields permissions
label_readonly: Read-only
label_required: Required
+ text_repository_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
diff --git a/config/locales/ca.yml b/config/locales/ca.yml
index 2bdd47289..fee68f70a 100644
--- a/config/locales/ca.yml
+++ b/config/locales/ca.yml
@@ -1058,3 +1058,4 @@ ca:
label_fields_permissions: Fields permissions
label_readonly: Read-only
label_required: Required
+ text_repository_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
diff --git a/config/locales/cs.yml b/config/locales/cs.yml
index 1c0edf0f8..b408bf90a 100644
--- a/config/locales/cs.yml
+++ b/config/locales/cs.yml
@@ -1059,3 +1059,4 @@ cs:
label_fields_permissions: Fields permissions
label_readonly: Read-only
label_required: Required
+ text_repository_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
diff --git a/config/locales/da.yml b/config/locales/da.yml
index bbee44a28..dcbb8c06c 100644
--- a/config/locales/da.yml
+++ b/config/locales/da.yml
@@ -1073,3 +1073,4 @@ da:
label_fields_permissions: Fields permissions
label_readonly: Read-only
label_required: Required
+ text_repository_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
diff --git a/config/locales/de.yml b/config/locales/de.yml
index f3eb9a7c9..8bb8a4ae4 100644
--- a/config/locales/de.yml
+++ b/config/locales/de.yml
@@ -1074,3 +1074,4 @@ de:
label_fields_permissions: Fields permissions
label_readonly: Nur-Lese-Zugriff
label_required: Erforderlich
+ text_repository_identifier_info: 'Kleinbuchstaben (a-z), Ziffern, Binde- und Unterstriche erlaubt.<br />Einmal gespeichert, kann die Kennung nicht mehr geändert werden.'
diff --git a/config/locales/el.yml b/config/locales/el.yml
index d2cb46e0f..ef9e44c2c 100644
--- a/config/locales/el.yml
+++ b/config/locales/el.yml
@@ -1056,3 +1056,4 @@ el:
label_fields_permissions: Fields permissions
label_readonly: Read-only
label_required: Required
+ text_repository_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
diff --git a/config/locales/en-GB.yml b/config/locales/en-GB.yml
index f9d795f64..f61fbfc85 100644
--- a/config/locales/en-GB.yml
+++ b/config/locales/en-GB.yml
@@ -1058,3 +1058,4 @@ en-GB:
label_fields_permissions: Fields permissions
label_readonly: Read-only
label_required: Required
+ text_repository_identifier_info: 'Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.'
diff --git a/config/locales/en.yml b/config/locales/en.yml
index a38171392..a6bbfa1fd 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -1053,3 +1053,4 @@ en:
description_date_range_interval: Choose range by selecting start and end date
description_date_from: Enter start date
description_date_to: Enter end date
+ text_repository_identifier_info: 'Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.'
diff --git a/config/locales/es.yml b/config/locales/es.yml
index bdb25a9f7..ceff24a21 100644
--- a/config/locales/es.yml
+++ b/config/locales/es.yml
@@ -1093,3 +1093,4 @@ es:
label_fields_permissions: Fields permissions
label_readonly: Read-only
label_required: Required
+ text_repository_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
diff --git a/config/locales/et.yml b/config/locales/et.yml
index c233604de..b5595eadd 100644
--- a/config/locales/et.yml
+++ b/config/locales/et.yml
@@ -1069,3 +1069,4 @@ et:
label_fields_permissions: Fields permissions
label_readonly: Read-only
label_required: Required
+ text_repository_identifier_info: "Lubatud on ainult väikesed tähed (a-z), numbrid ja kriipsud.<br />Peale salvestamist ei saa tunnust enam muuta."
diff --git a/config/locales/eu.yml b/config/locales/eu.yml
index 14e3ba76c..f89b190a4 100644
--- a/config/locales/eu.yml
+++ b/config/locales/eu.yml
@@ -1059,3 +1059,4 @@ eu:
label_fields_permissions: Fields permissions
label_readonly: Read-only
label_required: Required
+ text_repository_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
diff --git a/config/locales/fa.yml b/config/locales/fa.yml
index 55b99aa44..abc6a55ab 100644
--- a/config/locales/fa.yml
+++ b/config/locales/fa.yml
@@ -1058,3 +1058,4 @@ fa:
label_fields_permissions: Fields permissions
label_readonly: Read-only
label_required: Required
+ text_repository_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
diff --git a/config/locales/fi.yml b/config/locales/fi.yml
index 37f35c4c3..549cdb2f5 100644
--- a/config/locales/fi.yml
+++ b/config/locales/fi.yml
@@ -1077,3 +1077,4 @@ fi:
label_fields_permissions: Fields permissions
label_readonly: Read-only
label_required: Required
+ text_repository_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
diff --git a/config/locales/fr.yml b/config/locales/fr.yml
index f8f0aa0a3..007aecc7c 100644
--- a/config/locales/fr.yml
+++ b/config/locales/fr.yml
@@ -1070,3 +1070,4 @@ fr:
error_scm_annotate_big_text_file: Cette entrée ne peut pas être annotée car elle excède la taille maximale.
setting_repositories_encodings: Encodages des fichiers et des dépôts
label_search_for_watchers: Rechercher des observateurs
+ text_repository_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é.'
diff --git a/config/locales/gl.yml b/config/locales/gl.yml
index d528ee2ec..b4b557a03 100644
--- a/config/locales/gl.yml
+++ b/config/locales/gl.yml
@@ -1067,3 +1067,4 @@ gl:
label_fields_permissions: Fields permissions
label_readonly: Read-only
label_required: Required
+ text_repository_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
diff --git a/config/locales/he.yml b/config/locales/he.yml
index ef24f0988..665599113 100644
--- a/config/locales/he.yml
+++ b/config/locales/he.yml
@@ -1061,3 +1061,4 @@ he:
label_fields_permissions: Fields permissions
label_readonly: Read-only
label_required: Required
+ text_repository_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
diff --git a/config/locales/hr.yml b/config/locales/hr.yml
index e7f9eb673..e8805aae3 100644
--- a/config/locales/hr.yml
+++ b/config/locales/hr.yml
@@ -1059,3 +1059,4 @@ hr:
label_fields_permissions: Fields permissions
label_readonly: Read-only
label_required: Required
+ text_repository_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
diff --git a/config/locales/hu.yml b/config/locales/hu.yml
index fc99e4752..a42a3c80c 100644
--- a/config/locales/hu.yml
+++ b/config/locales/hu.yml
@@ -1075,3 +1075,4 @@
label_fields_permissions: Fields permissions
label_readonly: Read-only
label_required: Required
+ text_repository_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
diff --git a/config/locales/id.yml b/config/locales/id.yml
index c50fe27b4..52ff79a89 100644
--- a/config/locales/id.yml
+++ b/config/locales/id.yml
@@ -1062,3 +1062,4 @@ id:
label_fields_permissions: Fields permissions
label_readonly: Read-only
label_required: Required
+ text_repository_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
diff --git a/config/locales/it.yml b/config/locales/it.yml
index 73c57b05d..7ec498232 100644
--- a/config/locales/it.yml
+++ b/config/locales/it.yml
@@ -1057,3 +1057,4 @@ it:
label_fields_permissions: Fields permissions
label_readonly: Read-only
label_required: Required
+ text_repository_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
diff --git a/config/locales/ja.yml b/config/locales/ja.yml
index cd59b3430..5ef74b368 100644
--- a/config/locales/ja.yml
+++ b/config/locales/ja.yml
@@ -1086,3 +1086,4 @@ ja:
label_fields_permissions: フィールドに対する権限
label_readonly: 読み取り専用
label_required: 必須
+ text_repository_identifier_info: アルファベット小文字(a-z)・数字・ハイフン・アンダースコアが使えます。<br />識別子は後で変更することはできません。
diff --git a/config/locales/ko.yml b/config/locales/ko.yml
index 805491044..a48c7741e 100644
--- a/config/locales/ko.yml
+++ b/config/locales/ko.yml
@@ -1106,3 +1106,4 @@ ko:
label_fields_permissions: Fields permissions
label_readonly: Read-only
label_required: Required
+ text_repository_identifier_info: "소문자(a-z),숫자,대쉬(-)와 밑줄(_)만 가능합니다.<br />식별자는 저장후에는 수정할 수 없습니다."
diff --git a/config/locales/lt.yml b/config/locales/lt.yml
index 2784e4f42..a2fcce9ed 100644
--- a/config/locales/lt.yml
+++ b/config/locales/lt.yml
@@ -1116,3 +1116,4 @@ lt:
label_fields_permissions: Fields permissions
label_readonly: Read-only
label_required: Required
+ text_repository_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
diff --git a/config/locales/lv.yml b/config/locales/lv.yml
index 6d7dacbb6..e9d7e5f76 100644
--- a/config/locales/lv.yml
+++ b/config/locales/lv.yml
@@ -1050,3 +1050,4 @@ lv:
label_fields_permissions: Fields permissions
label_readonly: Read-only
label_required: Required
+ text_repository_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
diff --git a/config/locales/mk.yml b/config/locales/mk.yml
index 6831dd694..3d7f7e89f 100644
--- a/config/locales/mk.yml
+++ b/config/locales/mk.yml
@@ -1056,3 +1056,4 @@ mk:
label_fields_permissions: Fields permissions
label_readonly: Read-only
label_required: Required
+ text_repository_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
diff --git a/config/locales/mn.yml b/config/locales/mn.yml
index dd73bb755..af046320d 100644
--- a/config/locales/mn.yml
+++ b/config/locales/mn.yml
@@ -1058,3 +1058,4 @@ mn:
label_fields_permissions: Fields permissions
label_readonly: Read-only
label_required: Required
+ text_repository_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
diff --git a/config/locales/nl.yml b/config/locales/nl.yml
index 35b43ef0f..b4e0c8d35 100644
--- a/config/locales/nl.yml
+++ b/config/locales/nl.yml
@@ -1038,3 +1038,4 @@ nl:
label_fields_permissions: Fields permissions
label_readonly: Read-only
label_required: Required
+ text_repository_identifier_info: 'Alleen kleine letter (a-z), cijfers, streepjes en liggende streepjes zijn toegestaan.<br />Eenmaal opgeslagen kan de identifier niet worden gewijzigd.'
diff --git a/config/locales/no.yml b/config/locales/no.yml
index b87062482..b32df7494 100644
--- a/config/locales/no.yml
+++ b/config/locales/no.yml
@@ -1046,3 +1046,4 @@
label_fields_permissions: Fields permissions
label_readonly: Read-only
label_required: Required
+ text_repository_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
diff --git a/config/locales/pl.yml b/config/locales/pl.yml
index d4f31c612..0dc4a916a 100644
--- a/config/locales/pl.yml
+++ b/config/locales/pl.yml
@@ -1073,3 +1073,4 @@ pl:
label_fields_permissions: Fields permissions
label_readonly: Read-only
label_required: Required
+ text_repository_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml
index fc86bad5b..4c95f35b3 100644
--- a/config/locales/pt-BR.yml
+++ b/config/locales/pt-BR.yml
@@ -1078,3 +1078,4 @@ pt-BR:
label_fields_permissions: Fields permissions
label_readonly: Read-only
label_required: Required
+ text_repository_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
diff --git a/config/locales/pt.yml b/config/locales/pt.yml
index 6b3f0ce92..04b3c45f7 100644
--- a/config/locales/pt.yml
+++ b/config/locales/pt.yml
@@ -1061,3 +1061,4 @@ pt:
label_fields_permissions: Fields permissions
label_readonly: Read-only
label_required: Required
+ text_repository_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
diff --git a/config/locales/ro.yml b/config/locales/ro.yml
index b84d6070b..8c8488371 100644
--- a/config/locales/ro.yml
+++ b/config/locales/ro.yml
@@ -1053,3 +1053,4 @@ ro:
label_fields_permissions: Fields permissions
label_readonly: Read-only
label_required: Required
+ text_repository_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
diff --git a/config/locales/ru.yml b/config/locales/ru.yml
index 17173f162..479be8ce2 100644
--- a/config/locales/ru.yml
+++ b/config/locales/ru.yml
@@ -1169,3 +1169,4 @@ ru:
label_fields_permissions: Fields permissions
label_readonly: Read-only
label_required: Required
+ text_repository_identifier_info: Допускаются только строчные латинские буквы (a-z), цифры, тире и подчеркивания.<br />После сохранения идентификатор изменить нельзя.
diff --git a/config/locales/sk.yml b/config/locales/sk.yml
index 438294e94..8db88bb7d 100644
--- a/config/locales/sk.yml
+++ b/config/locales/sk.yml
@@ -1056,3 +1056,4 @@ sk:
label_fields_permissions: Fields permissions
label_readonly: Read-only
label_required: Required
+ text_repository_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
diff --git a/config/locales/sl.yml b/config/locales/sl.yml
index 7709648d9..8d317d1ca 100644
--- a/config/locales/sl.yml
+++ b/config/locales/sl.yml
@@ -1056,3 +1056,4 @@ sl:
label_fields_permissions: Fields permissions
label_readonly: Read-only
label_required: Required
+ text_repository_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
diff --git a/config/locales/sq.yml b/config/locales/sq.yml
index be98bdf43..5b3d97970 100644
--- a/config/locales/sq.yml
+++ b/config/locales/sq.yml
@@ -1052,3 +1052,4 @@ sq:
label_fields_permissions: Fields permissions
label_readonly: Read-only
label_required: Required
+ text_repository_identifier_info: 'Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.'
diff --git a/config/locales/sr-YU.yml b/config/locales/sr-YU.yml
index e94b12d15..b738d6b43 100644
--- a/config/locales/sr-YU.yml
+++ b/config/locales/sr-YU.yml
@@ -1058,3 +1058,4 @@ sr-YU:
label_fields_permissions: Fields permissions
label_readonly: Read-only
label_required: Required
+ text_repository_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
diff --git a/config/locales/sr.yml b/config/locales/sr.yml
index cd65cddcd..7ffbaddd5 100644
--- a/config/locales/sr.yml
+++ b/config/locales/sr.yml
@@ -1057,3 +1057,4 @@ sr:
label_fields_permissions: Fields permissions
label_readonly: Read-only
label_required: Required
+ text_repository_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
diff --git a/config/locales/sv.yml b/config/locales/sv.yml
index 784a7130c..4904b1b23 100644
--- a/config/locales/sv.yml
+++ b/config/locales/sv.yml
@@ -1094,3 +1094,4 @@ sv:
label_fields_permissions: Fields permissions
label_readonly: Read-only
label_required: Required
+ text_repository_identifier_info: Ändast gemener (a-z), siffror, streck och understreck är tillåtna.<br />När identifieraren sparats kan den inte ändras.
diff --git a/config/locales/th.yml b/config/locales/th.yml
index 6dc8c3609..bd58ca534 100644
--- a/config/locales/th.yml
+++ b/config/locales/th.yml
@@ -1053,3 +1053,4 @@ th:
label_fields_permissions: Fields permissions
label_readonly: Read-only
label_required: Required
+ text_repository_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
diff --git a/config/locales/tr.yml b/config/locales/tr.yml
index 8cd849009..14893aefa 100644
--- a/config/locales/tr.yml
+++ b/config/locales/tr.yml
@@ -1075,3 +1075,4 @@ tr:
label_fields_permissions: Fields permissions
label_readonly: Read-only
label_required: Required
+ text_repository_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
diff --git a/config/locales/uk.yml b/config/locales/uk.yml
index 14c1ea637..88b6432c8 100644
--- a/config/locales/uk.yml
+++ b/config/locales/uk.yml
@@ -1051,3 +1051,4 @@ uk:
label_fields_permissions: Fields permissions
label_readonly: Read-only
label_required: Required
+ text_repository_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
diff --git a/config/locales/vi.yml b/config/locales/vi.yml
index cbd808114..d074750c0 100644
--- a/config/locales/vi.yml
+++ b/config/locales/vi.yml
@@ -1107,3 +1107,4 @@ vi:
label_fields_permissions: Fields permissions
label_readonly: Read-only
label_required: Required
+ text_repository_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
diff --git a/config/locales/zh-TW.yml b/config/locales/zh-TW.yml
index 99b49b87a..c53c0bda3 100644
--- a/config/locales/zh-TW.yml
+++ b/config/locales/zh-TW.yml
@@ -1137,3 +1137,4 @@
description_date_range_interval: 選擇起始與結束日期以設定範圍區間
description_date_from: 輸入起始日期
description_date_to: 輸入結束日期
+ text_repository_identifier_info: '僅允許使用小寫英文字母 (a-z), 阿拉伯數字, 虛線與底線。<br />一旦儲存之後, 代碼便無法再次被更改。'
diff --git a/config/locales/zh.yml b/config/locales/zh.yml
index 5cd584562..64cdd7fe7 100644
--- a/config/locales/zh.yml
+++ b/config/locales/zh.yml
@@ -1060,3 +1060,4 @@ zh:
label_fields_permissions: 字段权限
label_readonly: 只读
label_required: 必填
+ text_repository_identifier_info: 仅小写字母(a-z)、数字、破折号(-)和下划线(_)可以使用。<br />一旦保存,标识无法修改。
diff --git a/test/unit/repository_test.rb b/test/unit/repository_test.rb
index f99711623..56663c165 100644
--- a/test/unit/repository_test.rb
+++ b/test/unit/repository_test.rb
@@ -105,6 +105,38 @@ class RepositoryTest < ActiveSupport::TestCase
)
assert r.save
end
+
+ def test_identifier_should_not_be_frozen_for_a_new_repository
+ assert_equal false, Repository.new.identifier_frozen?
+ end
+
+ def test_identifier_should_not_be_frozen_for_a_saved_repository_with_blank_identifier
+ Repository.update_all(["identifier = ''"], "id = 10")
+
+ assert_equal false, Repository.find(10).identifier_frozen?
+ end
+
+ def test_identifier_should_be_frozen_for_a_saved_repository_with_valid_identifier
+ Repository.update_all(["identifier = 'abc123'"], "id = 10")
+
+ assert_equal true, Repository.find(10).identifier_frozen?
+ end
+
+ def test_identifier_should_not_accept_change_if_frozen
+ r = Repository.new(:identifier => 'foo')
+ r.stubs(:identifier_frozen?).returns(true)
+
+ r.identifier = 'bar'
+ assert_equal 'foo', r.identifier
+ end
+
+ def test_identifier_should_accept_change_if_not_frozen
+ r = Repository.new(:identifier => 'foo')
+ r.stubs(:identifier_frozen?).returns(false)
+
+ r.identifier = 'bar'
+ assert_equal 'bar', r.identifier
+ end
def test_destroy
repository = Repository.find(10)