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

Merge 1.7.6.x to develop - 10/05/2019 #13755

Merged
merged 91 commits into from May 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
3e30f0d
Extends core and domain exceptions in Core and Core/Domain ns and add…
zuk3975 Apr 23, 2019
f7c6abd
Add a test mail action in theme preview (for current theme only), ref…
jolelievre Apr 17, 2019
5fbc1a0
Add a preview variables builder to debug efficiently the templates, a…
jolelievre Apr 18, 2019
a3e7d8d
Cs fixer and rename camelcase variables
jolelievre Apr 18, 2019
c9d34d8
Fix init of class field
jolelievre Apr 18, 2019
36f11a4
Add unit tests for new transformations
jolelievre Apr 19, 2019
731f112
Remove html-only and tx-only cleaning, use templateType in layouts in…
jolelievre Apr 23, 2019
d0c1b41
Fix alerts mail templates
jolelievre Apr 23, 2019
0f46b5f
A few classic templates html fixed, use twig conditions in classic or…
jolelievre Apr 23, 2019
1959a4a
Update classic templates to use twig conditions
jolelievre Apr 24, 2019
ea7f781
Fix test for renderer
jolelievre Apr 24, 2019
2dc9f1b
Fix templates with quotes, a few translation domains and use const in…
jolelievre Apr 24, 2019
34886c8
Update domain
jolelievre Apr 24, 2019
3e9d6fb
Add function Goto URL
boubkerbribri May 2, 2019
b77ffd6
Add selectors for Onboarding in navbar
boubkerbribri May 2, 2019
245e706
Add close Onboarding in NavBar
boubkerbribri May 2, 2019
414fb42
Update method for Goto list of employees
boubkerbribri May 2, 2019
42b58c2
Delete function gotoURL with javascript method
boubkerbribri May 2, 2019
27e306b
Click on Catalog before going to Employee Page
boubkerbribri May 2, 2019
93ca8a7
add welcome modal fix for test 6
May 2, 2019
a4da23d
add welcome modal fix for test 7
May 2, 2019
d864c36
add welcome modal fix for test 9
May 2, 2019
63eed25
add welcome modal fix for step 10
May 2, 2019
0c8d0d2
add welcome modal fix for step 11 and pause to check downloaded files
May 2, 2019
1097d47
add welcome modal fix for step 11
May 3, 2019
5783940
add welcome modal fix for test 13
May 3, 2019
88e8510
Fix the success message when create and delete a currency
nesrineabdmouleh May 3, 2019
648d22e
add welcome modal fix for test 14
May 3, 2019
0784ba3
add welcome modal fix for test 15
May 3, 2019
610ebd0
add welcome modal fix for test 16
May 3, 2019
bfaf69f
fix spaces
May 3, 2019
90c13e8
Remove a duplicated insertion for the product quantity in the order
nesrineabdmouleh May 3, 2019
8a4cc76
Fix test 1_create_edit_delete_feature
boubkerbribri May 3, 2019
3dfa386
Add close welcome modal for tests Manufacturer
boubkerbribri May 6, 2019
e36719f
Add close welcome module
boubkerbribri May 6, 2019
cf13c8e
Wait for element to be visible before click
boubkerbribri May 6, 2019
e082211
Update deletion message to check
boubkerbribri May 6, 2019
025d086
Add close welcome module for 2_local_units
boubkerbribri May 6, 2019
b51a61b
Add close welcome module for 3_advanced
boubkerbribri May 6, 2019
4dbf98b
Add close welcome module for test 4_create_edit_delete_live_exchange_…
boubkerbribri May 6, 2019
fa26af6
Add close welcome module for test 2_create_edit_activate_restrictions…
boubkerbribri May 6, 2019
cc7ecd1
Fix bankwire layout
jolelievre May 7, 2019
938f797
Fix ps_emailsubscription layouts
jolelievre May 7, 2019
513515a
Use TinyMCE translatable input in Add/Edit category page
matks Apr 12, 2019
4299532
Use TinyMCE translatable input in Add/Edit cms page
matks Apr 12, 2019
1102d33
Use TinyMCE translatable input in Add/Edit brand page
matks Apr 12, 2019
79a5370
Externalize TinyMCE init in an helper class
jolelievre Apr 30, 2019
e5578f7
Translatble fields and inputs are synchronized on locale switching, T…
jolelievre Apr 30, 2019
2d8a469
Rename TinyMCEEditor
jolelievre Apr 30, 2019
e032e38
Convert _tinymce.sass to scss, add custom display for tabbed editors
jolelievre Apr 30, 2019
14820b4
Enable TinyMCEEditor in categories and cms categories
jolelievre Apr 30, 2019
a0fc160
Use TinyMCEEDitor on maintenance page
jolelievre Apr 30, 2019
603f21d
Fix typo
jolelievre Apr 30, 2019
2c5edb6
Manage baseAdminUrl and langIsRtl, with fallbacks for both config
jolelievre May 2, 2019
01cbe97
PHP CS fix
jolelievre May 2, 2019
8ef56f1
Use const for EventEmitter instead of storing in window
jolelievre May 3, 2019
e62a518
Remove double quotes
jolelievre May 3, 2019
da06298
Use const and string templates
jolelievre May 6, 2019
a4e5611
Enable TinyMCE in category form
jolelievre May 7, 2019
fc92202
Replace double quotes
jolelievre May 7, 2019
6c1af11
Build assets
jolelievre May 7, 2019
a6fa8d2
Merge pull request #13676 from boubkerbribri/2_create_brand_address
Quetzacoalt91 May 8, 2019
a9d7c8c
Merge pull request #13667 from boubkerbribri/1_create_edit_delete_fea…
Quetzacoalt91 May 8, 2019
57ab9dd
Merge pull request #13657 from nesrineabdmouleh/fix_create_virtual_pr…
Quetzacoalt91 May 8, 2019
611d0a6
Merge pull request #13656 from SimonGrn/01_welcome_fix
Quetzacoalt91 May 8, 2019
72a9afc
Merge pull request #13630 from boubkerbribri/order_Onboarding
Quetzacoalt91 May 8, 2019
6459feb
Removes unnecessary ExceptionInterface
zuk3975 May 8, 2019
3cc2a28
Merge pull request #13481 from jolelievre/fix-products-mail
PierreRambaud May 9, 2019
970557a
Add close welcome Module for test 3_search_module
boubkerbribri May 6, 2019
3639cac
Add close welcome module for test 4_sort_module
boubkerbribri May 6, 2019
428a2ac
Add close welcome module for 5_check_addons_catalog_page
boubkerbribri May 6, 2019
5dfe29b
Add close Welcome module for 6_check_notifications
boubkerbribri May 6, 2019
25a7460
Add close welcome Module for 7_discover_module
boubkerbribri May 6, 2019
815b51b
Can't do normal click on 'view my shop' because its under green message
boubkerbribri May 6, 2019
976ed0e
Add dni to textToCheck (can't be removed 13691)
boubkerbribri May 7, 2019
e741883
Merge pull request #13680 from boubkerbribri/customer_welcomeModule
Quetzacoalt91 May 9, 2019
73530c5
Merge pull request #13683 from boubkerbribri/10_module_welcomeModule
Quetzacoalt91 May 9, 2019
db4f8e7
Merge pull request #13686 from boubkerbribri/international_welcomeModule
Quetzacoalt91 May 9, 2019
86527dc
Update default translation catalogue for 1.7.6
May 9, 2019
329dbd6
Merge pull request #13734 from eternoendless/update-catalog
PierreRambaud May 9, 2019
d125207
Update native modules
May 9, 2019
c431db6
Merge pull request #13735 from eternoendless/update-native-modules
Quetzacoalt91 May 10, 2019
21d6665
Merge pull request #13381 from matks/use-tinymce-in-sf-pages
PierreRambaud May 10, 2019
8878755
Add function to set innerHTML of an iframe (for tinymce)
boubkerbribri May 10, 2019
d6a7ebc
Replace selectors of textarea by selectors of iFrame
boubkerbribri May 10, 2019
f35cbb9
Change setting value method for textarea tinymce
boubkerbribri May 10, 2019
eeeae5a
Escape errors messages and remove useless javascript
May 10, 2019
d4e9daa
Merge pull request #13739 from boubkerbribri/fix_for_tinymce
mbadrani May 10, 2019
011df7a
Merge pull request #13522 from zuk3975/fix-extend-core-exception
matks May 10, 2019
f7e4546
Merge pull request #13738 from PierreRambaud/install-escape
matks May 10, 2019
d03dd0d
Merge branch '1.7.6.x' of github.com:PrestaShop/PrestaShop into merge…
matks May 10, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 5 additions & 0 deletions .gitignore
Expand Up @@ -77,6 +77,11 @@ npm-debug.log.*
*.hot-update.js
*.hot-update.json

tests-legacy/resources/modules/followup/
tests-legacy/resources/modules/ps_emailalerts/
tests-legacy/resources/modules/ps_emailsubscription/mails/
tests-legacy/resources/modules/referralprogram/

/admin-dev/autoupgrade/*
!/admin-dev/autoupgrade/index.php
!/admin-dev/autoupgrade/backup/index.php
Expand Down
1 change: 1 addition & 0 deletions admin-dev/themes/new-theme/.webpack/common.js
Expand Up @@ -50,6 +50,7 @@ module.exports = {
form_popover_error: './js/components/form/form-popover-error',
manufacturer: './js/pages/manufacturer',
manufacturer_address_form: './js/pages/manufacturer/manufacturer_address_form.js',
maintenance: './js/pages/maintenance',
},
output: {
path: path.resolve(__dirname, '../public'),
Expand Down
@@ -1,4 +1,3 @@
<?php
/**
* 2007-2019 PrestaShop and Contributors
*
Expand All @@ -24,11 +23,10 @@
* International Registered Trademark & Property of PrestaShop SA
*/

namespace PrestaShop\PrestaShop\Core\Domain\Employee\Exception;
import EventEmitterClass from 'events';

/**
* Class UndefinedEmployeeAccountStatusException.
* We instanciate one EventEmitter (restricted via a const) so that every components
* register/dispatch on the same one and can communicate with each other.
*/
class UndefinedEmployeeStatusException extends EmployeeException
{
}
export const EventEmitter = new EventEmitterClass();
236 changes: 236 additions & 0 deletions admin-dev/themes/new-theme/js/components/tinymce-editor.js
@@ -0,0 +1,236 @@
/**
* 2007-2019 PrestaShop and Contributors
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 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:
* https://opensource.org/licenses/OSL-3.0
* 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 license@prestashop.com 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 https://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2019 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/

const $ = window.$;

/**
* This class init TinyMCE instances in the back-office. It is wildly inspired by
* the scripts from js/admin And it actually loads TinyMCE from the js/tiny_mce
* folder along with its modules. One improvement could be to install TinyMCE via
* npm and fully integrate in the back-office theme.
*/
class TinyMCEEditor {
constructor(options) {
options = options || {};
this.tinyMCELoaded = false;
if (typeof options.baseAdminUrl == 'undefined') {
if (typeof window.baseAdminDir != 'undefined') {
options.baseAdminUrl = window.baseAdminDir;
} else {
const pathParts = window.location.pathname.split('/');
pathParts.every(function(pathPart) {
if (pathPart !== '') {
options.baseAdminUrl = `/${pathPart}/`;

return false;
}

return true;
});
}
}
if (typeof options.langIsRtl == 'undefined') {
options.langIsRtl = typeof window.lang_is_rtl != 'undefined' ? window.lang_is_rtl === '1' : false;
}
this.setupTinyMCE(options);
}

/**
* Initial setup which checks if the tinyMCE library is already loaded.
*
* @param config
*/
setupTinyMCE(config) {
if (typeof tinyMCE === 'undefined') {
this.loadAndInitTinyMCE(config);
} else {
this.initTinyMCE(config);
}
}

/**
* Prepare the config and init all TinyMCE editors
*
* @param config
*/
initTinyMCE(config) {
config = Object.assign({
selector: '.rte',
plugins: 'align colorpicker link image filemanager table media placeholder advlist code table autoresize',
browser_spellcheck: true,
toolbar1: 'code,colorpicker,bold,italic,underline,strikethrough,blockquote,link,align,bullist,numlist,table,image,media,formatselect',
toolbar2: '',
external_filemanager_path: config.baseAdminUrl + 'filemanager/',
filemanager_title: 'File manager',
external_plugins: {
'filemanager': config.baseAdminUrl + 'filemanager/plugin.min.js'
},
language: iso_user,
content_style : (config.langIsRtl ? 'body {direction:rtl;}' : ''),
skin: 'prestashop',
menubar: false,
statusbar: false,
relative_urls: false,
convert_urls: false,
entity_encoding: 'raw',
extended_valid_elements: 'em[class|name|id],@[role|data-*|aria-*]',
valid_children: '+*[*]',
valid_elements: '*[*]',
rel_list:[
{ title: 'nofollow', value: 'nofollow' }
],
editor_selector :'autoload_rte',
init_instance_callback: () => { this.changeToMaterial(); },
setup : (editor) => { this.setupEditor(editor); },
}, config);

if (typeof config.editor_selector != 'undefined') {
config.selector = '.' + config.editor_selector;
}

// Change icons in popups
$('body').on('click', '.mce-btn, .mce-open, .mce-menu-item', () => { this.changeToMaterial(); });

tinyMCE.init(config);
this.watchTabChanges(config);
}

/**
* Setup TinyMCE editor once it has been initialized
*
* @param editor
*/
setupEditor(editor) {
editor.on('loadContent', (event) => {
this.handleCounterTiny(event.target.id);
});
editor.on('change', (event) => {
tinyMCE.triggerSave();
this.handleCounterTiny(event.target.id);
});
editor.on('blur', () => {
tinyMCE.triggerSave();
});
}

/**
* When the editor is inside a tab it can cause a bug on tab switching.
* So we check if the editor is contained in a navigation and refresh the editor when its
* parent tab is shown.
*
* @param config
*/
watchTabChanges(config) {
$(config.selector).each((index, textarea) => {
const translatedField = $(textarea).closest('.translation-field');
const tabContainer = $(textarea).closest('.translations.tabbable');

if (translatedField.length && tabContainer.length) {
const textareaLocale = translatedField.data('locale');
const textareaLinkSelector = '.nav-item a[data-locale="'+textareaLocale+'"]';

$(textareaLinkSelector, tabContainer).on('shown.bs.tab', () => {
const editor = tinyMCE.get(textarea.id);
if (editor) {
//Reset content to force refresh of editor
editor.setContent(editor.getContent());
}
});
}
});
}

/**
* Loads the TinyMCE javascript library and then init the editors
*
* @param config
*/
loadAndInitTinyMCE(config) {
if (this.tinyMCELoaded) {
return;
}

this.tinyMCELoaded = true;
const pathArray = config.baseAdminUrl.split('/');
pathArray.splice((pathArray.length - 2), 2);
const finalPath = pathArray.join('/');
window.tinyMCEPreInit = {};
window.tinyMCEPreInit.base = finalPath+'/js/tiny_mce';
window.tinyMCEPreInit.suffix = '.min';
$.getScript(`${finalPath}/js/tiny_mce/tinymce.min.js`, () => {this.setupTinyMCE(config)});
}

/**
* Replace initial TinyMCE icons with material icons
*/
changeToMaterial() {
let materialIconAssoc = {
'mce-i-code': '<i class="material-icons">code</i>',
'mce-i-none': '<i class="material-icons">format_color_text</i>',
'mce-i-bold': '<i class="material-icons">format_bold</i>',
'mce-i-italic': '<i class="material-icons">format_italic</i>',
'mce-i-underline': '<i class="material-icons">format_underlined</i>',
'mce-i-strikethrough': '<i class="material-icons">format_strikethrough</i>',
'mce-i-blockquote': '<i class="material-icons">format_quote</i>',
'mce-i-link': '<i class="material-icons">link</i>',
'mce-i-alignleft': '<i class="material-icons">format_align_left</i>',
'mce-i-aligncenter': '<i class="material-icons">format_align_center</i>',
'mce-i-alignright': '<i class="material-icons">format_align_right</i>',
'mce-i-alignjustify': '<i class="material-icons">format_align_justify</i>',
'mce-i-bullist': '<i class="material-icons">format_list_bulleted</i>',
'mce-i-numlist': '<i class="material-icons">format_list_numbered</i>',
'mce-i-image': '<i class="material-icons">image</i>',
'mce-i-table': '<i class="material-icons">grid_on</i>',
'mce-i-media': '<i class="material-icons">video_library</i>',
'mce-i-browse': '<i class="material-icons">attachment</i>',
'mce-i-checkbox': '<i class="mce-ico mce-i-checkbox"></i>',
};

$.each(materialIconAssoc, function (index, value) {
$(`.${index}`).replaceWith(value);
});
}

/**
* Updates the characters counter
*
* @param id
*/
handleCounterTiny(id) {
const textarea = $(`#${id}`);
const counter = textarea.attr('counter');
const counterType = textarea.attr('counter_type');
const max = tinyMCE.activeEditor.getBody().textContent.length;

textarea.parent().find('span.currentLength').text(max);
if ('recommended' !== counterType && max > counter) {
textarea.parent().find('span.maxLength').addClass('text-danger');
} else {
textarea.parent().find('span.maxLength').removeClass('text-danger');
}
}
}

export default TinyMCEEditor;
73 changes: 73 additions & 0 deletions admin-dev/themes/new-theme/js/components/translatable-field.js
@@ -0,0 +1,73 @@
/**
* 2007-2019 PrestaShop and Contributors
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 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:
* https://opensource.org/licenses/OSL-3.0
* 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 license@prestashop.com 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 https://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2019 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/

import {EventEmitter} from './event-emitter';

const $ = window.$;

/**
* This class is used to automatically toggle translated fields (displayed with tabs
* using the TranslateType Symfony form type).
* Also compatible with TranslatableInput changes.
*/
class TranslatableField {
constructor(options) {
options = options || {};

this.localeButtonSelector = options.localeButtonSelector || '.translationsLocales.nav .nav-item a[data-toggle="tab"]';
this.localeNavigationSelector = options.localeNavigationSelector || '.translationsLocales.nav';

$('body').on('shown.bs.tab', this.localeButtonSelector, this.toggleLanguage.bind(this));
EventEmitter.on('languageSelected', this.toggleFields.bind(this));
}

/**
* Dispatch event on language selection to update inputs and other components which depend on the locale.
*
* @param event
*/
toggleLanguage(event) {
const localeLink = $(event.target);
const form = localeLink.closest('form');
EventEmitter.emit('languageSelected', {selectedLocale: localeLink.data('locale'), form: form});
}

/**
* Toggle all transtation fields to the selected locale
*
* @param event
*/
toggleFields(event) {
$(this.localeNavigationSelector).each((index, navigation) => {
const selectedLink = $('.nav-item a.active', navigation);
const selectedLocale = selectedLink.data('locale');
if (event.selectedLocale !== selectedLocale) {
$('.nav-item a[data-locale="'+event.selectedLocale+'"]', navigation).tab('show');
}
});
}
}

export default TranslatableField;