From 485e55f88c6f2a50f1d88188a015fb1572f8bd94 Mon Sep 17 00:00:00 2001
From: Douwe Maan <douwe@gitlab.com>
Date: Thu, 5 Feb 2015 15:56:58 +0100
Subject: [PATCH] Clean up devise views.

---
 app/assets/stylesheets/sections/login.scss    |  5 +++
 app/views/devise/confirmations/new.html.haml  |  7 ++--
 app/views/devise/passwords/edit.html.haml     | 11 +++---
 app/views/devise/passwords/new.html.haml      |  7 ++--
 app/views/devise/registrations/new.html.haml  | 34 ++++---------------
 app/views/devise/shared/_signup_box.html.haml |  2 +-
 6 files changed, 27 insertions(+), 39 deletions(-)

diff --git a/app/assets/stylesheets/sections/login.scss b/app/assets/stylesheets/sections/login.scss
index 901733ef9ff..3a3644c12b7 100644
--- a/app/assets/stylesheets/sections/login.scss
+++ b/app/assets/stylesheets/sections/login.scss
@@ -46,6 +46,10 @@
 
     .login-footer {
       margin-top: 10px;
+
+      p:last-child {
+        margin-bottom: 0;
+      }
     }
 
     a.forgot {
@@ -88,6 +92,7 @@
 
   .devise-errors {
     h2 {
+      margin-top: 0;
       font-size: 14px;
       color: #a00;
     }
diff --git a/app/views/devise/confirmations/new.html.haml b/app/views/devise/confirmations/new.html.haml
index 8d17f39eba2..970ba147111 100644
--- a/app/views/devise/confirmations/new.html.haml
+++ b/app/views/devise/confirmations/new.html.haml
@@ -7,7 +7,8 @@
         = devise_error_messages!
       .clearfix.append-bottom-20
         = f.email_field :email, placeholder: 'Email', class: "form-control", required: true
-      .clearfix.append-bottom-10
+      .clearfix
         = f.submit "Resend confirmation instructions", class: 'btn btn-success'
-  .login-footer
-    = render 'devise/shared/sign_in_link'
+
+.clearfix.prepend-top-20
+  = render 'devise/shared/sign_in_link'
diff --git a/app/views/devise/passwords/edit.html.haml b/app/views/devise/passwords/edit.html.haml
index 1326cc0aac9..0640739b5d7 100644
--- a/app/views/devise/passwords/edit.html.haml
+++ b/app/views/devise/passwords/edit.html.haml
@@ -10,9 +10,10 @@
         = f.password_field :password, class: "form-control top", placeholder: "New password", required: true
       %div
         = f.password_field :password_confirmation, class: "form-control bottom", placeholder: "Confirm new password", required: true
-      .clearfix.append-bottom-10
+      .clearfix
         = f.submit "Change my password", class: "btn btn-primary"
-  .login-footer
-    %p
-      = link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name)
-    = render 'devise/shared/sign_in_link'
+
+.clearfix.prepend-top-20
+  %p
+    = link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name)
+  = render 'devise/shared/sign_in_link'
diff --git a/app/views/devise/passwords/new.html.haml b/app/views/devise/passwords/new.html.haml
index b8af1b8693a..e8820daf58f 100644
--- a/app/views/devise/passwords/new.html.haml
+++ b/app/views/devise/passwords/new.html.haml
@@ -7,7 +7,8 @@
         = devise_error_messages!
       .clearfix.append-bottom-20
         = f.email_field :email, placeholder: "Email",  class: "form-control", required: true
-      .clearfix.append-bottom-10
+      .clearfix
         = f.submit "Reset password", class: "btn-primary btn"
-  .login-footer
-    = render 'devise/shared/sign_in_link'
+
+.clearfix.prepend-top-20
+  = render 'devise/shared/sign_in_link'
diff --git a/app/views/devise/registrations/new.html.haml b/app/views/devise/registrations/new.html.haml
index d6a952f3dc5..c07e409d583 100644
--- a/app/views/devise/registrations/new.html.haml
+++ b/app/views/devise/registrations/new.html.haml
@@ -1,27 +1,7 @@
-.login-box
-  .login-heading
-    %h3 Sign up
-  .login-body
-    = form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f|
-      .devise-errors
-        = devise_error_messages!
-      %div
-        = f.text_field :name, class: "form-control top", placeholder: "Name", required: true
-      %div
-        = f.text_field :username, class: "form-control middle", placeholder: "Username", required: true
-      %div
-        = f.email_field :email, class: "form-control middle", placeholder: "Email", required: true
-      %div
-        = f.password_field :password, class: "form-control middle", placeholder: "Password", required: true
-      %div
-        = f.password_field :password_confirmation, class: "form-control bottom", placeholder: "Confirm password", required: true
-      %div
-        = f.submit "Sign up", class: "btn-create btn"
-  .login-footer
-    %p
-      %span.light
-        Have an account?
-      %strong
-        = link_to "Sign in", new_session_path(resource_name)
-    %p
-      = link_to "Forgot your password?", new_password_path(resource_name)
+= render 'devise/shared/signup_box'
+
+.clearfix.prepend-top-20
+  = render 'devise/shared/sign_in_link'
+  %p
+    %span.light Did not receive confirmation email?
+    = link_to "Send again", new_confirmation_path(resource_name)
\ No newline at end of file
diff --git a/app/views/devise/shared/_signup_box.html.haml b/app/views/devise/shared/_signup_box.html.haml
index 5709c661288..8a6dc19ab64 100644
--- a/app/views/devise/shared/_signup_box.html.haml
+++ b/app/views/devise/shared/_signup_box.html.haml
@@ -11,7 +11,7 @@
         = f.text_field :username, class: "form-control middle", placeholder: "Username", required: true
       %div
         = f.email_field :email, class: "form-control middle", placeholder: "Email", required: true
-      .form-group#password-strength
+      .form-group.append-bottom-20#password-strength
         = f.password_field :password, class: "form-control bottom", id: "user_password_sign_up", placeholder: "Password", required: true
       %div
         = f.submit "Sign up", class: "btn-create btn"
-- 
GitLab