-
Notifications
You must be signed in to change notification settings - Fork 16
/
_form.erb
62 lines (62 loc) · 2.91 KB
/
_form.erb
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
60
61
62
<td class="adm_icon">
<%= unless @relation.new_record?
link_to_remote _('btn_x'), :url => relation_path(@relation, :dir => params[:dir]), :method => :get
else
link_to_function _('btn_x'), "['add_relation', 'add_relation_form'].each(Element.toggle)"
end %>
</td>
<td class="add" colspan="4">
<div id='relation_errors'><%= error_messages_for(:relation, :object => @relation) %></div>
<% unless @relation.new_record? %>
<%= form_remote_tag(:url => relation_path(@relation), :method => :put ) %>
<% else %>
<%= form_remote_tag(:url => relations_path ) %>
<% end %>
<table cellspacing='0' class='edit_relation'>
<tr><th></th><th><%= _('forward') %></th><th><%= _('inverse') %></th></tr>
<tr><td class="label"><%= _('class') %></td>
<td class="light"><%= select('relation', 'source_kpath', Node.kpaths_for_form ) %></td>
<td class="dark"><%= select('relation', 'target_kpath', Node.kpaths_for_form ) %></td>
</tr>
<tr><td class="label" ><%= _('type') %></td>
<td class="light boxes" >
<p>
<%= radio_button("relation", "target_unique", true , :checked => @relation.target_unique?) %>
<label for='relation_target_unique_true'><%= _('has_one') %></label>
</p>
<p>
<%= radio_button("relation", "target_unique", false, :checked => !@relation.target_unique?) %>
<label for='relation_target_unique_false'><%= _('has_many') %></label>
</p>
</td>
<td class="dark boxes" >
<p>
<%= radio_button("relation", "source_unique", true , :checked => @relation.source_unique?) %>
<label for='relation_source_unique_true'><%= _('has_one') %></label>
</p>
<p>
<%= radio_button("relation", "source_unique", false, :checked => !@relation.source_unique?) %>
<label for='relation_source_unique_false'><%= _('has_many') %></label>
</p>
</td>
</tr>
<tr><td class="label" ><%= _('role') %></td>
<td class="light" ><%= text_field('relation', 'target_role', :size=>18 ) %></td>
<td class="dark" ><%= text_field('relation', 'source_role', :size=>18 ) %></td>
</tr>
<tr><td class="label" ><%= _('icon') %></td>
<td class="light" ><%= text_field('relation', 'target_icon', :size=>18 ) %></td>
<td class="dark" ><%= text_field('relation', 'source_icon', :size=>18 ) %></td>
</tr>
<tr><td colspan='3'>
<%= text_area('relation', 'comment', :rows => 2, :cols => 40) %></td>
</td></tr>
<tr><td colspan='3'><p class='btn_validate'><input type='submit' value='<%= _('validate') %>'/></p></td></tr>
</table>
</form>
<% unless @relation.new_record? -%>
<%= form_remote_tag(:url => relation_path(@relation), :method => :delete, :confirm => _('Are you sure you want to destroy this relation ?') ) %>
<p class='destroy'><%= _('destroy relation (with all links)') %> <input type='submit' value='<%= _('destroy') %>'></p>
</form>
<% end -%>
</td>