Browse Source

layouts, refactor

pull/1/head
Nicolae Claudius 13 years ago
parent
commit
4e0ca91c65
  1. 2
      app/controllers/home_controller.rb
  2. 11
      app/views/fragments/_sidebar.html.erb
  3. 9
      app/views/fragments/_user_navigation.html.erb
  4. 5
      app/views/layouts/application.html.erb
  5. 23
      app/views/layouts/devise.html.erb
  6. 4
      app/views/layouts/marketing.html.erb
  7. 14
      config/application.rb

2
app/controllers/home_controller.rb

@ -1,6 +1,6 @@
class HomeController < ApplicationController class HomeController < ApplicationController
skip_before_filter :authenticate_user! skip_before_filter :authenticate_user!
layout 'home' layout proc{|controller| request.xhr? ? false : 'marketing'}
def index def index
redirect_to dashboard_path if user_signed_in? redirect_to dashboard_path if user_signed_in?

11
app/views/fragments/_sidebar.html.erb

@ -1,11 +0,0 @@
<div id="sidebar">
<div class="block">
<h3>Menu</h3>
<ul class="navigation">
<li><%= link_to 'Dashboard', dashboard_path, :data => {:pjax => '#main'} %></li>
<li><%= link_to 'Domains', domains_path, :data => {:pjax => '#main'} %></li>
</ul>
</div>
</div>

9
app/views/fragments/_user_navigation.html.erb

@ -1,9 +0,0 @@
<ul class="wat-cf">
<% if user_signed_in? %>
<li><%= link_to(current_user.email, edit_user_registration_path) %></li>
<li><%= link_to('Sign out', destroy_user_session_path, :method => :delete) %></li>
<% else %>
<li><%= link_to('Sign up', new_user_registration_path) %></li>
<li><%= link_to('Sign in', new_user_session_path) %></li>
<% end %>
</ul>

5
app/views/layouts/application.html.erb

@ -12,11 +12,11 @@
<%= render :partial => 'fragments/top' %> <%= render :partial => 'fragments/top' %>
<div id="wrapper" class="wat-cf"> <div id="wrapper" class="wat-cf">
<%= flash_display 'flash' %> <%= flash_display 'flash' %>
<div id="main"> <div id="main" style="width: 100%;">
<div class="block"> <div class="block">
<div class="secondary-navigation"> <div class="secondary-navigation">
<ul class="wat-cf"> <ul class="wat-cf">
<li><a href="#">Manage</a></li> <li><a href="#">&nbsp;</a></li>
</ul> </ul>
</div> </div>
<div class="content"> <div class="content">
@ -26,7 +26,6 @@
</div> </div>
</div> </div>
</div> </div>
<%= render :partial => 'fragments/sidebar' %>
</div> </div>
<%= render :partial => 'fragments/bottom' %> <%= render :partial => 'fragments/bottom' %>
</div> </div>

23
app/views/layouts/devise.html.erb

@ -1,23 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Simple DNS</title>
<%= stylesheet_link_tag "application" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tag %>
</head>
<body>
<div id="container">
<%= render :partial => 'fragments/top' %>
<div id="box" class="wat-cf">
<%= flash_display 'flash' %>
<div id="main">
<%= yield %>
</div>
</div>
<%= render :partial => 'fragments/bottom' %>
</div>
</body>
</html>

4
app/views/layouts/home.html.erb → app/views/layouts/marketing.html.erb

@ -12,7 +12,9 @@
<%= render :partial => 'fragments/top' %> <%= render :partial => 'fragments/top' %>
<div id="wrapper" class="wat-cf"> <div id="wrapper" class="wat-cf">
<%= flash_display 'flash' %> <%= flash_display 'flash' %>
<%= yield %> <div id="main" style="width: 100%;" data-pjax-container="true">
<%= yield %>
</div>
</div> </div>
<%= render :partial => 'fragments/bottom' %> <%= render :partial => 'fragments/bottom' %>
</div> </div>

14
config/application.rb

@ -46,11 +46,15 @@ module Simpledns
config.assets.version = '1.0' config.assets.version = '1.0'
config.to_prepare do config.to_prepare do
Devise::SessionsController.layout "devise" layout = proc{|controller|
Devise::RegistrationsController.layout proc{ |controller| user_signed_in? ? "application" : "devise" } l = user_signed_in? ? "application" : "marketing"
Devise::ConfirmationsController.layout "devise" request.xhr? ? false : l
Devise::UnlocksController.layout "devise" }
Devise::PasswordsController.layout "devise" Devise::SessionsController.layout layout
Devise::RegistrationsController.layout layout
Devise::ConfirmationsController.layout layout
Devise::UnlocksController.layout layout
Devise::PasswordsController.layout layout
end end
end end

Loading…
Cancel
Save