Skip to content
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

Release 3.2.0 #121

Merged
merged 32 commits into from
Jul 31, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
33653be
Use numbering system from Locale Repository
PierreRambaud Jul 17, 2019
e1547ef
Make it available for 1.7.5
PierreRambaud Jul 17, 2019
63ac89b
Ignore constant for version under 1.7.6
PierreRambaud Jul 18, 2019
20db127
Fix cs for ngihtly builds and previous releases
PierreRambaud Jul 23, 2019
aba5979
Merge branch 'fix/14657' of github.com:PierreRambaud/ps_facetedsearch…
PierreRambaud Jul 23, 2019
9478c58
Fix wrong cldr replacement
PierreRambaud Jul 23, 2019
2b5323e
Remove duplicate
PierreRambaud Jul 23, 2019
d9cef7a
Use strtr implementation
PierreRambaud Jul 23, 2019
b6028ee
Build assets
PierreRambaud Jul 23, 2019
3f09991
Merge pull request #115 from PierreRambaud/fix/14657
PierreRambaud Jul 23, 2019
7bdd746
Use texture / color only if it's a color type
PierreRambaud Jul 17, 2019
db43441
Allow to set a meta title without url name
PierreRambaud Jul 17, 2019
c439101
Cs fixer
PierreRambaud Jul 17, 2019
23a492e
Merge pull request #114 from PierreRambaud/fix/14677
PierreRambaud Jul 24, 2019
aea3a0e
Order by magnitude, remove when show_limit_filter is specify and reor…
PierreRambaud Jul 25, 2019
27c72cb
Add comment for Facet and filter
PierreRambaud Jul 25, 2019
9454843
Remove unwanted curl
PierreRambaud Jul 25, 2019
8fbd82b
Make code compliant with php7.2 (not only 7.3)
PierreRambaud Jul 25, 2019
efee5ac
Wrong docblock
PierreRambaud Jul 26, 2019
54ab947
Move RANGE_FILTERS const to Converter
PierreRambaud Jul 26, 2019
8e23b22
Repair collapse for sliders range
PierreRambaud Jul 26, 2019
ed43704
Merge pull request #118 from PierreRambaud/fix/14376
PierreRambaud Jul 30, 2019
48f7a81
Merge pull request #117 from PierreRambaud/remove-curl
PierreRambaud Jul 30, 2019
2a1cf9e
Make sur operationsFilters are properly resetted
PierreRambaud Jul 30, 2019
f27b452
Merge pull request #116 from PierreRambaud/fix/14769
PierreRambaud Jul 30, 2019
33bbe9d
Improve filters
PierreRambaud Jul 30, 2019
c453576
Refactor resetOperationsFilter method
PierreRambaud Jul 31, 2019
de50881
Remove useless foreach
PierreRambaud Jul 31, 2019
6da3b5d
Add missing comment
PierreRambaud Jul 31, 2019
a203e07
Merge pull request #119 from PierreRambaud/fix/14734
PierreRambaud Jul 31, 2019
bb128b3
Bump to 3.2.0
PierreRambaud Jul 31, 2019
a8edfdd
Merge pull request #120 from PierreRambaud/bump-version
PierreRambaud Jul 31, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,47 +24,53 @@ jobs:
- composer run test
# PHP Stan
- docker run -tid --rm -v ps-volume:/var/www/html --name temp-ps prestashop/prestashop:nightly
- docker run --rm --volumes-from temp-ps -v $PWD:/web/module -e _PS_ROOT_DIR_=/var/www/html quetzacoalt/phpstan analyse --configuration=/web/module/tests/php/phpstan/phpstan.neon
- docker exec -ti temp-ps rm -rf /var/www/html/modules/ps_facetedsearch
- docker run --rm --volumes-from temp-ps -v $PWD:/var/www/html/modules/ps_facetedsearch -e _PS_ROOT_DIR_=/var/www/html quetzacoalt/phpstan analyse --configuration=/var/www/html/modules/ps_facetedsearch/tests/php/phpstan/phpstan.neon
- stage: "PHP"
name: "PHPStan on PS 1.7.5.2"
language: php
php: 7.2
script:
- composer install
- docker run -tid --rm -v ps-volume:/var/www/html --name temp-ps prestashop/prestashop:1.7.5.1
- docker run --rm --volumes-from temp-ps -v $PWD:/web/module -e _PS_ROOT_DIR_=/var/www/html quetzacoalt/phpstan analyse --configuration=/web/module/tests/php/phpstan/phpstan.neon
- docker exec -ti temp-ps rm -rf /var/www/html/modules/ps_facetedsearch
- docker run --rm --volumes-from temp-ps -v $PWD:/var/www/html/modules/ps_facetedsearch -e _PS_ROOT_DIR_=/var/www/html quetzacoalt/phpstan analyse --configuration=/var/www/html/modules/ps_facetedsearch/tests/php/phpstan/phpstan.neon
- stage: "PHP"
name: "PHPStan on PS 1.7.4.4"
language: php
php: 7.2
script:
- composer install
- docker run -tid --rm -v ps-volume:/var/www/html --name temp-ps prestashop/prestashop:1.7.4.4
- docker run --rm --volumes-from temp-ps -v $PWD:/web/module -e _PS_ROOT_DIR_=/var/www/html quetzacoalt/phpstan analyse --configuration=/web/module/tests/php/phpstan/phpstan.neon
- docker exec -ti temp-ps rm -rf /var/www/html/modules/ps_facetedsearch
- docker run --rm --volumes-from temp-ps -v $PWD:/var/www/html/modules/ps_facetedsearch -e _PS_ROOT_DIR_=/var/www/html quetzacoalt/phpstan analyse --configuration=/var/www/html/modules/ps_facetedsearch/tests/php/phpstan/phpstan.neon
- stage: "PHP"
name: "PHPStan on PS 1.7.3.4"
language: php
php: 7.2
script:
- composer install
- docker run -tid --rm -v ps-volume:/var/www/html --name temp-ps prestashop/prestashop:1.7.3.4
- docker run --rm --volumes-from temp-ps -v $PWD:/web/module -e _PS_ROOT_DIR_=/var/www/html quetzacoalt/phpstan analyse --configuration=/web/module/tests/php/phpstan/phpstan.neon
- docker exec -ti temp-ps rm -rf /var/www/html/modules/ps_facetedsearch
- docker run --rm --volumes-from temp-ps -v $PWD:/var/www/html/modules/ps_facetedsearch -e _PS_ROOT_DIR_=/var/www/html quetzacoalt/phpstan analyse --configuration=/var/www/html/modules/ps_facetedsearch/tests/php/phpstan/phpstan.neon
- stage: "PHP"
name: "PHPStan on PS 1.7.2.5"
language: php
php: 7.2
script:
- composer install
- docker run -tid --rm -v ps-volume:/var/www/html --name temp-ps prestashop/prestashop:1.7.2.5
- docker run --rm --volumes-from temp-ps -v $PWD:/web/module -e _PS_ROOT_DIR_=/var/www/html quetzacoalt/phpstan analyse --configuration=/web/module/tests/php/phpstan/phpstan.neon
- docker exec -ti temp-ps rm -rf /var/www/html/modules/ps_facetedsearch
- docker run --rm --volumes-from temp-ps -v $PWD:/var/www/html/modules/ps_facetedsearch -e _PS_ROOT_DIR_=/var/www/html quetzacoalt/phpstan analyse --configuration=/var/www/html/modules/ps_facetedsearch/tests/php/phpstan/phpstan.neon
- stage: "PHP"
name: "PHPStan on PS 1.7.1.2"
language: php
php: 7.2
script:
- composer install
- docker run -tid --rm -v ps-volume:/var/www/html --name temp-ps prestashop/prestashop:1.7.1.2
- docker run --rm --volumes-from temp-ps -v $PWD:/web/module -e _PS_ROOT_DIR_=/var/www/html quetzacoalt/phpstan analyse --configuration=/web/module/tests/php/phpstan/phpstan.neon
- docker exec -ti temp-ps rm -rf /var/www/html/modules/ps_facetedsearch
- docker run --rm --volumes-from temp-ps -v $PWD:/var/www/html/modules/ps_facetedsearch -e _PS_ROOT_DIR_=/var/www/html quetzacoalt/phpstan analyse --configuration=/var/www/html/modules/ps_facetedsearch/tests/php/phpstan/phpstan.neon

