Skip to content
Snippets Groups Projects
Commit 2dae0e18 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

web hooks scaffold started

parent 8d7aaf0e
No related branches found
No related tags found
No related merge requests found
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
Loading
Loading
@@ -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
 
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
Loading
@@ -82,5 +82,6 @@ end
# linkedin :string(255) default(""), not null
# twitter :string(255) default(""), not null
# authentication_token :string(255)
# dark_scheme :boolean default(FALSE), not null
#
 
Loading
Loading
@@ -18,3 +18,14 @@ class WebHook < ActiveRecord::Base
# There was a problem calling this web hook, let's forget about it.
end
end
# == Schema Information
#
# Table name: web_hooks
#
# id :integer not null, primary key
# url :string(255)
# project_id :integer
# created_at :datetime
# updated_at :datetime
#
= render "repositories/head"
- unless @hooks.empty?
%div.update-data.ui-box.ui-box-small
.data
- @hooks.each do |hook|
%a.update-item{:href => project_hooks_path(@project, hook)}
%span.update-title{:style => "margin-bottom:0px;"}
= hook.url
- else
%h3 No hooks
class PostReceive
@queue = :post_receive
def self.perform(reponame, oldrev, newrev, ref)
project = Project.find_by_path(reponame)
return false if project.nil?
Loading
Loading
Gitlab::Application.routes.draw do
 
# Optionally, enable Resque here
# require 'resque/server'
# mount Resque::Server.new, at: '/info/resque'
require 'resque/server'
mount Resque::Server.new, at: '/info/resque'
 
get 'tags'=> 'tags#index'
get 'tags/:tag' => 'projects#index'
Loading
Loading
@@ -83,6 +83,8 @@ Gitlab::Application.routes.draw do
get :commits
end
end
resources :hooks, :only => [:index, :new, :create, :destroy, :show]
resources :snippets
resources :commits
resources :team_members
Loading
Loading
Loading
Loading
@@ -65,5 +65,6 @@ end
# linkedin :string(255) default(""), not null
# twitter :string(255) default(""), not null
# authentication_token :string(255)
# dark_scheme :boolean default(FALSE), not null
#
 
Loading
Loading
@@ -52,3 +52,14 @@ describe WebHook do
end
end
end
# == Schema Information
#
# Table name: web_hooks
#
# id :integer not null, primary key
# url :string(255)
# project_id :integer
# created_at :datetime
# updated_at :datetime
#
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment