From 7b964d2f2f576e8ecb7146d23fa302f872b5536a Mon Sep 17 00:00:00 2001 From: Nicolae Claudius Date: Wed, 7 Mar 2012 14:27:53 -0800 Subject: [PATCH] landing, better pjax and more --- app/assets/javascripts/application.js.coffee | 15 ++- app/assets/stylesheets/pages/home.css.scss | 40 +++++-- app/controllers/pages_controller.rb | 10 +- app/views/layouts/application.html.erb | 4 +- app/views/layouts/errors.html.erb | 4 +- app/views/layouts/home.html.erb | 15 +++ app/views/layouts/public.html.erb | 21 +--- app/views/pages/about.html.erb | 2 +- app/views/pages/home.html.erb | 100 +++++++++++------- .../{fragments => shared}/_action.html.erb | 0 .../{fragments => shared}/_benefits.html.erb | 0 .../{fragments => shared}/_features.html.erb | 0 .../{fragments => shared}/_analytics.html.erb | 0 .../{fragments => shared}/_bottom.html.erb | 2 +- .../_navigation.html.erb | 6 +- app/views/shared/_public_top.html.erb | 17 +++ .../navigation/_application.html.erb | 4 +- .../navigation/_public.html.erb | 4 +- 18 files changed, 159 insertions(+), 85 deletions(-) create mode 100644 app/views/layouts/home.html.erb rename app/views/pages/{fragments => shared}/_action.html.erb (100%) rename app/views/pages/{fragments => shared}/_benefits.html.erb (100%) rename app/views/pages/{fragments => shared}/_features.html.erb (100%) rename app/views/{fragments => shared}/_analytics.html.erb (100%) rename app/views/{fragments => shared}/_bottom.html.erb (92%) rename app/views/{fragments => shared}/_navigation.html.erb (77%) create mode 100644 app/views/shared/_public_top.html.erb rename app/views/{fragments => shared}/navigation/_application.html.erb (93%) rename app/views/{fragments => shared}/navigation/_public.html.erb (91%) diff --git a/app/assets/javascripts/application.js.coffee b/app/assets/javascripts/application.js.coffee index 597ca83..a69d574 100644 --- a/app/assets/javascripts/application.js.coffee +++ b/app/assets/javascripts/application.js.coffee @@ -18,8 +18,13 @@ $ -> $(document).popover(selector: '[rel=popover]') $(document).tooltip(selector: '[rel=tooltip]') - $('.pjax-nav a:not([data-remote]):not([data-behavior]):not([data-skip-pjax])').pjax('[data-pjax-container]') - - $(document).on 'pjax:success', (event, data, status, xhr, options) -> - $('ul.pjax-nav').find('li.active').removeClass 'active' - $("ul.pjax-nav a[href=\"#{window.location.pathname}\"]").parents('li').addClass 'active' + pjaxContainer = '[data-pjax-container]' + $('.pjax-nav a:not([data-remote]):not([data-behavior]):not([data-skip-pjax])').pjax(pjaxContainer) + $pjaxContainer = $(pjaxContainer) + $pjaxContainer.on 'pjax:success', (event, data, status, xhr, options) -> + $('.pjax-nav').find('li.active').removeClass 'active' + $(".pjax-nav a[href=\"#{window.location.pathname}\"]").parents('li').addClass 'active' + if $pjaxContainer.parent().hasClass('container') || $pjaxContainer.find('.container').length > 0 + $pjaxContainer.removeClass 'container' + else + $pjaxContainer.addClass 'container' diff --git a/app/assets/stylesheets/pages/home.css.scss b/app/assets/stylesheets/pages/home.css.scss index c304ad0..29f9ec2 100644 --- a/app/assets/stylesheets/pages/home.css.scss +++ b/app/assets/stylesheets/pages/home.css.scss @@ -14,13 +14,41 @@ font-weight: normal; } -.incentives-unit li, -.incentives-unit p -{ +.page-home-incentives li, +.page-home-incentives p { font-size: 14px; line-height: 20px; } -blockquote { - font-style: italic; -} \ No newline at end of file +.page-home-header { + background-color: #B9DCFF; + border-bottom: 1px solid darken(#B9DCFF, 10%); + .page-header { + small { + color: #3F3F39; + } + border-bottom: none; + padding-bottom: 0; + } +} + +.page-home-incentives { + border-top: 1px solid white; + background-color: #DAFFCD; + padding-top: 17px; + padding-bottom: 17px; + border-bottom: 1px solid darken(#DAFFCD, 10%); +} + +.page-home-quotes { + border-top: 1px solid white; + padding-top: 17px; + blockquote { + font-style: italic; + color: #555; + } +} + +.page-home-extra { + padding-top: 17px; +} diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index 2f1625d..28a8f48 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -15,11 +15,17 @@ class PagesController < ApplicationController def show return redirect_to(domains_path) if user_signed_in? && params[:id] == "home" - if params[:id] == "contact" + + options = {template: current_page} + case params[:id] + when "contact" init = user_signed_in? ? {:name => current_user.name, :email => current_user.email} : {} @contact_form = ContactForm.new(init) + when "home" + options[:layout] = 'home' unless request.xhr? end - render :template => current_page + + render options end def contact diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index ba9987c..a2544b5 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -13,14 +13,14 @@ <%= csrf_meta_tag %> - <%= render :partial => 'fragments/navigation' %> + <%= render 'shared/navigation' %>
<%= flash_display 'flash' %> <%= yield %>
- <%= render :partial => 'fragments/bottom' %> + <%= render 'shared/bottom' %>
diff --git a/app/views/layouts/errors.html.erb b/app/views/layouts/errors.html.erb index f0dbabe..1305fc2 100644 --- a/app/views/layouts/errors.html.erb +++ b/app/views/layouts/errors.html.erb @@ -12,14 +12,14 @@ <%= csrf_meta_tag %> - <%= render :partial => 'fragments/top' %> + <%= render 'shared/top' %>
<%= flash_display 'flash' %> <%= yield %>
- <%= render :partial => 'fragments/bottom' %> + <%= render 'shared/bottom' %>
diff --git a/app/views/layouts/home.html.erb b/app/views/layouts/home.html.erb new file mode 100644 index 0000000..6fd86c5 --- /dev/null +++ b/app/views/layouts/home.html.erb @@ -0,0 +1,15 @@ +<%= render 'shared/public_top' %> + + + <%= render 'shared/navigation' %> + +
+ <%= flash_display 'flash' %> + <%= yield %> +
+
+ <%= render 'shared/bottom' %> +
+ + + diff --git a/app/views/layouts/public.html.erb b/app/views/layouts/public.html.erb index bcb2643..6d45f90 100644 --- a/app/views/layouts/public.html.erb +++ b/app/views/layouts/public.html.erb @@ -1,29 +1,14 @@ - - - - - - - - <%= content_for?(:title) ? yield(:title) : "EntryDNS free DNS service and dynamic DNS" %> +<%= render 'shared/public_top' %> - " /> - " /> - - - <%= stylesheet_link_tag "application" %> - <%= javascript_include_tag "application" %> - <%= csrf_meta_tag %> - - <%= render :partial => 'fragments/navigation' %> + <%= render 'shared/navigation' %>
<%= flash_display 'flash' %> <%= yield %>
- <%= render :partial => 'fragments/bottom' %> + <%= render 'shared/bottom' %>
diff --git a/app/views/pages/about.html.erb b/app/views/pages/about.html.erb index e3f9dc8..e57ab8f 100644 --- a/app/views/pages/about.html.erb +++ b/app/views/pages/about.html.erb @@ -20,7 +20,7 @@

How can you benefit from this

-<%= render 'pages/fragments/benefits' %> +<%= render 'pages/shared/benefits' %>

We are open to new ideas or suggestions how to make the service better for you to use. diff --git a/app/views/pages/home.html.erb b/app/views/pages/home.html.erb index d0363a8..62e889d 100644 --- a/app/views/pages/home.html.erb +++ b/app/views/pages/home.html.erb @@ -1,55 +1,73 @@ -

+
+
+