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.193 app/views/caboose/pages/admin_edit_permissions.html.erb
caboose-cms-0.5.192 app/views/caboose/pages/admin_edit_permissions.html.erb
caboose-cms-0.5.191 app/views/caboose/pages/admin_edit_permissions.html.erb
caboose-cms-0.5.190 app/views/caboose/pages/admin_edit_permissions.html.erb
caboose-cms-0.5.189 app/views/caboose/pages/admin_edit_permissions.html.erb
caboose-cms-0.5.188 app/views/caboose/pages/admin_edit_permissions.html.erb
caboose-cms-0.5.187 app/views/caboose/pages/admin_edit_permissions.html.erb
caboose-cms-0.5.186 app/views/caboose/pages/admin_edit_permissions.html.erb
caboose-cms-0.5.185 app/views/caboose/pages/admin_edit_permissions.html.erb
caboose-cms-0.5.184 app/views/caboose/pages/admin_edit_permissions.html.erb
caboose-cms-0.5.183 app/views/caboose/pages/admin_edit_permissions.html.erb
caboose-cms-0.5.182 app/views/caboose/pages/admin_edit_permissions.html.erb
caboose-cms-0.5.181 app/views/caboose/pages/admin_edit_permissions.html.erb
caboose-cms-0.5.180 app/views/caboose/pages/admin_edit_permissions.html.erb
caboose-cms-0.5.179 app/views/caboose/pages/admin_edit_permissions.html.erb
caboose-cms-0.5.178 app/views/caboose/pages/admin_edit_permissions.html.erb
caboose-cms-0.5.177 app/views/caboose/pages/admin_edit_permissions.html.erb
caboose-cms-0.5.176 app/views/caboose/pages/admin_edit_permissions.html.erb
caboose-cms-0.5.175 app/views/caboose/pages/admin_edit_permissions.html.erb
caboose-cms-0.5.174 app/views/caboose/pages/admin_edit_permissions.html.erb