summaryrefslogtreecommitdiff
path: root/addons/project/static/src/js
diff options
context:
space:
mode:
authorJérome Maes <jem@openerp.com>2017-08-17 09:38:16 +0200
committerjem-odoo <jem@openerp.com>2017-12-12 14:06:29 +0100
commitd7d30f69d78e75cb859ec6b5e70b91d78c6e4eaf (patch)
tree11e537f68c4f71e7afd82cfb9ddccebea9e971da /addons/project/static/src/js
parent93adbdbb208a29b0a61b97a502bbbadb16e8e60a (diff)
[REM] website_rating_project: move feature in project
Displaying the rating of project is moved directly in project module, since it does not depends on website. User may want to display rating of its support project even without website.
Diffstat (limited to 'addons/project/static/src/js')
-rw-r--r--addons/project/static/src/js/portal_rating.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/addons/project/static/src/js/portal_rating.js b/addons/project/static/src/js/portal_rating.js
new file mode 100644
index 00000000000..12740b9bbba
--- /dev/null
+++ b/addons/project/static/src/js/portal_rating.js
@@ -0,0 +1,27 @@
+odoo.define('website_rating_project.rating', function (require) {
+'use strict';
+
+ var time = require('web.time');
+ require('web.dom_ready');
+
+ if(!$('.o_portal_project_rating').length) {
+ return $.Deferred().reject("DOM doesn't contain '.o_portal_project_rating'");
+ }
+
+ /**
+ * Rating popover with some informations
+ */
+ $('.o_portal_project_rating .o_rating_image').popover({
+ placement: 'bottom',
+ trigger: 'hover',
+ html: 'true',
+ content: function () {
+ var id = $(this).data('id');
+ var rating_date = $(this).data('rating-date');
+ var base_date = time.auto_str_to_date(rating_date);
+ var duration = moment(base_date).fromNow();
+ $("#rating_"+ id).find(".rating_timeduration").text(duration);
+ return $("#rating_"+ id).html();
+ }
+ });
+});