Sha256: 2e65de0d65ffe2475010e50cecfb1744cd3257e04a0306b8bb1c2dc3e50140ab

Contents?: true

Size: 1.6 KB

Versions: 384

Compression:

Stored size: 1.6 KB

Contents

<%= render :partial => 'caboose/pages/admin_header' %>

<p class='uri'>URI: /<span id='uri'><%= @page.uri %></span></p>

<table class='data' id='viewers'>
<tr><th>Role</th><th>View</th><th>Edit</th></tr>
<% Caboose::Role.flat_tree(' - ').each do |r| %>
  <% next if r.id == 1 %>
  <% may_view = Caboose::PagePermission.where(:role_id => r.id, :page_id => @page.id, :action => 'view').exists? %>
  <% may_edit = Caboose::PagePermission.where(:role_id => r.id, :page_id => @page.id, :action => 'edit').exists? %>
  <tr>
    <td><label for='role_<%= r.id %>'><%= r.name %></td>
    <td><input type='checkbox' id='role_<%= r.id %>' value='<%= r.id %>' <%= may_view ? "checked='true'" : '' %> onchange="toggle_page_permission(<%= r.id %>, $(this).prop('checked'), 'view');" /></td>
    <td><input type='checkbox' id='role_<%= r.id %>' value='<%= r.id %>' <%= may_edit ? "checked='true'" : '' %> onchange="toggle_page_permission(<%= r.id %>, $(this).prop('checked'), 'edit');" /></td>
  </tr>
<% end %>
</table>
  
<%= render :partial => 'caboose/pages/admin_footer' %>

<% content_for :caboose_css do %>
<style type='text/css'>
#viewers input[type=checkbox] { position: relative; }
#editors input[type=checkbox] { position: relative; }
</style>
<% end %>
<% content_for :caboose_js do %>
<script type='text/javascript'>

function toggle_page_permission(role_id, checked, action)
{              
  $.ajax({
    url: '/admin/page-permissions',
    type: checked ? 'post' : 'delete',
    data: { 
      page_id: <%= @page.id %>, 
      role_id: role_id, 
      action2: action 
    },
    success: function(resp) {}
  });
}

</script>
<% end %>

Version data entries

384 entries across 384 versions & 1 rubygems

Version Path
caboose-cms-0.5.213 app/views/caboose/pages/admin_edit_permissions.html.erb
caboose-cms-0.5.212 app/views/caboose/pages/admin_edit_permissions.html.erb
caboose-cms-0.5.211 app/views/caboose/pages/admin_edit_permissions.html.erb
caboose-cms-0.5.210 app/views/caboose/pages/admin_edit_permissions.html.erb
caboose-cms-0.5.209 app/views/caboose/pages/admin_edit_permissions.html.erb
caboose-cms-0.5.208 app/views/caboose/pages/admin_edit_permissions.html.erb
caboose-cms-0.5.207 app/views/caboose/pages/admin_edit_permissions.html.erb
caboose-cms-0.5.206 app/views/caboose/pages/admin_edit_permissions.html.erb
caboose-cms-0.5.205 app/views/caboose/pages/admin_edit_permissions.html.erb
caboose-cms-0.5.204 app/views/caboose/pages/admin_edit_permissions.html.erb
caboose-cms-0.5.203 app/views/caboose/pages/admin_edit_permissions.html.erb
caboose-cms-0.5.202 app/views/caboose/pages/admin_edit_permissions.html.erb
caboose-cms-0.5.201 app/views/caboose/pages/admin_edit_permissions.html.erb
caboose-cms-0.5.200 app/views/caboose/pages/admin_edit_permissions.html.erb
caboose-cms-0.5.199 app/views/caboose/pages/admin_edit_permissions.html.erb
caboose-cms-0.5.198 app/views/caboose/pages/admin_edit_permissions.html.erb
caboose-cms-0.5.197 app/views/caboose/pages/admin_edit_permissions.html.erb
caboose-cms-0.5.196 app/views/caboose/pages/admin_edit_permissions.html.erb
caboose-cms-0.5.195 app/views/caboose/pages/admin_edit_permissions.html.erb
caboose-cms-0.5.194 app/views/caboose/pages/admin_edit_permissions.html.erb