2013-07-24 01:15:58 +00:00
|
|
|
|
'use strict';
|
2013-06-24 23:41:59 +00:00
|
|
|
|
define(
|
|
|
|
|
[
|
|
|
|
|
'History/Model',
|
|
|
|
|
'backbone.pageable'
|
2013-07-24 01:15:58 +00:00
|
|
|
|
], function (HistoryModel, PageableCollection) {
|
2013-06-24 23:41:59 +00:00
|
|
|
|
return PageableCollection.extend({
|
|
|
|
|
url : window.ApiRoot + '/history',
|
|
|
|
|
model: HistoryModel,
|
2013-05-03 06:53:32 +00:00
|
|
|
|
|
2013-06-24 23:41:59 +00:00
|
|
|
|
state: {
|
|
|
|
|
pageSize: 15,
|
|
|
|
|
sortKey : 'date',
|
|
|
|
|
order : 1
|
|
|
|
|
},
|
2013-05-03 06:53:32 +00:00
|
|
|
|
|
2013-06-24 23:41:59 +00:00
|
|
|
|
queryParams: {
|
|
|
|
|
totalPages : null,
|
|
|
|
|
totalRecords: null,
|
|
|
|
|
pageSize : 'pageSize',
|
|
|
|
|
sortKey : 'sortKey',
|
|
|
|
|
order : 'sortDir',
|
|
|
|
|
directions : {
|
|
|
|
|
'-1': 'asc',
|
|
|
|
|
'1' : 'desc'
|
|
|
|
|
}
|
|
|
|
|
},
|
2013-05-03 06:53:32 +00:00
|
|
|
|
|
2013-06-24 23:41:59 +00:00
|
|
|
|
parseState: function (resp) {
|
|
|
|
|
return {totalRecords: resp.totalRecords};
|
|
|
|
|
},
|
2013-05-03 06:53:32 +00:00
|
|
|
|
|
2013-06-24 23:41:59 +00:00
|
|
|
|
parseRecords: function (resp) {
|
|
|
|
|
if (resp) {
|
|
|
|
|
return resp.records;
|
|
|
|
|
}
|
2013-05-03 06:53:32 +00:00
|
|
|
|
|
2013-06-24 23:41:59 +00:00
|
|
|
|
return resp;
|
|
|
|
|
}
|
|
|
|
|
});
|
2013-05-03 06:53:32 +00:00
|
|
|
|
});
|