Class: Admin::PermissionsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Admin::PermissionsController
- Defined in:
- app/controllers/admin/permissions_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/controllers/admin/permissions_controller.rb', line 9 def create @page = Page.find(params[:page_id]) scope = @group..for(@page) @permission = scope.first || scope.create! respond_to do |format| format.html { flash[:notice] = "#{@page.title} bound to group #{@group.name}" redirect_to admin_group_url(@group) } format.js { render :partial => 'page' } end end |
#destroy ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/controllers/admin/permissions_controller.rb', line 22 def destroy @permission ||= @group..find(params[:id]) @page = @permission.permitted @permission.delete if @permission respond_to do |format| format.html { flash[:notice] = "#{@page.title} released from group #{@group.name}" redirect_to admin_group_url(@group) } format.js { render :partial => 'page' } end end |
#index ⇒ Object
5 6 7 |
# File 'app/controllers/admin/permissions_controller.rb', line 5 def index redirect_to admin_group_url(@group) end |
#toggle ⇒ Object
35 36 37 38 39 40 41 |
# File 'app/controllers/admin/permissions_controller.rb', line 35 def toggle if @permission = @group.(@page) destroy else create end end |