Commit c9ea5f1316473f5ae33b24b673631f421b90a063

Authored by Dmitriy Zaporozhets
1 parent 809413d9

deploy key creation restyled

app/assets/stylesheets/style.scss
@@ -220,13 +220,9 @@ input.button{margin-bottom: 1.5em} @@ -220,13 +220,9 @@ input.button{margin-bottom: 1.5em}
220 220
221 .ui-box .data{padding: .5em 1em} 221 .ui-box .data{padding: .5em 1em}
222 222
223 -.ui-box .buttons{background-color: #f7f8f9; padding: 1em;  
224 - -webkit-border-bottom-right-radius: 5px;  
225 - -webkit-border-bottom-left-radius: 5px;  
226 - -moz-border-radius-bottomright: 5px;  
227 - -moz-border-radius-bottomleft: 5px;  
228 - border-bottom-right-radius: 5px;  
229 - border-bottom-left-radius: 5px; 223 +.ui-box .buttons{
  224 + padding: 1em;
  225 + border-top:1px solid $lite_border_color;
230 } 226 }
231 227
232 .ui-box .buttons .button{padding: 8px 9px; font-size: 11px} 228 .ui-box .buttons .button{padding: 8px 9px; font-size: 11px}
@@ -713,3 +709,17 @@ body, button, input, select, textarea { @@ -713,3 +709,17 @@ body, button, input, select, textarea {
713 } 709 }
714 } 710 }
715 711
  712 +
  713 +.errors_holder {
  714 + background:#FBB;
  715 + border:1px solid $lite_border_color;
  716 + @include round-borders-all(4px);
  717 + padding:5px;
  718 + list-style:none;
  719 + font-weight: bold;
  720 + text-shadow: 0 -1px 0 rgba(255, 255, 255, 0.25);
  721 +
  722 + li {
  723 + padding:10px;
  724 + }
  725 +}
app/controllers/deploy_keys_controller.rb
1 class DeployKeysController < ApplicationController 1 class DeployKeysController < ApplicationController
2 - respond_to :js, :html 2 + respond_to :html
3 layout "project" 3 layout "project"
4 before_filter :project 4 before_filter :project
5 5
@@ -29,7 +29,7 @@ class DeployKeysController &lt; ApplicationController @@ -29,7 +29,7 @@ class DeployKeysController &lt; ApplicationController
29 @key = @project.deploy_keys.new(params[:key]) 29 @key = @project.deploy_keys.new(params[:key])
30 @key.save 30 @key.save
31 31
32 - respond_with(@key) 32 + redirect_to project_deploy_keys_path(@project)
33 end 33 end
34 34
35 def destroy 35 def destroy
app/views/deploy_keys/_form.html.haml
1 %div 1 %div
2 - = form_for [@project, @key], :url => project_deploy_keys_path, :remote => true 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 4 + %ul.errors_holder
5 - @key.errors.full_messages.each do |msg| 5 - @key.errors.full_messages.each do |msg|
6 %li= msg 6 %li= msg
7 -  
8 - .form-row  
9 - = f.label :title  
10 - = f.text_field :title, :style => "width:300px"  
11 - .form-row  
12 - = f.label :key  
13 - = f.text_area :key, :style => "width:300px; height:130px"  
14 - .form-row 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
15 = f.submit 'Save', :class => "grey-button" 17 = f.submit 'Save', :class => "grey-button"
16 18
app/views/deploy_keys/create.js.haml
@@ -1,9 +0,0 @@ @@ -1,9 +0,0 @@
1 -- if @key.valid?  
2 - :plain  
3 - $("#new_key_dialog").dialog("close");  
4 - $("#keys-table .data").append("#{escape_javascript(render(:partial => 'show', :locals => {:key => @key} ))}");  
5 - $("#no_ssh_key_defined").hide();  
6 -- else  
7 - :plain  
8 - $("#new_key_dialog").empty();  
9 - $("#new_key_dialog").append("#{escape_javascript(render('form'))}");  
app/views/deploy_keys/edit.html.haml
@@ -1,7 +0,0 @@ @@ -1,7 +0,0 @@
1 -%h1 Editing key  
2 -  
3 -= render 'form'  
4 -  
5 -= link_to 'Show', @key  
6 -\|  
7 -= link_to 'Back', project_deploy_keys_path  
app/views/deploy_keys/new.html.haml
1 -%h1 New key 1 += render "repositories/head"
2 2
3 -= render 'form' 3 +%h2 New Deploy key
4 4
5 -= link_to 'Back', project_deploy_keys_path 5 += render 'form'
app/views/deploy_keys/new.js.haml
@@ -1,11 +0,0 @@ @@ -1,11 +0,0 @@
1 -:plain  
2 - var new_key_dialog = $("<div id='new_key_dialog'></div>");  
3 - new_key_dialog.html("#{escape_javascript(render('form'))}");  
4 - $(new_key_dialog).dialog({  
5 - width: 350,  
6 - resizable: false,  
7 - draggable: false,  
8 - title: "Add new public key",  
9 - close: function(event, ui) { $("#new_key_dialog").remove();},  
10 - modal: true  
11 - });  
app/views/issues/_form.html.haml
@@ -20,18 +20,13 @@ @@ -20,18 +20,13 @@
20 %i 20 %i
21 21
22 %h2= @issue.new_record? ? "New Issue" : "Edit Issue ##{@issue.id}" 22 %h2= @issue.new_record? ? "New Issue" : "Edit Issue ##{@issue.id}"
23 -  
24 %hr 23 %hr
25 - %table.no-borders  
26 - -if @issue.errors.any?  
27 - %tr  
28 - %td{:colspan => 2}  
29 - #error_explanation  
30 - - @issue.errors.full_messages.each do |msg|  
31 - %span= msg  
32 - %br  
33 - 24 + -if @issue.errors.any?
  25 + %ul.errors_holder
  26 + - @issue.errors.full_messages.each do |msg|
  27 + %li= msg
