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.152 app/views/caboose/pages/admin_edit_permissions.html.erb
caboose-cms-0.5.151 app/views/caboose/pages/admin_edit_permissions.html.erb
caboose-cms-0.5.150 app/views/caboose/pages/admin_edit_permissions.html.erb
caboose-cms-0.5.149 app/views/caboose/pages/admin_edit_permissions.html.erb
caboose-cms-0.5.148 app/views/caboose/pages/admin_edit_permissions.html.erb
caboose-cms-0.5.147 app/views/caboose/pages/admin_edit_permissions.html.erb
caboose-cms-0.5.146 app/views/caboose/pages/admin_edit_permissions.html.erb
caboose-cms-0.5.145 app/views/caboose/pages/admin_edit_permissions.html.erb
caboose-cms-0.5.144 app/views/caboose/pages/admin_edit_permissions.html.erb
caboose-cms-0.5.143 app/views/caboose/pages/admin_edit_permissions.html.erb
caboose-cms-0.5.142 app/views/caboose/pages/admin_edit_permissions.html.erb
caboose-cms-0.5.141 app/views/caboose/pages/admin_edit_permissions.html.erb
caboose-cms-0.5.140 app/views/caboose/pages/admin_edit_permissions.html.erb
caboose-cms-0.5.139 app/views/caboose/pages/admin_edit_permissions.html.erb
caboose-cms-0.5.138 app/views/caboose/pages/admin_edit_permissions.html.erb
caboose-cms-0.5.137 app/views/caboose/pages/admin_edit_permissions.html.erb
caboose-cms-0.5.136 app/views/caboose/pages/admin_edit_permissions.html.erb
caboose-cms-0.5.135 app/views/caboose/pages/admin_edit_permissions.html.erb
caboose-cms-0.5.134 app/views/caboose/pages/admin_edit_permissions.html.erb
caboose-cms-0.5.133 app/views/caboose/pages/admin_edit_permissions.html.erb