Fix links when site is in a sub url (#28)

This commit is contained in:
3Dgoo 2017-03-23 10:04:49 +10:30 committed by Jono Menz
parent 58fe5c8dd6
commit 4ad75cc564
2 changed files with 14 additions and 14 deletions

View File

@ -35,7 +35,7 @@ class BetterNavigatorExtension extends DataExtension {
}
}
// Only show edit link if user has permission to edit this page
$editLink = (($this->owner->dataRecord->canEdit() && Permission::check('CMS_ACCESS_CMSMain')) || $isDev) ? Controller::join_links('/', $nav['CMSLink']['Link']) : false;
$editLink = (($this->owner->dataRecord->canEdit() && Permission::check('CMS_ACCESS_CMSMain')) || $isDev) ? Controller::join_links(Director::absoluteBaseURL(), $nav['CMSLink']['Link']) : false;
// Is the logged in member nominated as a developer?
$member = Member::currentUser();
@ -49,8 +49,8 @@ class BetterNavigatorExtension extends DataExtension {
'Member' => $member,
'Stage' => Versioned::current_stage(),
'Viewing' => $viewing, // What we're viewing doesn't necessarily align with the active Stage
'LoginLink' => Controller::join_links('/', Config::inst()->get('Security', 'login_url'), $backURL),
'LogoutLink' => Controller::join_links('/Security/logout', $backURL),
'LoginLink' => Controller::join_links(Director::absoluteBaseURL(), Config::inst()->get('Security', 'login_url'), $backURL),
'LogoutLink' => Controller::join_links(Director::absoluteBaseURL() . 'Security/logout', $backURL),
'EditLink' => $editLink,
'Mode' => Director::get_environment_type(),
'IsDeveloper' => $isDeveloper

View File

@ -56,12 +56,12 @@
<% if $BetterNavigator.Mode='dev' %>
<span class="bn-disabled" title="Log out to end Dev Mode"><span class="bn-icon-tick"></span>Dev mode on</span>
<% else %>
<a href="$Link?isDev=1"><span class="bn-icon-devmode"></span>Dev mode</a>
<a href="{$AbsoluteLink}?isDev=1"><span class="bn-icon-devmode"></span>Dev mode</a>
<% end_if %>
<a href="$Link?flush=1" title="Flush templates and manifest, and regenerate images for this page (behaviour varies by Framework version)"><span class="bn-icon-flush"></span>Flush caches</a>
<a href="/dev/build/?flush=1" target="_blank" title="Build database and flush caches (excludes template caches pre SS-3.1.7)"><span class="bn-icon-db"></span>Build database</a>
<a href="/dev/" target="_blank"><span class="bn-icon-tools"></span>Dev menu</a>
<a href="{$AbsoluteLink}?flush=1" title="Flush templates and manifest, and regenerate images for this page (behaviour varies by Framework version)"><span class="bn-icon-flush"></span>Flush caches</a>
<a href="{$AbsoluteBaseURL}dev/build/?flush=1" target="_blank" title="Build database and flush caches (excludes template caches pre SS-3.1.7)"><span class="bn-icon-db"></span>Build database</a>
<a href="{$AbsoluteBaseURL}dev/" target="_blank"><span class="bn-icon-tools"></span>Dev menu</a>
</div>
@ -71,13 +71,13 @@
<div class="bn-links">
<a href="$Link?showtemplate=1"><span class="bn-icon-info"></span>Show template</a>
<a href="$Link?debug=1&amp;isDev=1"><span class="bn-icon-info"></span>Debug page</a>
<a href="$Link?debugmethods=1"><span class="bn-icon-info"></span>Debug methods</a>
<a href="$Link?debug_request=1&amp;isDev=1"><span class="bn-icon-info"></span>Debug request</a>
<a href="$Link?debugfailover=1&amp;isDev=1"><span class="bn-icon-info"></span>Debug failover</a>
<a href="$Link?showqueries=1&amp;isDev=1"><span class="bn-icon-info"></span>Show queries</a>
<a href="$Link?previewwrite=1&amp;isDev=1"><span class="bn-icon-info"></span>Preview write</a>
<a href="{$AbsoluteLink}?showtemplate=1"><span class="bn-icon-info"></span>Show template</a>
<a href="{$AbsoluteLink}?debug=1&amp;isDev=1"><span class="bn-icon-info"></span>Debug page</a>
<a href="{$AbsoluteLink}?debugmethods=1"><span class="bn-icon-info"></span>Debug methods</a>
<a href="{$AbsoluteLink}?debug_request=1&amp;isDev=1"><span class="bn-icon-info"></span>Debug request</a>
<a href="{$AbsoluteLink}?debugfailover=1&amp;isDev=1"><span class="bn-icon-info"></span>Debug failover</a>
<a href="{$AbsoluteLink}?showqueries=1&amp;isDev=1"><span class="bn-icon-info"></span>Show queries</a>
<a href="{$AbsoluteLink}?previewwrite=1&amp;isDev=1"><span class="bn-icon-info"></span>Preview write</a>
</div>