From 68196d6af09a9082d3a2bd6bd52f5959bcca60b6 Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Wed, 31 Jan 2024 02:52:36 +0200 Subject: [PATCH] better on prem console sign up --- app/views/devise/registrations/show.html.erb | 12 ++++++++++-- app/views/shared/_navbar_buttons.html.erb | 2 +- app/views/shared/_settings_nav.html.erb | 2 +- lib/docuseal.rb | 5 +++++ 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/app/views/devise/registrations/show.html.erb b/app/views/devise/registrations/show.html.erb index 7b711b5cf..804906996 100644 --- a/app/views/devise/registrations/show.html.erb +++ b/app/views/devise/registrations/show.html.erb @@ -1,6 +1,14 @@
- <%= render 'devise/shared/select_server' if Docuseal.multitenant? %> -

Create Free Account

+ <% if params[:redir].to_s.ends_with?('on_premise') %> +

DocuSeal Console

+
+ Sign up in DocuSeal Console to upgrade. + On-premises app is completely standalone, Console is used only to manage your license. +
+ <% else %> + <%= render 'devise/shared/select_server' if Docuseal.multitenant? %> +

Create Free Account

+ <% end %> <%= form_for(User.new, html: { class: 'space-y-6' }, url: new_registration_path, data: { turbo: params[:redir].blank? }, method: :get) do |f| %> <% if params[:redir].present? %> <%= hidden_field_tag :redir, params[:redir] %> diff --git a/app/views/shared/_navbar_buttons.html.erb b/app/views/shared/_navbar_buttons.html.erb index 7670205f1..4c81abd72 100644 --- a/app/views/shared/_navbar_buttons.html.erb +++ b/app/views/shared/_navbar_buttons.html.erb @@ -1,4 +1,4 @@ -<%= link_to Docuseal.multitenant? ? console_redirect_index_path(redir: "#{Docuseal::CONSOLE_URL}/plans") : "#{Docuseal::CONSOLE_URL}/on_premise", class: 'hidden md:inline-flex btn btn-warning btn-sm', data: { prefetch: false } do %> +<%= link_to Docuseal.multitenant? ? console_redirect_index_path(redir: "#{Docuseal::CONSOLE_URL}/plans") : "#{Docuseal::CLOUD_URL}/sign_up?#{{ redir: "#{Docuseal::CONSOLE_URL}/on_premise" }.to_query}", class: 'hidden md:inline-flex btn btn-warning btn-sm', data: { prefetch: false } do %> Upgrade <% end %> <% if signed_in? && current_user != true_user %> diff --git a/app/views/shared/_settings_nav.html.erb b/app/views/shared/_settings_nav.html.erb index 12da5ce1f..daa738912 100644 --- a/app/views/shared/_settings_nav.html.erb +++ b/app/views/shared/_settings_nav.html.erb @@ -69,7 +69,7 @@ <%= render 'shared/settings_nav_extra' %> <% if !Docuseal.demo? && can?(:manage, EncryptedConfig) %>
  • - <%= link_to Docuseal.multitenant? ? console_redirect_index_path(redir: "#{Docuseal::CONSOLE_URL}/plans") : "#{Docuseal::CONSOLE_URL}/on_premise", class: 'text-base hover:bg-base-300', data: { prefetch: false } do %> + <%= link_to Docuseal.multitenant? ? console_redirect_index_path(redir: "#{Docuseal::CONSOLE_URL}/plans") : "#{Docuseal::CLOUD_URL}/sign_up?#{{ redir: "#{Docuseal::CONSOLE_URL}/on_premise" }.to_query}", class: 'text-base hover:bg-base-300', data: { prefetch: false } do %> Plans New <% end %> diff --git a/lib/docuseal.rb b/lib/docuseal.rb index 588c1ebc1..bcbd4599d 100644 --- a/lib/docuseal.rb +++ b/lib/docuseal.rb @@ -19,6 +19,11 @@ module Docuseal else 'https://console.docuseal.co' end + CLOUD_URL = if Rails.env.development? + 'http://localhost:3000' + else + 'https://docuseal.co' + end CDN_URL = if Rails.env.development? 'http://localhost:3000' elsif ENV['MULTITENANT'] == 'true'