[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 /* 2 YUI 3.17.2 (build 9c3c78e) 3 Copyright 2014 Yahoo! Inc. All rights reserved. 4 Licensed under the BSD License. 5 http://yuilibrary.com/license/ 6 */ 7 8 YUI.add('paginator-url', function (Y, NAME) { 9 10 /** 11 Adds in URL options for paginator links. 12 13 @module paginator 14 @submodule paginator-url 15 @class Paginator.Url 16 @since 3.10.0 17 */ 18 19 function PaginatorUrl () {} 20 21 PaginatorUrl.ATTRS = { 22 /** 23 URL to return formatted with the page number. URL uses `Y.Lang.sub` for page number stubstitutions. 24 25 For example, if the page number is `3`, setting the `pageUrl` to `"?pg={page}"`, will result in `?pg=3` 26 27 @attribute pageUrl 28 @type String 29 **/ 30 pageUrl: {} 31 }; 32 33 PaginatorUrl.prototype = { 34 /** 35 Returns a formated URL for the previous page. 36 @method prevPageUrl 37 @return {String | null} Formatted URL for the previous page, or `null` if there is no previous page. 38 */ 39 prevPageUrl: function () { 40 return (this.hasPrevPage() && this.formatPageUrl(this.get('page') - 1)) || null; 41 }, 42 43 /** 44 Returns a formated URL for the next page. 45 @method nextPageUrl 46 @return {String | null} Formatted URL for the next page or `null` if there is no next page. 47 */ 48 nextPageUrl: function () { 49 return (this.hasNextPage() && this.formatPageUrl(this.get('page') + 1)) || null; 50 }, 51 52 /** 53 Returns a formated URL for the provided page number. 54 @method formatPageUrl 55 @param {Number} [page] Page value to be used in the formatted URL. If empty, page will be the value of the `page` ATTRS. 56 @return {String | null} Formatted URL for the page or `null` if there is not a `pageUrl` set. 57 */ 58 formatPageUrl: function (page) { 59 var pageUrl = this.get('pageUrl'); 60 if (pageUrl) { 61 return Y.Lang.sub(pageUrl, { 62 page: page || this.get('page') 63 }); 64 } 65 return null; 66 } 67 }; 68 69 Y.namespace('Paginator').Url = PaginatorUrl; 70 71 Y.Base.mix(Y.Paginator, [PaginatorUrl]); 72 73 74 }, '3.17.2', {"requires": ["paginator"]});
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Aug 11 10:00:09 2016 | Cross-referenced by PHPXref 0.7.1 |