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