2014-10-24 16:09:50 -05:00
|
|
|
var defaultPaginationSettings,
|
|
|
|
PaginationRoute;
|
|
|
|
|
|
|
|
defaultPaginationSettings = {
|
2014-07-20 11:42:03 -05:00
|
|
|
page: 1,
|
|
|
|
limit: 15
|
|
|
|
};
|
|
|
|
|
2014-10-24 16:09:50 -05:00
|
|
|
PaginationRoute = Ember.Mixin.create({
|
2014-07-20 11:42:03 -05:00
|
|
|
/**
|
|
|
|
* Sets up pagination details
|
2014-10-24 16:09:50 -05:00
|
|
|
* @param {object} settings specifies additional pagination details
|
2014-07-20 11:42:03 -05:00
|
|
|
*/
|
|
|
|
setupPagination: function (settings) {
|
|
|
|
settings = settings || {};
|
2014-07-31 15:29:35 -05:00
|
|
|
for (var key in defaultPaginationSettings) {
|
2014-10-04 11:38:15 -05:00
|
|
|
if (defaultPaginationSettings.hasOwnProperty(key)) {
|
|
|
|
if (!settings.hasOwnProperty(key)) {
|
|
|
|
settings[key] = defaultPaginationSettings[key];
|
|
|
|
}
|
2014-07-31 15:29:35 -05:00
|
|
|
}
|
|
|
|
}
|
2014-07-20 11:42:03 -05:00
|
|
|
|
|
|
|
this.set('paginationSettings', settings);
|
|
|
|
this.controller.set('paginationSettings', settings);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
export default PaginationRoute;
|