Refactor participatory budgets in draft mode

Previously the draft mode was a phase of the PB, but that had some
limitations.

Now the phase drafting disappears and therefore the PB can have the
status published or not published (in draft mode).

That will give more flexibility in order to navigate through the
different phases and see how it looks for administrators before
publishing the PB and everybody can see.

By default, the PB is always created in draft mode, so it gives you
the flexibility to adjust and modify anything before publishing it.
This commit is contained in:
Julian Herrero
2020-02-12 15:19:14 +07:00
committed by Javi Martín
parent 0b2b8b557d
commit 28caabecdf
21 changed files with 248 additions and 88 deletions

View File

@@ -15,6 +15,7 @@ class Admin::BudgetsController < Admin::BaseController
end
def show
render :edit
end
def new
@@ -23,6 +24,11 @@ class Admin::BudgetsController < Admin::BaseController
def edit
end
def publish
@budget.publish!
redirect_to edit_admin_budget_path(@budget), notice: t("admin.budgets.publish.notice")
end
def calculate_winners
return unless @budget.balloting_process?
@@ -42,9 +48,9 @@ class Admin::BudgetsController < Admin::BaseController
end
def create
@budget = Budget.new(budget_params)
@budget = Budget.new(budget_params.merge(published: false))
if @budget.save
redirect_to admin_budget_path(@budget), notice: t("admin.budgets.create.notice")
redirect_to edit_admin_budget_path(@budget), notice: t("admin.budgets.create.notice")
else
render :new
end