This repository has been archived on 2020-05-27. You can view files and clone it, but cannot push or open issues/pull-requests.
tuxbliki/app/views/permissions/edit.html.erb

38 lines
1.4 KiB
Plaintext
Raw Normal View History

2008-06-27 00:13:15 -04:00
<% throw_content :for_sidebar do -%>
<a href="<%= url(:author, :id => @author.name.gsub(/ /, '_')) -%>"><img src="/images/go-home.png" alt="Author's Home" /> <%= @author.name -%></a><br />
<% end -%>
<script type="text/javascript">
function check_all(form_name, field_name, checkbox_value)
{
if(!document.forms[form_name])
return;
var check_boxes = document.forms[form_name].elements[field_name];
if(!check_boxes)
return;
var count_check_boxes = check_boxes.length;
if(!count_check_boxes)
check_boxes.checked = check_value;
else
// set the check value for all check boxes
for(var i = 0; i < count_check_boxes; i++)
check_boxes[i].checked = checkbox_value;
}
</script>
2008-10-01 02:57:49 -04:00
<%= form_for :permission, :action => url(:permission, @author), :id => 'permission_form' do -%>
<%= hidden_field :name => '_method', :value => 'put' -%>
2008-06-27 00:13:15 -04:00
<fieldset>
<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>
<ul style="list-style-type: none">
<% @permissions.each do |p| -%>
<li><input type="checkbox" value="<%= p.id -%>" name="permissions[]" <% if @author.permissions.include?(p) -%>checked="checked"<% end -%> /> <%= p.name -%></li>
2008-06-27 00:13:15 -04:00
<% end -%>
</ul>
</fieldset>
<p>
2008-10-01 02:57:49 -04:00
<%= submit 'Save' %>
2008-06-27 00:13:15 -04:00
</p>
<% end =%>