Sha256: 8cef24796126c11ad5d1f4dd71a7396f0caf4d5f520fe263c79a490292b9a8b2
Contents?: true
Size: 1.25 KB
Versions: 62
Compression:
Stored size: 1.25 KB
Contents
# frozen_string_literal: true module Decidim module Budgets # Exposes the line items resource so users can create and remove from orders. class LineItemsController < Decidim::Budgets::ApplicationController include NeedsCurrentOrder helper_method :project def create authorize_action! "vote" respond_to do |format| AddLineItem.call(current_order, project, current_user) do on(:ok) do |order| self.current_order = order format.html { redirect_to :back } format.js { render "update_budget" } end on(:invalid) do render nothing: true, status: 422 end end end end def destroy respond_to do |format| RemoveLineItem.call(current_order, project) do on(:ok) do |_order| format.html { redirect_to :back } format.js { render "update_budget" } end on(:invalid) do render nothing: true, status: 422 end end end end private def project @project ||= Project.where(id: params[:project_id], feature: current_feature).first end end end end
Version data entries
62 entries across 62 versions & 2 rubygems