Class: Decidim::Budgets::OrdersController
- Inherits:
-
ApplicationController
- Object
- Components::BaseController
- ApplicationController
- Decidim::Budgets::OrdersController
- Includes:
- NeedsCurrentOrder
- Defined in:
- 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, #voting_finished?, #voting_open?
Instance Method Details
#checkout ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/controllers/decidim/budgets/orders_controller.rb', line 9 def checkout :vote, :project, order: current_order, budget:, workflow: current_workflow Checkout.call(current_order) do on(:ok) do i18n_key = pending_to_vote_budgets.any? ? "success_html" : "success_no_left_budgets_html" flash[:notice] = I18n.t(i18n_key, scope: "decidim.orders.checkout", rest_of_budgets_link: "#budgets") 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
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'app/controllers/decidim/budgets/orders_controller.rb', line 26 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 |