Skip to content

Commit

Permalink
A little refactoring of the accounts layout and the subsequent views.
Browse files Browse the repository at this point in the history
Views were simplified and the accounts related links are now called outside of the yield to save some markup.
  • Loading branch information
Frédéric de Villamil committed Aug 23, 2013
1 parent d565431 commit 4630c56
Show file tree
Hide file tree
Showing 9 changed files with 72 additions and 112 deletions.
3 changes: 2 additions & 1 deletion app/controllers/setup_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ class SetupController < ApplicationController

def index
return if not request.post?

@accounts_links = ""

this_blog.blog_name = params[:setting][:blog_name]
this_blog.base_url = blog_base_url

Expand Down
8 changes: 8 additions & 0 deletions app/helpers/accounts_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,12 @@ def create_account_link
def back_to_login
link_to(content_tag(:small, _("Back to login")), :action => 'login')
end

def back_home
link_to(content_tag(:small, _("&larr; Back to %s", this_blog.blog_name).html_safe), this_blog.base_url)
end

def link_to_publify
content_tag(:h1, link_to("Publify", "http://publify.co"))
end
end
45 changes: 17 additions & 28 deletions app/views/accounts/login.html.erb
Original file line number Diff line number Diff line change
@@ -1,29 +1,18 @@
<div class='row'>
<div class='span4 offset4'>
<h3><%= _("Sign in") %></h3>
<%= form_tag :action=> "login" do %>
<%= text_field(:user, :login, {:class => 'input-block-level', :placeholder => _("Login")})%>
<%= password_field(:user, :password, {:class => 'input-block-level', :placeholder => _("Password")})%>
<div class='clearfix'>
<div class='row'>
<div class='span2'>
<label class='checkbox inline'>
<%= check_box_tag 'remember_me' %><small><%= _('Remember me')%></small>
</label>
</div>
<div class='span2'>
<input type="submit" name="login" class="btn btn-info pull-right" value= "<%= _('Sign in') %>" />
</div>
</div>
</div>
</div>
<div class='row'>
<div class='span4 offset4 well'>
<div id="flash"><%= render_the_flash %></div>
<%= form_tag :action=> "login" do %>
<%= text_field(:user, :login, {:class => 'input-block-level', :placeholder => _("Login")})%>
<%= password_field(:user, :password, {:class => 'input-block-level', :placeholder => _("Password")})%>
<div class='clearfix'>
<div class='row'>
<div class='span2'>
<label class='checkbox inline'>
<%= check_box_tag 'remember_me' %><small><%= _('Remember me')%></small>
</label>
</div>
<div class='span2'>
<input type="submit" name="login" class="btn btn-info pull-right" value= "<%= _('Sign in') %>" />
</div>
</div>
</div>
<% end %>
</div>
</div>
<div class='span4 offset4'>
<%= [lost_password, create_account_link].join("<br />") %>
</div>
<% end %>
<% @accounts_links = [lost_password, create_account_link, back_home].join("<br />") %>
23 changes: 6 additions & 17 deletions app/views/accounts/recover_password.html.erb
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
<div class='row'>
<div class='span4 offset4'>
<h3><%= _("Reset my password") %></h3>
</div>
</div>
<div class='row'>
<div class='span4 offset4 well'>
<div id="flash"><%= render_the_flash %></div>
<%= form_tag :action=> "recover_password" do %>
<%= text_field(:user, :login, {:class => 'input-block-level', :placeholder => _("Username or email")})%>
<input type="submit" name="submit" class="btn btn-info pull-right" value= "<%= _('Reset my password') %>" />
<% end %>
</div>
</div>
<div class='span4 offset4'>
<%= [back_to_login, create_account_link].join("<br />") %>
</div>
<%= form_tag :action=> "recover_password" do %>
<%= text_field(:user, :login, {:class => 'input-block-level', :placeholder => _("Username or email")})%>
<input type="submit" name="submit" class="btn btn-info pull-right" value= "<%= _('Reset my password') %>" />
<% end %>
<% @accounts_links = [back_to_login, create_account_link, back_home].join("<br />") %>
25 changes: 7 additions & 18 deletions app/views/accounts/signup.html.erb
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
<div class='row'>
<div class='span4 offset4'>
<h3><%= _("Create an account") %></h3>
</div>
</div>
<div class='row'>
<div class='span4 offset4 well'>
<div id="flash"><%= render_the_flash %></div>
<%= form_tag :action=> "signup" do %>
<%= text_field(:user, :login, {:class => 'input-block-level', :placeholder => _("Username") })%>
<%= text_field(:user, :email, {:class => 'input-block-level', :placeholder => _("Email") })%>
<input type="submit" id="submit" class='btn btn-info pull-right' value="<%= _('Signup')%>" />
<% end %>
</div>
</div>
<div class='span4 offset4'>
<%= [lost_password, back_to_login].join("<br />") %>
</div>
<%= form_tag :action=> "signup" do %>
<%= text_field(:user, :login, {:class => 'input-block-level', :placeholder => _("Username") })%>
<%= text_field(:user, :email, {:class => 'input-block-level', :placeholder => _("Email") })%>
<input type="submit" id="submit" class='btn btn-info pull-right' value="<%= _('Signup')%>" />
<% end %>
<% @accounts_links = [lost_password, back_to_login, back_home].join("<br />") %>
2 changes: 1 addition & 1 deletion app/views/admin/dashboard/_comments.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<%= comment.html.strip_html.slice(0..300) %>
</p>
<%= show_feedback_actions(comment, 'dashboard') %>
<hr />
<hr />
</li>
<% end %>
<% end %>
Expand Down
22 changes: 14 additions & 8 deletions app/views/layouts/accounts.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
Expand All @@ -9,15 +9,21 @@
<%= stylesheet_link_tag "bootstrap-accounts", "accounts" %>
</head>
<body>
<div class='navbar navbar-fixed-top'>
<div class='navbar-inner'>
<div class='container'>
<%= link_to this_blog.blog_name, this_blog.base_url, { :class => 'brand' } %>
<div class='container'>
<div class='row'>
<div class='span4 offset4'>
<%= link_to_publify %>
</div>
</div>
<div class='row'>
<div class='span4 offset4 well'>
<div id="flash"><%= render_the_flash %></div>
<%= yield %>
</div>
<div class='span4 offset4'>
<%= @accounts_links %>
</div>
</div>
</div>
<div class='container'>
<%= yield %>
</div>
</body>
</html>
25 changes: 7 additions & 18 deletions app/views/setup/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,19 +1,8 @@
<div class='row'>
<div class='span4 offset4'>
<h3><%= _("Welcome")%></h3>
<%= form_tag :action=> 'index' do %>
<div class='alert'>
<small><%= _("Welcome to your %s blog setup. Just fill in your blog title and your email, and Publify will take care of everything else", link_to("Publify", 'http://publify.co'))%></small>
</div>
</div>
<div class='row'>
<div class='span4 offset4 well'>
<div id="flash"><%= render_the_flash %></div>
<%= form_tag :action=> 'index' do %>
<div class='alert'>
<small><%= _("Welcome to your %s blog setup. Just fill in your blog title and your email, and Publify will take care of everything else", link_to("Publify", 'http://publify.co'))%></small>
</div>
<%= text_field(:setting, :blog_name, { :class=> 'input-block-level', :placeholder => _("Blog name")})%>
<%= text_field(:setting, :email, { :class=> 'input-block-level', :placeholder => _("Your email")})%>
<input type="submit" id="submit" class='btn btn-info pull-right' value="<%= _('Save')%>" />
<% end %>
</div>
</div>
</div>
<%= text_field(:setting, :blog_name, { :class=> 'input-block-level', :placeholder => _("Blog name")})%>
<%= text_field(:setting, :email, { :class=> 'input-block-level', :placeholder => _("Your email")})%>
<input type="submit" id="submit" class='btn btn-info pull-right' value="<%= _('Save')%>" />
<% end %>
31 changes: 10 additions & 21 deletions app/views/shared/_confirm.html.erb
Original file line number Diff line number Diff line change
@@ -1,23 +1,12 @@
<div class='row'>
<div class='span4 offset4'>
<h3><%= _("Congratulations!") %></h3>
</div>
<p><%= _("You have successfully signed up") %></p>
<p>
<%= _("<strong>Login:</strong> %s", current_user.login)%>
</p>
<p>
<%= _("<strong>Password:</strong> %s", session[:tmppass]) %>
</p>
<div class='alert'>
<small><%= _("Don't lose the mail sent at %s or you won't be able to login anymore", current_user.email)%></small>
</div>

<div class='row'>
<div class='span4 offset4 well'>
<p><%= _("You have successfully signed up") %></p>
<p>
<%= _("<strong>Login:</strong> %s", current_user.login)%>
</p>
<p>
<%= _("<strong>Password:</strong> %s", session[:tmppass]) %>
</p>
<div class='alert'>
<small><%= _("Don't lose the mail sent at %s or you won't be able to login anymore", current_user.email)%></small>
</div>
</div>
</div>
<div class='span4 offset4'>
<small><%= _("Proceed to %s", link_to(_("admin"), :controller => 'admin/dashboard')) %></small>
</div>
<% @accounts_links = _("Proceed to %s", link_to(_("admin"), :controller => 'admin/dashboard')) %>

0 comments on commit 4630c56

Please sign in to comment.