Commit 15b06b01644f31314f3241afbb7a807219f18703

Authored by Dmitriy Zaporozhets
1 parent 089dca4d

Bootstrap: Deploy keys, Hooks

app/views/deploy_keys/_form.html.haml
1 %div 1 %div
2 = form_for [@project, @key], :url => project_deploy_keys_path do |f| 2 = form_for [@project, @key], :url => project_deploy_keys_path do |f|
3 -if @key.errors.any? 3 -if @key.errors.any?
4 - %ul.errors_holder  
5 - - @key.errors.full_messages.each do |msg|  
6 - %li= msg  
7 -  
8 - %table.no-borders  
9 - %tr  
10 - %td= f.label :title  
11 - %td= f.text_field :title, :style => "width:300px"  
12 - %tr  
13 - %td= f.label :key  
14 - %td= f.text_area :key, :style => "width:300px; height:130px"  
15 - %br  
16 - .merge-tabs 4 + .alert-message.block-message.error
  5 + %ul
  6 + - @key.errors.full_messages.each do |msg|
  7 + %li= msg
  8 +
  9 + .clearfix
  10 + = f.label :title
  11 + .input= f.text_field :title
  12 + .clearfix
  13 + = f.label :key
  14 + .input= f.text_area :key, :class => "xlarge"
  15 + .actions
17 = f.submit 'Save', :class => "primary btn" 16 = f.submit 'Save', :class => "primary btn"
  17 + = link_to "Cancel", project_deploy_keys_path(@project), :class => "btn"
18 18
app/views/deploy_keys/index.html.haml
1 = render "repositories/head" 1 = render "repositories/head"
2 -  
3 -%div#keys-table{ :class => "update-data ui-box ui-box-small ui-box-big" }  
4 - .data  
5 - - @keys.each do |key|  
6 - = render(:partial => 'show', :locals => {:key => key})  
7 -  
8 -- if @keys.blank?  
9 - .notice_holder  
10 - %li Deploy Keys do not exist yet.  
11 - - if can? current_user, :admin_project, @project  
12 - %li You can add a new one by clicking on "Add New" button  
13 -  
14 -:javascript  
15 - $('.delete-key').live('ajax:success', function() {  
16 - $(this).closest('.update-item').fadeOut(); });  
17 - 2 +- if can? current_user, :admin_project, @project
  3 + .alert-message.block-message.info
  4 + Deploy keys allow read-only access to repository.
  5 + = link_to new_project_deploy_key_path(@project), :class => "btn small", :title => "New Deploy Key" do
  6 + Add Deploy Key
  7 +
  8 +%ul.unstyled
  9 + - @keys.each do |key|
  10 + %li= render(:partial => 'show', :locals => {:key => key})
app/views/deploy_keys/show.html.haml
1 -.ui-box.width-100p  
2 - %h3= @key.title  
3 - .data  
4 - %pre= @key.key  
5 - .clear  
6 - .buttons  
7 - = link_to 'Remove', project_deploy_key_path(@key.project, @key), :confirm => 'Are you sure?', :method => :delete, :class => "red-button delete-key right"  
8 - .clear  
9 -  
10 - 1 += render "repositories/head"
  2 +%h3= @key.title
  3 +%hr
  4 +%pre= @key.key
  5 +.actions
  6 + = link_to 'Remove', project_deploy_key_path(@key.project, @key), :confirm => 'Are you sure?', :method => :delete, :class => "danger btn delete-key"
  7 + .clear
app/views/hooks/index.html.haml
1 = render "repositories/head" 1 = render "repositories/head"
2 -- unless @hooks.empty?  
3 - %div.update-data.ui-box.ui-box-small  
4 - .data  
5 - - @hooks.each do |hook|  
6 - %a.update-item{:href => project_hook_path(@project, hook)}  
7 - %span.update-title{:style => "margin-bottom:0px;"}  
8 - = hook.url  
9 - %span.update-author.right  
10 - Added  
11 - = time_ago_in_words(hook.created_at)  
12 - ago  
13 -- else  
14 - %h3 No hooks  
15 2
16 -.clear  
17 -%hr  
18 -%p  
19 - Post receive hooks. For now only POST request allowed. We send some data with request. Example below 3 +- if can? current_user, :admin_project, @project
  4 + .alert-message.block-message.info
  5 + Post receive hooks for binding events when someone push to repository.
  6 + = link_to new_project_hook_path(@project), :class => "btn small", :title => "New Web Hook" do
  7 + Add Post Receive Hook
