From fb5ea9059647ca8ee5cea568f47551da547b70f7 Mon Sep 17 00:00:00 2001 From: Azul Date: Tue, 26 Jun 2012 18:06:28 +0200 Subject: stress three step layout with a little helper --- http-srp.rb | 13 +++++++++++++ views/index.erb | 39 +++++++++++++++++++++++++++------------ 2 files changed, 40 insertions(+), 12 deletions(-) diff --git a/http-srp.rb b/http-srp.rb index ab1a4f4..c0c9360 100644 --- a/http-srp.rb +++ b/http-srp.rb @@ -53,3 +53,16 @@ post '/login' do @user.login!(params) redirect '/' end + +helpers do + def button_link(action, options = {}) + action = action.to_s + label = action.capitalize + klass = "btn btn-large" + if options.delete(:primary) + klass += " btn-primary" + label += " now..." + end + %Q(#{label}) + end +end diff --git a/views/index.erb b/views/index.erb index 54068c2..48d9f71 100644 --- a/views/index.erb +++ b/views/index.erb @@ -5,24 +5,12 @@

First you signup just like normal. Your browser runs a bit of javascript and does not transfer your password but some validator based on it.

- <% if @user.login %> -

You are signed up as <%= @user.login %> - <% if @user.active %> -

You are logged in. - <% end %> - <% end %> - - Signup now... -

2. Login

Login using the same credentials. Again javascript is used to calculate a random number and a key based on it that the server then uses to validate your password.

- - Login -

3. Verify

@@ -31,5 +19,32 @@

+
+
+ <% if @user.login %> +

You are signed up as <%= @user.login %>.

+ <% end %> +
+
+ <% if @user.active %> +

You are logged in.

+ <% end %> +
+
+
+
+
+
+ <%= button_link(:signup, :primary => !@user.login) %> +
+
+ <%= button_link(:login, :primary => @user.login && !@user.active) %> +
+
+ <%= button_link(:verify, :primary => @user.active) %> +
+
+ + -- cgit v1.2.3