web hooks scaffold started
This commit is contained in:
parent
8d7aaf0e55
commit
2dae0e18e0
10 changed files with 85 additions and 4 deletions
43
app/controllers/hooks_controller.rb
Normal file
43
app/controllers/hooks_controller.rb
Normal file
|
@ -0,0 +1,43 @@
|
|||
class HooksController < ApplicationController
|
||||
before_filter :authenticate_user!
|
||||
before_filter :project
|
||||
layout "project"
|
||||
|
||||
# Authorize
|
||||
before_filter :add_project_abilities
|
||||
before_filter :authorize_read_project!
|
||||
before_filter :authorize_admin_project!, :only => [:new, :create, :destroy]
|
||||
|
||||
respond_to :html
|
||||
|
||||
def index
|
||||
@hooks = @project.web_hooks
|
||||
end
|
||||
|
||||
def new
|
||||
@hook = @project.web_hooks.new
|
||||
end
|
||||
|
||||
def create
|
||||
@hook = @project.web_hooks.new(params[:hook])
|
||||
@hook.author = current_user
|
||||
@hook.save
|
||||
|
||||
if @hook.valid?
|
||||
redirect_to [@project, @hook]
|
||||
else
|
||||
respond_with(@hook)
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
@hook = @project.web_hooks.find(params[:id])
|
||||
end
|
||||
|
||||
def destroy
|
||||
@hook = @project.web_hooks.find(params[:id])
|
||||
@hook.destroy
|
||||
|
||||
redirect_to project_hooks_path(@project)
|
||||
end
|
||||
end
|
|
@ -68,7 +68,7 @@ class ProjectsController < ApplicationController
|
|||
|
||||
def show
|
||||
return render "projects/empty" unless @project.repo_exists? && @project.has_commits?
|
||||
limit = (params[:limit] || 20).to_i
|
||||
limit = (params[:limit] || 10).to_i
|
||||
@activities = @project.cached_updates(limit)
|
||||
end
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ class RepositoriesController < ApplicationController
|
|||
layout "project"
|
||||
|
||||
def show
|
||||
@activities = @project.fresh_commits(20)
|
||||
@activities = @project.fresh_commits(10)
|
||||
end
|
||||
|
||||
def branches
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue