Commit 96a2eb4

mo khan <mo@mokhan.ca>
2014-04-09 03:37:36
add login page using twitter bootstrap.
1 parent 5238593
app/assets/javascripts/application.js
@@ -13,4 +13,5 @@
 //= require jquery
 //= require jquery_ujs
 //= require turbolinks
+//= require bootstrap
 //= require_tree .
app/assets/stylesheets/application.css → app/assets/stylesheets/application.css.scss
@@ -11,3 +11,4 @@
  *= require_self
  *= require_tree .
  */
+@import 'bootstrap';
app/controllers/logins_controller.rb
@@ -1,5 +1,6 @@
 class LoginsController < ApplicationController
   before_filter :load_dependencies
+  layout 'public'
 
   def new
   end
app/views/layouts/application.html.erb
@@ -1,14 +1,14 @@
 <!DOCTYPE html>
 <html>
-<head>
-  <title>Mocode</title>
-  <%= stylesheet_link_tag    "application", media: "all", "data-turbolinks-track" => true %>
-  <%= javascript_include_tag "application", "data-turbolinks-track" => true %>
-  <%= csrf_meta_tags %>
-</head>
-<body>
+  <head>
+    <title>Mocode</title>
+    <%= stylesheet_link_tag    "application", media: "all", "data-turbolinks-track" => true %>
+    <%= javascript_include_tag "application", "data-turbolinks-track" => true %>
+    <%= csrf_meta_tags %>
+  </head>
+  <body>
 
-<%= yield %>
+    <%= yield %>
 
-</body>
+  </body>
 </html>
app/views/layouts/public.html.erb
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html lang="en">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    <meta name="description" content="">
+    <meta name="author" content="">
+    <link rel="shortcut icon" href="../../assets/ico/favicon.ico">
+    <title>Signin Template for Bootstrap</title>
+    <%= stylesheet_link_tag    "application", media: "all", "data-turbolinks-track" => true %>
+    <%= javascript_include_tag "application", "data-turbolinks-track" => true %>
+    <%= csrf_meta_tags %>
+  </head>
+  <body>
+    <div class="container">
+      <%= yield %>
+    </div> <!-- /container -->
+  </body>
+</html>
app/views/logins/new.html.erb
@@ -0,0 +1,17 @@
+<div class="row">
+  <div class="col-md-4">
+  </div>
+  <div class="col-md-4">
+    <%= form_tag logins_path, method: :post, class: 'form-signin', role: 'form' do %>
+      <h2 class="form-signin-heading">Please sign in</h2>
+      <input type="email" class="form-control" placeholder="Email address" required autofocus>
+      <input type="password" class="form-control" placeholder="Password" required>
+      <label class="checkbox">
+        <input type="checkbox" value="remember-me"> Remember me
+      </label>
+      <button class="btn btn-lg btn-primary btn-block" type="submit">Sign in</button>
+    <% end %>
+  </div>
+  <div class="col-md-4">
+  </div>
+</div>
Gemfile
@@ -35,6 +35,7 @@ end
 # Use ActiveModel has_secure_password
 gem 'bcrypt', '~> 3.1.7'
 gem 'spank'
+gem 'bootstrap-sass'
 
 # Use unicorn as the app server
 # gem 'unicorn'
Gemfile.lock
@@ -28,6 +28,8 @@ GEM
     arel (4.0.2)
     atomic (1.1.16)
     bcrypt (3.1.7)
+    bootstrap-sass (3.1.1.0)
+      sass (~> 3.2)
     builder (3.1.4)
     coffee-rails (4.0.1)
       coffee-script (>= 2.2.0)
@@ -125,6 +127,7 @@ PLATFORMS
 
 DEPENDENCIES
   bcrypt (~> 3.1.7)
+  bootstrap-sass
   coffee-rails (~> 4.0.0)
   jbuilder (~> 1.2)
   jquery-rails