Files
gitlabhq/app/controllers/projects/git_hooks_controller.rb
T
Vinnie Okada 067a5b9d8b Update path helpers and routes for Rails 4.1.9
Update project path helpers and routes to reflect the new nested
resources introduced in the Rails 4.1.9 upgrade.
2015-02-27 18:21:15 -07:00

34 lines
836 B
Ruby

class Projects::GitHooksController < Projects::ApplicationController
# Authorize
before_filter :authorize_admin_project!
respond_to :html
layout "project_settings"
def index
project.create_git_hook unless project.git_hook
@pre_receive_hook = project.git_hook
end
def update
@pre_receive_hook = project.git_hook
@pre_receive_hook.update_attributes(git_hook_params)
if @pre_receive_hook.valid?
redirect_to namespace_project_git_hooks_path(@project.namespace, @project)
else
render :index
end
end
private
# Only allow a trusted parameter "white list" through.
def git_hook_params
params.require(:git_hook).permit(:deny_delete_tag, :delete_branch_regex,
:commit_message_regex, :force_push_regex, :author_email_regex, :member_check, :file_name_regex)
end
end