mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Support custom domains
This commit is contained in:
parent
598b4743d8
commit
a69ecb9cc9
@ -851,6 +851,7 @@ class AccountController extends BaseController
|
||||
$account->client_view_css = $request->client_view_css;
|
||||
$account->subdomain = $request->subdomain;
|
||||
$account->iframe_url = $request->iframe_url;
|
||||
$account->is_custom_domain = $request->is_custom_domain;
|
||||
$account->save();
|
||||
|
||||
if ($fireUpdateSubdomainEvent) {
|
||||
|
@ -42,7 +42,11 @@ trait Inviteable
|
||||
}
|
||||
|
||||
if ($iframe_url && ! $forceOnsite) {
|
||||
if ($account->is_custom_domain) {
|
||||
$url = $iframe_url;
|
||||
} else {
|
||||
return "{$iframe_url}?{$this->invitation_key}/{$type}";
|
||||
}
|
||||
} elseif ($this->account->subdomain && ! $forcePlain) {
|
||||
$url = Utils::replaceSubdomain($url, $account->subdomain);
|
||||
}
|
||||
|
@ -87,8 +87,9 @@
|
||||
->label(trans('texts.customize'))
|
||||
->radios([
|
||||
trans('texts.subdomain') => ['value' => 'subdomain', 'name' => 'custom_link'],
|
||||
trans('texts.website') => ['value' => 'website', 'name' => 'custom_link'],
|
||||
])->check($account->iframe_url ? 'website' : 'subdomain') !!}
|
||||
'iFrame' => ['value' => 'iframe', 'name' => 'custom_link'],
|
||||
trans('texts.domain') => ['value' => 'domain', 'name' => 'custom_link'],
|
||||
])->check($account->iframe_url ? ($account->is_custom_domain ? 'domain' : 'iframe') : 'subdomain') !!}
|
||||
{{ Former::setOption('capitalize_translations', false) }}
|
||||
|
||||
{!! Former::text('subdomain')
|
||||
@ -100,12 +101,23 @@
|
||||
@endif
|
||||
|
||||
{!! Former::text('iframe_url')
|
||||
->placeholder('https://www.example.com/invoice')
|
||||
->placeholder('https://www.example.com')
|
||||
->appendIcon('question-sign')
|
||||
->addGroupClass('iframe_url')
|
||||
->label(Utils::isNinja() ? ' ' : trans('texts.website'))
|
||||
->help(trans(Utils::isNinja() ? 'texts.subdomain_help' : 'texts.website_help')) !!}
|
||||
|
||||
@if (Utils::isNinja())
|
||||
<div style="display:none">
|
||||
{!! Former::text('is_custom_domain') !!}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div id="domainHelp" style="display:none">
|
||||
{!! Former::plaintext(' ')
|
||||
->value('Using a custom domain requires an <a href="' . url('/settings/account_management?upgrade=true') . '" target="_blank">enterprise plan</a>') !!}
|
||||
</div>
|
||||
|
||||
{!! Former::plaintext('preview')
|
||||
->value($account->getSampleLink()) !!}
|
||||
|
||||
@ -354,7 +366,7 @@
|
||||
|
||||
<div class="container" style="width: 100%; padding-bottom: 0px !important">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
<div class="panel-body" id="iframeModalHelp">
|
||||
<p>{{ trans('texts.iframe_url_help1') }}</p>
|
||||
<pre><center>
|
||||
<iframe id="invoiceIFrame" width="100%" height="1200" style="max-width:1000px"></iframe>
|
||||
@ -369,6 +381,12 @@ iframe.src = '{{ rtrim(SITE_URL ,'/') }}/' + parts[1] + '/' + parts[0].substring
|
||||
<p>{{ trans('texts.iframe_url_help2') }}</p>
|
||||
<p><b>{{ trans('texts.iframe_url_help3') }}</b></p>
|
||||
</div>
|
||||
|
||||
<div class="panel-body" id="domainModalHelp" style="display:none">
|
||||
<p>Create a DNS A Record entry for your custom domain and point to the following IP address <code>96.126.107.105</code>.</p>
|
||||
<p>Once this is setup please send an email to {{ env('CONTACT_EMAIL') }} and we'll complete the process.</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -490,13 +508,23 @@ iframe.src = '{{ rtrim(SITE_URL ,'/') }}/' + parts[1] + '/' + parts[0].substring
|
||||
}
|
||||
|
||||
function onCustomLinkChange() {
|
||||
$('.iframe_url, .subdomain').hide();
|
||||
$('.subdomain').hide();
|
||||
$('#domainHelp, #iframeModalHelp, #domainModalHelp').hide();
|
||||
$('#is_custom_domain').val(0);
|
||||
|
||||
var val = $('input[name=custom_link]:checked').val()
|
||||
if (val == 'subdomain') {
|
||||
$('.subdomain').show();
|
||||
$('.iframe_url').hide();
|
||||
} else if (val == 'iframe') {
|
||||
$('.iframe_url, #iframeModalHelp').show();
|
||||
} else {
|
||||
$('.subdomain').hide();
|
||||
$('.iframe_url').show();
|
||||
@if (auth()->user()->isEnterprise())
|
||||
$('.iframe_url, #domainModalHelp').show();
|
||||
$('#is_custom_domain').val(1);
|
||||
@else
|
||||
$('#domainHelp').show();
|
||||
@endif
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user