summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/framework
diff options
context:
space:
mode:
authorGéry Debongnie <ged@odoo.com>2016-02-17 09:48:33 +0100
committerGéry Debongnie <ged@odoo.com>2016-02-17 09:51:42 +0100
commitf50807485125468f3da652097c9d0618cc8e4c8c (patch)
tree8041ae0de8a493e349af0b6c629b20aa62394656 /addons/web/static/src/js/framework
parent929ff48e17d0cff8c2b77e24075d2f9be6a9ff2e (diff)
parent715a5ba096082bde2f13dd5f8755f688cd9cdcec (diff)
[MERGE] web client: js libraries cleanup
Various steps have been taken to put the web client on a diet. Most notably: - remove many useless libraries - custom builds for nvd3 and jquery ui - remove web_editor (didn't work anyway) - lazy loading of raphaeljs (for the diagram view)
Diffstat (limited to 'addons/web/static/src/js/framework')
-rw-r--r--addons/web/static/src/js/framework/misc.js23
-rw-r--r--addons/web/static/src/js/framework/translation.js5
-rw-r--r--addons/web/static/src/js/framework/utils.js19
3 files changed, 12 insertions, 35 deletions
diff --git a/addons/web/static/src/js/framework/misc.js b/addons/web/static/src/js/framework/misc.js
index 25e80c33e84..b8c5e5e927e 100644
--- a/addons/web/static/src/js/framework/misc.js
+++ b/addons/web/static/src/js/framework/misc.js
@@ -7,7 +7,6 @@ var session = require('web.session');
var Widget = require('web.Widget');
var _t = core._t;
-var Spinner = window.Spinner;
var messages_by_seconds = function() {
return [
@@ -24,23 +23,6 @@ var messages_by_seconds = function() {
var Throbber = Widget.extend({
template: "Throbber",
start: function() {
- var opts = {
- lines: 13, // The number of lines to draw
- length: 7, // The length of each line
- width: 4, // The line thickness
- radius: 10, // The radius of the inner circle
- rotate: 0, // The rotation offset
- color: '#FFF', // #rgb or #rrggbb
- speed: 1, // Rounds per second
- trail: 60, // Afterglow percentage
- shadow: false, // Whether to render a shadow
- hwaccel: false, // Whether to use hardware acceleration
- className: 'spinner', // The CSS class to assign to the spinner
- zIndex: 2e9, // The z-index (defaults to 2000000000)
- top: 'auto', // Top position relative to parent in px
- left: 'auto' // Left position relative to parent in px
- };
- this.spin = new Spinner(opts).spin(this.$el[0]);
this.start_time = new Date().getTime();
this.act_message();
},
@@ -59,11 +41,6 @@ var Throbber = Widget.extend({
self.act_message();
}, 1000);
},
- destroy: function() {
- if (this.spin)
- this.spin.stop();
- this._super();
- },
});
diff --git a/addons/web/static/src/js/framework/translation.js b/addons/web/static/src/js/framework/translation.js
index 47673756e81..69743e9787d 100644
--- a/addons/web/static/src/js/framework/translation.js
+++ b/addons/web/static/src/js/framework/translation.js
@@ -80,11 +80,6 @@ var _lt = function (s) {
return {toString: function () { return _t(s); }};
};
-// provide timeago.js with our own translator method
-if($.timeago){ // make timeago an optional dependency of translation
- $.timeago.settings.translator = _t;
-}
-
qweb.default_dict = {
'_' : _,
'JSON': JSON,
diff --git a/addons/web/static/src/js/framework/utils.js b/addons/web/static/src/js/framework/utils.js
index a0ab37a7dfb..68291d41bbf 100644
--- a/addons/web/static/src/js/framework/utils.js
+++ b/addons/web/static/src/js/framework/utils.js
@@ -296,14 +296,19 @@ function human_size (size) {
*
* @param {Number} number
*/
-function human_number (number) {
- var units = _t(",k,M").split(',');
- var i = 0;
- while (number >= 1000) {
- number /= 1000;
- ++i;
+function human_number (number, decimals) {
+ var decimals = decimals | 0;
+ var number = Math.round(number);
+ var d2 = Math.pow(10, decimals);
+ var val = _t("kMGTPE");
+ var i = val.length-1, s;
+ while( i ) {
+ s = Math.pow(10,i--*3);
+ if( s <= number ) {
+ number = Math.round(number*d2/s)/d2 + val[i];
+ }
}
- return parseInt(number) + units[i];
+ return number;
}
/**