diff options
| author | Géry Debongnie <ged@odoo.com> | 2017-03-05 10:05:56 +0100 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2017-04-11 19:44:38 +0200 |
| commit | 905e01921f3c3ef43ace6fc537d1d8c0d280002c (patch) | |
| tree | 265c43ab21c5401a5d9f0f3d64d86f1ac417451c /addons/web/static/src/js/widgets/priority.js | |
| parent | 54d4c73af4ad05c7640d28c1892247c9538b8017 (diff) | |
[REF] web, *: redesign all JS views
This commit introduce a full redesign of all JS views. We started
basically from scratch. The goal was to unify all the various views
under a common framework, to make them testable, to make then usable in
different conditions (in studio, or in the frontend), and to make our
lives easier.
Some important points are:
- we introduced new coding guidelines (camelCase, 80 chars width, ...)
- we have a brand new testing framework (still QUnit based)
- kanban view moved to the web addon
- calendar view (formerly web_calender) moved to web as well
- the tree view was removed
- all new code should be documented
We hope that this code is the start of a new era for the Odoo web
client, we want to have a high quality codebase, well documented, well
tested, well designed.
Work done by the framework team: mostly aab, ged, chm, dmo, qsm
Diffstat (limited to 'addons/web/static/src/js/widgets/priority.js')
| -rw-r--r-- | addons/web/static/src/js/widgets/priority.js | 84 |
1 files changed, 0 insertions, 84 deletions
diff --git a/addons/web/static/src/js/widgets/priority.js b/addons/web/static/src/js/widgets/priority.js deleted file mode 100644 index 44ff3b50c1e..00000000000 --- a/addons/web/static/src/js/widgets/priority.js +++ /dev/null @@ -1,84 +0,0 @@ -odoo.define('web.Priority', function (require) { -"use strict"; - -var core = require('web.core'); -var Widget = require('web.Widget'); - -var QWeb = core.qweb; -var _t = core._t; - -var Priority = Widget.extend({ - template: "Priority", - events: { - 'mouseover > a': function(e) { - clearTimeout(this.hover_timer); - - this.$stars.removeClass('fa-star-o').addClass('fa-star'); - $(e.target).nextAll().removeClass('fa-star').addClass('fa-star-o'); - }, - 'mouseout > a': function(e) { - clearTimeout(this.hover_timer); - - var self = this; - this.hover_timer = setTimeout(function() { - self._render_value(); - }, 200); - }, - 'click > a': function(e) { - e.preventDefault(); - e.stopPropagation(); - - var old_value = this.value; - this.value = String($(e.target).data('value')); - if(old_value === this.value) { - this.value = this.empty_value; - } - - this._render_value(); - this.trigger('update', {value: this.value}); - }, - }, - init: function(parent, options) { - this._super.apply(this, arguments); - - options = _.defaults(options || {}, { - readonly: true, - value: 0, - values: [ - [0, _t("Normal")], - [1, _t("Low")], - [2, _t("High")], - [3, _t("Very High")] - ], - }); - - this.readonly = options.readonly; - this.value = options.value; - this.values = options.values; - this.empty_value = this.values[0][0]; - }, - start: function() { - this._render_value(); - return this._super(); - }, - set_value: function(value) { - this.value = value; - this._render_value(); - }, - _render_value: function() { - var self = this; - var index_value = this.value ? _.findIndex(this.values, function (v) { - return v[0] === self.value; - }) : 0; - this.$stars = this.$('.o_priority_star'); - this.$stars.each(function(i, el) { - var $star = $(el); - $star.toggleClass('fa-star', (i+1 <= index_value)) - .toggleClass('fa-star-o', (i+1 > index_value)); - }); - }, -}); - -return Priority; - -}); |
