Class: Decidim::DecidimAwesome::Admin::MenuHacksController
- Inherits:
-
ApplicationController
- Object
- Admin::ApplicationController
- ApplicationController
- Decidim::DecidimAwesome::Admin::MenuHacksController
- Includes:
- NeedsAwesomeConfig
- Defined in:
- app/controllers/decidim/decidim_awesome/admin/menu_hacks_controller.rb
Overview
Editing menu items
Instance Method Summary collapse
Methods included from NeedsAwesomeConfig
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'app/controllers/decidim/decidim_awesome/admin/menu_hacks_controller.rb', line 25 def create @form = form(MenuForm).from_params(params) CreateMenuHack.call(@form, ) do on(:ok) do flash[:notice] = I18n.t("menu_hacks.create.success", scope: "decidim.decidim_awesome.admin") redirect_to decidim_admin_decidim_awesome. end on(:invalid) do || flash.now[:alert] = I18n.t("menu_hacks.create.error", error: , scope: "decidim.decidim_awesome.admin") render :new end end end |
#destroy ⇒ Object
59 60 61 62 63 64 65 66 67 68 69 |
# File 'app/controllers/decidim/decidim_awesome/admin/menu_hacks_controller.rb', line 59 def destroy DestroyMenuHack.call(, , current_organization) do on(:ok) do flash[:notice] = I18n.t("menu_hacks.destroy.success", scope: "decidim.decidim_awesome.admin") end on(:invalid) do |error| flash[:alert] = I18n.t("menu_hacks.destroy.error", scope: "decidim.decidim_awesome.admin", error: error) end end redirect_to decidim_admin_decidim_awesome. end |
#edit ⇒ Object
40 41 42 |
# File 'app/controllers/decidim/decidim_awesome/admin/menu_hacks_controller.rb', line 40 def edit @form = form(MenuForm).from_model() end |
#index ⇒ Object
19 |
# File 'app/controllers/decidim/decidim_awesome/admin/menu_hacks_controller.rb', line 19 def index; end |
#new ⇒ Object
21 22 23 |
# File 'app/controllers/decidim/decidim_awesome/admin/menu_hacks_controller.rb', line 21 def new @form = form(MenuForm).instance end |
#update ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'app/controllers/decidim/decidim_awesome/admin/menu_hacks_controller.rb', line 44 def update @form = form(MenuForm).from_params(params) UpdateMenuHack.call(@form, ) do on(:ok) do flash[:notice] = I18n.t("menu_hacks.update.success", scope: "decidim.decidim_awesome.admin") redirect_to decidim_admin_decidim_awesome. end on(:invalid) do || flash.now[:alert] = I18n.t("menu_hacks.update.error", error: , scope: "decidim.decidim_awesome.admin") render :edit end end end |