From be7e0b11078a25d06984104da15dcdd5b0f73627 Mon Sep 17 00:00:00 2001 From: csubira Date: Thu, 30 May 2019 15:18:06 +0200 Subject: [PATCH] Fix api keys banner --- app/models/user.rb | 5 +++++ .../client_applications/api_key.html.erb | 1 + .../admin/shared/_trial_notification.html.erb | 19 +++++++++---------- assets/stylesheets/common/flash-message.scss | 3 ++- .../trial-notification/trial-notification.tpl | 6 +++--- lib/assets/javascripts/locale/en.json | 2 +- package.json | 2 +- 7 files changed, 22 insertions(+), 16 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index 500634c9fa..e71eef9b7f 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1910,6 +1910,11 @@ class User < Sequel::Model end end + def remaining_trial_days + return 0 unless trial_ends_at + (trial_ends_at - DateTime.now).to_f.floor + end + private def password_rate_limit_configured? diff --git a/app/views/admin/client_applications/api_key.html.erb b/app/views/admin/client_applications/api_key.html.erb index dec880164c..0204168785 100644 --- a/app/views/admin/client_applications/api_key.html.erb +++ b/app/views/admin/client_applications/api_key.html.erb @@ -23,6 +23,7 @@ <% end %> <%= render :partial => 'shared/flash_message' %> +<%= render :partial => 'admin/shared/trial_notification' %>
diff --git a/app/views/admin/shared/_trial_notification.html.erb b/app/views/admin/shared/_trial_notification.html.erb index 688b75f409..86863050de 100644 --- a/app/views/admin/shared/_trial_notification.html.erb +++ b/app/views/admin/shared/_trial_notification.html.erb @@ -1,14 +1,13 @@ -<% if current_user.account_type == 'PERSONAL30' %> +<% if current_user.account_type == 'PERSONAL30' || current_user.account_type == 'Professional' %> +
-
-
-

You're currently under your Trial Period. Add your billing info to keep using our platform.

-

- - Add payment method - -

-
+
+
+

<%= current_user.remaining_trial_days %> days left days left in your Trial Period. To keep using our platform, + Subscribe now +

+
+
<% end %> diff --git a/assets/stylesheets/common/flash-message.scss b/assets/stylesheets/common/flash-message.scss index 456d65553f..6853b4e8a6 100644 --- a/assets/stylesheets/common/flash-message.scss +++ b/assets/stylesheets/common/flash-message.scss @@ -45,8 +45,9 @@ } .FlashMessage--text { - font-family: 'Montserrat-SemiBold'; + font-family: 'Montserrat'; font-size: 12px; + font-weight: 600; letter-spacing: 0; line-height: 16px; text-align: right; diff --git a/lib/assets/javascripts/dashboard/components/trial-notification/trial-notification.tpl b/lib/assets/javascripts/dashboard/components/trial-notification/trial-notification.tpl index 28d646325f..751fbb0996 100644 --- a/lib/assets/javascripts/dashboard/components/trial-notification/trial-notification.tpl +++ b/lib/assets/javascripts/dashboard/components/trial-notification/trial-notification.tpl @@ -1,7 +1,7 @@
-
-

<%= _t('common.trial_notification.views.trial_notification.message', { trial_days: trialDays }) %> <%= _t('common.trial_notification.views.trial_notification.add_payment') %>

-
+
+

<%= _t('common.trial_notification.views.trial_notification.message', { trial_days: trialDays }) %> <%= _t('common.trial_notification.views.trial_notification.add_payment') %>

+
diff --git a/lib/assets/javascripts/locale/en.json b/lib/assets/javascripts/locale/en.json index 8de8d12482..8832e6138c 100644 --- a/lib/assets/javascripts/locale/en.json +++ b/lib/assets/javascripts/locale/en.json @@ -3,7 +3,7 @@ "trial_notification": { "views": { "trial_notification": { - "message": "%{trial_days} days left days left in your Professional Plan Trial. To keep using our platform,", + "message": "%{trial_days} days left days left in your Trial Period. To keep using our platform,", "add_payment": "Subscribe Now" } } diff --git a/package.json b/package.json index 212ff28b68..1892b5b7d1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cartodb-ui", - "version": "1.0.0-assets.97-banner4", + "version": "1.0.0-assets.97-banner5", "description": "CARTO UI frontend", "repository": { "type": "git",