Sha256: a926bcf09e4b8ca556be4f856608c03afea0bcdf2d06ceadbabd09225e3b8f56
Contents?: true
Size: 1.29 KB
Versions: 2
Compression:
Stored size: 1.29 KB
Contents
module Admin class MenusController < ApplicationController before_action(:authenticate_user!) # Devise helper EffectiveMenusAdminHelper layout (EffectivePages.layout.kind_of?(Hash) ? EffectivePages.layout[:admin] : EffectivePages.layout) def index @datatable = EffectiveMenusDatatable.new(self) @page_title = 'Menus' authorize_effective_menus! end def new @menu = Effective::Menu.new() @page_title = 'New Menu' authorize_effective_menus! end def create @menu = Effective::Menu.new(menu_params) @page_title = 'New Menu' authorize_effective_menus! if @menu.save flash[:success] = 'Successfully created menu' redirect_to effective_pages.admin_menu_path(@menu) else flash.now[:danger] = 'Unable to create menu' render :action => :new end end def show @menu = Effective::Menu.find(params[:id]) @page_title = @menu.to_s authorize_effective_menus! end private def authorize_effective_menus! EffectivePages.authorize!(self, :admin, :effective_pages) EffectivePages.authorize!(self, action_name.to_sym, @menu || Effective::Menu) end def menu_params params.require(:effective_menu).permit(:title) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
effective_pages-2.1.0 | app/controllers/admin/menus_controller.rb |
effective_pages-2.0.9 | app/controllers/admin/menus_controller.rb |