Commit 2d3b6375 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

hooks scaffold

parent 495deea7
...@@ -181,6 +181,13 @@ input.ssh_project_url { ...@@ -181,6 +181,13 @@ input.ssh_project_url {
} }
} }
.text_field {
width:400px;
padding:8px;
font-size:14px;
@include round-borders-all(4px);
}
.input_button { .input_button {
padding:8px; padding:8px;
font-size:14px; font-size:14px;
......
...@@ -20,13 +20,12 @@ class HooksController < ApplicationController ...@@ -20,13 +20,12 @@ class HooksController < ApplicationController
def create def create
@hook = @project.web_hooks.new(params[:hook]) @hook = @project.web_hooks.new(params[:hook])
@hook.author = current_user
@hook.save @hook.save
if @hook.valid? if @hook.valid?
redirect_to [@project, @hook] redirect_to project_hook_path(@project, @hook)
else else
respond_with(@hook) render :new
end end
end end
......
...@@ -35,7 +35,8 @@ module ProjectsHelper ...@@ -35,7 +35,8 @@ module ProjectsHelper
end end
def repository_tab_class def repository_tab_class
if controller.controller_name == "repositories" if controller.controller_name == "repositories" ||
controller.controller_name == "hooks"
"current" "current"
end end
end end
......
= render "repositories/head" = render "repositories/head"
.right= link_to "Add new", new_project_hook_path(@project), :class => "grey-button append-bottom-10"
- unless @hooks.empty? - unless @hooks.empty?
%div.update-data.ui-box.ui-box-small %div.update-data.ui-box.ui-box-small
.data .data
- @hooks.each do |hook| - @hooks.each do |hook|
%a.update-item{:href => project_hooks_path(@project, hook)} %a.update-item{:href => project_hook_path(@project, hook)}
%span.update-title{:style => "margin-bottom:0px;"} %span.update-title{:style => "margin-bottom:0px;"}
= hook.url = hook.url
%span.update-author.right
Added
= time_ago_in_words(hook.created_at)
ago
- else - else
%h3 No hooks %h3 No hooks
= render "repositories/head"
= form_for [@project, @hook], :as => :hook, :url => project_hooks_path(@project) do |f|
-if @hook.errors.any?
%ul
- @hook.errors.full_messages.each do |msg|
%li= msg
= f.label :url, "URL:"
= f.text_field :url, :class => "text_field"
.clear
%br
.merge-tabs
= f.submit "Save", :class => "grey-button"
= render "repositories/head"
= debug @hook
- if can? current_user, :admin_project, @project
.merge-tabs
.right
= link_to 'Remove', project_hook_path(@project, @hook), :confirm => 'Are you sure?', :method => :delete, :class => "red-button"
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
= link_to tags_project_repository_path(@project), :class => "tab #{'active' if current_page?(tags_project_repository_path(@project)) }" do = link_to tags_project_repository_path(@project), :class => "tab #{'active' if current_page?(tags_project_repository_path(@project)) }" do
%span %span
Tags Tags
-#= link_to "#", :class => "tab" do = link_to project_hooks_path, :class => "tab #{'active' if controller.controller_name == "hooks" }" do
%span %span
Hooks Hooks
-#= link_to "#", :class => "tab" do -#= link_to "#", :class => "tab" do
......
...@@ -84,8 +84,8 @@ Gitlab::Application.routes.draw do ...@@ -84,8 +84,8 @@ Gitlab::Application.routes.draw do
end end
end end
resources :hooks, :only => [:index, :new, :create, :destroy, :show]
resources :snippets resources :snippets
resources :hooks, :only => [:index, :new, :create, :destroy, :show]
resources :commits resources :commits
resources :team_members resources :team_members
resources :issues do resources :issues do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment