<%= Tang.free_plan_name %>

Free

plan sentence goes here

<% if user_signed_in? %> <% if current_user.subscription.present? %> <% # downgrade to free %> <%= link_to 'Choose Plan', account_subscription_path, method: :delete, data: { confirm: 'Are you sure you want to cancel your current plan?' }, class: 'pricing__action' %> <% else %> <% # already on free plan %> <%= button_tag 'Selected', class: 'pricing__action', disabled: 'disabled' %> <% end %> <% else %> <% # sign in for free %> <%= link_to 'Get started', main_app.new_user_registration_path, class: 'pricing__action' %> <% end %>
<% @plans.each do |plan| %>

<%= plan.name %>

<%= number_to_currency(plan.amount / 100, format: '%u') %><%= number_to_currency(plan.amount / 100, format: '%n') %>/<%= plan.interval %>

plan sentence goes here

<% if user_signed_in? %> <% if current_user.subscription.present? && current_user.subscription.plan.present? %> <% if current_user.subscription.plan.group == plan.group %> <% # current plan %> <%= button_tag 'Selected', class: 'pricing__action', disabled: 'disabled' %> <% else %> <% # upgrade or downgrade to plan %> <%= link_to 'Choose plan', account_subscription_path(plan: plan), method: :patch, class: 'pricing__action' %> <% end %> <% else %> <% # subscribe to new plan %> <%= link_to 'Choose plan', account_subscription_path(subscription: { plan: plan }), method: :post, class: 'pricing__action' %> <% end %> <% else %> <% # sign in and subscribe %> <%= link_to 'Choose plan', account_subscription_path(subscription: { plan: plan }), method: :post, class: 'pricing__action' %> <% end %>
<% end %>