2015-10-09 08:17:29 -04:00
|
|
|
class Admin::LeaderSkillsController < Admin::BaseController
|
2015-10-06 13:55:12 -04:00
|
|
|
before_action :set_leader_skill, only: [:show, :edit, :update, :destroy]
|
2015-10-08 15:18:21 -04:00
|
|
|
after_action :verify_authorized
|
2015-10-06 13:55:12 -04:00
|
|
|
|
|
|
|
def index
|
|
|
|
@leader_skills = LeaderSkill.all
|
2015-10-08 15:18:21 -04:00
|
|
|
|
|
|
|
authorize LeaderSkill
|
2015-10-06 13:55:12 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def show
|
2015-10-08 15:18:21 -04:00
|
|
|
authorize @leader_skill
|
2015-10-06 13:55:12 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def new
|
|
|
|
@leader_skill = LeaderSkill.new
|
2015-10-08 15:18:21 -04:00
|
|
|
|
|
|
|
authorize @leader_skill
|
2015-10-06 13:55:12 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def create
|
|
|
|
@leader_skill = LeaderSkill.new(leader_skill_params)
|
|
|
|
|
2015-10-08 15:18:21 -04:00
|
|
|
authorize @leader_skill
|
|
|
|
|
2015-10-06 13:55:12 -04:00
|
|
|
if @leader_skill.save
|
2015-10-09 08:17:29 -04:00
|
|
|
redirect_to admin_leader_skills_path, notice: 'Leader Skill was created'
|
2015-10-06 13:55:12 -04:00
|
|
|
else
|
|
|
|
render :new
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def edit
|
2015-10-08 15:18:21 -04:00
|
|
|
authorize @leader_skill
|
2015-10-06 13:55:12 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def update
|
2015-10-08 15:18:21 -04:00
|
|
|
authorize @leader_skill
|
|
|
|
|
2015-10-06 13:55:12 -04:00
|
|
|
if @leader_skill.update(leader_skill_params)
|
2015-10-09 08:17:29 -04:00
|
|
|
redirect_to admin_leader_skills_path, notice: 'Leader Skill was updated'
|
2015-10-06 13:55:12 -04:00
|
|
|
else
|
|
|
|
render :edit
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def destroy
|
2015-10-08 15:18:21 -04:00
|
|
|
authorize @leader_skill
|
|
|
|
|
2015-10-06 13:55:12 -04:00
|
|
|
@leader_skill.destroy
|
|
|
|
|
2015-10-09 08:17:29 -04:00
|
|
|
redirect_to admin_leader_skills_path, notice: 'Leader Skills was deleted'
|
2015-10-06 13:55:12 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def leader_skill_params
|
2015-10-07 16:17:40 -04:00
|
|
|
params.require(:leader_skill).permit(:description)
|
2015-10-06 13:55:12 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def set_leader_skill
|
|
|
|
@leader_skill = LeaderSkill.find(params[:id])
|
|
|
|
end
|
|
|
|
end
|