From 5356572f0408e95ca18e0337ae77fdc022310a50 Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Mon, 20 Feb 2017 18:44:36 +0000 Subject: [PATCH 1/5] Data migrations for updating billing plans and existing users --- lib/tasks/data_migrations.rake | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/lib/tasks/data_migrations.rake b/lib/tasks/data_migrations.rake index 075f7dc0..8de590b4 100644 --- a/lib/tasks/data_migrations.rake +++ b/lib/tasks/data_migrations.rake @@ -35,4 +35,37 @@ namespace :data_migrations do # Since no active subscriptions is equivalent to the free tier, there's no need to build Subscriptions for these users end end + + desc "Add bandwidth bonuses to billing plans" + task billing_plan_bandwidths: :environment do + puts "Updating bandwidths for all billing plans" + BillingPlan.find_by(stripe_plan_id: 'starter').update(bonus_bandwidth_kb: 50_000) + BillingPlan.find_by(stripe_plan_id: 'free-for-life').update(bonus_bandwidth_kb: 250_000) + BillingPlan.find_by(stripe_plan_id: 'early-adopters').update(bonus_bandwidth_kb: 950_000) + BillingPlan.find_by(stripe_plan_id: 'premium').update(bonus_bandwidth_kb: 950_000) + puts "Done" + end + + desc "Add bandwidth counts to existing users" + task initialize_user_bandwidths: :environment do + starter_id = BillingPlan.find_by(stripe_plan_id: 'starter').id + beta_id = BillingPlan.find_by(stripe_plan_id: 'free-for-life').id + premium_ids = [ + BillingPlan.find_by(stripe_plan_id: 'early-adopters').id, + BillingPlan.find_by(stripe_plan_id: 'premium').id + ] + + # Premium + puts "Setting premium users to 1GB" + puts User.where(selected_billing_plan_id: premium_ids).update_all(upload_bandwidth_kb: 1_000_000) # 1GB + + # Starter + puts "Setting starter users to 50MB" + puts User.where(selected_billing_plan_id: nil).update_all(upload_bandwidth_kb: 50_000) # 50MB + puts User.where(selected_billing_plan_id: starter_id).update_all(upload_bandwidth_kb: 50_000) # 50MB + + # Beta + puts "Setting beta users to 250MB" + puts User.where(selected_billing_plan_id: beta_id).update_all(upload_bandwidth_kb: 250_000) # 250MB + end end \ No newline at end of file From 56aee7d4288ff574fe7fca7e67f6c0a281bc4685 Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Mon, 20 Feb 2017 18:45:42 +0000 Subject: [PATCH 2/5] Update CTA button colors on landing page --- app/views/main/index.html.erb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/main/index.html.erb b/app/views/main/index.html.erb index e8e02f4b..82c22f30 100644 --- a/app/views/main/index.html.erb +++ b/app/views/main/index.html.erb @@ -3,7 +3,7 @@


-

+

<%= t('marketing.landing_page.promo_header') %>

@@ -14,7 +14,7 @@
<%= link_to t('marketing.landing_page.cta.get_yours'), new_user_registration_path, - class: 'btn-large waves-effect waves-light teal lighten-1' %> + class: 'btn-large waves-effect waves-light blue lighten-1' %>

<%= t('marketing.landing_page.promo_subtext') %> @@ -208,7 +208,7 @@
-

<%= t('marketing.landing_page.pricing.title') %>

+

<%= t('marketing.landing_page.pricing.title') %>

<%= t('marketing.landing_page.pricing.subtitle') %> @@ -276,7 +276,7 @@
<%= link_to t('marketing.landing_page.pricing.cta.button'), new_user_registration_path, - class: 'btn-large waves-effect waves-light teal lighten-1' %> + class: 'btn-large waves-effect waves-light blue lighten-1' %>
From cf0ba4d11490eb0fc6957387eb5763439437e9d4 Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Mon, 20 Feb 2017 19:00:45 +0000 Subject: [PATCH 3/5] Don't show things users can't create on dashboard unless they already have some --- app/views/devise/registrations/new.html.erb | 2 +- app/views/main/dashboard.html.erb | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/views/devise/registrations/new.html.erb b/app/views/devise/registrations/new.html.erb index 6167f319..21ed6afb 100644 --- a/app/views/devise/registrations/new.html.erb +++ b/app/views/devise/registrations/new.html.erb @@ -45,7 +45,7 @@
- <%= f.submit "Sign up", class: 'btn' %> + <%= f.submit "Sign up", class: 'btn blue' %>


