2015-10-24 18:46:33 +05:30
|
|
|
class Projects::TriggersController < Projects::ApplicationController
|
2016-04-02 18:10:28 +05:30
|
|
|
before_action :authorize_admin_build!
|
2015-10-24 18:46:33 +05:30
|
|
|
|
|
|
|
layout 'project_settings'
|
|
|
|
|
|
|
|
def index
|
2015-12-23 02:04:40 +05:30
|
|
|
@triggers = project.triggers
|
2015-10-24 18:46:33 +05:30
|
|
|
@trigger = Ci::Trigger.new
|
|
|
|
end
|
|
|
|
|
|
|
|
def create
|
2015-12-23 02:04:40 +05:30
|
|
|
@trigger = project.triggers.new
|
2015-10-24 18:46:33 +05:30
|
|
|
@trigger.save
|
|
|
|
|
|
|
|
if @trigger.valid?
|
|
|
|
redirect_to namespace_project_triggers_path(@project.namespace, @project)
|
|
|
|
else
|
2015-12-23 02:04:40 +05:30
|
|
|
@triggers = project.triggers.select(&:persisted?)
|
2015-10-24 18:46:33 +05:30
|
|
|
render :index
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def destroy
|
|
|
|
trigger.destroy
|
|
|
|
|
|
|
|
redirect_to namespace_project_triggers_path(@project.namespace, @project)
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def trigger
|
2015-12-23 02:04:40 +05:30
|
|
|
@trigger ||= project.triggers.find(params[:id])
|
2015-10-24 18:46:33 +05:30
|
|
|
end
|
|
|
|
end
|