From 05a7e8b9c0b1ebdc01470a31f933b7526ca2cd08 Mon Sep 17 00:00:00 2001
From: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Date: Mon, 24 Jun 2013 19:25:10 +0300
Subject: [PATCH] Better design for SSH keys page

---
 .../stylesheets/gitlab_bootstrap/common.scss  |  7 +++++
 app/controllers/profiles/keys_controller.rb   |  2 +-
 app/views/profiles/keys/_form.html.haml       |  7 ++---
 app/views/profiles/keys/_key.html.haml        | 19 +++++-------
 app/views/profiles/keys/edit.html.haml        |  7 -----
 app/views/profiles/keys/index.html.haml       | 31 ++++++++++---------
 app/views/profiles/keys/show.html.haml        | 27 +++++++++-------
 7 files changed, 52 insertions(+), 48 deletions(-)
 delete mode 100644 app/views/profiles/keys/edit.html.haml

diff --git a/app/assets/stylesheets/gitlab_bootstrap/common.scss b/app/assets/stylesheets/gitlab_bootstrap/common.scss
index d2460c5f022..4a77e166e67 100644
--- a/app/assets/stylesheets/gitlab_bootstrap/common.scss
+++ b/app/assets/stylesheets/gitlab_bootstrap/common.scss
@@ -87,3 +87,10 @@ fieldset legend { font-size: 17px; }
   color: #333;
   text-shadow: 0 1px 1px #FFF;
 }
+
+pre.well-pre {
+  border: 1px solid #EEE;
+  background: #f9f9f9;
+  border-radius: 0;
+  color: #555;
+}
diff --git a/app/controllers/profiles/keys_controller.rb b/app/controllers/profiles/keys_controller.rb
index 24a01040f52..c36dae2abd3 100644
--- a/app/controllers/profiles/keys_controller.rb
+++ b/app/controllers/profiles/keys_controller.rb
@@ -2,7 +2,7 @@ class Profiles::KeysController < ApplicationController
   layout "profile"
 
   def index
-    @keys = current_user.keys.all
+    @keys = current_user.keys.order('id DESC').all
   end
 
   def show
diff --git a/app/views/profiles/keys/_form.html.haml b/app/views/profiles/keys/_form.html.haml
index 59808d60022..7ba8e20a44f 100644
--- a/app/views/profiles/keys/_form.html.haml
+++ b/app/views/profiles/keys/_form.html.haml
@@ -12,13 +12,12 @@
     .clearfix
       = f.label :key
       .input
+        %p.light
+          Paste your public key here. Read more about how generate it #{link_to "here", help_ssh_path}
         = f.text_area :key, class: [:xxlarge, :thin_area]
-        %p.hint
-          Paste your public key here. Read more about how generate it
-          = link_to "here", help_ssh_path
 
 
     .actions
-      = f.submit 'Save', class: "btn btn-save"
+      = f.submit 'Add key', class: "btn btn-create"
       = link_to "Cancel", profile_keys_path, class: "btn btn-cancel"
 
diff --git a/app/views/profiles/keys/_key.html.haml b/app/views/profiles/keys/_key.html.haml
index a71ad6295cd..cf4d80ad894 100644
--- a/app/views/profiles/keys/_key.html.haml
+++ b/app/views/profiles/keys/_key.html.haml
@@ -1,12 +1,9 @@
-%tr
-  %td
-    = link_to profile_key_path(key) do
-      %strong= key.title
-  %td
-    %span.cgray
-      Added
-      = time_ago_in_words(key.created_at)
-      ago
-  %td
-    = link_to 'Remove', profile_key_path(key), confirm: 'Are you sure?', method: :delete, class: "btn btn-small btn-remove delete-key pull-right"
+%li
+  = link_to profile_key_path(key) do
+    %strong= key.title
+  %span.cgray
+    added
+    = time_ago_in_words(key.created_at)
+    ago
+  = link_to 'Remove', profile_key_path(key), confirm: 'Are you sure?', method: :delete, class: "btn btn-small btn-remove delete-key pull-right"
 
diff --git a/app/views/profiles/keys/edit.html.haml b/app/views/profiles/keys/edit.html.haml
deleted file mode 100644
index 08c5a3dfe1e..00000000000
--- a/app/views/profiles/keys/edit.html.haml
+++ /dev/null
@@ -1,7 +0,0 @@
-%h1 Editing key
-
-= render 'form'
-
-= link_to 'Show', profile_keys_path(key)
-\|
-= link_to 'Back', profile_keys_path
diff --git a/app/views/profiles/keys/index.html.haml b/app/views/profiles/keys/index.html.haml
index b22805bc862..05c481ded23 100644
--- a/app/views/profiles/keys/index.html.haml
+++ b/app/views/profiles/keys/index.html.haml
@@ -1,21 +1,24 @@
 %h3.page_title
   SSH Keys
-  = link_to "Add new", new_profile_key_path, class: "btn pull-right"
+  = link_to "Add SSH Key", new_profile_key_path, class: "btn pull-right btn-primary"
 
-%hr
-%p.slead
+%br
+%p.light
   SSH key allows you to establish a secure connection between your computer and GitLab
+%p.light
+  Before you can add ssh key you need to
+  = link_to "generate it", help_ssh_path
 
 
-%table#keys-table
-  %thead
-    %tr
-      %th Name
-      %th Added
-      %th
-  = render @keys
-  - if @keys.blank?
-    %tr
-      %td{colspan: 3}
-        %p.nothing_here_message There are no SSH keys with access to your account.
+
+.ui-box
+  %h5.title
+    SSH Keys (#{@keys.count})
+    .pull-right
+  %ul.well-list#keys-table
+    = render @keys
+    - if @keys.blank?
+      %li
+        %h3.nothing_here_message There are no SSH keys with access to your account.
+
 
diff --git a/app/views/profiles/keys/show.html.haml b/app/views/profiles/keys/show.html.haml
index 64c6621ea5f..fc292f23066 100644
--- a/app/views/profiles/keys/show.html.haml
+++ b/app/views/profiles/keys/show.html.haml
@@ -1,14 +1,19 @@
-%h3.page_title
-  Public key:
-  = @key.title
-  %small
-    created at
-    = @key.created_at.stamp("Aug 21, 2011")
-.back_link
-  = link_to profile_keys_path do
-    &larr; To keys list
-%hr
+.row
+  .span4
+    .ui-box
+      %h5.title
+        SSH Key
+      %ul.well-list
+        %li
+          %span.light Title:
+          %strong= @key.title
+        %li
+          %span.light Created at:
+          %strong= @key.created_at.stamp("Aug 21, 2011")
+
+  .span8
+    %pre.well-pre
+      = @key.key
 
-%pre= @key.key
 .pull-right
   = link_to 'Remove', profile_key_path(@key), confirm: 'Are you sure?', method: :delete, class: "btn btn-remove delete-key"
-- 
GitLab