mirror of
https://github.com/e107inc/e107.git
synced 2025-07-31 03:40:37 +02:00
Expanding Page-Navigation support added. (still a few glitches)
This commit is contained in:
45
e107_plugins/page/css/page.navigation.css
Normal file
45
e107_plugins/page/css/page.navigation.css
Normal file
@@ -0,0 +1,45 @@
|
||||
|
||||
/********************/
|
||||
/* EXPANDABLE LIST */
|
||||
/********************/
|
||||
|
||||
ul.page-nav {
|
||||
margin-left:5px;
|
||||
}
|
||||
|
||||
ul.page-nav p {
|
||||
|
||||
display:block;
|
||||
}
|
||||
|
||||
ul.page-nav li {
|
||||
line-height:150%;
|
||||
cursor: pointer;
|
||||
background-position: 1px 6px;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
/* Collapsed state for list element */
|
||||
ul.page-nav .collapsed {
|
||||
list-style: none;
|
||||
padding-left: 15px;
|
||||
text-indent:0px;
|
||||
margin:0;
|
||||
margin-left:5px;
|
||||
background-image: url(../img/collapsed.png);
|
||||
}
|
||||
/* Expanded state for list element
|
||||
/* NOTE: This class must be located UNDER the collapsed one */
|
||||
ul.page-nav .expanded {
|
||||
list-style: none;
|
||||
padding-left: 15px;
|
||||
text-indent:0px;
|
||||
margin:0;
|
||||
margin-left:5px;
|
||||
background-image: url(../img/expanded.png);
|
||||
}
|
||||
|
||||
ul.page-nav {
|
||||
clear: both;
|
||||
}
|
||||
|
BIN
e107_plugins/page/img/collapsed.png
Normal file
BIN
e107_plugins/page/img/collapsed.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
BIN
e107_plugins/page/img/expanded.png
Normal file
BIN
e107_plugins/page/img/expanded.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 207 B |
47
e107_plugins/page/js/jquery.page.navigation.js
Normal file
47
e107_plugins/page/js/jquery.page.navigation.js
Normal file
@@ -0,0 +1,47 @@
|
||||
/**************************************************************/
|
||||
/* Prepares the cv to be dynamically expandable/collapsible */
|
||||
/**************************************************************/
|
||||
function pageNavList() {
|
||||
|
||||
$('ul.page-nav').find('li:has(ul)').attr('title', 'Expand/Collapse');;
|
||||
|
||||
$('ul.page-nav').find('li:has(ul)')
|
||||
.click( function(event) {
|
||||
|
||||
if (this == event.target) {
|
||||
$(this).toggleClass('expanded');
|
||||
$(this).children('ul').toggle('medium');
|
||||
|
||||
}
|
||||
return false;
|
||||
})
|
||||
.addClass('collapsed')
|
||||
.children('ul').hide();
|
||||
|
||||
//Create the button funtionality
|
||||
$('#page-nav-expand')
|
||||
.unbind('click')
|
||||
.click( function() {
|
||||
$('.collapsed').addClass('expanded');
|
||||
$('.collapsed').children().show('medium');
|
||||
|
||||
});
|
||||
|
||||
//FIXME - Collapses too many items, it should leave the primary <li> items visible.
|
||||
$('#page-nav-collapse')
|
||||
.unbind('click')
|
||||
.click( function() {
|
||||
$('.collapsed').removeClass('expanded');
|
||||
$('.collapsed').children().hide('medium');
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**************************************************************/
|
||||
/* Functions to execute on loading the document */
|
||||
/**************************************************************/
|
||||
$(document).ready( function()
|
||||
{
|
||||
pageNavList();
|
||||
});
|
@@ -11,6 +11,8 @@
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
|
||||
|
||||
|
||||
//FIXME XXX - This menu should call the {PAGE_NAVIGATION} shortcode instead of duplicating its code and automatically display all links.
|
||||
|
||||
$parm = eHelper::scParams($parm);
|
||||
@@ -40,6 +42,8 @@ if($request && is_array($request))
|
||||
}
|
||||
}
|
||||
|
||||
$expandable = vartrue($parm['expandable']);
|
||||
|
||||
if($parm) $parm = http_build_query($parm, null, '&');
|
||||
else $parm = '';
|
||||
|
||||
@@ -56,6 +60,18 @@ if(isset($data['title']) && !vartrue($template['noAutoTitle']))
|
||||
if(empty($data)) return;
|
||||
$text = e107::getNav()->render($data, $template) ;
|
||||
|
||||
/**
|
||||
* Expandable menu support.
|
||||
* @see jquery.page.navigation.js . activate with expandable=1 in the page-navigation menu.
|
||||
* For best results include: e107::css('page', 'css/page.navigation.css', 'jquery'); in theme.php
|
||||
*/
|
||||
if($expandable)
|
||||
{
|
||||
e107::js('page','js/jquery.page.navigation.js','jquery');
|
||||
$template['caption'] .= "<span class='btn-group pull-right'><a class='btn btn-mini' id='page-nav-expand'>+</a><a class='btn btn-mini' id='page-nav-collapse'>-</a></span>";
|
||||
}
|
||||
|
||||
|
||||
### Render
|
||||
e107::getRender()->tablerender($template['caption'], $text, 'page-navigation-menu');
|
||||
|
||||
|
@@ -47,6 +47,7 @@ e107::css('url', "//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.
|
||||
|
||||
e107::css('theme', 'js/google-code-prettify/prettify.css');
|
||||
e107::js('theme', "js/google-code-prettify/prettify.js");
|
||||
e107::css('page', 'css/page.navigation.css', 'jquery');
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user