-
Notifications
You must be signed in to change notification settings - Fork 1.9k
18.0 redesign catalog view ajka #719
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ajka-odoo
wants to merge
6
commits into
odoo:18.0
Choose a base branch
from
odoo-dev:18.0-Redesign-Catalog-view-ajka
base: 18.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
6cdadfa
[ADD] Increase image size and add zooming support for mobile devices
ajka-odoo 77e1232
[ADD] Increase image size and add zooming support for mobile devices
ajka-odoo e0a4f09
[ADD] Increase image size and add zooming support for mobile devices
ajka-odoo f0c9c5d
Update product_catalog_templates.xml
ajka-odoo 696f3ef
Update product_catalog_kanban.xml
ajka-odoo 8d0e99c
Update product_catalog_kanban.js
ajka-odoo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
'name': 'Product Image Popup', | ||
'version': '1.0', | ||
'category': 'Sales', | ||
'license': 'LGPL-3', | ||
'depends': ['base', 'product', 'web'], | ||
'data': [ | ||
'views/product_catalog_kanban.xml', | ||
], | ||
'assets': { | ||
'web.assets_backend': [ | ||
'Redesign_Catalog_view/static/src/**/*', | ||
], | ||
'web.assets_frontend': [ | ||
'Redesign_Catalog_view/static/src/**/*', | ||
], | ||
}, | ||
'installable': True, | ||
'application': True, | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import product_image_popup |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from odoo import models | ||
|
||
|
||
class ProductImagePopup(models.Model): | ||
_inherit = 'product.product' | ||
|
||
pass | ||
101 changes: 101 additions & 0 deletions
101
Redesign_Catalog_view/static/src/css/product_image_model.scss
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
/* Responsive product image on product card */ | ||
@media (max-width: 768px) { | ||
.o_product_image_custom img { | ||
max-width: 150px !important; | ||
max-height: 150px !important; | ||
width: 150px !important; | ||
height: 150px !important; | ||
} | ||
} | ||
|
||
/* Full-screen image viewer modal */ | ||
@media (max-width: 768px){ | ||
.full-image-dialog { | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
position: fixed; | ||
inset: 0; | ||
z-index: 1000; | ||
background: rgba(0, 0, 0, 0.85); | ||
backdrop-filter: blur(4px); | ||
padding: 1rem; | ||
} | ||
|
||
/* Container for the image and controls */ | ||
.image-container { | ||
position: relative; | ||
width: 70vw; | ||
height: 70vh; | ||
max-width: 95vw; | ||
max-height: 95vh; | ||
overflow: hidden; | ||
border-radius: 12px; | ||
background-color: #000; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
} | ||
|
||
/* Zoomable image */ | ||
.full-size-image { | ||
width: 100%; | ||
height: 100%; | ||
object-fit: contain; | ||
transition: transform 0.3s ease-in-out; | ||
} | ||
|
||
/* Zoom control buttons */ | ||
.zoom-controls { | ||
position: absolute; | ||
bottom: 10px; | ||
right: 10px; | ||
display: flex; | ||
gap: 10px; | ||
z-index: 2; | ||
} | ||
|
||
/* Zoom buttons styling */ | ||
.zoom-btn { | ||
background-color: rgba(255, 255, 255, 0.8); | ||
border: none; | ||
width: 32px; | ||
height: 32px; | ||
font-size: 18px; | ||
font-weight: bold; | ||
border-radius: 50%; | ||
cursor: pointer; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
transition: background 0.2s; | ||
} | ||
|
||
.zoom-btn:hover { | ||
background-color: rgba(255, 255, 255, 1); | ||
} | ||
|
||
/* Close button styling */ | ||
.close-btn { | ||
position: absolute; | ||
top: 10px; | ||
right: 10px; | ||
background-color: rgba(255, 255, 255, 0.9); | ||
border: none; | ||
width: 30px; | ||
height: 30px; | ||
font-size: 20px; | ||
font-weight: bold; | ||
border-radius: 50%; | ||
cursor: pointer; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
z-index: 3; | ||
transition: background 0.2s ease; | ||
} | ||
|
||
.close-btn:hover { | ||
background-color: rgba(255, 255, 255, 1); | ||
} | ||
} |
64 changes: 64 additions & 0 deletions
64
Redesign_Catalog_view/static/src/js/product_catalog_kanban.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { Component, useState } from "@odoo/owl"; | ||
import { useService } from "@web/core/utils/hooks"; | ||
import { Dialog } from "@web/core/dialog/dialog"; | ||
import { registry } from "@web/core/registry"; | ||
import { ProductCatalogKanbanRecord } from "@product/product_catalog/kanban_record"; | ||
import { ProductCatalogKanbanRenderer } from "@product/product_catalog/kanban_renderer"; | ||
import { productCatalogKanbanView } from "@product/product_catalog/kanban_view"; | ||
|
||
class ImageDialog extends Component { | ||
static template = "product_catalog_redesign.ImageDialog"; | ||
static components = { Dialog }; | ||
static props = ["imageUrl","close"]; | ||
|
||
setup() { | ||
this.state = useState({ zoom: 1 }); | ||
this.updateZoom = this.updateZoom.bind(this); | ||
} | ||
|
||
updateZoom(value) { | ||
this.state.zoom = Math.max(0.5, Math.min(3, this.state.zoom + value)); | ||
} | ||
} | ||
|
||
class ProductCatalogKanbanRecordInherited extends ProductCatalogKanbanRecord { | ||
setup() { | ||
super.setup(); | ||
this.dialogService = useService("dialog"); | ||
} | ||
|
||
onGlobalClick(ev) { | ||
|
||
const imageElement = ev.target.closest(".o_product_image_custom img"); | ||
if (imageElement) { | ||
this.dialogService.add(ImageDialog, { | ||
imageUrl: imageElement.src, | ||
}); | ||
return; | ||
} | ||
|
||
if (ev.target.closest(".o_product_catalog_cancel_global_click")) { | ||
return; | ||
} | ||
if (this.productCatalogData.quantity === 0) { | ||
this.addProduct(); | ||
} else { | ||
this.increaseQuantity(); | ||
} | ||
|
||
} | ||
} | ||
|
||
class InheritProductCatalogKanbanRenderer extends ProductCatalogKanbanRenderer { | ||
static components = { | ||
...ProductCatalogKanbanRenderer.components, | ||
KanbanRecord: ProductCatalogKanbanRecordInherited, | ||
}; | ||
} | ||
|
||
export const InheritProductCatalogKanbanView = { | ||
...productCatalogKanbanView, | ||
Renderer: InheritProductCatalogKanbanRenderer, | ||
}; | ||
|
||
registry.category("views").add("product_kanban_catalog_inherit", InheritProductCatalogKanbanView); |
17 changes: 17 additions & 0 deletions
17
Redesign_Catalog_view/static/src/xml/product_catalog_templates.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<templates xml:space="preserve"> | ||
<t t-name="product_catalog_redesign.ImageDialog"> | ||
<div class="full-image-dialog" > | ||
<button class="close-btn" t-on-click="props.close">×</button> | ||
<div class="image-container"> | ||
<img t-att-src="props.imageUrl" | ||
class="full-size-image" | ||
t-att-style="'transform: scale(' + state.zoom + ');'"/> | ||
<div class="zoom-controls"> | ||
<button class="zoom-btn" t-on-click="() => updateZoom(0.1)">+</button> | ||
<button class="zoom-btn" t-on-click="() => updateZoom(-0.1)">-</button> | ||
</div> | ||
</div> | ||
</div> | ||
</t> | ||
</templates> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<odoo> | ||
<record id="product_view_kanban_catalog_inherit_porduct_catalog_redesign" model="ir.ui.view"> | ||
<field name="name">product.product.view.kanban.inherit</field> | ||
<field name="model">product.product</field> | ||
<field name="inherit_id" ref="product.product_view_kanban_catalog"/> | ||
<field name="arch" type="xml"> | ||
<xpath expr="//field[@name='image_128']" position="attributes"> | ||
<attribute name="class">ms-auto o_product_image_custom</attribute> | ||
</xpath> | ||
<xpath expr="//kanban" position="attributes"> | ||
<attribute name="js_class" add="product_kanban_catalog_inherit" remove="product_kanban_catalog"/> | ||
</xpath> | ||
</field> | ||
</record> | ||
</odoo> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can You explain what is the use of this file ?