Files
nairobi/app/controllers/admin/milestone_statuses_controller.rb
Javi Martín 65c9786db7 Apply Layout/RedundantLineBreak rule to short lines
We're not adding the rule because it would apply the current line length
rule of 110 characters per line. We still haven't decided whether we'll
keep that rule or make lines shorter so they're easier to read,
particularly when vertically splitting the editor window.

So, for now, I'm applying the rule to lines which are about 90
characters long.
2021-09-03 11:49:53 +02:00

48 lines
986 B
Ruby

class Admin::MilestoneStatusesController < Admin::BaseController
before_action :load_status, only: [:edit, :update, :destroy]
def index
@statuses = Milestone::Status.all
end
def new
@status = Milestone::Status.new
end
def create
@status = Milestone::Status.new(status_params)
if @status.save
redirect_to admin_milestone_statuses_path, notice: t("admin.statuses.create.notice")
else
render :new
end
end
def edit
end
def update
if @status.update(status_params)
redirect_to admin_milestone_statuses_path, notice: t("admin.statuses.update.notice")
else
render :edit
end
end
def destroy
@status.destroy!
redirect_to admin_milestone_statuses_path, notice: t("admin.statuses.delete.notice")
end
private
def load_status
@status = Milestone::Status.find(params[:id])
end
def status_params
params.require(:milestone_status).permit([:name, :description])
end
end