mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Core of sign up functionality.
This commit is contained in:
@@ -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 = ->
|
||||
|
||||
@@ -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
|
||||
.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
|
||||
17
app/views/home/_signup.html.haml
Normal file
17
app/views/home/_signup.html.haml
Normal file
@@ -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'
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user