summaryrefslogtreecommitdiff
path: root/addons/website_sale_slides
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2019-06-27 19:10:09 +0200
committerChristophe Simonis <chs@odoo.com>2019-06-27 19:10:09 +0200
commit6c5783bd5a8b20dce99b26a81e734a50c168bae0 (patch)
tree28f6179342d5799f1cee8bd5da21dc638c70b49a /addons/website_sale_slides
parentfdcabf19b27cb5427b8f55f922479cb740d590f3 (diff)
parent465909f0fde4d02b101d35c61bab8f0dea20f003 (diff)
[MERGE] forward port branch saas-12.2 up to 465909f0fde
Diffstat (limited to 'addons/website_sale_slides')
-rw-r--r--addons/website_sale_slides/__manifest__.py1
-rw-r--r--addons/website_sale_slides/static/src/js/slides_course_quiz.js25
-rw-r--r--addons/website_sale_slides/static/src/xml/website_sale_slides_quiz.xml43
-rw-r--r--addons/website_sale_slides/views/assets.xml10
-rw-r--r--addons/website_sale_slides/views/website_slides_templates.xml22
5 files changed, 101 insertions, 0 deletions
diff --git a/addons/website_sale_slides/__manifest__.py b/addons/website_sale_slides/__manifest__.py
index 951611eba62..d37fb3dbcda 100644
--- a/addons/website_sale_slides/__manifest__.py
+++ b/addons/website_sale_slides/__manifest__.py
@@ -11,6 +11,7 @@
'installable': True,
'auto_install': True,
'data': [
+ 'views/assets.xml',
'views/slide_channel_views.xml',
'views/website_slides_templates.xml',
],
diff --git a/addons/website_sale_slides/static/src/js/slides_course_quiz.js b/addons/website_sale_slides/static/src/js/slides_course_quiz.js
new file mode 100644
index 00000000000..9dc0154596a
--- /dev/null
+++ b/addons/website_sale_slides/static/src/js/slides_course_quiz.js
@@ -0,0 +1,25 @@
+odoo.define('website_sale_slides.quiz', function (require) {
+"use strict";
+
+var sAnimations = require('website.content.snippets.animation');
+var Quiz = require('website_slides.quiz');
+
+sAnimations.registry.websiteSlidesQuizNoFullscreen.include({
+ _extractChannelData: function (slideData){
+ return _.extend({}, this._super.apply(this, arguments), {
+ productId: slideData.productId,
+ enroll: slideData.enroll,
+ currencyName: slideData.currencyName,
+ currencySymbol: slideData.currencySymbol,
+ price: slideData.price,
+ hasDiscountedPrice: slideData.hasDiscountedPrice
+ });
+ }
+});
+
+Quiz.include({
+ xmlDependencies: (Quiz.prototype.xmlDependencies || []).concat(
+ ["/website_sale_slides/static/src/xml/website_sale_slides_quiz.xml"]
+ )
+});
+});
diff --git a/addons/website_sale_slides/static/src/xml/website_sale_slides_quiz.xml b/addons/website_sale_slides/static/src/xml/website_sale_slides_quiz.xml
new file mode 100644
index 00000000000..bcf0dc5a032
--- /dev/null
+++ b/addons/website_sale_slides/static/src/xml/website_sale_slides_quiz.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<templates xml:space="preserve">
+ <t t-extend="slide.slide.quiz.validation">
+ <t t-jquery="#validation" t-operation="append">
+ <div t-if="widget.readonly &amp;&amp; widget.publicUser &amp;&amp; widget.channel.channelEnroll == 'payment'" class="alert alert-info d-flex align-items-center justify-content-between">
+ <div>
+ <b class="h5 mb-0">Sign in and buy the course to join it and take the quiz!</b>
+ <span class="my-0 h4" style="line-height: 1">
+ <span title="Succeed and gain karma" aria-label="Succeed and gain karma" class="badge badge-pill badge-warning text-white font-weight-bold ml-3 px-2 py-1">
+ + <t t-esc="widget.quiz.quizKarmaGain"/> XP
+ </span>
+ </span>
+ </div>
+ <div>
+ <a t-att-href="'/web/login?redirect=' + widget.redirectURL" class="btn btn-primary font-weight-bold text-uppercase">Sign in</a>
+ <span t-if="widget.channel.signupAllowed" class="d-block mt-2">Don't have an account ? <a class="font-weight-bold" t-att-href="'/web/signup?redirect=' + widget.url">Sign Up !</a></span>
+ </div>
+ </div>
+ <div t-if="!widget.publicUser &amp;&amp; widget.channel.channelEnroll == 'payment'" class="card col-md-3">
+ <div class="card-body d-flex flex-column align-items-center">
+ <a role="button"
+ class="btn btn-primary btn-block o_wslides_js_course_join_link d-block mb-2"
+ title="Start Course" aria-label="Start Course Channel"
+ t-attf-href="/shop/cart/update?product_id=#{widget.channel.productId}&amp;express=1"
+ t-att-data-channel-id="widget.slide.channelId">
+ <span class="text-white text-uppercase font-weight-bold">
+ Buy the course
+ </span>
+ </a>
+ <div class="text-center">
+ <del t-if="widget.channel.hasDiscountedPrice"
+ class="text-600 text-nowrap oe_default_price d-inline"
+ t-esc="widget.channel.listPrice"/>
+ <span class="oe_price font-weight-bold text-nowrap h3 my-2"
+ t-esc="widget.channel.price"/>
+ <span t-if="widget.channel.currencySymbol" class="text-nowrap font-weight-bold h3 my-2" itemprop="priceCurrency" t-esc="widget.channel.currencySymbol"/>
+ <span t-else="" class="text-nowrap ml-1" itemprop="priceCurrency" t-esc="widget.channel.currencyName"/>
+ </div>
+ </div>
+ </div>
+ </t>
+ </t>
+</templates>
diff --git a/addons/website_sale_slides/views/assets.xml b/addons/website_sale_slides/views/assets.xml
new file mode 100644
index 00000000000..ce0ecddc580
--- /dev/null
+++ b/addons/website_sale_slides/views/assets.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" ?>
+<odoo>
+ <data>
+ <template id="assets_frontend" inherit_id="website.assets_frontend" name="Buy course on quiz">
+ <xpath expr="//script[last()]" position="after">
+ <script type="text/javascript" src="/website_sale_slides/static/src/js/slides_course_quiz.js"/>
+ </xpath>
+ </template>
+ </data>
+</odoo>
diff --git a/addons/website_sale_slides/views/website_slides_templates.xml b/addons/website_sale_slides/views/website_slides_templates.xml
index 39c6747ed26..a4f885182e7 100644
--- a/addons/website_sale_slides/views/website_slides_templates.xml
+++ b/addons/website_sale_slides/views/website_slides_templates.xml
@@ -31,4 +31,26 @@
</xpath>
</template>
+<template id="lesson_content_quiz" inherit_id="website_slides.lesson_content_quiz">
+ <xpath expr="//div[hasclass('o_wslides_js_lesson_quiz')]" position="attributes">
+ <attribute name="t-att-data-price">product_info['price'] if product_info else None</attribute>
+ <attribute name="t-att-data-currency-name">product_info['currency_id'].name if product_info else None</attribute>
+ <attribute name="t-att-data-currency-symbol">product_info['currency_id'].symbol if product_info else None</attribute>
+ <attribute name="t-att-data-has-discounted-price">product_info['has_discounted_price'] if product_info else None</attribute>
+ <attribute name="t-att-data-product-id">slide.channel_id.product_id.id if slide.channel_id.product_id else None</attribute>
+ <attribute name="t-att-data-list-price">product_info['list_price'] if product_info else None</attribute>
+ </xpath>
+</template>
+
+<template id="slide_fullscreen" inherit_id="website_slides.slide_fullscreen">
+ <xpath expr="//div[hasclass('o_wslides_fs_main')]" position="attributes">
+ <attribute name="t-att-data-price">product_info['price'] if product_info else None</attribute>
+ <attribute name="t-att-data-currency-name">product_info['currency_id'].name if product_info else None</attribute>
+ <attribute name="t-att-data-currency-symbol">product_info['currency_id'].symbol if product_info else None</attribute>
+ <attribute name="t-att-data-has-discounted-price">product_info['has_discounted_price'] if product_info else None</attribute>
+ <attribute name="t-att-data-product-id">slide.channel_id.product_id.id if product_info else None</attribute>
+ <attribute name="t-att-data-list-price">product_info['list_price'] if product_info else None</attribute>
+ </xpath>
+</template>
+
</data></odoo>