Skip to content

Commit

Permalink
Add pageActiveTpl to differentiate current page link
Browse files Browse the repository at this point in the history
  • Loading branch information
opengeek committed Aug 18, 2010
1 parent 54f8c78 commit f58b109
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 5 deletions.
4 changes: 2 additions & 2 deletions _build/build.transport.php
Expand Up @@ -4,7 +4,7 @@
*
* @package getpage
* @subpackage build
* @version 1.0.0-rc1
* @version 1.0.0-pl
* @author Jason Coward <jason@modxcms.com>
*/
$mtime = microtime();
Expand All @@ -26,7 +26,7 @@
/* package defines */
define('PKG_NAME','getPage');
define('PKG_VERSION','1.0.0');
define('PKG_RELEASE','rc1');
define('PKG_RELEASE','pl');
define('PKG_LNAME',strtolower(PKG_NAME));

// override with your own defines here (see build.config.sample.php)
Expand Down
7 changes: 7 additions & 0 deletions _build/properties/properties.getpage.php
Expand Up @@ -74,6 +74,13 @@
'options' => '',
'value' => '<li[[+classes]]><a[[+classes]][[+title]] href="[[+href]]">[[+pageNo]]</a></li>',
)
,array(
'name' => 'pageActiveTpl',
'desc' => 'Content representing the current page navigation control.',
'type' => 'textfield',
'options' => '',
'value' => '<li[[+activeClasses]]><a[[+activeClasses:default=` class="active"`]][[+title]] href="[[+href]]">[[+pageNo]]</a></li>',
)
,array(
'name' => 'pageFirstTpl',
'desc' => 'Content representing the first page navigation control.',
Expand Down
4 changes: 4 additions & 0 deletions core/components/getpage/docs/changelog.txt
@@ -1,5 +1,9 @@
Changelog for getPage.

getPage 1.0.0-pl (August 18, 2010)
====================================
- Add pageActiveTpl to differentiate current page link

getPage 1.0.0-rc1 (June 29, 2010)
====================================
- Add per page caching capabilities
Expand Down
4 changes: 2 additions & 2 deletions core/components/getpage/docs/readme.txt
@@ -1,11 +1,11 @@
--------------------
Snippet: getPage
--------------------
Version: 1.0.0-rc1
Version: 1.0.0-pl
Since: March 19, 2010
Author: Jason Coward <jason@modxcms.com>

A generic wrapper snippet for returning paged results and navigation from snippets that return limitable collections.

Official Documentation:
http://svn.modxcms.com/docs/display/ADDON/getPage
http://rtfm.modx.com/display/ADDON/getPage
6 changes: 5 additions & 1 deletion core/components/getpage/include.getpage.php
Expand Up @@ -18,7 +18,11 @@ function getpage_buildControls(& $modx, $properties) {
}
}
if ($i >= $page - $pageLimit && $i <= $page + $pageLimit) {
$nav[$i] = getpage_makeUrl($modx, $properties, $i, $pageNavTpl);
if ($i == $page) {
$nav[$i] = getpage_makeUrl($modx, $properties, $i, $pageActiveTpl);
} else {
$nav[$i] = getpage_makeUrl($modx, $properties, $i, $pageNavTpl);
}
}
if ($i == $pageCount && $i != $page && !empty($pageLastTpl)) {
if (!empty($pageNextTpl) && ($page + 1) <= $pageCount) {
Expand Down
1 change: 1 addition & 0 deletions core/components/getpage/snippet.getpage.php
Expand Up @@ -15,6 +15,7 @@
$properties['elementClass'] = empty($elementClass) ? 'modChunk' : $elementClass;
$properties['pageNavVar'] = empty($pageNavVar) ? 'page.nav' : $pageNavVar;
$properties['pageNavTpl'] = empty($pageNavTpl) ? "<li[[+classes]]><a[[+classes]][[+title]] href=\"[[+href]]\">[[+pageNo]]</a></li>" : $pageNavTpl;
$properties['pageActiveTpl'] = empty($pageActiveTpl) ? "<li[[+activeClasses:default=` class=\"active\"`]]><a[[+activeClasses:default=` class=\"active\"`]][[+title]] href=\"[[+href]]\">[[+pageNo]]</a></li>" : $pageActiveTpl;
$properties['pageFirstTpl'] = empty($pageFirstTpl) ? "<li class=\"control\"><a[[+title]] href=\"[[+href]]\">First</a></li>" : $pageFirstTpl;
$properties['pageLastTpl'] = empty($pageLastTpl) ? "<li class=\"control\"><a[[+title]] href=\"[[+href]]\">Last</a></li>" : $pageLastTpl;
$properties['pagePrevTpl'] = empty($pagePrevTpl) ? "<li class=\"control\"><a[[+title]] href=\"[[+href]]\">&lt;&lt;</a></li>" : $pagePrevTpl;
Expand Down

0 comments on commit f58b109

Please sign in to comment.