From ed0a82ed5d7d5548fba12f5f5540980b0e565f11 Mon Sep 17 00:00:00 2001 From: Ludovic Stephan Date: Wed, 5 Apr 2017 16:51:17 -0300 Subject: [PATCH] Add no_trigramme option --- kfet/static/kfet/js/history.js | 12 ++++++------ kfet/static/kfet/js/kfet.api.js | 3 --- kfet/static/kfet/js/kfet.js | 16 ---------------- kfet/templates/kfet/account_read.html | 2 +- 4 files changed, 7 insertions(+), 26 deletions(-) diff --git a/kfet/static/kfet/js/history.js b/kfet/static/kfet/js/history.js index 5fcb8f2c..a41173b2 100644 --- a/kfet/static/kfet/js/history.js +++ b/kfet/static/kfet/js/history.js @@ -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': '
', 'specialope': '
', @@ -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'] = '
' + 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); } diff --git a/kfet/static/kfet/js/kfet.api.js b/kfet/static/kfet/js/kfet.api.js index ee5376af..10e52989 100644 --- a/kfet/static/kfet/js/kfet.api.js +++ b/kfet/static/kfet/js/kfet.api.js @@ -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 : ''; diff --git a/kfet/static/kfet/js/kfet.js b/kfet/static/kfet/js/kfet.js index d9e2624c..d8799b1d 100644 --- a/kfet/static/kfet/js/kfet.js +++ b/kfet/static/kfet/js/kfet.js @@ -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 ; diff --git a/kfet/templates/kfet/account_read.html b/kfet/templates/kfet/account_read.html index 206b40ce..86e1b43e 100644 --- a/kfet/templates/kfet/account_read.html +++ b/kfet/templates/kfet/account_read.html @@ -102,7 +102,7 @@ $(document).ready(function() { 'use strict'; - var khistory = new KHistory({'remove_props': ['trigramme']}); + var khistory = new KHistory({'no_trigramme': true}); // ----- // Synchronization