Skip to content

Commit

Permalink
Basics of new signup modal/form
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick Barnwell committed May 5, 2015
1 parent ec2948c commit 30e4e0f
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 9 deletions.
4 changes: 4 additions & 0 deletions app/assets/javascripts/modals.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ function loadModal(modalTarget) {
function closeModal() { modal.dialog('close') }

function modalActivation() {
$('a.sign-up').on('click', function(evt) {
loadModal('/signup')(evt)
});

$('#login').on('click', function(evt) {
loadModal('/signin')(evt)
});
Expand Down
8 changes: 8 additions & 0 deletions app/assets/stylesheets/static/_signup.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.full-sign-up {
form.sign-up {
@include media($tablet) {
@include shift(3);
@include span-columns(6);
}
}
}
11 changes: 11 additions & 0 deletions app/controllers/static_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,15 @@ def questions

def hosting
end

def jfdi_signup
use_new_styles
@full_form = !request.xhr?
return redirect_to profile_path if current_user
if @full_form
render 'registrations/sign_up'
else
render 'shared/_new_sign_up', layout: @full_form
end
end
end
1 change: 1 addition & 0 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,6 @@
ga('create', 'UA-39634305-2', 'teawithstrangers.com');
ga('send', 'pageview');
</script>
<div id="modal"></div>
</body>
</html>
3 changes: 3 additions & 0 deletions app/views/registrations/sign_up.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div class="container full-sign-up">
<%= render partial: 'shared/new_sign_up' %>
</div>
2 changes: 1 addition & 1 deletion app/views/shared/_header.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<li class="nav-link-item"><%= link_to li[0], li[1] %></li>
<% end %>
<li class="nav-link-item">
<%= link_to_if(current_user.nil?, 'Sign In', new_user_session_path, class: 'sign-in-emphasis') do
<%= link_to_if(current_user.nil?, 'Sign In', new_user_session_path, id: 'login', class: 'sign-in-emphasis') do
link_to('My Account', profile_path)
end %>
</ul>
Expand Down
6 changes: 6 additions & 0 deletions app/views/shared/_new_sign_up.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { class: ['sign-up' ] }) do |f| %>
<%= f.text_field :nickname, placeholder: 'Nickname' %>
<%= f.email_field :email, placeholder: 'Email Address' %>
<%= f.password_field :password, placeholder: 'Password' %>
<%= f.submit "Let's Go!" %>
<% end %>
2 changes: 1 addition & 1 deletion app/views/shared/_signup.html.haml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
- if current_user.nil?
= form_for(resource, as: resource_name, url: registration_path(resource_name), class: 'signup') do |f|
= form_for(resource, as: resource_name, url: registration_path(resource_name), class: 'sign-up') do |f|
= f.text_field :nickname, placeholder: 'Nickname'
= f.email_field :email, placeholder: 'Email Address'
- if dropdown ||= false
Expand Down
16 changes: 10 additions & 6 deletions app/views/static/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
Expand your world, one
real-life conversation at a time.
</h2>
<button class='orange cover-photo-cta'>
<%= link_to 'Sign Up', '#' %>
</button>
<%= link_to sign_up_path, class: 'sign-up' do %>
<button class='orange cover-photo-cta'>
Sign Up
</button>
<% end %>
</div>
</div>
</div>
Expand Down Expand Up @@ -61,9 +63,11 @@
<h2>
Ready to take the plunge?
</h2>
<button class='orange cover-photo-cta'>
<%= link_to 'Sign Up', '#' %>
</button>
<%= link_to sign_up_path, class: 'sign-up' do %>
<button class='orange cover-photo-cta'>
Sign Up
</button>
<% end %>
</div>
</div>
</div>
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
get '/openhouse' => 'static#openhouse', as: :openhouse
get '/questions' => 'static#questions', as: :questions
get '/stories' => 'static#stories', as: :stories
get '/signup' => 'static#jfdi_signup', as: :sign_up

# Devise and Registration Routes
devise_for :users, :controllers => {:registrations => "registrations"}, :skip => [:sessions]
Expand Down
2 changes: 1 addition & 1 deletion lib/assets/stylesheets/tws-styles

0 comments on commit 30e4e0f

Please sign in to comment.