@@ -5,12 +5,12 | |||
|
5 | 5 | # modify it under the terms of the GNU General Public License |
|
6 | 6 | # as published by the Free Software Foundation; either version 2 |
|
7 | 7 | # of the License, or (at your option) any later version. |
|
8 |
# |
|
|
8 | # | |
|
9 | 9 | # This program is distributed in the hope that it will be useful, |
|
10 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | 12 | # GNU General Public License for more details. |
|
13 |
# |
|
|
13 | # | |
|
14 | 14 | # You should have received a copy of the GNU General Public License |
|
15 | 15 | # along with this program; if not, write to the Free Software |
|
16 | 16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
@@ -29,7 +29,7 module CustomFieldsHelper | |||
|
29 | 29 | {:name => 'DocumentCategoryCustomField', :partial => 'custom_fields/index', :label => DocumentCategory::OptionName} |
|
30 | 30 | ] |
|
31 | 31 | end |
|
32 | ||
|
32 | ||
|
33 | 33 | # Return custom field html tag corresponding to its format |
|
34 | 34 | def custom_field_tag(name, custom_value) |
|
35 | 35 | custom_field = custom_value.custom_field |
@@ -39,7 +39,7 module CustomFieldsHelper | |||
|
39 | 39 | field_format = Redmine::CustomFieldFormat.find_by_name(custom_field.field_format) |
|
40 | 40 | case field_format.try(:edit_as) |
|
41 | 41 | when "date" |
|
42 |
text_field_tag(field_name, custom_value.value, :id => field_id, :size => 10) + |
|
|
42 | text_field_tag(field_name, custom_value.value, :id => field_id, :size => 10) + | |
|
43 | 43 | calendar_for(field_id) |
|
44 | 44 | when "text" |
|
45 | 45 | text_area_tag(field_name, custom_value.value, :id => field_id, :rows => 3, :style => 'width:90%') |
@@ -47,14 +47,14 module CustomFieldsHelper | |||
|
47 | 47 | hidden_field_tag(field_name, '0') + check_box_tag(field_name, '1', custom_value.true?, :id => field_id) |
|
48 | 48 | when "list" |
|
49 | 49 | blank_option = custom_field.is_required? ? |
|
50 |
(custom_field.default_value.blank? ? "<option value=\"\">--- #{l(:actionview_instancetag_blank_option)} ---</option>" : '') : |
|
|
50 | (custom_field.default_value.blank? ? "<option value=\"\">--- #{l(:actionview_instancetag_blank_option)} ---</option>" : '') : | |
|
51 | 51 | '<option></option>' |
|
52 | 52 | select_tag(field_name, blank_option + options_for_select(custom_field.possible_values_options(custom_value.customized), custom_value.value), :id => field_id) |
|
53 | 53 | else |
|
54 | 54 | text_field_tag(field_name, custom_value.value, :id => field_id) |
|
55 | 55 | end |
|
56 | 56 | end |
|
57 | ||
|
57 | ||
|
58 | 58 | # Return custom field label tag |
|
59 | 59 | def custom_field_label_tag(name, custom_value) |
|
60 | 60 | content_tag "label", h(custom_value.custom_field.name) + |
@@ -62,19 +62,19 module CustomFieldsHelper | |||
|
62 | 62 | :for => "#{name}_custom_field_values_#{custom_value.custom_field.id}", |
|
63 | 63 | :class => (custom_value.errors.empty? ? nil : "error" ) |
|
64 | 64 | end |
|
65 | ||
|
65 | ||
|
66 | 66 | # Return custom field tag with its label tag |
|
67 | 67 | def custom_field_tag_with_label(name, custom_value) |
|
68 | 68 | custom_field_label_tag(name, custom_value) + custom_field_tag(name, custom_value) |
|
69 | 69 | end |
|
70 | ||
|
70 | ||
|
71 | 71 | def custom_field_tag_for_bulk_edit(name, custom_field, projects=nil) |
|
72 | 72 | field_name = "#{name}[custom_field_values][#{custom_field.id}]" |
|
73 | 73 | field_id = "#{name}_custom_field_values_#{custom_field.id}" |
|
74 | 74 | field_format = Redmine::CustomFieldFormat.find_by_name(custom_field.field_format) |
|
75 | 75 | case field_format.try(:edit_as) |
|
76 | 76 | when "date" |
|
77 |
text_field_tag(field_name, '', :id => field_id, :size => 10) + |
|
|
77 | text_field_tag(field_name, '', :id => field_id, :size => 10) + | |
|
78 | 78 | calendar_for(field_id) |
|
79 | 79 | when "text" |
|
80 | 80 | text_area_tag(field_name, '', :id => field_id, :rows => 3, :style => 'width:90%') |
@@ -94,7 +94,7 module CustomFieldsHelper | |||
|
94 | 94 | return "" unless custom_value |
|
95 | 95 | format_value(custom_value.value, custom_value.custom_field.field_format) |
|
96 | 96 | end |
|
97 | ||
|
97 | ||
|
98 | 98 | # Return a string used to display a custom value |
|
99 | 99 | def format_value(value, field_format) |
|
100 | 100 | Redmine::CustomFieldFormat.format_value(value, field_format) # Proxy |
@@ -104,7 +104,7 module CustomFieldsHelper | |||
|
104 | 104 | def custom_field_formats_for_select(custom_field) |
|
105 | 105 | Redmine::CustomFieldFormat.as_select(custom_field.class.customized_class.name) |
|
106 | 106 | end |
|
107 | ||
|
107 | ||
|
108 | 108 | # Renders the custom_values in api views |
|
109 | 109 | def render_api_custom_values(custom_values, api) |
|
110 | 110 | api.array :custom_fields do |
General Comments 0
You need to be logged in to leave comments.
Login now