From f2663fddb16ff8e06f38e818d3fecb36fcecc8f2 Mon Sep 17 00:00:00 2001
From: Andrew Brown
Date: Sat, 18 Jan 2020 14:23:28 -0600
Subject: [PATCH] polish
---
app/controllers/subscriptions_controller.rb | 6 ++++--
app/views/main/dashboard.html.erb | 12 ++++++++++++
app/views/subscriptions/new.html.erb | 4 ++--
app/views/subscriptions/prepay.html.erb | 2 +-
4 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/app/controllers/subscriptions_controller.rb b/app/controllers/subscriptions_controller.rb
index cae6bc06..579d4556 100644
--- a/app/controllers/subscriptions_controller.rb
+++ b/app/controllers/subscriptions_controller.rb
@@ -34,10 +34,12 @@ class SubscriptionsController < ApplicationController
def prepay
@invoices = current_user.paypal_invoices
- .where.not(status: 'CREATED')
+ .where(status: 'COMPLETED')
.includes(:page_unlock_promo_code)
.order('id desc')
-
+ .sort_by { |invoice| invoice.page_unlock_promo_code.uses_remaining }
+ .reverse
+
promo_code_ids = @invoices.map(&:page_unlock_promo_code_id).flatten
@promo_codes = PageUnlockPromoCode.where(id: promo_code_ids)
end
diff --git a/app/views/main/dashboard.html.erb b/app/views/main/dashboard.html.erb
index 62673b93..c28e9d99 100644
--- a/app/views/main/dashboard.html.erb
+++ b/app/views/main/dashboard.html.erb
@@ -11,6 +11,18 @@
<% end %>
+ <% unless current_user.notice_dismissals.where(notice_id: 4).any? %>
+
+
+ <%= link_to 'Dismiss this notice.', notice_dismissal_dismiss_path(notice_id: 4), class: 'blue-text right' %>
+ <%= link_to prepay_path, class: 'black-text' do %>
+
+ New in Notebook.ai: You can now purchase Premium for yourself — or your friends — with PayPal.
+ <% end %>
+
+
+ <% end %>
+
<%
s_width = 12
m_width = 6
diff --git a/app/views/subscriptions/new.html.erb b/app/views/subscriptions/new.html.erb
index 779f891c..6dc10c6e 100644
--- a/app/views/subscriptions/new.html.erb
+++ b/app/views/subscriptions/new.html.erb
@@ -268,8 +268,8 @@
- These codes let you prepay for however many months of Premium you'd like, and can be activated afterwards
- whenever you'd like. Each code can be used only once, but can be used by anyone you share the code with —
+ These codes let you prepay for however many months of Premium you'd like, and can be manually activated at any time.
+ Each code can be used only once, but can be used by anyone you share the code with —
so they make great gifts, too!
diff --git a/app/views/subscriptions/prepay.html.erb b/app/views/subscriptions/prepay.html.erb
index 3863d32d..dbef291d 100644
--- a/app/views/subscriptions/prepay.html.erb
+++ b/app/views/subscriptions/prepay.html.erb
@@ -161,7 +161,7 @@
<%= link_to '#', class: 'btn hoverable black-text white right activator', onclick: 'return false' do %>
share
- Share
+ Gift
<% end %>
<% unless current_user.on_premium_plan? %>
<%= form_for :promotional_code, url: redeem_path do |form| %>