@@ -1,128 +1,128 | |||
|
1 | 1 | <%= error_messages_for 'custom_field' %> |
|
2 | 2 | |
|
3 | 3 | <script type="text/javascript"> |
|
4 | 4 | //<![CDATA[ |
|
5 | 5 | function toggle_custom_field_format() { |
|
6 | 6 | format = $("custom_field_field_format"); |
|
7 | 7 | p_length = $("custom_field_min_length"); |
|
8 | 8 | p_regexp = $("custom_field_regexp"); |
|
9 | 9 | p_values = $("custom_field_possible_values"); |
|
10 | 10 | p_searchable = $("custom_field_searchable"); |
|
11 | 11 | p_default = $("custom_field_default_value"); |
|
12 | 12 | p_multiple = $("custom_field_multiple"); |
|
13 | 13 | |
|
14 | 14 | p_default.setAttribute('type','text'); |
|
15 | 15 | Element.show(p_default.parentNode); |
|
16 | 16 | |
|
17 | 17 | switch (format.value) { |
|
18 | 18 | case "list": |
|
19 | 19 | Element.hide(p_length.parentNode); |
|
20 | 20 | Element.hide(p_regexp.parentNode); |
|
21 | 21 | if (p_searchable) Element.show(p_searchable.parentNode); |
|
22 | 22 | Element.show(p_values.parentNode); |
|
23 | 23 | Element.show(p_multiple.parentNode); |
|
24 | 24 | break; |
|
25 | 25 | case "bool": |
|
26 | 26 | p_default.setAttribute('type','checkbox'); |
|
27 | 27 | Element.hide(p_length.parentNode); |
|
28 | 28 | Element.hide(p_regexp.parentNode); |
|
29 | 29 | if (p_searchable) Element.hide(p_searchable.parentNode); |
|
30 | 30 | Element.hide(p_values.parentNode); |
|
31 | 31 | Element.hide(p_multiple.parentNode); |
|
32 | 32 | break; |
|
33 | 33 | case "date": |
|
34 | 34 | Element.hide(p_length.parentNode); |
|
35 | 35 | Element.hide(p_regexp.parentNode); |
|
36 | 36 | if (p_searchable) Element.hide(p_searchable.parentNode); |
|
37 | 37 | Element.hide(p_values.parentNode); |
|
38 | 38 | Element.hide(p_multiple.parentNode); |
|
39 | 39 | break; |
|
40 | 40 | case "float": |
|
41 | 41 | case "int": |
|
42 | 42 | Element.show(p_length.parentNode); |
|
43 | 43 | Element.show(p_regexp.parentNode); |
|
44 | 44 | if (p_searchable) Element.hide(p_searchable.parentNode); |
|
45 | 45 | Element.hide(p_values.parentNode); |
|
46 | 46 | Element.hide(p_multiple.parentNode); |
|
47 | 47 | break; |
|
48 | 48 | case "user": |
|
49 | 49 | case "version": |
|
50 | 50 | Element.hide(p_length.parentNode); |
|
51 | 51 | Element.hide(p_regexp.parentNode); |
|
52 | 52 | if (p_searchable) Element.hide(p_searchable.parentNode); |
|
53 | 53 | Element.hide(p_values.parentNode); |
|
54 | 54 | Element.hide(p_default.parentNode); |
|
55 | 55 | Element.show(p_multiple.parentNode); |
|
56 | 56 | break; |
|
57 | 57 | default: |
|
58 | 58 | Element.show(p_length.parentNode); |
|
59 | 59 | Element.show(p_regexp.parentNode); |
|
60 | 60 | if (p_searchable) Element.show(p_searchable.parentNode); |
|
61 | 61 | Element.hide(p_values.parentNode); |
|
62 | 62 | Element.hide(p_multiple.parentNode); |
|
63 | 63 | break; |
|
64 | 64 | } |
|
65 | 65 | } |
|
66 | 66 | |
|
67 | 67 | //]]> |
|
68 | 68 | </script> |
|
69 | 69 | |
|
70 | 70 | <div class="box tabular"> |
|
71 | 71 | <p><%= f.text_field :name, :required => true %></p> |
|
72 | 72 | <p><%= f.select :field_format, custom_field_formats_for_select(@custom_field), {}, :onchange => "toggle_custom_field_format();", |
|
73 | 73 | :disabled => !@custom_field.new_record? %></p> |
|
74 | <p><%= f.check_box :multiple, :disabled => !@custom_field.new_record? %></p> | |
|
74 | <p><%= f.check_box :multiple, :disabled => @custom_field.multiple && !@custom_field.new_record? %></p> | |
|
75 | 75 | <p><label for="custom_field_min_length"><%=l(:label_min_max_length)%></label> |
|
76 | 76 | <%= f.text_field :min_length, :size => 5, :no_label => true %> - |
|
77 | 77 | <%= f.text_field :max_length, :size => 5, :no_label => true %><br />(<%=l(:text_min_max_length_info)%>)</p> |
|
78 | 78 | <p><%= f.text_field :regexp, :size => 50 %><br />(<%=l(:text_regexp_info)%>)</p> |
|
79 | 79 | <p> |
|
80 | 80 | <%= f.text_area :possible_values, :value => @custom_field.possible_values.to_a.join("\n"), :rows => 15 %> |
|
81 | 81 | <br /><em><%= l(:text_custom_field_possible_values_info) %></em> |
|
82 | 82 | </p> |
|
83 | 83 | <p><%= @custom_field.field_format == 'bool' ? f.check_box(:default_value) : f.text_field(:default_value) %></p> |
|
84 | 84 | <%= call_hook(:view_custom_fields_form_upper_box, :custom_field => @custom_field, :form => f) %> |
|
85 | 85 | </div> |
|
86 | 86 | |
|
87 | 87 | <div class="box tabular"> |
|
88 | 88 | <% case @custom_field.class.name |
|
89 | 89 | when "IssueCustomField" %> |
|
90 | 90 | |
|
91 | 91 | <fieldset><legend><%=l(:label_tracker_plural)%></legend> |
|
92 | 92 | <% Tracker.all.each do |tracker| %> |
|
93 | 93 | <%= check_box_tag "custom_field[tracker_ids][]", |
|
94 | 94 | tracker.id, |
|
95 | 95 | (@custom_field.trackers.include? tracker), |
|
96 | 96 | :id => "custom_field_tracker_ids_#{tracker.id}" %> |
|
97 | 97 | <label class="no-css" for="custom_field_tracker_ids_<%=tracker.id%>"> |
|
98 | 98 | <%= h(tracker.name) %> |
|
99 | 99 | </label> |
|
100 | 100 | <% end %> |
|
101 | 101 | <%= hidden_field_tag "custom_field[tracker_ids][]", '' %> |
|
102 | 102 | </fieldset> |
|
103 | 103 | |
|
104 | 104 | <p><%= f.check_box :is_required %></p> |
|
105 | 105 | <p><%= f.check_box :is_for_all %></p> |
|
106 | 106 | <p><%= f.check_box :is_filter %></p> |
|
107 | 107 | <p><%= f.check_box :searchable %></p> |
|
108 | 108 | |
|
109 | 109 | <% when "UserCustomField" %> |
|
110 | 110 | <p><%= f.check_box :is_required %></p> |
|
111 | 111 | <p><%= f.check_box :visible %></p> |
|
112 | 112 | <p><%= f.check_box :editable %></p> |
|
113 | 113 | |
|
114 | 114 | <% when "ProjectCustomField" %> |
|
115 | 115 | <p><%= f.check_box :is_required %></p> |
|
116 | 116 | <p><%= f.check_box :visible %></p> |
|
117 | 117 | <p><%= f.check_box :searchable %></p> |
|
118 | 118 | |
|
119 | 119 | <% when "TimeEntryCustomField" %> |
|
120 | 120 | <p><%= f.check_box :is_required %></p> |
|
121 | 121 | |
|
122 | 122 | <% else %> |
|
123 | 123 | <p><%= f.check_box :is_required %></p> |
|
124 | 124 | |
|
125 | 125 | <% end %> |
|
126 | 126 | <%= call_hook(:"view_custom_fields_form_#{@custom_field.type.to_s.underscore}", :custom_field => @custom_field, :form => f) %> |
|
127 | 127 | </div> |
|
128 | 128 | <%= javascript_tag "toggle_custom_field_format();" %> |
General Comments 0
You need to be logged in to leave comments.
Login now