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