Commit fb69f4a9 authored by Imre Farkas's avatar Imre Farkas

Merge branch 'vs-ee-prettify-billings-cards' into 'master'

Prettify billing plans section

See merge request gitlab-org/gitlab!48008
parents f5b96fb2 4436fd04
...@@ -21,10 +21,6 @@ ...@@ -21,10 +21,6 @@
.billing-plans { .billing-plans {
.card { .card {
&-header {
line-height: $gl-line-height-20;
}
&-active { &-active {
background-color: $gray-light; background-color: $gray-light;
} }
......
...@@ -49,9 +49,9 @@ module BillingPlansHelper ...@@ -49,9 +49,9 @@ module BillingPlansHelper
plan.features.sort_by! { |feature| feature.highlight ? 0 : 1 }[0...4] plan.features.sort_by! { |feature| feature.highlight ? 0 : 1 }[0...4]
end end
def plan_purchase_or_upgrade_url(group, plan, current_plan) def plan_purchase_or_upgrade_url(group, plan)
if group.upgradable? if group.upgradable?
plan_upgrade_url(group, current_plan) plan_upgrade_url(group, plan)
else else
plan_purchase_url(group, plan) plan_purchase_url(group, plan)
end end
......
- purchase_link = plan.purchase_link - purchase_link = plan.purchase_link
- is_current_plan = plan.code == current_plan&.code
.col-md-6.col-lg-3 .card.h-100{ class: ("card-active" if is_current) }
.card.mb-5{ class: ("card-active" if is_current_plan) } .card-header.gl-font-weight-bold.d-flex.flex-row.justify-content-between.flex-wrap
.card-header.font-weight-bold.p-3 %div
= plan.name = plan.name
- if is_current_plan - if is_current
.float-right.text-muted .text-muted
= _("Current Plan") = _("Current Plan")
.card-body .card-body
...@@ -14,28 +13,31 @@ ...@@ -14,28 +13,31 @@
.gl-mr-2 .gl-mr-2
= number_to_plan_currency(plan.price_per_month) = number_to_plan_currency(plan.price_per_month)
%ul.conditions.p-0.my-auto %ul.conditions.gl-p-0.gl-my-auto
%li= s_("BillingPlans|per user") %li= s_("BillingPlans|per user")
%li= s_("BillingPlans|monthly") %li= s_("BillingPlans|monthly")
.price-per-year.text-left{ class: ("invisible" unless plan.price_per_year > 0) } .price-per-year.text-left{ class: ("invisible" unless plan.price_per_year > 0) }
- price_per_year = number_to_plan_currency(plan.price_per_year) - price_per_year = number_to_plan_currency(plan.price_per_year)
= s_("BillingPlans|billed annually at %{price_per_year}") % { price_per_year: price_per_year } = s_("BillingPlans|billed annually at %{price_per_year}") % { price_per_year: price_per_year }
%hr.mt-3.mb-3 %hr.gl-my-3
%ul.unstyled-list %ul.unstyled-list
- plan_feature_short_list(plan).each do |feature| - plan_feature_short_list(plan).each do |feature|
%li.p-0{ class: ("font-weight-bold" if feature.highlight) } - feature_class = "gl-p-0!"
- if feature.highlight
- feature_class += " gl-font-weight-bold"
%li{ class: "#{feature_class}" }
= feature.title = feature.title
%li.p-0.pt-3 %li.gl-p-0.gl-pt-3
- if plan.about_page_href - if plan.about_page_href
= link_to s_("BillingPlans|See all %{plan_name} features") % { plan_name: plan.name }, EE::SUBSCRIPTIONS_COMPARISON_URL = link_to s_("BillingPlans|See all %{plan_name} features") % { plan_name: plan.name }, EE::SUBSCRIPTIONS_COMPARISON_URL
- if purchase_link - if purchase_link
.card-footer.p-3 .card-footer
.float-right{ class: ("invisible" unless purchase_link.action == 'upgrade' || is_current_plan) } .float-right{ class: ("invisible" unless purchase_link.action == 'upgrade' || is_current) }
- if show_contact_sales_button?(purchase_link.action) - if show_contact_sales_button?(purchase_link.action)
= link_to s_('BillingPlan|Contact sales'), "#{contact_sales_url}?test=inappcontactsales#{plan.code}", class: "btn btn-success-secondary gl-button", data: { **experiment_tracking_data_for_button_click('contact_sales') } = link_to s_('BillingPlan|Contact sales'), "#{contact_sales_url}?test=inappcontactsales#{plan.code}", class: "btn btn-success-secondary gl-button", data: { **experiment_tracking_data_for_button_click('contact_sales') }
- upgrade_button_class = "disabled" if is_current_plan && !namespace.trial_active? - upgrade_button_class = "disabled" if is_current && !namespace.trial_active?
- cta_class = '-new' if use_new_purchase_flow?(namespace) - cta_class = '-new' if use_new_purchase_flow?(namespace)
= link_to s_('BillingPlan|Upgrade'), plan_purchase_or_upgrade_url(namespace, plan, current_plan), class: "btn btn-success gl-button #{upgrade_button_class} billing-cta-purchase#{cta_class}", data: { **experiment_tracking_data_for_button_click('upgrade') } = link_to s_('BillingPlan|Upgrade'), plan_purchase_or_upgrade_url(namespace, plan), class: "btn btn-success gl-button #{upgrade_button_class} billing-cta-purchase#{cta_class}", data: { **experiment_tracking_data_for_button_click('upgrade') }
...@@ -5,9 +5,12 @@ ...@@ -5,9 +5,12 @@
= render 'shared/billings/billing_plan_header', namespace: namespace, plan: current_plan = render 'shared/billings/billing_plan_header', namespace: namespace, plan: current_plan
- if show_plans?(namespace) - if show_plans?(namespace)
.billing-plans.mt-5.row .billing-plans.gl-mt-5.row
- plans_data.each do |plan| - plans_data.each do |plan|
= render 'shared/billings/billing_plan', namespace: namespace, plan: plan, current_plan: current_plan - is_default_plan = current_plan.nil? && plan.default?
- is_current = plan.code == current_plan&.code || is_default_plan
.col-md-6.col-lg-3.gl-mb-5
= render 'shared/billings/billing_plan', namespace: namespace, plan: plan, is_current: is_current
- if namespace.gitlab_subscription&.has_a_paid_hosted_plan? - if namespace.gitlab_subscription&.has_a_paid_hosted_plan?
.center.gl-mb-7 .center.gl-mb-7
......
---
title: Prettify billing plans section
merge_request: 48008
author:
type: other
...@@ -152,4 +152,24 @@ RSpec.describe BillingPlansHelper do ...@@ -152,4 +152,24 @@ RSpec.describe BillingPlansHelper do
end end
end end
end end
describe "#plan_purchase_or_upgrade_url" do
let(:plan) { double('Plan') }
it 'is upgradable' do
group = double('Group', upgradable?: true)
expect(helper).to receive(:plan_upgrade_url)
helper.plan_purchase_or_upgrade_url(group, plan)
end
it 'is purchasable' do
group = double('Group', upgradable?: false)
expect(helper).to receive(:plan_purchase_url)
helper.plan_purchase_or_upgrade_url(group, plan)
end
end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment