Skip to content

Commit d9ce157

Browse files
committed
Fix upgrade/downgrade buttons
- Remove old buttons I had added before the UI work. - Fix: make new upgrade button use the dedicated action. - Add symmetric downgrade button.
1 parent 7bf7010 commit d9ce157

2 files changed

Lines changed: 12 additions & 17 deletions

File tree

saas/app/views/account/settings/_paid_plan.html.erb

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,4 @@
1616

1717
<% if Current.account.subscription %>
1818
<%= render "account/settings/subscription", subscription: Current.account.subscription %>
19-
<div class="settings-subscription__footer txt-small margin-block">
20-
Right now you’re on the <strong><%= Current.account.plan.name %></strong> plan which includes unlimited cards, unlimited users, and <%= storage_to_human_size(Plan.paid.storage_limit) %> of storage.
21-
22-
<% unless Current.account.exceeding_storage_limit? || Current.account.nearing_plan_storage_limit? %>
23-
<%= button_to "Upgrade", account_subscription_path(plan_key: Plan.paid_with_extra_storage.key), class: "btn btn--plain settings-subscription__link txt-link", form: { class: "flex-inline flex-wrap", data: { turbo: false } } %>
24-
to <%= storage_to_human_size(Plan.paid_with_extra_storage.storage_limit) %> storage for <%= number_to_currency(Plan.paid_with_extra_storage.price - Plan.paid.price, strip_insignificant_zeros: true) %>/month more.
25-
<% end %>
26-
</div>
27-
<% end %>
19+
<% end %>

saas/app/views/account/settings/_subscription.html.erb

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,19 @@
22
<p class="margin-block-start-half"><%= subscription_period_end_action(subscription) %> <strong><%= subscription.current_period_end.to_date.to_fs(:long) %></strong></p>
33
<% end %>
44

5-
<p>
6-
<% if subscription.plan == Plan.paid && (Current.account.nearing_plan_storage_limit? || Current.account.exceeding_storage_limit?) %>
7-
<%= button_to "Upgrade to #{Plan.paid_with_extra_storage.name } for #{ number_to_currency(Plan.paid_with_extra_storage.price, strip_insignificant_zeros: true) }/month", account_subscription_upgrade_path, class: "btn settings-subscription__button", form: { data: { turbo: false } } %>
8-
<% elsif subscription.plan == Plan.paid_with_extra_storage && !Current.account.exceeding_storage_limit? %>
9-
<%= button_to "Downgrade to Regular", account_subscription_downgrade_path, class: "btn", form: { data: { turbo: false } } %>
10-
<% end %>
11-
</p>
12-
135
<p>
146
<%= link_to "Manage your subscription", account_billing_portal_path, class: "btn btn--plain settings-subscription__link txt-link", data: { turbo_prefetch: false } %>
157
</p>
168

9+
<div class="settings-subscription__footer txt-small margin-block">
10+
Right now you’re on the <strong><%= Current.account.plan.name %></strong> plan which includes unlimited cards, unlimited users, and <%= storage_to_human_size(Plan.paid.storage_limit) %> of storage.
11+
12+
<% if subscription.plan == Plan.paid %>
13+
<%= button_to "Upgrade", account_subscription_upgrade_path, class: "btn btn--plain settings-subscription__link txt-link", form: { class: "flex-inline flex-wrap", data: { turbo: false } } %>
14+
to <%= storage_to_human_size(Plan.paid_with_extra_storage.storage_limit) %> storage for <%= number_to_currency(Plan.paid_with_extra_storage.price - Plan.paid.price, strip_insignificant_zeros: true) %>/month more.
15+
<% elsif subscription.plan == Plan.paid_with_extra_storage && !Current.account.exceeding_storage_limit? %>
16+
<%= button_to "Downgrade", account_subscription_downgrade_path, class: "btn btn--plain settings-subscription__link txt-link", form: { class: "flex-inline flex-wrap", data: { turbo: false } } %>
17+
to <%= storage_to_human_size(Plan.paid.storage_limit) %> storage.
18+
<% end %>
19+
</div>
1720

0 commit comments

Comments
 (0)