Skip to content

Commit

Permalink
Merge branch 'release/3.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Prestarocket committed May 27, 2021
2 parents 6465728 + 6777c00 commit 8644dcc
Show file tree
Hide file tree
Showing 25 changed files with 2,005 additions and 2,180 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ With the same server (gzip, PrestaShop performance settings properly adjusted)
- JS: 155 Ko (with Classic theme) to 86 Ko

You can also see the web quality and performance comparison report on [Dareboost](https://www.dareboost.com/en/comparison/d_5b51dc70e967906045fd3683/d_5b51dc70e967906045fd3684)
### Twitter Bootstrap 4.3.x
### Twitter Bootstrap 4.4.x

- Almost all tpl files are edited to use new BS classes (ex: col-xs-12 => col-12)
- For retrocompatibility and third modules, we keep some important old classes in bs_alpha.scss
Expand Down
6 changes: 6 additions & 0 deletions _dev/css/partials/_commons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ h1,.h1{
box-shadow: none;
text-align: center;
font-weight: 700;

&::-webkit-outer-spin-button,
&::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}
}
.btn {
position: relative;
Expand Down
6 changes: 4 additions & 2 deletions _dev/js/cart.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ $(document).ready(() => {

// Refresh cart preview
prestashop.emit('updateCart', {
reason: dataset
reason: dataset,
resp: resp
});
}).fail((resp) => {
prestashop.emit('handleError', {
Expand Down Expand Up @@ -205,7 +206,8 @@ $(document).ready(() => {

// Refresh cart preview
prestashop.emit('updateCart', {
reason: dataset
reason: dataset,
resp: resp
});
}).fail((resp) => {
prestashop.emit('handleError', {eventType: 'updateProductQuantityInCart', resp: resp})
Expand Down
2 changes: 2 additions & 0 deletions _dev/js/components/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ export default class Form {
divToScroll = _parent;
}
});
$(this).data('disabled', false);
$('button[type="submit"]', form).removeClass('disabled');
}
form.classList.add('was-validated');
if(divToScroll){
Expand Down
1 change: 0 additions & 1 deletion _dev/js/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ for (var i in EventEmitter.prototype) {
}

$(document).ready(() => {
const test = 270479;
const form = new Form();
let slickSlider = new SlickSlider();
let topMenuEl = $('#_desktop_top_menu #top-menu');
Expand Down
3,922 changes: 1,811 additions & 2,111 deletions _dev/package-lock.json

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions _dev/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@
"author": "Prestarocket",
"license": "AFL-3.0",
"devDependencies": {
"@babel/core": "^7.8.7",
"@babel/preset-env": "^7.8.7",
"autoprefixer": "^9.7.4",
"babel-loader": "^8.0.6",
"css-loader": "^3.4.2",
"@babel/core": "^7.10.4",
"@babel/preset-env": "^7.10.4",
"autoprefixer": "^9.8.5",
"babel-loader": "^8.1.0",
"css-loader": "^3.6.0",
"file-loader": "^5.1.0",
"jquery": "^3.4.1",
"jquery": "^3.5.1",
"mini-css-extract-plugin": "^0.9.0",
"node-sass": "^4.13.1",
"node-sass": "^4.14.1",
"optimize-css-assets-webpack-plugin": "^5.0.3",
"postcss-loader": "^3.0.0",
"sass-loader": "^8.0.2",
"terser-webpack-plugin": "^2.3.5",
"webpack": "^4.42.0",
"webpack-cli": "^3.3.11"
"terser-webpack-plugin": "^2.3.7",
"webpack": "^4.43.0",
"webpack-cli": "^3.3.12"
},
"dependencies": {
"bootstrap": "^4.4.1",
Expand Down
11 changes: 9 additions & 2 deletions _dev/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ module.exports = (env, argv) => {
}
},
{
test: /\.(png|jp(e)g|gif|svg|webp)$/,
test: /\.(png|jpe?g|gif|svg|webp)$/,
use: [
{
loader: 'file-loader',
Expand Down Expand Up @@ -158,7 +158,14 @@ module.exports = (env, argv) => {
}
}
}),
new OptimizeCSSAssetsPlugin({})
new OptimizeCSSAssetsPlugin({
cssProcessorOptions: {
map: {
annotation: true,
inline: IS_DEV
}
}
}),
]
},
plugins: [
Expand Down
3 changes: 2 additions & 1 deletion assets/css/theme.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/js/theme.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions config/theme.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
name: classic-rocket
display_name: Classic Rocket
version: 3.0.4
version: 3.1.0
author:
name: "Prestarocket"
email: "[email protected]"
url: "http://www.prestarocket.com"

meta:
compatibility:
from: 1.7.6.5
from: 1.7.7.x
to: ~

available_layouts:
Expand Down
37 changes: 37 additions & 0 deletions dependencies/modules/ps_searchbarjqauto/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Search bar autocomplete

## About

Adds a quick search field to your website with autosuggestions using [https://github.com/Pixabay/jQuery-autoComplete](https://github.com/Pixabay/jQuery-autoComplete)
Contributed by [Prestarocket](//www.prestarocket.com/blog/) (Twitter: [@prestarocket](https://twitter.com/prestarocket))

## Contributing

PrestaShop modules are open-source extensions to the PrestaShop e-commerce solution. Everyone is welcome and even encouraged to contribute with their own improvements.

### Requirements

Contributors **must** follow the following rules:

* **Make your Pull Request on the "dev" branch**, NOT the "master" branch.
* Do not update the module's version number.
* Follow [the coding standards][1].

### Process in details

Contributors wishing to edit a module's files should follow the following process:

1. Create your GitHub account, if you do not have one already.
2. Fork the ps_searchbar project to your GitHub account.
3. Clone your fork to your local machine in the ```/modules``` directory of your PrestaShop installation.
4. Create a branch in your local clone of the module for your changes.
5. Change the files in your branch. Be sure to follow [the coding standards][1]!
6. Push your changed branch to your fork in your GitHub account.
7. Create a pull request for your changes **on the _'dev'_ branch** of the module's project. Be sure to follow [the commit message norm][2] in your pull request. If you need help to make a pull request, read the [Github help page about creating pull requests][3].
8. Wait for one of the core developers either to include your change in the codebase, or to comment on possible improvements you should make to your code.

That's it: you have contributed to this open-source project! Congratulations!

[1]: http://doc.prestashop.com/display/PS16/Coding+Standards
[2]: http://doc.prestashop.com/display/PS16/How+to+write+a+commit+message
[3]: https://help.github.com/articles/using-pull-requests
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ $(document).ready(function () {
'</div>';
},
onSelect: function (e, term, item) {
e.preventDefault();
window.location.href = item.data('url');
}
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,11 @@
<div class="search-widget" data-search-widget data-search-controller-url="{$search_controller_url}">
<form method="get" action="{$search_controller_url}">
<input type="hidden" name="controller" value="search">
<div class="input-group">
<input class="form-control" type="search" name="s" value="{$search_string}" placeholder="{l s='Search our catalog' d='Shop.Theme.Catalog'}" aria-label="{l s='Search' d='Shop.Theme.Catalog'}">
<button type="submit" class="btn btn-link">
<i class="material-icons search">&#xE8B6;</i>
<span class="d-none">{l s='Search' d='Shop.Theme.Catalog'}</span>
</button>
</div>
<input type="text" name="s" value="{$search_string}" placeholder="{l s='Search our catalog' d='Shop.Theme.Catalog'}" aria-label="{l s='Search' d='Shop.Theme.Catalog'}">
<button type="submit">
<i class="material-icons search">&#xE8B6;</i>
<span class="hidden-xl-down">{l s='Search' d='Shop.Theme.Catalog'}</span>
</button>
</form>
</div>
<!-- /Block search module TOP -->
35 changes: 35 additions & 0 deletions dependencies/modules/ps_searchbarjqauto/views/templates/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
/*
* 2007-2015 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <[email protected]>
* @copyright 2007-2015 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/

header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");

header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");

header("Location: ../");
exit;
39 changes: 31 additions & 8 deletions modules/productcomments/views/js/list-comments.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,30 @@ jQuery(document).ready(function () {
reportCommentPostErrorModal.modal('show');
}

// Productcomments 4.2.1 and newer return json. older return html string
// which is parsed, helper method for checking if the response is json and
// should not be parsed
function isJson(str) {
if (typeof str !== 'string') return false;
try {
const result = JSON.parse(str);
const type = Object.prototype.toString.call(result);
return type === '[object Object]'
|| type === '[object Array]';
} catch (err) {
return false;
}
}


function paginateComments(page) {
$.get(commentsListUrl, {page: page}, function(result) {
const jsonResponse = JSON.parse(result);
let jsonResponse;
if(isJson(result)) {
jsonResponse = JSON.parse(result);
} else {
jsonResponse = result;
}
if (jsonResponse.comments && jsonResponse.comments.length > 0) {
populateComments(jsonResponse.comments);
if (jsonResponse.comments_nb > jsonResponse.comments_per_page) {
Expand Down Expand Up @@ -130,10 +151,11 @@ jQuery(document).ready(function () {

function updateCommentUsefulness($comment, commentId, usefulness) {
$.post(updateCommentUsefulnessUrl, {id_product_comment: commentId, usefulness: usefulness}, function(jsonResponse){
var jsonData = false;
try {
jsonData = JSON.parse(jsonResponse);
} catch (e) {
let jsonData;
if(isJson(jsonResponse)) {
jsonData = JSON.parse(jsonResponse);
} else {
jsonData = jsonResponse;
}
if (jsonData) {
if (jsonData.success) {
Expand All @@ -158,10 +180,11 @@ jQuery(document).ready(function () {
return;
}
$.post(reportCommentUrl, {id_product_comment: commentId}, function(jsonResponse){
var jsonData = false;
try {
let jsonData;
if(isJson(jsonResponse)) {
jsonData = JSON.parse(jsonResponse);
} catch (e) {
} else {
jsonData = jsonResponse;
}
if (jsonData) {
if (jsonData.success) {
Expand Down
22 changes: 19 additions & 3 deletions modules/productcomments/views/js/post-comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,33 @@ jQuery(document).ready(function () {
$('#post-product-comment-form').submit(submitCommentForm);
}

// Productcomments 4.2.1 and newer return json. older return html string
// which is parsed, helper method for checking if the response is json and
// should not be parsed
function isJson(str) {
if (typeof str !== 'string') return false;
try {
const result = JSON.parse(str);
const type = Object.prototype.toString.call(result);
return type === '[object Object]'
|| type === '[object Array]';
} catch (err) {
return false;
}
}

function submitCommentForm(event) {
event.preventDefault();
var formData = $(this).serializeArray();
if (!validateFormData(formData)) {
return;
}
$.post($(this).attr('action'), $(this).serialize(), function(jsonResponse) {
var jsonData = false;
try {
let jsonData;
if (isJson(jsonResponse)) {
jsonData = JSON.parse(jsonResponse);
} catch (e) {
} else {
jsonData = jsonResponse;
}
if (jsonData) {
if (jsonData.success) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
</div>

<div class="col-sm-9 comment-content">
<p class="h4 comment__title">@COMMENT_TITLE@</ph4>
<p class="h4 comment__title">@COMMENT_TITLE@</p>
<p>@COMMENT_COMMENT@</p>
<div class="comment-buttons btn-group btn-group-sm">
{if $usefulness_enabled}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
*}

<script type="text/javascript">
var productCommentUpdatePostErrorMessage = '{l s='Sorry, your review appreciation cannot be sent.' d='Modules.Productcomments.Shop' js=1}';
var productCommentAbuseReportErrorMessage = '{l s='Sorry, your abuse report cannot be sent.' d='Modules.Productcomments.Shop' js=1}';
var productCommentUpdatePostErrorMessage = '{l|escape:'javascript' s='Sorry, your review appreciation cannot be sent.' d='Modules.Productcomments.Shop'}';
var productCommentAbuseReportErrorMessage = '{l|escape:'javascript' s='Sorry, your abuse report cannot be sent.' d='Modules.Productcomments.Shop'}';
</script>
<div class="product-comments">
<div class="comments__header" id="product-comments-list-header">
Expand Down
4 changes: 3 additions & 1 deletion templates/_partials/head.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@
<meta name="robots" content="none">
{/if}

{if $page.canonical}
{if $page.page_name == 'product'}
<link rel="canonical" href="{$product.canonical_url}">
{elseif $page.canonical}
<link rel="canonical" href="{$page.canonical}">
{/if}
{block name='head_hreflang'}
Expand Down
2 changes: 1 addition & 1 deletion templates/_partials/microdata-jsonld.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
{/if}
{if $product_manufacturer->name OR $shop.name}"brand": {
"@type": "Thing",
"name": "{if $product_manufacturer->name}{$product_manufacturer->name|escape:'html':'UTF-8'}{else}$shop.name{/if}"
"name": "{if $product_manufacturer->name}{$product_manufacturer->name|escape:'html':'UTF-8'}{else}{$shop.name}{/if}"
},{/if}
{if isset($nbComments) && $nbComments && $ratings.avg}"aggregateRating": {
"@type": "AggregateRating",
Expand Down
Loading

0 comments on commit 8644dcc

Please sign in to comment.