Commit 867fd30d authored by Ruben Davila's avatar Ruben Davila

Update some sections of the admin license page

parent 3a2c28c1
class TrialsController < ApplicationController class TrialsController < ApplicationController
SUBSCRIPTIONS_PORTAL_URL = 'https://customers.gitlab.com'
before_filter :check_presence_of_license before_filter :check_presence_of_license
def new def new
...@@ -24,7 +22,7 @@ class TrialsController < ApplicationController ...@@ -24,7 +22,7 @@ class TrialsController < ApplicationController
end end
def save_license def save_license
result = HTTParty.post("#{SUBSCRIPTIONS_PORTAL_URL}/trials", body: params) result = HTTParty.post("#{Gitlab::SUBSCRIPTIONS_URL}/trials", body: params)
if result.ok? if result.ok?
@license.data = result['license_key'] @license.data = result['license_key']
......
...@@ -19,7 +19,7 @@ module LicenseHelper ...@@ -19,7 +19,7 @@ module LicenseHelper
def trial_license_message def trial_license_message
return unless signed_in? && current_license&.trial? return unless signed_in? && current_license&.trial?
buy_now_link = link_to('Buy now!', 'https://customers.gitlab.com/plans', target: '_blank') buy_now_link = link_to('Buy now!', "#{Gitlab::SUBSCRIPTIONS_URL}/plans", target: '_blank')
message = message =
if current_license.expired? if current_license.expired?
if current_user.admin? if current_user.admin?
......
- page_title "License" - page_title "License"
%h3.page-title %h3.page-title
Your License Your License
- if current_license.trial?
= link_to 'Buy License', "#{Gitlab::SUBSCRIPTIONS_URL}/plans", target: '_blank', class: "btn btn-new pull-right"
= link_to 'Upload New License', new_admin_license_path, class: "btn pull-right"
- else
= link_to 'Upload New License', new_admin_license_path, class: "btn btn-new pull-right" = link_to 'Upload New License', new_admin_license_path, class: "btn btn-new pull-right"
%hr %hr
...@@ -32,11 +36,13 @@ ...@@ -32,11 +36,13 @@
Expired: Expired:
- else - else
Expires: Expires:
%strong
- if @license.will_expire? - if @license.will_expire?
= time_ago_with_tooltip @license.expires_at %strong= time_ago_with_tooltip(@license.expires_at)
- if @license.trial?
- remaining_days = (@license.expires_at - Date.today).to_i
%span= "(Free trial will expire in #{pluralize(remaining_days, 'day')})"
- else - else
Never %strong Never
- if @license.expired? - if @license.expired?
%span.label.label-danger.pull-right %span.label.label-danger.pull-right
......
...@@ -3,6 +3,7 @@ require_dependency 'gitlab/git' ...@@ -3,6 +3,7 @@ require_dependency 'gitlab/git'
module Gitlab module Gitlab
SUBDOMAIN_REGEX = %r{\Ahttps://[a-z0-9]+\.gitlab\.com\z} SUBDOMAIN_REGEX = %r{\Ahttps://[a-z0-9]+\.gitlab\.com\z}
COM_URL = 'https://gitlab.com'.freeze COM_URL = 'https://gitlab.com'.freeze
SUBSCRIPTIONS_URL = 'https://customers.gitlab.com'.freeze
def self.com? def self.com?
# Check `gl_subdomain?` as well to keep parity with gitlab.com # Check `gl_subdomain?` as well to keep parity with gitlab.com
......
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