<%= render "devise/shared/links" %> diff --git a/app/views/main/dashboard.html.erb b/app/views/main/dashboard.html.erb index 09a359a9..6155a34b 100644 --- a/app/views/main/dashboard.html.erb +++ b/app/views/main/dashboard.html.erb @@ -15,8 +15,10 @@

<% [:universe, :character, :location, :item, :creature, :race, :religion, :group, :magic, :language, :scene].each do |type| %> + <% content_list = current_user.send(type.to_s.pluralize) %> + <% next if !current_user.can_create?(type.to_s.capitalize.constantize) && content_list.empty? %>
"> - <%= render partial: 'content/cards/in_universe_content_list', locals: { content_type: type, content_list: current_user.send(type.to_s.pluralize) } %> + <%= render partial: 'content/cards/in_universe_content_list', locals: { content_type: type, content_list: content_list } %>
<% end %>
From 19f5ff03a48c7c890a694d29bc86892583199386 Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Mon, 20 Feb 2017 19:50:07 +0000 Subject: [PATCH 4/5] Show content list banners even when users don't have any content of that type --- app/views/content/index.html.erb | 43 ++++++++++++++++---------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/app/views/content/index.html.erb b/app/views/content/index.html.erb index 45103d62..490b4edf 100644 --- a/app/views/content/index.html.erb +++ b/app/views/content/index.html.erb @@ -7,29 +7,30 @@ <%= render partial: 'cards/serendipitous/content_question', locals: { question: @question, content: @questioned_content } %> <% end %> -<% if @content.any? %> -
-
    -
  • - <%= image_tag "card-headers/#{content_type.pluralize}" %> - -
    -

    <%= content_type.titleize.pluralize %>

    -
    <%= t("content_oneliners.#{content_type}") %>
    -
    -
  • -
-
+
+
    +
  • + <%= image_tag "card-headers/#{content_type.pluralize}" %> + +
    +

    <%= content_type.titleize.pluralize %>

    +
    <%= t("content_oneliners.#{content_type}") %>
    +
    +
  • +
+
- + }); + + +<% if @content.any? %>

You've created <%= pluralize(@content.count, @content.content_name) %> @@ -65,7 +66,7 @@ <% elsif @content.empty? %> -
+

You haven't created any <%= @content.content_name.pluralize %> yet!

From 8f52fbdef75ba42b44963dffeb84228b52d59395 Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Mon, 20 Feb 2017 19:50:21 +0000 Subject: [PATCH 5/5] Replace sidebar subscription message with image upload message --- app/views/layouts/_sidebar.html.erb | 33 ++++++++++++++++------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/app/views/layouts/_sidebar.html.erb b/app/views/layouts/_sidebar.html.erb index 4d6ba11b..4de54ae6 100644 --- a/app/views/layouts/_sidebar.html.erb +++ b/app/views/layouts/_sidebar.html.erb @@ -22,21 +22,24 @@ <% end %> -
-

Subscriptions are here!

+
+

You can now upload images!

- Read about what that means for you and your notebook in our latest blog post. + Image uploading has been our most-requested feature since launch. Now that I'm working full-time on + Notebook.ai, I'm happy to say it took about a week to finish up — and now it's ready for you. +

+

+ You can upload images to any content from the "Gallery" tab while editing it. +

+

+ Free users have 50MB of space, and premium users have a whopping 1GB. + <% if current_user && current_user.selected_billing_plan_id == BillingPlan.find_by(stripe_plan_id: 'free-for-life').id %> + Because you were here at Notebook.ai's launch, we've quintupled your space from 50MB to 250MB. Thank you! + <% end %> +

+

+ Happy worldbuilding, and + + don't forget to leave feedback on what feature you'd like to see next!

- <% active_billing_plans = current_user.active_billing_plans if current_user %> - <% if current_user && active_billing_plans.any? && active_billing_plans.first.stripe_plan_id == 'free-for-life' %> -

- Because you signed up during Notebook.ai's October "free for life" promotion, your account will continue to be just that — - free for life. :) -

- <% else %> -

- You can sign up for a subscription by clicking "Account billing" from the dropdown menu in the top-right of any page, or by - <%= link_to 'clicking here', subscription_path %>. -

- <% end %>