BUGFIX: fixed url in header anchors. Added missing js link in the controller

This commit is contained in:
Will Rossiter 2010-10-28 21:27:30 +00:00
parent ef7c095533
commit 587f557949
2 changed files with 9 additions and 1 deletions

View File

@ -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.

View File

@ -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') + '">&para;</a>';
var link = '<a class="heading-anchor-link" title="Link to this section" href="'+ url + '#' + $(this).attr('id') + '">&para;</a>';
$(this).append(' ' + link);
});