diff --git a/app_helpers.rb b/app_helpers.rb index 0723f111..638f1c48 100644 --- a/app_helpers.rb +++ b/app_helpers.rb @@ -76,3 +76,31 @@ def send_confirmation_email(site=current_site) body: Tilt.new('./views/templates/email_confirm.erb', pretty: true).render(self, site: site) }) end + +def plan_pricing_button(plan_type) + plan_type = plan_type.to_s + + if !parent_site + %{Sign Up} + elsif parent_site && parent_site.plan_type == plan_type + if request.path.match /\/welcome/ + %{Get Started} + else + %{
Current Plan
} + 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 + + if request.path.match /\/welcome/ + button_title = 'Get Started' + else + button_title = parent_site.plan_type == 'free' ? 'Upgrade' : 'Change' + end + + %{#{button_title}} + end +end diff --git a/ext/numeric.rb b/ext/numeric.rb index 88535856..5a0d7064 100644 --- a/ext/numeric.rb +++ b/ext/numeric.rb @@ -15,9 +15,9 @@ class Numeric # if space >= 1000000 # "#{space/1000000} TB" if space >= 1000 - "#{space/1000} GB" + "#{(space/1000).to_comma_separated} GB" else - "#{space} MB" + "#{space.to_comma_separated} MB" end end diff --git a/views/plan/_compare.erb b/views/plan/_compare.erb new file mode 100644 index 00000000..907f4e97 --- /dev/null +++ b/views/plan/_compare.erb @@ -0,0 +1,152 @@ +

What You Get

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Free

+ <% if request.path != '/welcome' %> +

$<%= Site::PLAN_FEATURES[:free][:price] %>/mo

+ <%== plan_pricing_button :free %> + <% end %> +
+

Supporter

+ <% if request.path != '/welcome' %> + <% if parent_site && parent_site.legacy_supporter? %> +

$<%= Site::LEGACY_SUPPORTER_PRICES[parent_site.values[:plan_type].to_sym] %>/mo

+
Current Plan
+ <% else %> +

$<%= Site::PLAN_FEATURES[:supporter][:price] %>/mo

+ <%== plan_pricing_button :supporter %> + <% end %> + <% end %> +
+ Storage + <%= Site::PLAN_FEATURES[:free][:space].to_bytes_pretty %><%= (Site::PLAN_FEATURES[:supporter][:space] / (10**6)).to_comma_separated %> MB
+ Bandwidth + <%= Site::PLAN_FEATURES[:free][:bandwidth].to_bytes_pretty %><%= Site::PLAN_FEATURES[:supporter][:bandwidth].to_bytes_pretty %>
+ No advertising, ever +
+ Global CDN Site Cache +
+ Free Site Subdomain +
+ One-Click Backups +
+ Site Tags +
+ RSS Feed +
+ Follow Your Favorite Sites +
+ Site Profile +
+ Neocities Site Editor +
+ WebDAV Uploading +
+ Custom Domains +
+ Unlimited Site Creation +
+ Custom SSL Certs (soon) +
+ No File Upload Type Restrictions +
+ + diff --git a/views/plan/_pricing.erb b/views/plan/_pricing.erb index c0a8f255..6eda3f0f 100644 --- a/views/plan/_pricing.erb +++ b/views/plan/_pricing.erb @@ -1,31 +1,5 @@ <% - def plan_pricing_button(plan_type) - plan_type = plan_type.to_s - if !parent_site - %{Sign Up} - elsif parent_site && parent_site.plan_type == plan_type - if request.path.match /\/welcome/ - %{Get Started} - else - %{
Current Plan
} - 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 - - if request.path.match /\/welcome/ - button_title = 'Get Started' - else - button_title = parent_site.plan_type == 'free' ? 'Upgrade' : 'Change' - end - - %{#{button_title}} - end - end %>
@@ -125,147 +99,7 @@ - -

Compare

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

Free

-

$<%= Site::PLAN_FEATURES[:free][:price] %>/mo

- <%== plan_pricing_button :free %> -
-

Supporter

- <% if parent_site && parent_site.legacy_supporter? %> -

$<%= Site::LEGACY_SUPPORTER_PRICES[parent_site.values[:plan_type].to_sym] %>/mo

-
Current Plan
- <% else %> -

$<%= Site::PLAN_FEATURES[:supporter][:price] %>/mo

- <%== plan_pricing_button :supporter %> - <% end %> -
- Storage - <%= Site::PLAN_FEATURES[:free][:space].to_bytes_pretty %><%= Site::PLAN_FEATURES[:supporter][:space].to_bytes_pretty %>
- Bandwidth - <%= Site::PLAN_FEATURES[:free][:bandwidth].to_bytes_pretty %>1000 GB
- No advertising, ever -
- Global CDN Site Cache -
- Free Site Subdomain -
- One-Click Backups -
- Site Tags -
- RSS Feed -
- Follow Your Favorite Sites -
- Site Profile -
- Neocities Site Editor -
- WebDAV Uploading -
- Custom Domains -
- Unlimited Site Creation -
- Custom SSL Certs (soon) -
- No File Upload Type Restrictions -
+ <%== erb :'plan/_compare', layout: false %> <% if request.path.match /\/plan/ %>
@@ -313,10 +147,6 @@