Class: Decidim::Budgets::OrdersController
- Inherits:
-
ApplicationController
- Object
- Components::BaseController
- ApplicationController
- Decidim::Budgets::OrdersController
- Includes:
- NeedsCurrentOrder
- Defined in:
- decidim-budgets/app/controllers/decidim/budgets/orders_controller.rb
Overview
Exposes the order resource so users can checkout it.
Instance Method Summary collapse
Methods inherited from ApplicationController
#current_workflow, #show_votes_count?, #voting_finished?, #voting_open?
Instance Method Details
#checkout ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'decidim-budgets/app/controllers/decidim/budgets/orders_controller.rb', line 9 def checkout :vote, :project, order: current_order, budget: budget, workflow: current_workflow Checkout.call(current_order) do on(:ok) do flash[:notice] = I18n.t("orders.checkout.success", scope: "decidim") redirect_to budgets_path end on(:invalid) do flash.now[:alert] = I18n.t("orders.checkout.error", scope: "decidim") redirect_to budgets_path end end end |
#destroy ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'decidim-budgets/app/controllers/decidim/budgets/orders_controller.rb', line 25 def destroy CancelOrder.call(current_order) do on(:ok) do flash[:notice] = I18n.t("orders.destroy.success", scope: "decidim") redirect_to redirect_path end on(:invalid) do flash.now[:alert] = I18n.t("orders.destroy.error", scope: "decidim") redirect_to redirect_path end end end |