Debian Codegraph @

addons/website_sale_slides/views/website_slides_templates.xml

raw
1 <?xml version="1.0" ?>
2 <odoo><data>
3
4 <!-- LESSON -->
5 <template id="lesson_content_quiz" inherit_id="website_slides.lesson_content_quiz">
6 <xpath expr="//div[hasclass('o_wslides_js_lesson_quiz')]" position="attributes">
7 <attribute name="t-att-data-price">product_info['price'] if product_info else None</attribute>
8 <attribute name="t-att-data-currency-name">product_info['currency'].name if product_info else None</attribute>
9 <attribute name="t-att-data-currency-symbol">product_info['currency'].symbol if product_info else None</attribute>
10 <attribute name="t-att-data-has-discounted-price">product_info['has_discounted_price'] if product_info else None</attribute>
11 <attribute name="t-att-data-product-id">slide.channel_id.product_id.id if slide.channel_id.product_id else None</attribute>
12 <attribute name="t-att-data-list-price">product_info['list_price'] if product_info else None</attribute>
13 </xpath>
14 </template>
15
16 <template name="Buy Course To Download Resource" id="slide_aside_training_category_buy_course" inherit_id="website_slides.slide_aside_training_category">
17 <xpath expr="//div[hasclass('o_wslides_js_course_join') and hasclass('o_wslides_no_access')]" position="inside">
18 <li t-elif="aside_slide.channel_id.enroll == 'payment'" class="text-decoration-none small">
19 <i class="fa fa-download me-1"/>
20 <t t-call="website_sale_slides.course_buy_course_link">
21 <t t-set="for_resources" t-value="1"/>
22 <t t-set="slide" t-value="aside_slide"/>
23 </t>
24 </li>
25 </xpath>
26 </template>
27
28 <template name="Buy Course To Access Resources or Interact Slide Detail" id="slide_content_detailed_buy_course" inherit_id="website_slides.slide_content_detailed">
29 <xpath expr="//div[hasclass('o_wslides_js_course_join') and hasclass('o_wslides_no_access')] //div[@t-else='']" position="before">
30 <span t-elif="slide.channel_id.enroll == 'payment'" class="text-muted me-auto border-start ps-3">
31 <t t-call="website_sale_slides.course_buy_course_link">
32 <t t-set="for_resources" t-value="1"/>
33 </t>
34 </span>
35 </xpath>
36 <xpath expr="//div[hasclass('o_wslides_js_course_join') and hasclass('o_wslides_no_access_comments')]" position="inside">
37 <span t-elif="slide.channel_id.enroll == 'payment'">
38 <t t-call="website_sale_slides.course_buy_course_link"/>
39 </span>
40 </xpath>
41 </template>
42
43 <!-- Tweak "preview" badge: display Free Preview if payment-based course -->
44 <template id="course_slides_list_slide"
45 name="Slide template for a training channel (Sale)"
46 inherit_id="website_slides.course_slides_list_slide">
47 <xpath expr="//a[@t-if='channel.can_upload']/span/span" position="replace">
48 <span t-if="channel.enroll == 'payment'">Free Preview</span>
49 <span t-else="">Preview</span>
50 </xpath>
51 <xpath expr="//t[@t-elif='slide.is_preview and not channel.is_member']/span/span" position="replace">
52 <span t-if="channel.enroll == 'payment'">Free Preview</span>
53 <span t-else="">Preview</span>
54 </xpath>
55 </template>
56
57 <!-- FULLSCREEN -->
58 <template id="slide_fullscreen" inherit_id="website_slides.slide_fullscreen">
59 <xpath expr="//div[hasclass('o_wslides_fs_main')]" position="attributes">
60 <attribute name="t-att-data-price">product_info['price'] if product_info else None</attribute>
61 <attribute name="t-att-data-currency-name">product_info['currency'].name if product_info else None</attribute>
62 <attribute name="t-att-data-currency-symbol">product_info['currency'].symbol if product_info else None</attribute>
63 <attribute name="t-att-data-has-discounted-price">product_info['has_discounted_price'] if product_info else None</attribute>
64 <attribute name="t-att-data-product-id">slide.channel_id.product_id.id if product_info else None</attribute>
65 <attribute name="t-att-data-list-price">product_info['list_price'] if product_info else None</attribute>
66 </xpath>
67 </template>
68
69 <template name="Buy Course To Download Resource Fullscreen" id="slide_fullscreen_sidebar_category_buy_course" inherit_id="website_slides.slide_fullscreen_sidebar_category">
70 <xpath expr="//div[hasclass('o_wslides_js_course_join') and hasclass('o_wslides_no_access')]" position="inside">
71 <li t-elif="slide.channel_id.enroll == 'payment'" class="o_wslides_fs_slide_link mb-1">
72 <i class="fa fa-download me-1"/>
73 <t t-call="website_sale_slides.course_buy_course_link">
74 <t t-set="for_resources" t-value="1"/>
75 </t>
76 </li>
77 </xpath>
78 </template>
79
80 <!-- COURSE -->
81 <template name="Course Main" id="course_main" inherit_id="website_slides.course_main">
82 <xpath expr="//div[@id='home']" position="before">
83 <div t-if="channel.enroll == 'payment' and not channel.product_id.is_published"
84 class="alert alert-info" role="alert" groups="website_slides.group_website_slides_officer">
85 This course cannot be bought because its linked product
86 <a t-attf-href="/odoo/action-website_sale.product_template_action_website/{{channel.product_id.product_tmpl_id.id}}"
87 class="alert-link" t-out="channel.product_id.name"/>
88 is not published.
89 </div>
90 </xpath>
91 </template>
92
93 <template name="Course Sidebar (infos, CTA)" id="course_join" inherit_id="website_slides.course_join">
94 <!-- Channel main template: override button to join channel -->
95 <xpath expr="//div[hasclass('o_wslides_js_course_join')]" position="inside">
96 <t t-if="(not channel.is_member or channel.can_publish) and channel.enroll == 'payment'">
97 <t t-call="website_sale_slides.course_buy_course_button" />
98 </t>
99 </xpath>
100 </template>
101
102 <!-- TOOLS -->
103 <template name="Buy Course Link" id="course_buy_course_link">
104 <form class="oe_website_sale">
105 <input
106 type="hidden"
107 name="product_template_id"
108 t-att-value="slide.channel_id.product_id.product_tmpl_id.id"
109 />
110 <input
111 type="hidden"
112 class="product_id"
113 name="product_id"
114 t-att-value="slide.channel_id.product_id.id"
115 />
116 <a
117 id="add_to_cart"
118 role="button"
119 class="btn btn-primary d-block"
120 >
121 Join this Course
122 </a>
123 <t t-if="for_resources"> to access resources</t>
124 </form>
125 </template>
126
127 <template name="Buy Course Button" id="course_buy_course_button">
128 <t t-if="product_info and channel.product_id.website_published and not channel.is_member">
129 <div t-attf-class="text-center d-flex align-items-center text-center pb-1 #{'justify-content-between' if product_info['has_discounted_price'] else 'justify-content-around'}">
130 <div class="css_editable_mode_hidden">
131 <!-- real price -->
132 <div t-attf-class="oe_price fw-bold text-nowrap my-2 #{'h4' if len(str(product_info['price'])) > 10 else 'h2'}"
133 t-out="product_info['price']"
134 t-options="{'widget': 'monetary', 'display_currency': product_info['currency']}"/>
135 <span itemprop="price" style="display:none;" t-out="product_info['price']"/>
136 <span itemprop="priceCurrency" style="display:none;" t-out="product_info['currency'].name"/>
137 <!-- original discounted price, if any -->
138 <del t-att-class="'text-600 text-nowrap oe_default_price %s' % ('' if product_info['has_discounted_price'] else 'd-none')"
139 t-out="product_info['list_price']"
140 t-options="{'widget': 'monetary', 'display_currency': product_info['currency']}"/>
141 </div>
142 <div class="css_non_editable_mode_hidden decimal_precision oe_price fw-bold text-nowrap h2 my-2"
143 t-att-data-precision="str(product_info['currency'].decimal_places)">
144 <span t-field="channel.product_id.list_price" t-options="{'widget': 'monetary', 'display_currency': product_info['currency']}"/>
145 </div>
146 </div>
147 <t t-if="not invite_preview and channel.prerequisite_channel_ids and not channel.prerequisite_user_has_completed">
148 <small t-if="len(channel.prerequisite_channel_ids) == 1" class="text-center mb-2">
149 Prerequisite:
150 <a t-attf-href="/slides/{{channel.prerequisite_channel_ids[0].id}}"
151 t-out="channel.prerequisite_channel_ids[0].name"/>
152 </small>
153 <small t-else="" class="text-center mb-2">
154 There are some
155 <a href="#" class="o_wslides_js_prerequisite_course"
156 t-att-data-channels="json.dumps([
157 {'course_id': course.id, 'course_name': course.name}
158 for course in channel.prerequisite_channel_ids]
159 )">
160 prerequisite courses.
161 </a>
162 </small>
163 </t>
164 <t t-if="invite_preview">
165 <a type="button" class="btn btn-primary text-uppercase ms-2"
166 t-att-aria-label="'Sign up' if is_partner_without_user else 'Log in'"
167 t-attf-href="/slides/#{channel.id}/identify?#{keep_query('invite_partner_id', 'invite_hash')}">
168 <t t-if="is_partner_without_user">Sign up</t>
169 <t t-else="">Log in</t>
170 </a>
171 </t>
172 <div t-else="" class="oe_website_sale">
173 <form>
174 <input
175 type="hidden"
176 name="product_template_id"
177 t-att-value="channel.product_id.product_tmpl_id.id"
178 />
179 <input
180 type="hidden"
181 class="product_id"
182 name="product_id"
183 t-att-value="channel.product_id.id"
184 />
185 <a
186 id="add_to_cart"
187 role="button"
188 class="btn btn-primary d-block"
189 >
190 <i class="fa fa-shopping-cart"></i> Add to Cart
191 </a>
192 <!-- Hook for wishlist -->
193 <div id="product_option_block"/>
194 </form>
195 </div>
196 </t>
197 <t t-elif="not channel.is_member">
198 <div class="alert my-0 bg-200 text-center">
199 Course Unavailable
200 </div>
201 </t>
202 </template>
203
204 <template name="Display 'Buy Now'" id="course_option_buy_course_now" inherit_id="website_sale_slides.course_buy_course_button" active="False">
205 <xpath expr="//form//a[@id='add_to_cart']" position="before">
206 <a
207 role="button"
208 class="btn btn-primary d-block o_we_buy_now mb-1"
209 >
210 <i class="fa fa-bolt"></i> Buy Now
211 </a>
212 </xpath>
213 <xpath expr="//form//a[@id='add_to_cart']" position="attributes">
214 <attribute name="class" remove="btn-primary" add="btn-outline-primary" separator=" "/>
215 </xpath>
216 </template>
217
218 </data></odoo>