Skip to content

Commit

Permalink
Adding List.getAdminURL method, fixes keystonejs#1584
Browse files Browse the repository at this point in the history
  • Loading branch information
JedWatson committed Aug 14, 2015
1 parent c644007 commit 0bbe3a9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ List.prototype.underscoreMethod = require('./list/underscoreMethod');
List.prototype.register = require('./list/register');
List.prototype.getData = require('./list/getData');
List.prototype.getOptions = require('./list/getOptions');
List.prototype.getAdminURL = require('./list/getAdminURL');
List.prototype.getDocumentName = require('./list/getDocumentName');
List.prototype.addFiltersToQuery = require('./list/addFiltersToQuery');
List.prototype.isReserved = require('./list/isReserved');
Expand Down
14 changes: 14 additions & 0 deletions lib/list/getAdminUrl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* Gets the Admin URL to view the list (or an item if provided)
*
* Example:
* var listURL = list.getAdminURL()
* var itemURL = list.getAdminURL(item)
*
* @param {Object} item
*/
function getAdminURL(item) {
return '/keystone/' + this.path + (item ? '/' + item.id : '');
}

module.exports = getAdminURL;

0 comments on commit 0bbe3a9

Please sign in to comment.