Before, users needed to navigate to the list of groups in order to add, edit or delete a group. Also, they need to navigate to the list of groups first, and then to the list of headings for that group in order to add, edit or delete a heading. Now, it's possible to do all these actions for any group or heading from the participatory budget view to bring simplicity and to reduce the number of clicks from a user perspective. Co-Authored-By: Javi Martín <javim@elretirao.net>
32 lines
702 B
Ruby
32 lines
702 B
Ruby
class Admin::BudgetsWizard::HeadingsController < Admin::BudgetsWizard::BaseController
|
|
include Admin::BudgetHeadingsActions
|
|
|
|
before_action :load_headings, only: [:index, :create]
|
|
|
|
def index
|
|
if single_heading?
|
|
@heading = @group.headings.first_or_initialize
|
|
else
|
|
@heading = @group.headings.new
|
|
end
|
|
end
|
|
|
|
private
|
|
|
|
def headings_index
|
|
if single_heading?
|
|
admin_budgets_wizard_budget_budget_phases_path(@budget, url_params)
|
|
else
|
|
admin_budgets_wizard_budget_group_headings_path(@budget, @group, url_params)
|
|
end
|
|
end
|
|
|
|
def load_headings
|
|
@headings = @group.headings.order(:id)
|
|
end
|
|
|
|
def new_action
|
|
:index
|
|
end
|
|
end
|