-
Notifications
You must be signed in to change notification settings - Fork 82
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
[IMPROVEMENTS - PART 1] Global quality improvement #668
base: develop
Are you sure you want to change the base?
[IMPROVEMENTS - PART 1] Global quality improvement #668
Conversation
Hey @tblivet, I have written most of the code with Valentin, there is one thing I am not really happy about regarding product miniature. We are doing column count in product list by passing boostrap classes into the templates, but this is just too much work and every module needs to do this. I have come up with far simplier solution - https://danielhlavacek.cz/products.html, wdyt? It doesn't need to know anything about the context or container. :-) |
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.
Good work, but I don't really like two things:
- You are moving a lot of things to
core
folder and deleting a lot of things fromcustom
folder. The point of this was to separate the basic layout and our own custom design things. So developers can get a nice clean bootstrap base just by commeting out the custom folder. And not having to spend time with deleting things they dont need. - There are container media queries used, I don't think the support is that big. Is it safe to use it?
Hi @Hlavtox 👋 thanks for the review and feedback !
|
Hey @tblivet! :-)
It does handle this case as well, see here: With the proposed approach, you don't need to care about layout, about left/right column, nothing. :-) Plus a bonus is that if you decide to widen a layout, new columns will just pop in place.
Check this article - https://build.prestashop-project.org/news/2022/new-theme-announce/, the point of this separation was, that it allows you to start creating much easier. I think that 90% of theme developers use classic theme as a base for their theme, and if you did this, you maybe spent more time deleting styles you don't want, other than building the new stuff. This way, you can just comment out
I don't know what is the current standard, but I think we should aim more for 95 % to 97 % of support, it's ecommerce after all... I have only started using grid/flex gaps recently for example. But, no doubt that it's a cool feature that would allow to nicely style the product miniature sizing for example. :-) |
<i class="material-icons" aria-hidden="true"></i> | ||
<div class="contact__info"><a href="tel:{$contact_infos.phone}">{$contact_infos.phone}</a></div> | ||
<div class="ps-contactinfo__info"><a href="tel:{$contact_infos.phone|escape:'htmlall':'UTF-8'}">{$contact_infos.phone|escape:'htmlall':'UTF-8'}</a></div> |
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.
What's the point of adding |escape:'htmlall':'UTF-8'
?
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.
Hello @kpodemski 👋
This recommendation comes from: https://docs.cloud.prestashop.com/10-validation-checklist/#security
However, I can remove these occurrences in this PR and start a discussion in a separate PR about whether or not to include them in the entire project. Wdyt?
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.
As far as I know, those are still relevant for the back office but not the front office. They were removed on purpose in 1.7 quite a long time ago.
Let me also ping @jolelievre, so he is also aware of this recommendation and share his opinion :)
modules/ps_emailsubscription/views/templates/hook/ps_emailsubscription.tpl
Show resolved
Hide resolved
templates/_partials/header.tpl
Outdated
<div class="header-block d-flex align-items-center"> | ||
<a class="header-block__action-btn" href="#" role="button" data-bs-toggle="offcanvas" data-bs-target="#searchCanvas" aria-controls="searchCanvas" aria-label="{l s='Show search bar' d='Shop.Theme.Global'}"> | ||
<span class="material-icons header-block__icon">search</span> | ||
</a> | ||
</div> | ||
|
||
<div class="search__offcanvas js-search-offcanvas offcanvas offcanvas-top h-auto" data-bs-backdrop="false" data-bs-scroll="true" tabindex="-1" id="searchCanvas" aria-labelledby="offcanvasTopLabel"> | ||
<div class="ps-searchbar__offcanvas js-search-offcanvas offcanvas offcanvas-top h-auto" tabindex="-1" id="searchCanvas" aria-labelledby="offcanvasTopLabel"> |
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.
I don't like the hardcoding module name in the generic file that is header.tpl. What if I change the search module? 🤔
templates/_partials/header.tpl
Outdated
|
||
{* MOBILE SEARCH BAR *} | ||
<div class="ps-searchbar--mobile d-md-none d-flex col-auto"> |
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.
This should be somehow integrated into ps_searchbar
module.
<span class="header-block__badge">{$cart.products_count}</span> | ||
</span> | ||
{if !$configuration.is_catalog} | ||
<div id="_mobile_ps_shoppingcart" class="d-md-none d-flex col-auto"> |
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.
again, I didn't notice it before, and I think it is indeed just a placeholder for the shopping cart module to load the data from, not just having them hardcoded with the module name there
<div class="ps-contactinfo"> | ||
<p class="h2 ps-contactinfo__title">{l s='Store information' d='Shop.Theme.Global'}</p> | ||
<div class="ps-contactinfo__item"> | ||
<i class="material-icons" aria-hidden="true"></i> |
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.
for part 2 it would be interesting to put all the ex code in text so that it remains more meaningful.
<div class="ps-shoppingcart"> | ||
<div class="header-block d-flex align-items-center blockcart cart-preview {if $cart.products_count> 0}header-block--active{else}inactive{/if}" data-refresh-url="{$refresh_url}"> | ||
{if $cart.products_count> 0} | ||
<a class="header-block__action-btn pe-md-0" rel="nofollow" href="{$cart_url}" aria-label="{l s='View cart (%d products)' d='Shop.Theme.Checkout' sprintf=[$cart.products_count]}"> |
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.
I think that can be a cool idea to escape $cart_url
to prevent side effect
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.
what do you mean? front office variables are automatically escaped
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.
I am blocking to prevent accidental merge.
Hi @Hlavtox :)
|
0cc0298
to
3d91468
Compare
Although it doesn't look like a clean design, it is a clean bootstrap, and that was its purpose: to serve as a skeleton for developers who dislike the default styling. |
It's perfectly normal to me, in a real world, it just happens all the time. What would you want to do instead, make one product 3 columns wide? :-)
I don't understand, I am keeping the same behavior as now - 3 products per row in left column layouts, 4 products per row in full width layouts. :-) If people don't want to have 1 products per line, they need to make sure to implement some conditions in their modules.
Yeah, it doesn't look good. I wasn't active in this repo for a while. The original idea was to make it look something like Falcon - https://falcon-theme.dev/en/. |
@tblivet what about some other comments I made? :) if you want to move them to another PR then fine, but I think we lack of consistency with |
@kpodemski I completely agree that a module should be handled through hooks and not directly inside the theme .tpl files, but that's not currently the case. What I’m proposing in this PR is a "Part 1" of the optimization. I believe there’s still a lot to do to improve the overall quality, but we can’t include everything in this single PR ?
|
data-id-product="{$product.id_product}" | ||
data-id-product-attribute="{$product.id_product_attribute}" | ||
> | ||
<div class="card"> |
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.
Why do you remove all of the things we spent so much time on? The usage of card and card-body had their purpose, to automatically style it somehow...
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.
that's true, it follows what has been done in Falcon and what Daniel mentioned before, if you "skip" the "custom" layer you will end up with a design that looks like a clean Boostrap theme
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.
@Hlavtox I have removed this because, in my opinion, product-miniature
appears to be more of a fully custom component rather than a card component.
@kpodemski I understand, but currently, we don’t ended up with a clean Bootstrap theme. By "clean," you mean an unmodified Bootstrap version?
I believe this concept wasn’t clearly defined and shared among all contributors. If we look at the current implementation, if I understand well, we can see elements that don’t align with this vision?
Example: Breadcrumb Component
- Some SCSS variables from the Bootstrap breadcrumb are overridden in
abstract/variables/bootstrap
, which is good. - Then, we have
core/components/_breadcrumb.scss
, which seems to adapt the breadcrumb to our styling needs. - Finally, there's
custom/components/_breadcrumb.scss
, which, in this case, only containsmargin: 0
. However, I’m not sure if this is expected ? Shouldcustom/components
only contain components unrelated to Bootstrap?
Another Example: Product Miniature
- We have styles in
core/components/product/_product-miniature.scss
, which are related to custom classes defined in the template that handle product miniature. - We also have styles in
custom/components/product/_product-miniature.scss
, which again relate to custom classes in the same template.
In this case, I don’t really understand why both exist. Is there a specific reason for this? Or is it just, as I mentioned in another comment, that contributors are confused or unsure where to contribute?
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.
@tblivet Unfortunately, as with everything Prestashop SA invests in, the work was not finished and it was abandoned. @NeOMakinG left the company and I lost the will to work on it for free.
So yeah, I agree with you, it doesn't look like it now, but that was the vision. To provide developers with easy starter template. Something that will only contain the most basic styles.
So, for example, after commenting out the custom folder, you should get something like this https://getbootstrap.com/docs/5.3/examples/checkout/.
- Is it a style that makes the layout and makes thing work? =
core/
- Is it a style that adds colors, rounded borders, margins, paddings, fonts etc.? =
custom/
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.
@Hlavtox Thank you for this information, it's a bit clearer what was trying to be achieved. I think it's a great idea to provide developers with a clean base Bootstrap theme 👍 I also believe the design should have been entirely based on Bootstrap to achieve this, and I think it wasn't the case 😕
However, there's one thing I don't agree with: the use of core/
and custom/.
I strongly believe that it creates confusion and slows down the integration process. Manually splitting layout and visual styles into two separate folders seems a bit inconvenient, doesn’t it?
Maybe core/
should have been named bootstrap/
to specifically style Bootstrap components, while custom/
would be used only for PrestaShop specific custom components ?
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.
I think @tblivet 's solution is an excellent idea to clarify this part.
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.
What about structure
and styling
folders?
- Header refactoring, including the integration of the following modules:
-
ps_contactinfo
-
ps_searchbar
-
ps_currencyselector
-
ps_languageselector
-
ps_customersignin
-
ps_mainmenu
-
ps_shoppingcart
- The ps_mainmenu desktop display has been completely reworked.
- The ps_searchbar functionality has been improved.
- The product miniature component has been reworked.
- The “product grid” has been updated to use CSS Grid instead of multiple classes.
- The workflow has been updated to include Prettier for SCSS files.