@@ -1,47 +1,47 | |||||
1 | <%= custom_field_title @custom_field %> |
|
1 | <%= custom_field_title @custom_field %> | |
2 |
|
2 | |||
3 | <% if @custom_field.enumerations.any? %> |
|
3 | <% if @custom_field.enumerations.any? %> | |
4 | <%= form_tag custom_field_enumerations_path(@custom_field), :method => 'put' do %> |
|
4 | <%= form_tag custom_field_enumerations_path(@custom_field), :method => 'put' do %> | |
5 | <div class="box"> |
|
5 | <div class="box"> | |
6 | <ul id="custom_field_enumerations" class="flat"> |
|
6 | <ul id="custom_field_enumerations" class="flat"> | |
7 | <% @custom_field.enumerations.each_with_index do |value, position| %> |
|
7 | <% @custom_field.enumerations.each_with_index do |value, position| %> | |
8 | <li> |
|
8 | <li> | |
9 |
<span class="sort-handle |
|
9 | <span class="sort-handle"></span> | |
10 | <%= hidden_field_tag "custom_field_enumerations[#{value.id}][position]", position, :class => 'position' %> |
|
10 | <%= hidden_field_tag "custom_field_enumerations[#{value.id}][position]", position, :class => 'position' %> | |
11 | <%= text_field_tag "custom_field_enumerations[#{value.id}][name]", value.name, :size => 40 %> |
|
11 | <%= text_field_tag "custom_field_enumerations[#{value.id}][name]", value.name, :size => 40 %> | |
12 | <%= hidden_field_tag "custom_field_enumerations[#{value.id}][active]", 0 %> |
|
12 | <%= hidden_field_tag "custom_field_enumerations[#{value.id}][active]", 0 %> | |
13 | <label> |
|
13 | <label> | |
14 | <%= check_box_tag "custom_field_enumerations[#{value.id}][active]", 1, value.active? %> |
|
14 | <%= check_box_tag "custom_field_enumerations[#{value.id}][active]", 1, value.active? %> | |
15 | <%= l(:field_active) %> |
|
15 | <%= l(:field_active) %> | |
16 | </label> |
|
16 | </label> | |
17 | <%= delete_link custom_field_enumeration_path(@custom_field, value) %> |
|
17 | <%= delete_link custom_field_enumeration_path(@custom_field, value) %> | |
18 | </li> |
|
18 | </li> | |
19 | <% end %> |
|
19 | <% end %> | |
20 | </ul> |
|
20 | </ul> | |
21 | </div> |
|
21 | </div> | |
22 | <p> |
|
22 | <p> | |
23 | <%= submit_tag(l(:button_save)) %> | |
|
23 | <%= submit_tag(l(:button_save)) %> | | |
24 | <%= link_to l(:button_back), edit_custom_field_path(@custom_field) %> |
|
24 | <%= link_to l(:button_back), edit_custom_field_path(@custom_field) %> | |
25 | </p> |
|
25 | </p> | |
26 | <% end %> |
|
26 | <% end %> | |
27 | <% end %> |
|
27 | <% end %> | |
28 |
|
28 | |||
29 | <p><%= l(:label_enumeration_new) %></p> |
|
29 | <p><%= l(:label_enumeration_new) %></p> | |
30 |
|
30 | |||
31 | <%= form_tag custom_field_enumerations_path(@custom_field), :method => 'post', :remote => true do %> |
|
31 | <%= form_tag custom_field_enumerations_path(@custom_field), :method => 'post', :remote => true do %> | |
32 | <p><%= text_field_tag 'custom_field_enumeration[name]', '', :size => 40 %> |
|
32 | <p><%= text_field_tag 'custom_field_enumeration[name]', '', :size => 40 %> | |
33 | <%= submit_tag(l(:button_add)) %></p> |
|
33 | <%= submit_tag(l(:button_add)) %></p> | |
34 | <% end %> |
|
34 | <% end %> | |
35 |
|
35 | |||
36 | <%= javascript_tag do %> |
|
36 | <%= javascript_tag do %> | |
37 | $(function() { |
|
37 | $(function() { | |
38 | $("#custom_field_enumerations").sortable({ |
|
38 | $("#custom_field_enumerations").sortable({ | |
39 | handle: ".sort-handle", |
|
39 | handle: ".sort-handle", | |
40 | update: function(event, ui) { |
|
40 | update: function(event, ui) { | |
41 | $("#custom_field_enumerations li").each(function(){ |
|
41 | $("#custom_field_enumerations li").each(function(){ | |
42 | $(this).find("input.position").val($(this).index()+1); |
|
42 | $(this).find("input.position").val($(this).index()+1); | |
43 | }); |
|
43 | }); | |
44 | } |
|
44 | } | |
45 | }); |
|
45 | }); | |
46 | }); |
|
46 | }); | |
47 | <% end %> |
|
47 | <% end %> |
General Comments 0
You need to be logged in to leave comments.
Login now