refactor: remove legacy website snippet configurations and clean up theme structure

This commit is contained in:
hoangvv
2026-08-13 16:15:21 +07:00
parent 860cf9cb0f
commit 4d9da4d492
16 changed files with 399 additions and 451 deletions
@@ -2,10 +2,10 @@
import { registry } from '@web/core/registry';
import { markup } from "@odoo/owl";
import { rpc } from "@web/core/network/rpc";
export const componentService = {
dependencies: ['rpc'],
start(env, { rpc }) {
start() {
return {
async _fetchRecords(params, extras) {
let { routePath, fieldsToMarkup } = extras || {};
@@ -26,4 +26,4 @@ export const componentService = {
}
}
registry.category('services').add('shared_component_service', componentService);
registry.category('services').add('shared_component_service', componentService);
@@ -1,6 +1,6 @@
/** @odoo-module **/
import "@website_sale_product_configurator/js/website_sale_options";
import "@website_sale/js/website_sale_configurators";
import publicWidget from "@web/legacy/js/public/public_widget";
import {CartManagerMixin} from "@theme_prime/js/core/mixins";
import { QuickViewDialog } from "@theme_prime/js/frontend/quick_view_dialog";
@@ -10,7 +10,7 @@ publicWidget.registry.WebsiteSale.include(Object.assign({}, CartManagerMixin, {
this._super(...arguments);
this.notification = this.bindService("notification");
},
_onProductReady: function () {
_onProductReady: function (isOnProductPage = false) {
if (this._isB2bModeEnabled()) {
this._loggedInNotification();
return Promise.resolve();
@@ -1,8 +1,9 @@
/** @odoo-module **/
import SnippetsMenu from "@website/js/editor/snippets.editor";
import { _lt } from "@web/core/l10n/translation";
import websiteSnippetsEditor from "@website/js/editor/snippets.editor";
import { _t } from "@web/core/l10n/translation";
SnippetsMenu.SnippetsMenu.include({
optionsTabStructure: [...SnippetsMenu.SnippetsMenu.prototype.optionsTabStructure, ["theme-prime-options", _lt("Theme Prime Options")]],
});
websiteSnippetsEditor.SnippetsMenu.optionsTabStructure = [
...websiteSnippetsEditor.SnippetsMenu.optionsTabStructure,
["theme-prime-options", _t("Theme Prime Options")],
];
@@ -1,7 +1,7 @@
/** @odoo-module **/
import '@website_sale_comparison/js/website_sale_comparison';
import { jsonrpc } from "@web/core/network/rpc_service";
import { rpc } from "@web/core/network/rpc";
import Dialog from '@web/legacy/js/core/dialog';
import publicWidget from "@web/legacy/js/public/public_widget";
import { ProductCarouselMixins } from "@theme_prime/js/core/mixins";
@@ -24,7 +24,7 @@ export const QuickViewDialog = Dialog.extend(ProductCarouselMixins, {
},
willStart: async function () {
await this._super(...arguments);
const result = await jsonrpc('/theme_prime/get_quick_view_html', {
const result = await rpc('/theme_prime/get_quick_view_html', {
options: {productID: this.productID, variantID: this.variantID, variant_selector: this.isVariantSelectorDialog}
});
if (result) {
+4 -4
View File
@@ -386,7 +386,7 @@
</h6>
<t t-call="tp-snippet-product-price"/>
<span t-if="widget._isActionEnabled('rating')" class=" w-auto px-0 small mt-n1 d-block">
<t t-raw="item.rating"/>
<t t-out="item.rating"/>
</span>
</div>
<div class="flex-shrink-1 d-flex align-items-center">
@@ -420,7 +420,7 @@
</a>
</h5>
<span class="mb-2 d-block" t-if="widget._isActionEnabled('rating')">
<t t-raw="item.rating"/>
<t t-out="item.rating"/>
</span>
<t t-call="tp-snippet-product-price"/>
<div class="d_product_description my-3" t-if="widget._isActionEnabled('description_sale') &amp;&amp; item.description_sale">
@@ -468,7 +468,7 @@
</a>
</h5>
<span class="mb-1 d-block" t-if="widget._isActionEnabled('rating')">
<t t-raw="item.rating"/>
<t t-out="item.rating"/>
</span>
<t t-call="tp-snippet-colors-pills">
<t t-set="_classes" t-value="'mb-3'"/>
@@ -558,7 +558,7 @@
<div class="o_cc o_cc5 bg-transparent">
<div class="d-flex align-items-center justify-content-between pt-md-2 pt-lg-0">
<t t-call="tp_category_info"><t t-set="_classes" t-value="'d-inline-block'"/></t>
<span class="d-block" t-if="widget._isActionEnabled('rating')"><t t-raw="item.rating"/></span>
<span class="d-block" t-if="widget._isActionEnabled('rating')"><t t-out="item.rating"/></span>
</div>
<h5 class="card-title mt-1 mb-1 d-product-name text-truncate fw-light">
<a t-att-href="item.website_url" class="d-none d-lg-block" style="color:inherit !important"><t t-out="item.name"/></a>
@@ -29,11 +29,11 @@
</a>
</h5>
<div class="mt-1 mb-2" t-if="widget.shopParams.is_rating_active">
<t t-raw="product.rating"></t>
<t t-out="product.rating"></t>
</div>
<div class="d-product-price my-2">
<h5 class="d-inline-block mb-0 fw-bold text-primary" t-raw="product.price"/>
<p t-if="product.has_discounted_price" class="text-muted d-inline-block mb-0" style="text-decoration: line-through; white-space: nowrap;" t-raw="product.list_price"/>
<h5 class="d-inline-block mb-0 fw-bold text-primary" t-out="product.price"/>
<p t-if="product.has_discounted_price" class="text-muted d-inline-block mb-0" style="text-decoration: line-through; white-space: nowrap;" t-out="product.list_price"/>
</div>
<div class="d_product_description mb-2" t-if="product.description_sale">
<p class="mb-1 card-text" t-esc="product.short_description"/>
@@ -92,8 +92,8 @@
</a>
</h6>
<div class="d-product-price my-1">
<p class="d-inline-block mb-0 fw-bold text-primary" t-raw="product.price"/>
<small t-if="product.has_discounted_price" class="text-muted d-inline-block mb-0" style="text-decoration: line-through; white-space: nowrap;" t-raw="product.list_price"/>
<p class="d-inline-block mb-0 fw-bold text-primary" t-out="product.price"/>
<small t-if="product.has_discounted_price" class="text-muted d-inline-block mb-0" style="text-decoration: line-through; white-space: nowrap;" t-out="product.list_price"/>
</div>
<button t-att-data-product-product-id="product.product_variant_id" data-bs-toggle="tooltip" data-placement="bottom" class="btn btn-primary w-100 d_action_btn d_add_to_cart_btn btn-sm py-1" title="Add to Cart">
<i class="d_action_btn_icon dri dri-cart"></i> ADD TO CART
@@ -12,8 +12,8 @@
</a>
</h1>
<div class="d-product-price my-2">
<h3 class="d-inline-block text-primary" t-raw="product.price"/>
<p t-if="product.has_discounted_price" class="text-muted d-inline-block mb-0" style="text-decoration: line-through; white-space: nowrap;" t-raw="product.list_price"/>
<h3 class="d-inline-block text-primary" t-out="product.price"/>
<p t-if="product.has_discounted_price" class="text-muted d-inline-block mb-0" style="text-decoration: line-through; white-space: nowrap;" t-out="product.list_price"/>
</div>
<p t-if="product.description_sale" t-esc="product.description_sale"/>
<div t-if="product.offer_data" class="d_offer_block mt-2">
@@ -139,7 +139,7 @@
</t>
</t>
<t t-else="">
<t t-raw="widget._markUpResults(data)"/>
<t t-out="widget._markUpResults(data)"/>
</t>
</t>
@@ -12,10 +12,10 @@
<a t-att-href="productInfo.website_url"><t t-esc="productInfo.name"/></a>
</h6>
<div class="mt-2">
<p class="text-primary mb-0 h6" t-raw="productInfo.price"/>
<p class="text-primary mb-0 h6" t-out="productInfo.price"/>
</div>
<div class="mt-2">
<span t-if="productInfo.has_discounted_price" class="text-muted" style="text-decoration: line-through; white-space: nowrap;" t-raw="productInfo.list_price"/>
<span t-if="productInfo.has_discounted_price" class="text-muted" style="text-decoration: line-through; white-space: nowrap;" t-out="productInfo.list_price"/>
<span class="tp-discount-badge small ms-2" t-if="productInfo.discount"><t t-esc="productInfo.discount"></t>% OFF</span>
</div>
</div>
@@ -31,7 +31,7 @@
</a>
</h6>
<div t-if="widget.shopConfig.is_rating_active &amp;&amp; item.rating_avg" class="d-star-rating mb-2 d-none d-md-block">
<t t-raw="item.rating"/>
<t t-out="item.rating"/>
</div>
<t t-call="tp-snippet-product-price"/>
</div>
@@ -7,7 +7,7 @@
<img loading="lazy" t-att-src="product.img_medium" class="img img-fluid" t-att-alt="product.name"/>
</a>
<t t-if="product.label_id">
<span t-raw="product.label_template"/>
<span t-out="product.label_template"/>
</t>
<div class="card-body p-2">
<div class="card-text">
@@ -25,8 +25,8 @@
</a>
</h6>
<div>
<h6 class="text-primary d-inline mb-0" t-raw="product.price"/>
<small t-if="product.has_discounted_price" class="text-muted d-inline-block mb-0" style="text-decoration: line-through; white-space: nowrap;" t-raw="product.list_price"/>
<h6 class="text-primary d-inline mb-0" t-out="product.price"/>
<small t-if="product.has_discounted_price" class="text-muted d-inline-block mb-0" style="text-decoration: line-through; white-space: nowrap;" t-out="product.list_price"/>
</div>
</div>
</div>