diff --git a/app/assets/javascripts/search/landing_page.js.coffee.erb b/app/assets/javascripts/search/landing_page.js.coffee.erb index a1566f284a..753d372bbb 100644 --- a/app/assets/javascripts/search/landing_page.js.coffee.erb +++ b/app/assets/javascripts/search/landing_page.js.coffee.erb @@ -12,9 +12,36 @@ setup_background = -> setup_offcanvas_panel = -> events = 'click.fndtn' - $("#sidebarButton").on events, (e) -> + $("#sidebarLoginButton").on events, (e) -> e.preventDefault() - $("body").toggleClass "active" + + if $("#sign-up-content").is(':visible') && $("body").hasClass("active") + $("#login-content").show() + $("#sign-up-content").hide() + else if $("body").hasClass("active") + $("body").toggleClass "active" + $("#login-content").hide(400) + $("#sign-up-content").hide(400) + else + $("body").toggleClass "active" + $("#login-content").show() + $("#sign-up-content").hide() + + $("#sidebarSignUpButton").on events, (e) -> + e.preventDefault() + + if $("#login-content").is(':visible') && $("body").hasClass("active") + + $("#login-content").hide() + $("#sign-up-content").show() + else if $("body").hasClass("active") + $("body").toggleClass "active" + $("#login-content").hide(400) + $("#sign-up-content").hide(400) + else + $("body").toggleClass "active" + $("#login-content").hide() + $("#sign-up-content").show() setup_login_handlers = -> diff --git a/app/views/home/_login.html.haml b/app/views/home/_login.html.haml index 2d15b23d96..ddc9a3f6b1 100644 --- a/app/views/home/_login.html.haml +++ b/app/views/home/_login.html.haml @@ -1,19 +1,18 @@ -.login-panel - .row - .large-12.large-centered.columns - %h2 Login - = form_for Spree::User.new, :remote => true, :html => {'data-type' => :json}, :as => :spree_user, :url => spree.spree_user_session_path do |f| - #password-credentials - #login-error-alert.alert-box.alert.hide - Invalid email or password - %p - = f.label :email, t(:email) - = f.email_field :email, :class => 'title', :tabindex => 1 - %p - = f.label :password, t(:password) - = f.password_field :password, :class => 'title', :tabindex => 2 - %p - %label - = f.check_box :remember_me - = f.label :remember_me, t(:remember_me) - %p= f.submit t(:login), :class => 'button primary', :tabindex => 3 \ No newline at end of file +.row + .large-12.large-centered.columns + %h2 Login += form_for Spree::User.new, :remote => true, :html => {'data-type' => :json}, :as => :spree_user, :url => spree.spree_user_session_path do |f| + #password-credentials + #login-error-alert.alert-box.alert.hide + Invalid email or password + %p + = f.label :email, t(:email) + = f.email_field :email, :class => 'title', :tabindex => 1 + %p + = f.label :password, t(:password) + = f.password_field :password, :class => 'title', :tabindex => 2 + %p + %label + = f.check_box :remember_me + = f.label :remember_me, t(:remember_me) + %p= f.submit t(:login), :class => 'button primary', :tabindex => 3 \ No newline at end of file diff --git a/app/views/home/_signup.html.haml b/app/views/home/_signup.html.haml new file mode 100644 index 0000000000..5c8284b485 --- /dev/null +++ b/app/views/home/_signup.html.haml @@ -0,0 +1,17 @@ +.row + .large-12.large-centered.columns + %h2 Sign Up += form_for Spree::User.new, :as => :spree_user, :url => spree.spree_user_registration_path(@spree_user) do |f| + %p + = f.label :email, t(:email) + = f.email_field :email, :class => 'title' + + #password-credentials + %p + = f.label :password, t(:password) + = f.password_field :password, :class => 'title' + %p + = f.label :password_confirmation, t(:confirm_password) + = f.password_field :password_confirmation, :class => 'title' + + = f.submit t(:create), :class => 'button' diff --git a/app/views/layouts/landing_page.html.haml b/app/views/layouts/landing_page.html.haml index 4a6dbfc2cc..ee7cdb9f65 100644 --- a/app/views/layouts/landing_page.html.haml +++ b/app/views/layouts/landing_page.html.haml @@ -16,13 +16,13 @@ %nav.top-bar %section.top-bar-section %ul.left + %li= link_to image_tag("ofn_logo_small.png"), new_landing_page_path + %li.divider - if spree_current_user.nil? - %li= link_to image_tag("ofn_logo_small.png"), root_url - %li.divider - %li#login-link= link_to "Login", "#sidebar", id: "sidebarButton", class: "sidebar-button" + %li#login-link= link_to "Login", "#sidebar", id: "sidebarLoginButton", class: "sidebar-button" %li#login-name.hide %li.divider - %li#sign-up-link= link_to "Sign Up", "#" + %li#sign-up-link= link_to "Sign Up", "#sidebar", id: "sidebarSignUpButton", class: "sidebar-button" %li#sign-out-link.hide= link_to "Sign Out", "/logout" - else %li#login-link.hide= link_to "Login", "#sidebar", id: "sidebarButton", class: "sidebar-button" @@ -38,6 +38,10 @@ %section{ role: "main" } = yield %section#sidebar{ role: "complementary" } - = render "home/login" + .login-panel + #login-content.hide + = render "home/login" + #sign-up-content.hide + = render "home/signup" = yield :scripts