Add no_trigramme option

This commit is contained in:
Ludovic Stephan 2017-04-05 16:51:17 -03:00
parent f57c292184
commit ed0a82ed5d
4 changed files with 7 additions and 26 deletions

View file

@ -4,7 +4,7 @@ class KHistory {
return { from: moment().subtract(1, 'days').format('YYYY-MM-DD HH:mm:ss'), };
}
constructor(display_options, noselect) {
constructor(options) {
this.templates = {
'purchase': '<div class="ope"><span class="amount"></span><span class="infos1"></span><span class="infos2"></span><span class="addcost"></span><span class="canceled"></span></div>',
'specialope': '<div class="ope"><span class="amount"></span><span class="infos1"></span><span class="infos2"></span><span class="addcost"></span><span class="canceled"></span></div>',
@ -19,12 +19,12 @@ class KHistory {
this.list = new OperationList();
this.display_options = display_options || {};
if (!noselect) {
if (!options.no_select)
this.selection = new KHistorySelection(this);
}
if (options.no_trigramme)
this.templates['opegroup'] = '<div class="opegroup"><span class="time"></span><span class="amount"></span><span class="valid_by"></span><span class="comment"></span></div>'
this._init_events();
}
@ -43,7 +43,7 @@ class KHistory {
}
display() {
this.list.display(this._$container, this.templates, this.display_options);
this.list.display(this._$container, this.templates, {});
var nb_opes = this._$container.find('.ope[canceled="false"]').length;
$('#nb_opes').text(nb_opes);
}

View file

@ -1230,9 +1230,6 @@ class Formatter {
var props = options.override_props ? options.props : this.props.concat(options.props);
var attrs = options.override_attrs ? options.attrs : this.attrs.concat(options.attrs);
props = options.remove_props ? props.diff(options.remove_props) : props;
attrs = options.remove_attrs ? props.diff(options.remove_attrs) : attrs;
var prefix_prop = options.prefix_prop !== undefined ? options.prefix_prop : '.';
var prefix_attr = options.prefix_attr !== undefined ? options.prefix_attr : '';

View file

@ -24,22 +24,6 @@ String.prototype.isValidTri = function() {
return pattern.test(this);
}
/**
* Array method
* @global
* @return {[]} Array elements not in given argument
*/
// Note : we define it this way to avoid problems in for loops
Object.defineProperty(Array.prototype, 'diff', {
enumerable: false,
configurable: true,
value: function(a) {
return this.filter(function (elt) {
return a.indexOf(elt) < 0 ;
});
}
});
/**
* Checks if given argument is float ;

View file

@ -102,7 +102,7 @@
$(document).ready(function() {
'use strict';
var khistory = new KHistory({'remove_props': ['trigramme']});
var khistory = new KHistory({'no_trigramme': true});
// -----
// Synchronization