Sha256: 4d3ad5e92693cd4884ce60b69fde26c198beed5e3c06c70602cb7eefa1821238

Contents?: true

Size: 1.07 KB

Versions: 13

Compression:

Stored size: 1.07 KB

Contents

class Admin::PermissionsController < ApplicationController
    
  before_filter :find_group
  
  def index
    redirect_to admin_group_url(@group)
  end
  
  def create
    @page = Page.find(params[:page_id])
    raise ActiveRecord::RecordNotFound unless @page
    @permission = Permission.find_or_create_by_page_id_and_group_id(@page.id, @group.id)
    respond_to do |format|
      format.html { 
        flash[:notice] = "#{@page.name} bound to group #{@group.name}"
        redirect_to admin_group_url(@group) 
      }
      format.js { render :partial => 'page' }
    end
  end
  
  def destroy
    @permission = @group.permissions.find(params[:id])
    @page = @permission.page
    @permission.delete if @permission
    respond_to do |format|
      format.html { 
        flash[:notice] = "#{@page.name} released from group #{@group.name}"
        redirect_to admin_group_url(@group)
      }
      format.js { render :partial => 'page' }
    end
  end
  
protected

  def find_group
    @group = Group.find(params[:group_id])
    raise ActiveRecord::RecordNotFound unless @group
  end
  
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
radiant-reader-extension-3.0.0.rc3 app/controllers/admin/permissions_controller.rb
radiant-reader-extension-2.0.0.rc4 app/controllers/admin/permissions_controller.rb
radiant-reader_group-extension-1.2.4 app/controllers/admin/permissions_controller.rb
radiant-reader_group-extension-1.2.3 app/controllers/admin/permissions_controller.rb
radiant-reader_group-extension-1.2.2 app/controllers/admin/permissions_controller.rb
radiant-reader_group-extension-1.2.1 app/controllers/admin/permissions_controller.rb
radiant-reader_group-extension-1.2.0 app/controllers/admin/permissions_controller.rb
radiant-reader_group-extension-1.1.2 app/controllers/admin/permissions_controller.rb
radiant-reader_group-extension-1.1.1 app/controllers/admin/permissions_controller.rb
radiant-reader_group-extension-1.1.0 app/controllers/admin/permissions_controller.rb
radiant-reader_group-extension-1.0.1 app/controllers/admin/permissions_controller.rb
radiant-reader_group-extension-1.0.0 app/controllers/admin/permissions_controller.rb
radiant-reader_group-extension-0.9.0 app/controllers/admin/permissions_controller.rb