mirror of
https://github.com/silverstripe/silverstripe-docsviewer
synced 2024-10-22 09:05:56 +00:00
BUGFIX: fixed url in header anchors. Added missing js link in the controller
This commit is contained in:
parent
ef7c095533
commit
587f557949
@ -66,6 +66,9 @@ class DocumentationViewer extends Controller {
|
||||
$canAccess = (Director::isDev() || Director::is_cli() || !self::$check_permission || Permission::check(self::$check_permission));
|
||||
|
||||
if(!$canAccess) return Security::permissionFailure($this);
|
||||
|
||||
Requirements::javascript(THIRDPARTY_DIR .'/jquery/jquery.js');
|
||||
Requirements::javascript('sapphiredocs/javascript/DocumentationViewer.js');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -112,6 +115,9 @@ class DocumentationViewer extends Controller {
|
||||
DocumentationService::load_automatic_registration();
|
||||
|
||||
if(isset($firstParam)) {
|
||||
// allow assets
|
||||
if($firstParam == "assets") return parent::handleRequest($request);
|
||||
|
||||
if($link = DocumentationPermalinks::map($firstParam)) {
|
||||
// the first param is a shortcode for a page so redirect the user to
|
||||
// the short code.
|
||||
|
@ -27,8 +27,10 @@
|
||||
*
|
||||
* Automatically adds anchor links to headings that have IDs
|
||||
*/
|
||||
var url = window.location.href;
|
||||
|
||||
$("#left-column h1[id], #left-column h2[id], #left-column h3[id], #left-column h4[id], #left-column h5[id], #left-column h6[id]").each(function() {
|
||||
var link = '<a class="heading-anchor-link" title="Link to this section" href="#' + $(this).attr('id') + '">¶</a>';
|
||||
var link = '<a class="heading-anchor-link" title="Link to this section" href="'+ url + '#' + $(this).attr('id') + '">¶</a>';
|
||||
$(this).append(' ' + link);
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user