_manage_community_fields.html.erb
2.3 KB
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
63
64
65
66
67
68
<%= labelled_form_for(:environment, :url => {:action => 'manage_community_fields'}) do |f| %>
<table id='community_fields_conf'>
<tr>
<th><%= _('Field') %></th>
<th><%= _('Active') %></th>
<th><%= _('Required') %></th>
<th><%= _('Display on creation?') %></th>
</tr>
<tr class='manage-fields-batch-actions'>
<td>
<%= _("Check/Uncheck All")%>
</td>
<td>
<input type="checkbox" id="community_active" />
</td>
<td>
<input type="checkbox" id="community_required" />
</td>
<td>
<input type="checkbox" id="community_signup" />
</td>
</tr>
<% @community_fields.each do |field| %>
<tr>
<td><label for="community_fields[<%= field %>][active]"><%= _(field.humanize) %></label></td>
<td>
<%= hidden_field_tag "community_fields[#{field}][active]", false %>
<%= check_box_tag "community_fields[#{field}][active]", true, environment.custom_community_field(field, 'active'), :onclick => "active_action(this, 'community_fields[#{field}][required]', 'community_fields[#{field}][signup]')" %>
</td>
<td>
<%= hidden_field_tag "community_fields[#{field}][required]", false %>
<%= check_box_tag "community_fields[#{field}][required]", true, environment.custom_community_field(field, 'required'), :onclick => "required_action('community_fields[#{field}][active]','community_fields[#{field}][required]', 'community_fields[#{field}][signup]')" %>
</td>
<td>
<%= hidden_field_tag "community_fields[#{field}][signup]", false %>
<%= check_box_tag "community_fields[#{field}][signup]", true, environment.custom_community_field(field, 'signup'), :onclick => "signup_action('community_fields[#{field}][active]','community_fields[#{field}][required]', 'community_fields[#{field}][signup]')" %>
</td>
</tr>
<% end %>
</table>
<script type='text/javascript'>
var trs = jQuery('#community_fields_conf tr');
var tr, td2;
for ( var i=2; tr=trs[i]; i++ ) {
if ( td2 = tr.getElementsByTagName('td')[1] ) {
td2.getElementsByTagName('input')[1].onclick();
}
}
</script>
<div>
<% button_bar do %>
<%= submit_button('save', _('Save changes'), :id=>"save_community_fields") %>
<%= button :back, _('Back to admin panel'), :controller => 'admin_panel', :action => 'index' %>
<% end %>
</div>
<% end %>