mirror of
https://github.com/silverstripe/silverstripe-docsviewer
synced 2024-10-22 11:05:56 +02:00
Minor: coding conventions and javascript, also added submenu title
This commit is contained in:
parent
08bfb941d4
commit
1f6c5deda7
@ -40,50 +40,50 @@ class DocumentationPage extends ViewableData {
|
|||||||
/**
|
/**
|
||||||
* @var Boolean
|
* @var Boolean
|
||||||
*/
|
*/
|
||||||
protected $IsFolder = false;
|
protected $isFolder = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Boolean
|
* @param Boolean
|
||||||
*/
|
*/
|
||||||
function setIsFolder($isFolder = false) {
|
public function setIsFolder($isFolder = false) {
|
||||||
$this->IsFolder = $isFolder;
|
$this->IsFolder = $isFolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Boolean
|
* @return Boolean
|
||||||
*/
|
*/
|
||||||
function getIsFolder($isFolder = false) {
|
public function getIsFolder($isFolder = false) {
|
||||||
return $this->IsFolder;
|
return $this->IsFolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return DocumentationEntity
|
* @return DocumentationEntity
|
||||||
*/
|
*/
|
||||||
function getEntity() {
|
public function getEntity() {
|
||||||
return $this->entity;
|
return $this->entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param DocumentationEntity
|
* @param DocumentationEntity
|
||||||
*/
|
*/
|
||||||
function setEntity($entity) {
|
public function setEntity($entity) {
|
||||||
$this->entity = $entity;
|
$this->entity = $entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function getRelativePath() {
|
public function getRelativePath() {
|
||||||
return $this->relativePath;
|
return $this->relativePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string
|
* @param string
|
||||||
*/
|
*/
|
||||||
function setRelativePath($path) {
|
public function setRelativePath($path) {
|
||||||
$this->relativePath = $path;
|
$this->relativePath = $path;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
@ -8,8 +8,8 @@
|
|||||||
*/
|
*/
|
||||||
if($("#content-column").length > 0) {
|
if($("#content-column").length > 0) {
|
||||||
var toc = '<div id="table-of-contents" class="open">' +
|
var toc = '<div id="table-of-contents" class="open">' +
|
||||||
'<h4>Table of contents<span class="updown">▼</span></h4><ul id="toc" style="display:none;">';
|
'<h4>Table of contents<span class="updown">▼</span></h4><ul style="display: none;">';
|
||||||
|
|
||||||
// Remove existing anchor redirection in the url
|
// Remove existing anchor redirection in the url
|
||||||
var pageURL = window.location.href.replace(/#[a-zA-Z0-9\-\_]*/g, '');
|
var pageURL = window.location.href.replace(/#[a-zA-Z0-9\-\_]*/g, '');
|
||||||
|
|
||||||
@ -39,10 +39,10 @@
|
|||||||
// Toggle the TOC
|
// Toggle the TOC
|
||||||
$('#table-of-contents').attr('href', 'javascript:void()').toggle(
|
$('#table-of-contents').attr('href', 'javascript:void()').toggle(
|
||||||
function() {
|
function() {
|
||||||
$("#toc").animate({'height':'show'}, 200, function(){$('#table-of-contents h4 span').html('▲');})
|
$("#table-of-contents ul").animate({'height':'show'}, 200, function(){$('#table-of-contents h4 span').html('▲');})
|
||||||
},
|
},
|
||||||
function() {
|
function() {
|
||||||
$("#toc").animate({'height':'hide'}, 200, function(){$('#table-of-contents h4 span').html('▼');})
|
$("#table-of-contents ul").animate({'height':'hide'}, 200, function(){$('#table-of-contents h4 span').html('▼');})
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -57,8 +57,10 @@
|
|||||||
* move to separate menu block
|
* move to separate menu block
|
||||||
*/
|
*/
|
||||||
if ($("#submenu").length > 0) {
|
if ($("#submenu").length > 0) {
|
||||||
var submenu = '<div class = "sidebar-box"><ul>';
|
var submenuTitle = $("#sibling-pages").find('a.current, a.section').eq(0).text();
|
||||||
|
var submenu = '<div class = "sidebar-box"><h4>' + submenuTitle + '</h4><ul>'
|
||||||
submenu += $("#submenu").html();
|
submenu += $("#submenu").html();
|
||||||
|
submenu += '</ul></div>';
|
||||||
$("#sidebar-column").append(submenu);
|
$("#sidebar-column").append(submenu);
|
||||||
$("#submenu").remove();
|
$("#submenu").remove();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user