permissions form fixes for merb_helpers 0.9.7
parent
63313f84b6
commit
0b100f11ca
|
@ -21,23 +21,17 @@ function check_all(form_name, field_name, checkbox_value)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<%= form_for :permission, :action => url(:permission, @author), :id => 'permission_form' do -%>
|
<%= form_for :permission, :action => url(:permission, @author), :id => 'permission_form' do -%>
|
||||||
<%= hidden_field :name => '_method', :value => 'put' %>
|
<%= hidden_field :name => '_method', :value => 'put' -%>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>Select Author's permissions</legend>
|
<legend>Select Author's permissions</legend>
|
||||||
<p>Select: <a href="#" onclick="check_all('permission_form', 'permissions[]', true); return false">all</a> | <a href="#" onclick="check_all('permission_form', 'permissions[]', false); return false">none</a></p>
|
<p>Select: <a href="#" onclick="check_all('permission_form', 'permissions[]', true); return false">all</a> | <a href="#" onclick="check_all('permission_form', 'permissions[]', false); return false">none</a></p>
|
||||||
<ul style="list-style-type: none">
|
<ul style="list-style-type: none">
|
||||||
<% @permissions.each do |p| -%>
|
<% @permissions.each do |p| -%>
|
||||||
<%
|
<li><input type="checkbox" value="<%= p.id -%>" name="permissions[]" <% if @author.permissions.include?(p) -%>checked="checked"<% end -%> /> <%= p.name -%></li>
|
||||||
attr = { :name => 'permissions[]', :boolean => false, :value => p.id }
|
|
||||||
if @author.permissions.include?(p)
|
|
||||||
attr[:checked] = true
|
|
||||||
end
|
|
||||||
-%>
|
|
||||||
<li><%= checkbox attr -%> <%= p.name -%></li>
|
|
||||||
<% end -%>
|
<% end -%>
|
||||||
</ul>
|
</ul>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<p>
|
<p>
|
||||||
<%= submit 'Save' %>
|
<%= submit 'Save' %>
|
||||||
</p>
|
</p>
|
||||||
<% end -%>
|
<% end =%>
|
||||||
|
|
Reference in New Issue