diff --git a/kfet/static/kfet/js/history.js b/kfet/static/kfet/js/history.js
index eaecfb8f..6a77a8ff 100644
--- a/kfet/static/kfet/js/history.js
+++ b/kfet/static/kfet/js/history.js
@@ -1,28 +1,38 @@
class KHistory {
- static get default_options() {
- return { from: moment().subtract(1, 'days').format('YYYY-MM-DD HH:mm:ss'), };
+ static get default_options {
+ return {
+ 'templates': {
+ 'purchase': '
',
+ 'specialope': '
',
+ 'opegroup': '
',
+ 'transfergroup': '
',
+ 'day': '
',
+ 'transfer': '
',
+ },
+
+ 'api_options': {
+ from: moment().subtract(1, 'days').format('YYYY-MM-DD HH:mm:ss'),
+ },
+
+ };
}
constructor(options) {
- this.templates = {
- 'purchase': '
',
- 'specialope': '
',
- 'opegroup': '
',
- 'transfergroup': '
',
- 'day': '
',
- 'transfer': '
',
- };
+ var all_options = $.extend({}, this.constructor.default_options, options);
+
+ this.templates = all_options.templates;
+ this.api_options = all_options.api_options;
this._$container = $('#history');
this._$nb_opes = $('#nb_opes');
this.list = new OperationList();
- if (!options || !options.no_select)
+ if (!all_options.no_select)
this.selection = new KHistorySelection(this);
- if (options && options.no_trigramme)
+ if (all_options.no_trigramme)
this.templates['opegroup'] = '
'
this._init_events();
@@ -34,8 +44,6 @@ class KHistory {
if (api_options)
this.api_options = api_options;
- else if (!this.api_options)
- this.api_options = this.constructor.default_options;
this.list.fromAPI(this.api_options)
.done( () => this.display() );