@@ -53,6 +53,11 class CustomField < ActiveRecord::Base | |||||
53 | errors.add(:possible_values, :activerecord_error_blank) if self.possible_values.nil? || self.possible_values.empty? |
|
53 | errors.add(:possible_values, :activerecord_error_blank) if self.possible_values.nil? || self.possible_values.empty? | |
54 | errors.add(:possible_values, :activerecord_error_invalid) unless self.possible_values.is_a? Array |
|
54 | errors.add(:possible_values, :activerecord_error_invalid) unless self.possible_values.is_a? Array | |
55 | end |
|
55 | end | |
|
56 | ||||
|
57 | # validate default value | |||
|
58 | v = CustomValue.new(:custom_field => self.dup, :value => default_value, :customized => nil) | |||
|
59 | v.custom_field.is_required = false | |||
|
60 | errors.add(:default_value, :activerecord_error_invalid) unless v.valid? | |||
56 | end |
|
61 | end | |
57 |
|
62 | |||
58 | def <=>(field) |
|
63 | def <=>(field) |
@@ -19,6 +19,12 class CustomValue < ActiveRecord::Base | |||||
19 | belongs_to :custom_field |
|
19 | belongs_to :custom_field | |
20 | belongs_to :customized, :polymorphic => true |
|
20 | belongs_to :customized, :polymorphic => true | |
21 |
|
21 | |||
|
22 | def after_initialize | |||
|
23 | if custom_field && new_record? && (customized_type.blank? || (customized && customized.new_record?)) | |||
|
24 | self.value ||= custom_field.default_value | |||
|
25 | end | |||
|
26 | end | |||
|
27 | ||||
22 | protected |
|
28 | protected | |
23 | def validate |
|
29 | def validate | |
24 | errors.add(:value, :activerecord_error_blank) and return if custom_field.is_required? and value.blank? |
|
30 | errors.add(:value, :activerecord_error_blank) and return if custom_field.is_required? and value.blank? |
@@ -8,31 +8,42 function toggle_custom_field_format() { | |||||
8 | p_regexp = $("custom_field_regexp"); |
|
8 | p_regexp = $("custom_field_regexp"); | |
9 | p_values = $("custom_field_possible_values"); |
|
9 | p_values = $("custom_field_possible_values"); | |
10 | p_searchable = $("custom_field_searchable"); |
|
10 | p_searchable = $("custom_field_searchable"); | |
|
11 | p_default = $("custom_field_default_value"); | |||
|
12 | ||||
|
13 | p_default.setAttribute('type','text'); | |||
|
14 | Element.show(p_default.parentNode); | |||
|
15 | ||||
11 | switch (format.value) { |
|
16 | switch (format.value) { | |
12 | case "list": |
|
17 | case "list": | |
13 | Element.hide(p_length.parentNode); |
|
18 | Element.hide(p_length.parentNode); | |
14 | Element.hide(p_regexp.parentNode); |
|
19 | Element.hide(p_regexp.parentNode); | |
15 | Element.show(p_searchable.parentNode); |
|
20 | if (p_searchable) Element.show(p_searchable.parentNode); | |
16 | Element.show(p_values); |
|
21 | Element.show(p_values); | |
17 | break; |
|
22 | break; | |
18 | case "date": |
|
|||
19 | case "bool": |
|
23 | case "bool": | |
|
24 | p_default.setAttribute('type','checkbox'); | |||
|
25 | Element.hide(p_length.parentNode); | |||
|
26 | Element.hide(p_regexp.parentNode); | |||
|
27 | if (p_searchable) Element.hide(p_searchable.parentNode); | |||
|
28 | Element.hide(p_values); | |||
|
29 | break; | |||
|
30 | case "date": | |||
20 | Element.hide(p_length.parentNode); |
|
31 | Element.hide(p_length.parentNode); | |
21 | Element.hide(p_regexp.parentNode); |
|
32 | Element.hide(p_regexp.parentNode); | |
22 | Element.hide(p_searchable.parentNode); |
|
33 | if (p_searchable) Element.hide(p_searchable.parentNode); | |
23 | Element.hide(p_values); |
|
34 | Element.hide(p_values); | |
24 | break; |
|
35 | break; | |
25 | case "float": |
|
36 | case "float": | |
26 | case "int": |
|
37 | case "int": | |
27 | Element.show(p_length.parentNode); |
|
38 | Element.show(p_length.parentNode); | |
28 | Element.show(p_regexp.parentNode); |
|
39 | Element.show(p_regexp.parentNode); | |
29 | Element.hide(p_searchable.parentNode); |
|
40 | if (p_searchable) Element.hide(p_searchable.parentNode); | |
30 | Element.hide(p_values); |
|
41 | Element.hide(p_values); | |
31 | break; |
|
42 | break; | |
32 | default: |
|
43 | default: | |
33 | Element.show(p_length.parentNode); |
|
44 | Element.show(p_length.parentNode); | |
34 | Element.show(p_regexp.parentNode); |
|
45 | Element.show(p_regexp.parentNode); | |
35 | Element.show(p_searchable.parentNode); |
|
46 | if (p_searchable) Element.show(p_searchable.parentNode); | |
36 | Element.hide(p_values); |
|
47 | Element.hide(p_values); | |
37 | break; |
|
48 | break; | |
38 | } |
|
49 | } | |
@@ -70,6 +81,7 function deleteValueField(e) { | |||||
70 | <span><%= text_field_tag 'custom_field[possible_values][]', value, :size => 30 %> <%= image_to_function "delete.png", "deleteValueField(this);return false" %><br /></span> |
|
81 | <span><%= text_field_tag 'custom_field[possible_values][]', value, :size => 30 %> <%= image_to_function "delete.png", "deleteValueField(this);return false" %><br /></span> | |
71 | <% end %> |
|
82 | <% end %> | |
72 | </p> |
|
83 | </p> | |
|
84 | <p><%= @custom_field.field_format == 'bool' ? f.check_box(:default_value) : f.text_field(:default_value) %></p> | |||
73 | </div> |
|
85 | </div> | |
74 |
|
86 | |||
75 | <div class="box"> |
|
87 | <div class="box"> |
@@ -161,6 +161,7 field_delay: Отместване | |||||
161 | field_assignable: Възможно е възлагане на задачи за тази роля |
|
161 | field_assignable: Възможно е възлагане на задачи за тази роля | |
162 | field_redirect_existing_links: Пренасочване на съществуващи линкове |
|
162 | field_redirect_existing_links: Пренасочване на съществуващи линкове | |
163 | field_estimated_hours: Изчислено време |
|
163 | field_estimated_hours: Изчислено време | |
|
164 | field_default_value: Статус по подразбиране | |||
164 |
|
165 | |||
165 | setting_app_title: Заглавие |
|
166 | setting_app_title: Заглавие | |
166 | setting_app_subtitle: Описание |
|
167 | setting_app_subtitle: Описание |
@@ -159,6 +159,7 field_is_filter: Used as a filter | |||||
159 | field_issue_to_id: Vztažený požadavek |
|
159 | field_issue_to_id: Vztažený požadavek | |
160 | field_delay: Zpoždění |
|
160 | field_delay: Zpoždění | |
161 | field_assignable: Požadavky mohou být přiřazeny této roli |
|
161 | field_assignable: Požadavky mohou být přiřazeny této roli | |
|
162 | field_default_value: Výchozí stav | |||
162 |
|
163 | |||
163 | setting_app_title: Titulek aplikace |
|
164 | setting_app_title: Titulek aplikace | |
164 | setting_app_subtitle: Podtitulek aplikace |
|
165 | setting_app_subtitle: Podtitulek aplikace |
@@ -161,6 +161,7 field_delay: Pufferzeit | |||||
161 | field_assignable: Tickets können dieser Rolle zugewiesen werden |
|
161 | field_assignable: Tickets können dieser Rolle zugewiesen werden | |
162 | field_redirect_existing_links: Existierende Links umleiten |
|
162 | field_redirect_existing_links: Existierende Links umleiten | |
163 | field_estimated_hours: Geschätzter Aufwand |
|
163 | field_estimated_hours: Geschätzter Aufwand | |
|
164 | field_default_value: Default | |||
164 |
|
165 | |||
165 | setting_app_title: Applikations-Titel |
|
166 | setting_app_title: Applikations-Titel | |
166 | setting_app_subtitle: Applikations-Untertitel |
|
167 | setting_app_subtitle: Applikations-Untertitel |
@@ -174,6 +174,7 field_estimated_hours: Estimated time | |||||
174 | field_column_names: Columns |
|
174 | field_column_names: Columns | |
175 | field_time_zone: Time zone |
|
175 | field_time_zone: Time zone | |
176 | field_searchable: Searchable |
|
176 | field_searchable: Searchable | |
|
177 | field_default_value: Default value | |||
177 |
|
178 | |||
178 | setting_app_title: Application title |
|
179 | setting_app_title: Application title | |
179 | setting_app_subtitle: Application subtitle |
|
180 | setting_app_subtitle: Application subtitle |
@@ -155,6 +155,7 field_identifier: Identificador | |||||
155 | field_is_filter: Usado como filtro |
|
155 | field_is_filter: Usado como filtro | |
156 | field_issue_to_id: Petición Relacionada |
|
156 | field_issue_to_id: Petición Relacionada | |
157 | field_delay: Retraso |
|
157 | field_delay: Retraso | |
|
158 | field_default_value: Estado por defecto | |||
158 |
|
159 | |||
159 | setting_app_title: Título de la aplicación |
|
160 | setting_app_title: Título de la aplicación | |
160 | setting_app_subtitle: Subtítulo de la aplicación |
|
161 | setting_app_subtitle: Subtítulo de la aplicación |
@@ -174,6 +174,7 field_estimated_hours: Arvioitu aika | |||||
174 | field_column_names: Saraketta |
|
174 | field_column_names: Saraketta | |
175 | field_time_zone: Aikavyöhyke |
|
175 | field_time_zone: Aikavyöhyke | |
176 | field_searchable: Haettava |
|
176 | field_searchable: Haettava | |
|
177 | field_default_value: Vakio arvo | |||
177 |
|
178 | |||
178 | setting_app_title: Ohjelman otsikko |
|
179 | setting_app_title: Ohjelman otsikko | |
179 | setting_app_subtitle: Ohjelman alaotsikko |
|
180 | setting_app_subtitle: Ohjelman alaotsikko |
@@ -174,6 +174,7 field_estimated_hours: Temps estimé | |||||
174 | field_column_names: Colonnes |
|
174 | field_column_names: Colonnes | |
175 | field_time_zone: Fuseau horaire |
|
175 | field_time_zone: Fuseau horaire | |
176 | field_searchable: Utilisé pour les recherches |
|
176 | field_searchable: Utilisé pour les recherches | |
|
177 | field_default_value: Valeur par défaut | |||
177 |
|
178 | |||
178 | setting_app_title: Titre de l'application |
|
179 | setting_app_title: Titre de l'application | |
179 | setting_app_subtitle: Sous-titre de l'application |
|
180 | setting_app_subtitle: Sous-titre de l'application |
@@ -164,6 +164,7 field_assignable: ניתן להקצות נושאים לתפקיד זה | |||||
164 | field_redirect_existing_links: העבר קישורים קיימים |
|
164 | field_redirect_existing_links: העבר קישורים קיימים | |
165 | field_estimated_hours: זמן משוער |
|
165 | field_estimated_hours: זמן משוער | |
166 | field_column_names: עמודות |
|
166 | field_column_names: עמודות | |
|
167 | field_default_value: ערך ברירת מחדל | |||
167 |
|
168 | |||
168 | setting_app_title: כותרת ישום |
|
169 | setting_app_title: כותרת ישום | |
169 | setting_app_subtitle: תת-כותרת ישום |
|
170 | setting_app_subtitle: תת-כותרת ישום |
@@ -161,6 +161,7 field_delay: Delay | |||||
161 | field_assignable: Issues can be assigned to this role |
|
161 | field_assignable: Issues can be assigned to this role | |
162 | field_redirect_existing_links: Redirect existing links |
|
162 | field_redirect_existing_links: Redirect existing links | |
163 | field_estimated_hours: Estimated time |
|
163 | field_estimated_hours: Estimated time | |
|
164 | field_default_value: Stato predefinito | |||
164 |
|
165 | |||
165 | setting_app_title: Titolo applicazione |
|
166 | setting_app_title: Titolo applicazione | |
166 | setting_app_subtitle: Sottotitolo applicazione |
|
167 | setting_app_subtitle: Sottotitolo applicazione |
@@ -162,6 +162,7 field_delay: 遅延 | |||||
162 | field_assignable: 問題はこのロールに割り当てることができます |
|
162 | field_assignable: 問題はこのロールに割り当てることができます | |
163 | field_redirect_existing_links: 既存のリンクをリダイレクトする |
|
163 | field_redirect_existing_links: 既存のリンクをリダイレクトする | |
164 | field_estimated_hours: 予定工数 |
|
164 | field_estimated_hours: 予定工数 | |
|
165 | field_default_value: デフォルトのステータス | |||
165 |
|
166 | |||
166 | setting_app_title: アプリケーションのタイトル |
|
167 | setting_app_title: アプリケーションのタイトル | |
167 | setting_app_subtitle: アプリケーションのサブタイトル |
|
168 | setting_app_subtitle: アプリケーションのサブタイトル |
@@ -164,6 +164,7 field_assignable: 이 역할에 할당될수 있는 티켓 | |||||
164 | field_redirect_existing_links: Redirect existing links |
|
164 | field_redirect_existing_links: Redirect existing links | |
165 | field_estimated_hours: 추정시간 |
|
165 | field_estimated_hours: 추정시간 | |
166 | field_column_names: 컬럼 |
|
166 | field_column_names: 컬럼 | |
|
167 | field_default_value: 기본값 | |||
167 |
|
168 | |||
168 | setting_app_title: 레드마인 제목 |
|
169 | setting_app_title: 레드마인 제목 | |
169 | setting_app_subtitle: 레드마인 부제목 |
|
170 | setting_app_subtitle: 레드마인 부제목 |
@@ -171,7 +171,8 field_estimated_hours: Apskaičiuotas laikas | |||||
171 | field_column_names: Skiltys |
|
171 | field_column_names: Skiltys | |
172 | field_time_zone: Laiko juosta |
|
172 | field_time_zone: Laiko juosta | |
173 | field_searchable: Randamas |
|
173 | field_searchable: Randamas | |
174 |
|
174 | field_default_value: Numatytoji vertė | ||
|
175 | ||||
175 | setting_app_title: Programos pavadinimas |
|
176 | setting_app_title: Programos pavadinimas | |
176 | setting_app_subtitle: Programos paantraštė |
|
177 | setting_app_subtitle: Programos paantraštė | |
177 | setting_welcome_text: Pasveikinimas |
|
178 | setting_welcome_text: Pasveikinimas |
@@ -109,7 +109,7 field_issue: Issue | |||||
109 | field_status: Status |
|
109 | field_status: Status | |
110 | field_notes: Notities |
|
110 | field_notes: Notities | |
111 | field_is_closed: Issue gesloten |
|
111 | field_is_closed: Issue gesloten | |
112 |
field_is_default: Default |
|
112 | field_is_default: Default | |
113 | field_tracker: Tracker |
|
113 | field_tracker: Tracker | |
114 | field_subject: Onderwerp |
|
114 | field_subject: Onderwerp | |
115 | field_due_date: Verwachte datum gereed |
|
115 | field_due_date: Verwachte datum gereed | |
@@ -161,6 +161,7 field_delay: Vertraging | |||||
161 | field_assignable: Issues can be assigned to this role |
|
161 | field_assignable: Issues can be assigned to this role | |
162 | field_redirect_existing_links: Redirect existing links |
|
162 | field_redirect_existing_links: Redirect existing links | |
163 | field_estimated_hours: Estimated time |
|
163 | field_estimated_hours: Estimated time | |
|
164 | field_default_value: Default value | |||
164 |
|
165 | |||
165 | setting_app_title: Applicatie titel |
|
166 | setting_app_title: Applicatie titel | |
166 | setting_app_subtitle: Applicatie ondertitel |
|
167 | setting_app_subtitle: Applicatie ondertitel |
@@ -155,6 +155,7 field_identifier: Identifikator | |||||
155 | field_is_filter: Atrybut filtrowania |
|
155 | field_is_filter: Atrybut filtrowania | |
156 | field_issue_to_id: Powiązania zagadnienia |
|
156 | field_issue_to_id: Powiązania zagadnienia | |
157 | field_delay: Opóźnienie |
|
157 | field_delay: Opóźnienie | |
|
158 | field_default_value: Domyślny | |||
158 |
|
159 | |||
159 | setting_app_title: Tytuł aplikacji |
|
160 | setting_app_title: Tytuł aplikacji | |
160 | setting_app_subtitle: Podtytuł aplikacji |
|
161 | setting_app_subtitle: Podtytuł aplikacji |
@@ -161,6 +161,7 field_delay: Delay | |||||
161 | field_assignable: Issues can be assigned to this role |
|
161 | field_assignable: Issues can be assigned to this role | |
162 | field_redirect_existing_links: Redirect existing links |
|
162 | field_redirect_existing_links: Redirect existing links | |
163 | field_estimated_hours: Estimated time |
|
163 | field_estimated_hours: Estimated time | |
|
164 | field_default_value: Padrao | |||
164 |
|
165 | |||
165 | setting_app_title: Titulo da aplicacao |
|
166 | setting_app_title: Titulo da aplicacao | |
166 | setting_app_subtitle: Sub-titulo da aplicacao |
|
167 | setting_app_subtitle: Sub-titulo da aplicacao |
@@ -161,6 +161,7 field_delay: Atraso | |||||
161 | field_assignable: Issues can be assigned to this role |
|
161 | field_assignable: Issues can be assigned to this role | |
162 | field_redirect_existing_links: Redirect existing links |
|
162 | field_redirect_existing_links: Redirect existing links | |
163 | field_estimated_hours: Estimated time |
|
163 | field_estimated_hours: Estimated time | |
|
164 | field_default_value: Padrão | |||
164 |
|
165 | |||
165 | setting_app_title: Título da aplicação |
|
166 | setting_app_title: Título da aplicação | |
166 | setting_app_subtitle: Sub-título da aplicação |
|
167 | setting_app_subtitle: Sub-título da aplicação |
@@ -161,6 +161,7 field_delay: Intarziere | |||||
161 | field_assignable: La acest rol se poate atribui tichete |
|
161 | field_assignable: La acest rol se poate atribui tichete | |
162 | field_redirect_existing_links: Redirectare linkuri existente |
|
162 | field_redirect_existing_links: Redirectare linkuri existente | |
163 | field_estimated_hours: Timpul estimat |
|
163 | field_estimated_hours: Timpul estimat | |
|
164 | field_default_value: Default value | |||
164 |
|
165 | |||
165 | setting_app_title: Titlul aplicatiei |
|
166 | setting_app_title: Titlul aplicatiei | |
166 | setting_app_subtitle: Subtitlul aplicatiei |
|
167 | setting_app_subtitle: Subtitlul aplicatiei |
@@ -166,6 +166,7 field_assignable: Задача может быть назначена этой | |||||
166 | field_redirect_existing_links: Перенаправить существующие ссылки |
|
166 | field_redirect_existing_links: Перенаправить существующие ссылки | |
167 | field_estimated_hours: Оцененное время |
|
167 | field_estimated_hours: Оцененное время | |
168 | field_column_names: Колонки |
|
168 | field_column_names: Колонки | |
|
169 | field_default_value: Default value | |||
169 |
|
170 | |||
170 | setting_app_title: Название приложения |
|
171 | setting_app_title: Название приложения | |
171 | setting_app_subtitle: Подзаголовок приложения |
|
172 | setting_app_subtitle: Подзаголовок приложения |
@@ -166,6 +166,7 field_assignable: Kartice mogu biti dodeljene ovoj ulozi | |||||
166 | field_redirect_existing_links: Redirekcija postojećih linkova |
|
166 | field_redirect_existing_links: Redirekcija postojećih linkova | |
167 | field_estimated_hours: Procenjeno vreme |
|
167 | field_estimated_hours: Procenjeno vreme | |
168 | field_column_names: Kolone |
|
168 | field_column_names: Kolone | |
|
169 | field_default_value: Default value | |||
169 |
|
170 | |||
170 | setting_app_title: Naziv aplikacije |
|
171 | setting_app_title: Naziv aplikacije | |
171 | setting_app_subtitle: Podnaslov aplikacije |
|
172 | setting_app_subtitle: Podnaslov aplikacije |
@@ -161,6 +161,7 field_delay: Delay | |||||
161 | field_assignable: Issues can be assigned to this role |
|
161 | field_assignable: Issues can be assigned to this role | |
162 | field_redirect_existing_links: Redirect existing links |
|
162 | field_redirect_existing_links: Redirect existing links | |
163 | field_estimated_hours: Estimated time |
|
163 | field_estimated_hours: Estimated time | |
|
164 | field_default_value: Default value | |||
164 |
|
165 | |||
165 | setting_app_title: Applikationstitel |
|
166 | setting_app_title: Applikationstitel | |
166 | setting_app_subtitle: Applicationsunderrubrik |
|
167 | setting_app_subtitle: Applicationsunderrubrik |
@@ -174,6 +174,7 field_estimated_hours: 預估工時 | |||||
174 | field_column_names: Columns |
|
174 | field_column_names: Columns | |
175 | field_time_zone: 時區 |
|
175 | field_time_zone: 時區 | |
176 | field_searchable: 可用做搜尋條件 |
|
176 | field_searchable: 可用做搜尋條件 | |
|
177 | field_default_value: Default value | |||
177 |
|
178 | |||
178 | setting_app_title: 標題 |
|
179 | setting_app_title: 標題 | |
179 | setting_app_subtitle: 副標題 |
|
180 | setting_app_subtitle: 副標題 |
@@ -164,6 +164,7 field_delay: Delay | |||||
164 | field_assignable: Issues can be assigned to this role |
|
164 | field_assignable: Issues can be assigned to this role | |
165 | field_redirect_existing_links: Redirect existing links |
|
165 | field_redirect_existing_links: Redirect existing links | |
166 | field_estimated_hours: Estimated time |
|
166 | field_estimated_hours: Estimated time | |
|
167 | field_default_value: Default value | |||
167 |
|
168 | |||
168 | setting_app_title: 应用程序标题 |
|
169 | setting_app_title: 应用程序标题 | |
169 | setting_app_subtitle: 应用程序子标题 |
|
170 | setting_app_subtitle: 应用程序子标题 |
@@ -10,6 +10,7 custom_fields_001: | |||||
10 | id: 1 |
|
10 | id: 1 | |
11 | is_required: false |
|
11 | is_required: false | |
12 | field_format: list |
|
12 | field_format: list | |
|
13 | default_value: "" | |||
13 | custom_fields_002: |
|
14 | custom_fields_002: | |
14 | name: Searchable field |
|
15 | name: Searchable field | |
15 | min_length: 1 |
|
16 | min_length: 1 | |
@@ -22,6 +23,7 custom_fields_002: | |||||
22 | is_required: false |
|
23 | is_required: false | |
23 | field_format: string |
|
24 | field_format: string | |
24 | searchable: true |
|
25 | searchable: true | |
|
26 | default_value: "Default string" | |||
25 | custom_fields_003: |
|
27 | custom_fields_003: | |
26 | name: Development status |
|
28 | name: Development status | |
27 | min_length: 0 |
|
29 | min_length: 0 | |
@@ -33,6 +35,7 custom_fields_003: | |||||
33 | id: 3 |
|
35 | id: 3 | |
34 | is_required: true |
|
36 | is_required: true | |
35 | field_format: list |
|
37 | field_format: list | |
|
38 | default_value: "" | |||
36 | custom_fields_004: |
|
39 | custom_fields_004: | |
37 | name: Phone number |
|
40 | name: Phone number | |
38 | min_length: 0 |
|
41 | min_length: 0 | |
@@ -44,6 +47,7 custom_fields_004: | |||||
44 | id: 4 |
|
47 | id: 4 | |
45 | is_required: false |
|
48 | is_required: false | |
46 | field_format: string |
|
49 | field_format: string | |
|
50 | default_value: "" | |||
47 | custom_fields_005: |
|
51 | custom_fields_005: | |
48 | name: Money |
|
52 | name: Money | |
49 | min_length: 0 |
|
53 | min_length: 0 | |
@@ -55,4 +59,5 custom_fields_005: | |||||
55 | id: 5 |
|
59 | id: 5 | |
56 | is_required: false |
|
60 | is_required: false | |
57 | field_format: float |
|
61 | field_format: float | |
|
62 | default_value: "" | |||
58 | No newline at end of file |
|
63 |
@@ -34,7 +34,10 class IssuesControllerTest < Test::Unit::TestCase | |||||
34 | :enabled_modules, |
|
34 | :enabled_modules, | |
35 | :enumerations, |
|
35 | :enumerations, | |
36 | :attachments, |
|
36 | :attachments, | |
37 | :workflows |
|
37 | :workflows, | |
|
38 | :custom_fields, | |||
|
39 | :custom_values, | |||
|
40 | :custom_fields_trackers | |||
38 |
|
41 | |||
39 | def setup |
|
42 | def setup | |
40 | @controller = IssuesController.new |
|
43 | @controller = IssuesController.new | |
@@ -132,6 +135,9 class IssuesControllerTest < Test::Unit::TestCase | |||||
132 | get :new, :project_id => 1, :tracker_id => 1 |
|
135 | get :new, :project_id => 1, :tracker_id => 1 | |
133 | assert_response :success |
|
136 | assert_response :success | |
134 | assert_template 'new' |
|
137 | assert_template 'new' | |
|
138 | ||||
|
139 | assert_tag :tag => 'input', :attributes => { :name => 'custom_fields[2]', | |||
|
140 | :value => 'Default string' } | |||
135 | end |
|
141 | end | |
136 |
|
142 | |||
137 | def test_get_new_without_tracker_id |
|
143 | def test_get_new_without_tracker_id | |
@@ -162,9 +168,16 class IssuesControllerTest < Test::Unit::TestCase | |||||
162 | :issue => {:tracker_id => 1, |
|
168 | :issue => {:tracker_id => 1, | |
163 | :subject => 'This is the test_new issue', |
|
169 | :subject => 'This is the test_new issue', | |
164 | :description => 'This is the description', |
|
170 | :description => 'This is the description', | |
165 | :priority_id => 5} |
|
171 | :priority_id => 5}, | |
|
172 | :custom_fields => {'2' => 'Value for field 2'} | |||
166 | assert_redirected_to 'projects/ecookbook/issues' |
|
173 | assert_redirected_to 'projects/ecookbook/issues' | |
167 | assert Issue.find_by_subject('This is the test_new issue') |
|
174 | ||
|
175 | issue = Issue.find_by_subject('This is the test_new issue') | |||
|
176 | assert_not_nil issue | |||
|
177 | assert_equal 2, issue.author_id | |||
|
178 | v = issue.custom_values.find_by_custom_field_id(2) | |||
|
179 | assert_not_nil v | |||
|
180 | assert_equal 'Value for field 2', v.value | |||
168 | end |
|
181 | end | |
169 |
|
182 | |||
170 | def test_copy_issue |
|
183 | def test_copy_issue |
@@ -1,7 +1,16 | |||||
1 | require "#{File.dirname(__FILE__)}/../test_helper" |
|
1 | require "#{File.dirname(__FILE__)}/../test_helper" | |
2 |
|
2 | |||
3 | class IssuesTest < ActionController::IntegrationTest |
|
3 | class IssuesTest < ActionController::IntegrationTest | |
4 | fixtures :projects, :users, :trackers, :issue_statuses, :issues, :enumerations |
|
4 | fixtures :projects, | |
|
5 | :users, | |||
|
6 | :trackers, | |||
|
7 | :projects_trackers, | |||
|
8 | :issue_statuses, | |||
|
9 | :issues, | |||
|
10 | :enumerations, | |||
|
11 | :custom_fields, | |||
|
12 | :custom_values, | |||
|
13 | :custom_fields_trackers | |||
5 |
|
14 | |||
6 | # create an issue |
|
15 | # create an issue | |
7 | def test_add_issue |
|
16 | def test_add_issue | |
@@ -18,7 +27,8 class IssuesTest < ActionController::IntegrationTest | |||||
18 | :description => "new issue", |
|
27 | :description => "new issue", | |
19 | :done_ratio => "0", |
|
28 | :done_ratio => "0", | |
20 | :due_date => "", |
|
29 | :due_date => "", | |
21 | :assigned_to_id => "" } |
|
30 | :assigned_to_id => "" }, | |
|
31 | :custom_fields => {'2' => 'Value for field 2'} | |||
22 | # find created issue |
|
32 | # find created issue | |
23 | issue = Issue.find_by_subject("new test issue") |
|
33 | issue = Issue.find_by_subject("new test issue") | |
24 | assert_kind_of Issue, issue |
|
34 | assert_kind_of Issue, issue |
@@ -31,4 +31,15 class CustomValueTest < Test::Unit::TestCase | |||||
31 | v.value = '6a' |
|
31 | v.value = '6a' | |
32 | assert !v.save |
|
32 | assert !v.save | |
33 | end |
|
33 | end | |
|
34 | ||||
|
35 | def test_default_value | |||
|
36 | field = CustomField.find_by_default_value('Default string') | |||
|
37 | assert_not_nil field | |||
|
38 | ||||
|
39 | v = CustomValue.new(:custom_field => field) | |||
|
40 | assert_equal 'Default string', v.value | |||
|
41 | ||||
|
42 | v = CustomValue.new(:custom_field => field, :value => 'Not empty') | |||
|
43 | assert_equal 'Not empty', v.value | |||
|
44 | end | |||
34 | end |
|
45 | end |
General Comments 0
You need to be logged in to leave comments.
Login now