Commit f1fee8da authored by Diana Zubova's avatar Diana Zubova Committed by Igor Drozdov

Unify expired subscription message buttons

parent def56e9a
......@@ -31,6 +31,10 @@ module EE
"#{EE::SUBSCRIPTIONS_URL}/subscriptions"
end
def link_to_button_style(path:, track_property:)
link_to _('Renew subscription'), path, class: 'btn gl-button btn-confirm gl-mr-3 gl-mb-2', data: { track_event: 'click_text', track_label: 'subscribable_action', track_property: track_property }
end
private
def current_namespace
......
......@@ -16,11 +16,10 @@
= image_tag('illustrations/subscription-warning.svg')
.gl-text-left.gl-pt-3
= message
- if subscribable.block_changes?
= link_to s_('Subscription|Renew your subscription'), renew_subscription_path, class: 'btn gl-button btn-confirm gl-mr-3 gl-mb-2', data: { track_event: 'click_text', track_label: 'subscribable_action', track_property: 'renew' }
= link_to_button_style(path: renew_subscription_path, track_property: 'renew')
- elsif subscribable.expired?
= link_to _('Upgrade your plan'), upgrade_subscription_path, class: 'btn gl-button btn-confirm', data: { track_event: 'click_text', track_label: 'subscribable_action', track_property: 'upgrade' }
= link_to_button_style(path: upgrade_subscription_path, track_property: 'upgrade')
- else
= link_to _('Renew subscription'), renew_subscription_path, class: 'btn gl-button btn-confirm gl-mr-3 gl-mb-2', data: { track_event: 'click_text', track_label: 'subscribable_action', track_property: 'renew' }
= link_to_button_style(path: renew_subscription_path, track_property: 'renew')
= link_to _("That's OK, I don't want to renew"), '#', data: { track_event: 'click_text', track_label: 'subscribable_action', track_property: 'thats_ok' }, 'aria-label' => 'Dismiss', class: 'btn gl-button btn-info btn-info-secondary js-close gl-mb-2'
......@@ -216,4 +216,11 @@ RSpec.describe EE::SubscribableBannerHelper do
expect(helper.instance_variable_get(:@display_subscription_banner)).to be true
end
end
describe '#link_to_button_style' do
it 'return correct link with path and track property' do
expect(link_to_button_style(path: '/subscriptions', track_property: 'test-track-label')).to match %r{<a.*href="/subscriptions".*>.*</a>}m
expect(link_to_button_style(path: '/subscriptions', track_property: 'test-track-label')).to match %r{<a.*data-track-property="test-track-label".*>.*</a>}m
end
end
end
......@@ -27,7 +27,7 @@ RSpec.describe 'layouts/header/_ee_subscribable_banner' do
let(:license) { build(:gitlab_license, expires_at: Date.current - 1.week) }
it 'shows the upgrade plan link' do
expect(rendered).to have_link 'Upgrade your plan', href: view.upgrade_subscription_path
expect(rendered).to have_link 'Renew subscription', href: view.upgrade_subscription_path
end
end
......@@ -35,7 +35,7 @@ RSpec.describe 'layouts/header/_ee_subscribable_banner' do
let(:license) { build(:gitlab_license, expires_at: Date.current - 3.weeks) }
it 'shows the renew plan link' do
expect(rendered).to have_link 'Renew your subscription', href: view.renew_subscription_path
expect(rendered).to have_link 'Renew subscription', href: view.renew_subscription_path
end
end
end
......
......@@ -32528,9 +32528,6 @@ msgstr ""
msgid "Subscriptions"
msgstr ""
msgid "Subscription|Renew your subscription"
msgstr ""
msgid "Subscription|Your subscription for %{strong}%{namespace_name}%{strong_close} has expired and you are now on %{pricing_link_start}the GitLab Free tier%{pricing_link_end}. Don't worry, your data is safe. Get in touch with our support team (%{support_email}). They'll gladly help with your subscription renewal."
msgstr ""
......
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