script:
- npm run lint
Expand Down
31 changes: 23 additions & 8 deletions _dev/cldr/number-formatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ import NumberSymbol from './number-symbol';
import PriceSpecification from './specifications/price';
import NumberSpecification from './specifications/number';

const escapeRE = require('lodash.escaperegexp');

const CURRENCY_SYMBOL_PLACEHOLDER = '¤';
const DECIMAL_SEPARATOR_PLACEHOLDER = '.';
const GROUP_SEPARATOR_PLACEHOLDER = ',';
Expand Down Expand Up @@ -199,16 +201,29 @@ class NumberFormatter {
*/
replaceSymbols(number) {
const symbols = this.numberSpecification.getSymbol();
let num = number;
num = num.split(DECIMAL_SEPARATOR_PLACEHOLDER).join(symbols.getDecimal());
num = num.split(GROUP_SEPARATOR_PLACEHOLDER).join(symbols.getGroup());
num = num.split(MINUS_SIGN_PLACEHOLDER).join(symbols.getMinusSign());
num = num.split(PERCENT_SYMBOL_PLACEHOLDER).join(symbols.getPercentSign());
num = num.split(PLUS_SIGN_PLACEHOLDER).join(symbols.getPlusSign());

return num;

const map = {};
map[DECIMAL_SEPARATOR_PLACEHOLDER] = symbols.getDecimal();
map[GROUP_SEPARATOR_PLACEHOLDER] = symbols.getGroup();
map[MINUS_SIGN_PLACEHOLDER] = symbols.getMinusSign();
map[PERCENT_SYMBOL_PLACEHOLDER] = symbols.getPercentSign();
map[PLUS_SIGN_PLACEHOLDER] = symbols.getPlusSign();

return this.strtr(number, map);
}

/**
* strtr() for JavaScript
* Translate characters or replace substrings
*/
strtr(str, pairs) {
const substrs = Object.keys(pairs).map(escapeRE);
return str.split(RegExp(`(${substrs.join('|')})`))
.map(part => pairs[part] || part)
.join('');
}


/**
* Add missing placeholders to the number using the passed CLDR pattern.
*
Expand Down
7 changes: 7 additions & 0 deletions _dev/front/facet.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@

#search_filters {
.facet {
.title {
display: flex;
.collapse-icons {
margin-left: auto;
}
}

.facet-title {
@include text-ellipsis();
}
Expand Down
2 changes: 1 addition & 1 deletion config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<module>
<name>ps_facetedsearch</name>
<displayName><![CDATA[Faceted search]]></displayName>
<version><![CDATA[3.1.0]]></version>
<version><![CDATA[3.2.0]]></version>
<description><![CDATA[Displays a block allowing multiple filters.]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[front_office_features]]></tab>
Expand Down
5 changes: 5 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"webpack-cli": "^3.2.3"
},
"dependencies": {
"jquery-ui-touch-punch": "^0.2.3"
"jquery-ui-touch-punch": "^0.2.3",
"lodash.escaperegexp": "^4.1.2"
}
}
6 changes: 2 additions & 4 deletions ps_facetedsearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function __construct()
{
$this->name = 'ps_facetedsearch';
$this->tab = 'front_office_features';
$this->version = '3.1.0';
$this->version = '3.2.0';
$this->author = 'PrestaShop';
$this->need_instance = 0;
$this->bootstrap = true;
Expand Down Expand Up @@ -1404,9 +1404,7 @@ private function indexPrices($cursor = 0, $full = false, $ajax = false, $smart =
? Tools::getShopDomainSsl(true)
: Tools::getShopDomain(true);

if (!Tools::file_get_contents($domain . __PS_BASE_URI__ . 'modules/ps_facetedsearch/ps_facetedsearch-price-indexer.php?token=' . $token . '&cursor=' . (int) $cursor . '&full=' . (int) $full)) {
$this->indexPrices((int) $cursor, (int) $full);
}
$this->indexPrices((int) $cursor, (int) $full);

return $cursor;
}
Expand Down
22 changes: 20 additions & 2 deletions src/Adapter/AbstractAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public function __construct()
public function __clone()
{
$this->filters = clone $this->filters;
$this->operationsFilters = clone $this->operationsFilters;
}

/**
Expand All @@ -97,10 +98,27 @@ public function resetFilter($filterName)
/**
* {@inheritdoc}
*/
public function resetOperationsFilter($filterName)
public function resetOperationsFilter($filterName, $value = null)
{
if ($this->operationsFilters->offsetExists($filterName)) {
if (!$this->operationsFilters->offsetExists($filterName)) {
return $this;
}

if ($value === null) {
$this->operationsFilters->offsetUnset($filterName);

return $this;
}

$operations = $this->operationsFilters->offsetGet($filterName);
if (isset($operations[$value])) {
unset($operations[$value]);
}

if (empty($operations)) {
$this->resetOperationsFilter($filterName);
} else {
$this->addOperationsFilter($filterName, $operations);
}

return $this;
Expand Down
4 changes: 3 additions & 1 deletion src/Adapter/InterfaceAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,12 +201,14 @@ public function resetOperationsFilters();

/**
* Reset the operations filter for the given filterName
* or reset the operations filter with a specific value
*
* @param string $filterName
* @param string|int $value
*
* @return self
*/
public function resetOperationsFilter($filterName);
public function resetOperationsFilter($filterName, $value = null);

/**
* Reset the filter for the given filterName
Expand Down
4 changes: 3 additions & 1 deletion src/Adapter/MySQL.php
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,9 @@ private function computeWhereConditions(array $filterToTableMapping)
$operationsConditions[] = '(' . implode(' AND ', $conditions) . ')';
}

$whereConditions[] = '(' . implode(' OR ', $operationsConditions) . ')';
if (!empty($operationsConditions)) {
$whereConditions[] = '(' . implode(' OR ', $operationsConditions) . ')';
}
}

foreach ($this->getFilters() as $filterName => $filterContent) {
Expand Down
Loading