diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2012-01-04 00:42:14 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2012-01-04 00:42:14 +0200 |
commit | 2dae0e18e09132c0db32c8646d8d11b30cfcb83f (patch) | |
tree | b28e2b90fae53324750e82e47898ab815c0bb82e /app/controllers | |
parent | 8d7aaf0e5501c472504467b9252dd5bde14a98c8 (diff) | |
download | gitlab-ce-2dae0e18e09132c0db32c8646d8d11b30cfcb83f.tar.gz |
web hooks scaffold started
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/hooks_controller.rb | 43 | ||||
-rw-r--r-- | app/controllers/projects_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/repositories_controller.rb | 2 |
3 files changed, 45 insertions, 2 deletions
diff --git a/app/controllers/hooks_controller.rb b/app/controllers/hooks_controller.rb new file mode 100644 index 00000000000..70516dacf72 --- /dev/null +++ b/app/controllers/hooks_controller.rb @@ -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 diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 1e859ceac31..29fcb52eb97 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -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 diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 9a112f4674f..c0652cbeab9 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -9,7 +9,7 @@ class RepositoriesController < ApplicationController layout "project" def show - @activities = @project.fresh_commits(20) + @activities = @project.fresh_commits(10) end def branches |