Skip to content

Commit

Permalink
Merge pull request #101 from PrestaShop/dev
Browse files Browse the repository at this point in the history
Release 2.3.1
  • Loading branch information
Progi1984 authored Jan 24, 2022
2 parents b8846d4 + c8de73b commit e23a597
Show file tree
Hide file tree
Showing 10 changed files with 312 additions and 181 deletions.
84 changes: 59 additions & 25 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,62 @@
name: Build
on:
push:
branches:
- master
on: [push, pull_request]

jobs:
deploy:
name: build dependencies & create artifact
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]

# Install PHP dependencies (Production ONLY)
- name: Install composer dependencies
run: composer install --no-dev -o

# Remove development files
- name: Clean-up project
uses: PrestaShopCorp/[email protected]

# Zip files and upload to artifacts list
- name: Create & upload artifact
uses: actions/upload-artifact@v1
with:
name: ${{ github.event.repository.name }}
path: ../
deploy:
name: build dependencies & create artifact
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
- name: Install composer dependencies
run: composer install --no-dev -o
- name: Clean-up project
uses: PrestaShopCorp/[email protected]
- name: Prepare auto-index tool
run: |
composer global require prestashop/autoindex
- name: Generate index.php
run: |
~/.composer/vendor/bin/autoindex
- name: Create & upload artifact
uses: actions/upload-artifact@v1
with:
name: ${{ github.event.repository.name }}
path: ../
update_release_draft:
runs-on: ubuntu-latest
needs: [deploy]
if: github.event_name == 'push' && github.event.ref == 'refs/heads/master'
steps:
- name: Download artifact
uses: actions/download-artifact@v1
with:
name: ${{ github.event.repository.name }}
- id: release_info
uses: toolmantim/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Prepare for Release
run: |
cd ${{ github.event.repository.name }}
zip -r ${{ github.event.repository.name }}.zip ${{ github.event.repository.name }}
- name: Clean existing assets
shell: bash
run: |
curl -fsSL https://github.com/github/hub/raw/master/script/get | bash -s 2.14.1
assets=`bin/hub api -t repos/${{ github.repository }}/releases/${{ steps.release_info.outputs.id }}/assets | awk '/\].url/ { print $2 }'`
for asset in $assets
do
bin/hub api -X DELETE $asset
done
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to GitHub Release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.release_info.outputs.upload_url }}
asset_path: ./${{ github.event.repository.name }}/${{ github.event.repository.name }}.zip
asset_name: ${{ github.event.repository.name }}.zip
asset_content_type: application/zip
69 changes: 0 additions & 69 deletions .travis.yml

This file was deleted.

6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
}
],
"require": {
"php": ">=5.6",
"prestashop/php-dev-tools": "^3.15"
"php": ">=5.6"
},
"require-dev": {
"prestashop/php-dev-tools": "^3.16"
},
"config": {
"platform": {
Expand Down
67 changes: 57 additions & 10 deletions composer.lock

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

4 changes: 4 additions & 0 deletions controllers/front/account.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ public function getBreadcrumbLinks()
{
$breadcrumb = parent::getBreadcrumbLinks();
$breadcrumb['links'][] = $this->addMyAccountToBreadcrumb();
$breadcrumb['links'][] = [
'title' => $this->trans('My alerts', [], 'Modules.Emailalerts.Shop'),
'url' => $this->context->link->getModuleLink('ps_emailalerts', 'account'),
];

return $breadcrumb;
}
Expand Down
46 changes: 36 additions & 10 deletions js/mailalerts.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,30 +23,56 @@
* International Registered Trademark & Property of PrestaShop SA
*/

function addNotification() {
var ids = $('div.js-mailalert > input[type=hidden]');
function addNotification(productId, productAttributeId) {
// to keep backward compatibility
if (typeof productId === 'undefined') {
var ids = $('div.js-mailalert > input[type=hidden]');
productId = ids.eq(0).val();
productIdAttribute = ids.eq(1).val();
}

$.ajax({
type: 'POST',
url: $('div.js-mailalert').data('url'),
data: 'id_product='+ids[0].value+'&id_product_attribute='+ids[1].value+'&customer_email='+$('div.js-mailalert > input[type=email]').val(),
data: 'id_product='+productId+'&id_product_attribute='+productAttributeId+'&customer_email='+$('div.js-mailalert > input[type=email]').val(),
success: function (resp) {
resp = JSON.parse(resp);

$('div.js-mailalert > span').html('<article class="alert alert-info" role="alert" data-alert="success">'+resp.message+'</article>').show();
$('.js-mailalert-alerts').html('<article class="mt-1 alert alert-' + (resp.error ? 'danger' : 'success') + '" role="alert" data-alert="' + (resp.error ? 'error' : 'success') + '">'+ resp.message +'</article>').show();
if (!resp.error) {
$('div.js-mailalert > button').hide();
$('div.js-mailalert > input[type=email]').hide();
$('div.js-mailalert > #gdpr_consent').hide();
$('div.js-mailalert > .js-mailalert-add, div.js-mailalert > input[type=email], div.js-mailalert .gdpr_consent_wrapper').hide();
}
}
});
return false;
}

$('document').ready(function()
{
$('.js-remove-email-alert').click(function()
$(document).on('ready', function() {
const mailAlertSubmitButtonClass = '.js-mailalert-add';
const mailAlertWrapper = $('.js-mailalert');
const mailAlertSubmitButton = mailAlertWrapper.find(mailAlertSubmitButtonClass);

if (mailAlertWrapper.find('#gdpr_consent').length) {
// We use a timeout to put this at the end of the callstack, so it's executed after GPDR module.
setTimeout(() => {
mailAlertSubmitButton.prop('disabled', true);

mailAlertWrapper.find('[name="psgdpr_consent_checkbox"]').on('change', function (e) {
e.stopPropagation();

mailAlertSubmitButton.prop('disabled', !$(this).prop('checked'));
});
}, 0);
}

$(document).on('click', mailAlertSubmitButtonClass, function (e)
{
e.preventDefault();

addNotification($(this).data('product'), $(this).data('product-attribute'));
});

$(document).on('click', '.js-remove-email-alert', function()
{
var self = $(this);
var ids = self.attr('rel').replace('js-id-emailalerts-', '');
Expand Down
Loading

0 comments on commit e23a597

Please sign in to comment.