20 8
21 -.view_file  
22 - .view_file_header  
23 - %strong POST data passed  
24 - .data.no-padding  
25 - = render "data_ex" 9 +%ul.unstyled
  10 + - @hooks.each do |hook|
  11 + %li
  12 + %a.update-item{:href => project_hook_path(@project, hook)}
  13 + = hook.url
  14 +
  15 +.alert-message.block-message.info
  16 + We send some data with POST request when someone makes git push
  17 +
  18 +.well= render "data_ex"
app/views/hooks/show.html.haml
1 = render "repositories/head" 1 = render "repositories/head"
2 -%h3  
3 - %span.commit.tag POST  
4 - = @hook.url  
5 - 2 +%pre= @hook.url
6 3
7 - if can? current_user, :admin_project, @project 4 - if can? current_user, :admin_project, @project
8 - .merge-tabs  
9 - = link_to 'Test Hook', test_project_hook_path(@project, @hook), :class => "grey-button"  
10 - .right  
11 - = link_to 'Remove', project_hook_path(@project, @hook), :confirm => 'Are you sure?', :method => :delete, :class => "red-button" 5 + .actions
  6 + = link_to 'Test Hook', test_project_hook_path(@project, @hook), :class => "btn"
  7 + = link_to 'Remove', project_hook_path(@project, @hook), :confirm => 'Are you sure?', :method => :delete, :class => "danger btn"
app/views/repositories/_head.html.haml
1 -.top-tabs.repository  
2 - = link_to project_repository_path(@project), :class => "activities-tab tab #{'active' if current_page?(project_repository_path(@project)) }" do  
3 - %span  
4 - Activities  
5 - = link_to branches_project_repository_path(@project), :class => "tab #{'active' if current_page?(branches_project_repository_path(@project)) }" do  
6 - %span  
7 - Branches  
8 - = link_to tags_project_repository_path(@project), :class => "tab #{'active' if current_page?(tags_project_repository_path(@project)) }" do  
9 - %span  
10 - Tags  
11 - = link_to project_hooks_path, :class => "tab #{'active' if controller.controller_name == "hooks" }" do  
12 - %span  
13 - Hooks  
14 - - if can? current_user, :admin_project, @project  
15 - = link_to project_deploy_keys_path(@project), :class => "tab #{'active' if controller.controller_name == "deploy_keys"}" do 1 +%ul.tabs
  2 + %li{:class => "#{'active' if current_page?(project_repository_path(@project)) }"}
  3 + = link_to project_repository_path(@project) do
16 %span 4 %span
17 - Deploy Keys  
18 -  
19 - - if current_page?(project_hooks_path(@project))  
20 - - if can? current_user, :admin_project, @project  
21 - = link_to new_project_hook_path(@project), :class => "add_new", :title => "New Web Hook" do  
22 - Add new  
23 -  
24 - - if current_page?(project_deploy_keys_path(@project)) 5 + Activities
  6 + %li{:class => "#{'active' if current_page?(branches_project_repository_path(@project)) }"}
  7 + = link_to branches_project_repository_path(@project) do
  8 + %span
  9 + Branches
  10 + %li{:class => "#{'active' if current_page?(tags_project_repository_path(@project)) }"}
  11 + = link_to tags_project_repository_path(@project) do
  12 + %span
  13 + Tags
  14 + %li{:class => "#{'active' if controller.controller_name == "hooks" }"}
  15 + = link_to project_hooks_path do
  16 + %span
  17 + Hooks
  18 + %li{:class => "#{'active' if controller.controller_name == "deploy_keys"}"}
25 - if can? current_user, :admin_project, @project 19 - if can? current_user, :admin_project, @project
26 - = link_to new_project_deploy_key_path(@project), :class => "add_new", :title => "New Deploy Key" do  
27 - Add new 20 + = link_to project_deploy_keys_path(@project) do
  21 + %span
  22 + Deploy Keys
28 23