Welcome screen for new users

This commit is contained in:
Kyle Drake 2015-02-10 19:15:49 -08:00
parent c66a935cb1
commit 84f4c3b3aa
5 changed files with 48 additions and 14 deletions

View file

@ -34,6 +34,12 @@ get '/?' do
erb :index, layout: false
end
get '/welcome' do
require_login
redirect '/' if current_site.plan_type != 'free'
erb :'welcome'
end
get '/tutorials' do
erb :'tutorials'
end

View file

@ -1,5 +1,9 @@
require_relative './environment.rb'
Capybara.register_driver :poltergeist do |app|
Capybara::Poltergeist::Driver.new(app, js_errors: false)
end
describe 'signup' do
include Capybara::DSL
@ -15,7 +19,7 @@ describe 'signup' do
end
def site_created?
page.must_have_content 'Your Feed'
page.must_have_content 'Welcome to Neocities'
end
def visit_signup
@ -33,7 +37,6 @@ describe 'signup' do
end
it 'succeeds with valid data' do
Capybara.default_driver = :poltergeist
fill_in_valid
click_signup_button
site_created?.must_equal true
@ -52,7 +55,7 @@ describe 'signup' do
it 'fails to create for existing site' do
fill_in_valid
click_signup_button
page.must_have_content 'Your Feed'
page.must_have_content 'Welcome to Neocities'
Capybara.reset_sessions!
visit_signup
fill_in 'username', with: @site[:username]

View file

@ -396,7 +396,7 @@
</div>
</div>
<%== erb :'_footer', layout: false%>
<%== erb :'_footer', layout: false %>
</footer>
</div>
@ -408,7 +408,7 @@
$.post('/create_validate_all', $(obj.target).serialize(), function(errors) {
if(errors.length == 0) {
$.post('/create', $('#createSiteForm').serialize(), function(res) {
location.reload()
window.location.href = '/welcome'
})
} else {
for(var i=0; i<errors.length;i++) {

View file

@ -5,25 +5,41 @@
if !parent_site
%{<a href="/#new" class="btn-Action">Sign Up</a>}
elsif parent_site && parent_site.plan_type == plan_type
%{<div class="current-plan">Current Plan</div>}
if request.path.match /\/welcome/
%{<a href="/" class="btn-Action">Get Started</a>}
else
%{<div class="current-plan">Current Plan</div>}
end
else
#if plan_type == 'supporter'
# plan_price = "$#{Site::PLAN_FEATURES[plan_type.to_sym][:price]*12}, once per year"
#else
plan_price = "$#{Site::PLAN_FEATURES[plan_type.to_sym][:price]}, monthly"
#end
%{<a data-plan_name="#{Site::PLAN_FEATURES[plan_type.to_sym][:name]}" data-plan_type="#{plan_type}" data-plan_price="#{plan_price}" onclick="return false" class="btn-Action planPricingButton">#{parent_site.plan_type == 'free' ? 'Upgrade' : 'Change'}</a>}
if request.path.match /\/welcome/
button_title = 'Get Started'
else
button_title = parent_site.plan_type == 'free' ? 'Upgrade' : 'Change'
end
%{<a data-plan_name="#{Site::PLAN_FEATURES[plan_type.to_sym][:name]}" data-plan_type="#{plan_type}" data-plan_price="#{plan_price}" onclick="card = new Skeuocard($('#skeuocard')); return false" class="btn-Action planPricingButton">#{button_title}</a>}
end
end
%>
<section class="section plans">
<% if request.path.match /\/welcome/ %>
<div class="txt-Center"><img src="/img/heartcat.png"></div>
<% end %>
<h2>
<% if request.path == '/' %>
Need more space? Weve got you covered.
<br>
Upgrading gives you more space, bandwidth, features, <strong>and helps us stay independent and keep the free sites free.</strong>
<% elsif request.path.match /\/plan/ %>
<% elsif request.path.match /\/welcome/ %>
Welcome to Neocities!
<% else %>
Support Us
<% end %>
</h2>
@ -36,6 +52,18 @@
</h3>
</div>
</div>
<% elsif request.path.match /\/welcome/ %>
<div class="row" style="margin-top: 0px">
<div class="col-75" style="margin-left: auto; margin-right: auto;">
<h3 class="subtitle">
Welcome, and thanks for signing up! We can't wait to see your web site!
<br>
Neocities does not put advertising on your site, <strong>and we never will</strong>.
<br>
Instead, Neocities is powered by supporters like you. If you'd like to help us out, we'd love your support. Thank you!
</h3>
</div>
</div>
<% end %>
<div class="plan-overview">
@ -65,7 +93,7 @@
</div>
<div class="col col-25 supporter">
<div class="plan-image" data-original-title="Pick me!"></div>
<div class="plan-image" data-original-title="Meow!"></div>
<h3>Supporter</h3>
<% if parent_site && parent_site.legacy_supporter? %>
<div class="price">$<%= Site::LEGACY_SUPPORTER_PRICES[parent_site[:plan_type].to_sym] %></div>
@ -374,16 +402,12 @@
<% if current_site %>
<link rel="stylesheet" href="/css/skeuocard.reset.css" />
<link rel="stylesheet" href="/css/skeuocard.css" />
<script src="/js/skeuocard.min.js"></script>
<script src="/js/cssua.min.js"></script>
<script type="text/javascript" src="https://js.stripe.com/v2/"></script>
<script>
Stripe.setPublishableKey('<%= $config['stripe_publishable_key'] %>')
$(function() {
card = new Skeuocard($("#skeuocard"))
})
$('#upgradeForm').submit(function(event) {
if($('#stripe_token').val() != '')
@ -427,5 +451,5 @@
})
</script>
<script src="/js/skeuocard.min.js"></script>
<% end %>

1
views/welcome.erb Normal file
View file

@ -0,0 +1 @@
<%== erb :'plan/_pricing' %>