This commit is contained in:
Andrew Brown 2020-01-18 14:23:28 -06:00
parent 2deb04aa4c
commit f2663fddb1
4 changed files with 19 additions and 5 deletions

View File

@ -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

View File

@ -11,6 +11,18 @@
</div>
<% end %>
<% unless current_user.notice_dismissals.where(notice_id: 4).any? %>
<div class="col s12">
<div class="hoverable card-panel orange lighten-5">
<%= link_to 'Dismiss this notice.', notice_dismissal_dismiss_path(notice_id: 4), class: 'blue-text right' %>
<%= link_to prepay_path, class: 'black-text' do %>
<i class="fa fa-paypal left"></i>
New in Notebook.ai: You can now purchase Premium for yourself &mdash; or your friends &mdash; with PayPal.
<% end %>
</div>
</div>
<% end %>
<%
s_width = 12
m_width = 6

View File

@ -268,8 +268,8 @@
</p>
<br />
<p>
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 &mdash;
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 &mdash;
so they make great gifts, too!
</p>
<br />

View File

@ -161,7 +161,7 @@
<div class="card-action">
<%= link_to '#', class: 'btn hoverable black-text white right activator', onclick: 'return false' do %>
<i class="material-icons left">share</i>
Share
Gift
<% end %>
<% unless current_user.on_premium_plan? %>
<%= form_for :promotional_code, url: redeem_path do |form| %>