Class: Katalyst::Navigation::MenusController
- Inherits:
-
BaseController
- Object
- ActionController::Base
- BaseController
- Katalyst::Navigation::MenusController
- Defined in:
- app/controllers/katalyst/navigation/menus_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
-
#update ⇒ Object
PATCH /admins/navigation_menus/:slug.
Instance Method Details
#create ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'app/controllers/katalyst/navigation/menus_controller.rb', line 28 def create = Menu.new() if .save redirect_to else render :new, locals: { menu: }, status: :unprocessable_entity end end |
#destroy ⇒ Object
61 62 63 64 65 66 67 |
# File 'app/controllers/katalyst/navigation/menus_controller.rb', line 61 def destroy = Menu.find(params[:id]) .destroy! redirect_to action: :index, status: :see_other end |
#edit ⇒ Object
22 23 24 25 26 |
# File 'app/controllers/katalyst/navigation/menus_controller.rb', line 22 def edit = Menu.find(params[:id]) render locals: { menu: } end |
#index ⇒ Object
6 7 8 9 10 |
# File 'app/controllers/katalyst/navigation/menus_controller.rb', line 6 def index sort, = table_sort(Menu.all) render locals: { menus: , sort: sort } end |
#new ⇒ Object
18 19 20 |
# File 'app/controllers/katalyst/navigation/menus_controller.rb', line 18 def new render locals: { menu: Menu.new } end |
#show ⇒ Object
12 13 14 15 16 |
# File 'app/controllers/katalyst/navigation/menus_controller.rb', line 12 def show = Menu.find(params[:id]) render locals: { menu: } end |
#update ⇒ Object
PATCH /admins/navigation_menus/:slug
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'app/controllers/katalyst/navigation/menus_controller.rb', line 39 def update = Menu.find(params[:id]) .attributes = unless .valid? return render turbo_stream: helpers.(menu: ), status: :unprocessable_entity end case params[:commit] when "publish" .save! .publish! when "save" .save! when "revert" .revert! end redirect_to end |