34 28
  29 + %table.no-borders
35 %tr 30 %tr
36 %td= f.label :assignee_id 31 %td= f.label :assignee_id
37 %td= f.select(:assignee_id, @project.users.all.collect {|p| [ p.name, p.id ] }, { :include_blank => "Select user" }) 32 %td= f.select(:assignee_id, @project.users.all.collect {|p| [ p.name, p.id ] }, { :include_blank => "Select user" })
app/views/repositories/_head.html.haml
@@ -23,6 +23,6 @@ @@ -23,6 +23,6 @@
23 23
24 - if current_page?(project_deploy_keys_path(@project)) 24 - if current_page?(project_deploy_keys_path(@project))
25 - if can? current_user, :admin_project, @project 25 - if can? current_user, :admin_project, @project
26 - = link_to new_project_deploy_key_path(@project), :class => "add_new", :title => "New Deploy Key", :remote => true do 26 + = link_to new_project_deploy_key_path(@project), :class => "add_new", :title => "New Deploy Key" do
27 = image_tag "add_new.png", :width => 14 27 = image_tag "add_new.png", :width => 14
28 28
spec/requests/projects_deploy_keys_spec.rb
@@ -36,7 +36,7 @@ describe &quot;Projects&quot;, &quot;DeployKeys&quot; do @@ -36,7 +36,7 @@ describe &quot;Projects&quot;, &quot;DeployKeys&quot; do
36 end 36 end
37 37
38 it "should open new key popup" do 38 it "should open new key popup" do
39 - page.should have_content("Add new public key") 39 + page.should have_content("New Deploy key")
40 end 40 end
41 41
42 describe "fill in" do 42 describe "fill in" do
@@ -50,7 +50,6 @@ describe &quot;Projects&quot;, &quot;DeployKeys&quot; do @@ -50,7 +50,6 @@ describe &quot;Projects&quot;, &quot;DeployKeys&quot; do
50 it "should add new key to table" do 50 it "should add new key to table" do
51 click_button "Save" 51 click_button "Save"
52 52
53 - page.should_not have_content("Add new public key")  
54 page.should have_content "laptop" 53 page.should have_content "laptop"
55 end 54 end
56 end 55 end