-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_form.html.haml
59 lines (58 loc) · 2.04 KB
/
_form.html.haml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
= nested_form_for @evaluation do |f|
%table.resource.evaluation
%tbody
%tr
%th= f.label :name
%td
= f.text_field :name
= errors_for @evaluation, :name
%tr
%th= f.label :criteria
%td.table
%table.list.criteria
%thead
%tr
%th Position
%th Prompt
%th Delete
%th Alternatives
= f.fields_for :criteria, :collection_tag => 'tbody', :fields_tag => 'tr' do |f|
%td
= f.text_field :position, :size => 1
= errors_for f.object, :position
%td
= f.text_field :prompt
= errors_for f.object, :prompt
%td.delete
= f.hidden_field :id
= f.link_to_remove do
= image_tag 'delete.png', :alt => 'Remove Criterion'
%td.table
%table.list.alternatives
%thead
%tr
%th Position
%th Label
%th Delete
= f.fields_for :alternatives, :collection_tag => 'tbody', :fields_tag => 'tr' do |f|
%td
= f.text_field :position, :size => 1
= errors_for f.object, :position
%td
= f.text_field :label
= errors_for f.object, :label
%td.delete
= f.hidden_field :id
= f.link_to_remove do
= image_tag 'delete.png', :alt => 'Remove Alternative'
%tfoot
%tr
%td{'colspan' => 2}
= f.link_to_add 'Add Alternative', :alternatives
%tfoot
%tr
%td{'colspan' => 3}
= f.link_to_add 'Add Criterion', :criteria
= f.submit 'Save Evaluation'
%span.or or
= link_to 'Cancel', evaluations_path