blob: 12a6d8b63b7b973ea49f09fe499551a81ae30eca (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
odoo.define('website_slides.ratingField', function (require) {
"use strict";
var basicFields = require('web.basic_fields');
var fieldRegistry = require('web.field_registry');
var core = require('web.core');
var QWeb = core.qweb;
var FieldFloatRating = basicFields.FieldFloat.extend({
xmlDependencies: !basicFields.FieldFloat.prototype.xmlDependencies ?
['/portal_rating/static/src/xml/portal_tools.xml'] : basicFields.FieldFloat.prototype.xmlDependencies.concat(
['/portal_rating/static/src/xml/portal_tools.xml']
),
//--------------------------------------------------------------------------
// Private
//--------------------------------------------------------------------------
/**
* @override
* @private
*/
_render: function () {
var self = this;
return Promise.resolve(this._super()).then(function () {
self.$el.html(QWeb.render('portal_rating.rating_stars_static', {
'val': self.value / 2,
'inline_mode': true
}));
});
},
});
fieldRegistry.add('field_float_rating', FieldFloatRating);
return {
FieldFloatRating: FieldFloatRating,
};
});
|