Sha256: ae417b7e8d49cecb45994f025b82da7ab3172c4c405cdd386060867c311242b6
Contents?: true
Size: 1023 Bytes
Versions: 8
Compression:
Stored size: 1023 Bytes
Contents
# frozen_string_literal: true require_dependency 'c/admin_controller' module C class Admin::MenuItemsController < AdminController load_and_authorize_resource class: C::MenuItem def index @menu_items = @menu_items.hash_tree end def create if @menu_item.save redirect_to menu_items_path, notice: 'Item Created' else render :new end end def update if @menu_item.update(menu_item_params) redirect_to menu_items_path, notice: 'Item Updated' else render :edit end end def update_order children = params.require(:order) MenuItem.update(children.keys, children.values) end def destroy @menu_item.destroy respond_to do |format| format.js format.html { redirect_to [:menu_items] } end end def confirm_destroy; end private def menu_item_params params.require(:menu_item).permit(:name, :link, :target, :page_id, :parent_id) end end end
Version data entries
8 entries across 8 versions & 1 rubygems