Skip to content

Commit

Permalink
Improve regex
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre RAMBAUD committed Oct 18, 2018
1 parent 4a001e9 commit 229b023
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions admin-dev/themes/default/js/bundle/product/form.js
Expand Up @@ -398,7 +398,7 @@ var featuresCollection = (function() {

if('' !== $(this).val()) {
$.ajax({
url: $(this).attr('data-action').replace(/\/\d+(?=\?.*)?$/, '/' + $(this).val()),
url: $(this).attr('data-action').replace(/\/\d+((?=\?.*))?/, '/' + $(this).val()),
success: function(response) {
$selector.prop('disabled', response.length === 0);
$selector.empty();
Expand Down Expand Up @@ -644,7 +644,7 @@ var form = (function() {
//update the customization ids
if (typeof response.customization_fields_ids != "undefined") {
$.each(response.customization_fields_ids, function (k, v) {
$("#form_step6_custom_fields_" + k + "_id_customization_field").val(v);
$("#form_step6_custom_fields_" + k + "_id_customization_field").val(v);
});
}

Expand Down Expand Up @@ -742,23 +742,23 @@ var form = (function() {
}

function updateMissingTranslatedNames() {
var namesDiv = $('#form_step1_names');
var defaultLanguageValue = null;
$("input[id^='form_step1_name_']", namesDiv).each(function(index) {
var value = $(this).val();
// The first language is ALWAYS the employee language
if (0 === index) {
defaultLanguageValue = value;
} else if (0 === value.length) {
$(this).val(defaultLanguageValue);
}
});
var namesDiv = $('#form_step1_names');
var defaultLanguageValue = null;
$("input[id^='form_step1_name_']", namesDiv).each(function(index) {
var value = $(this).val();
// The first language is ALWAYS the employee language
if (0 === index) {
defaultLanguageValue = value;
} else if (0 === value.length) {
$(this).val(defaultLanguageValue);
}
});
}

/**
* Depending on the provided params, this method displays or hides
* an error panel with the form errors not linked to a specific field.
*
*
* @param {string} content The HTML content to display
*/
function updateDisplayGlobalErrors(content) {
Expand Down

0 comments on commit 229b023

Please sign in to comment.