From bcac1037fb35554b2882faa5a122d65d097aaf00 Mon Sep 17 00:00:00 2001 From: adonis karavokyros Date: Thu, 22 Nov 2012 21:19:12 +0100 Subject: [PATCH] Clean history.js js selectors should be more simple in order to be more flexible in theme development --- themes/default/js/history.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/themes/default/js/history.js b/themes/default/js/history.js index 6c8f88cbc..a489dc649 100644 --- a/themes/default/js/history.js +++ b/themes/default/js/history.js @@ -36,26 +36,26 @@ function showOrder(mode, var_content, file) { $(this).html(data); /* if return is allowed*/ - if ($('div#order-detail-content table td.order_cb').length > 0) + if ($('#order-detail-content .order_cb').length > 0) { //return slip : check or uncheck every checkboxes - $('form div#order-detail-content th input[type=checkbox]').click(function() + $('#order-detail-content th input[type=checkbox]').click(function() { - $('form div#order-detail-content td input[type=checkbox]').each(function() + $('#order-detail-content td input[type=checkbox]').each(function() { - this.checked = $('form div#order-detail-content th input[type=checkbox]').is(':checked'); + this.checked = $('#order-detail-content th input[type=checkbox]').is(':checked'); updateOrderLineDisplay(this); }); }); //return slip : enable or disable 'global' quantity editing - $('form div#order-detail-content td input[type=checkbox]').click(function() + $('#order-detail-content td input[type=checkbox]').click(function() { updateOrderLineDisplay(this); }); //return slip : limit quantities - $('form div#order-detail-content td input.order_qte_input').keyup(function() + $('#order-detail-content td .order_qte_input').keyup(function() { - var maxQuantity = parseInt($(this).parent().find('span.order_qte_span').text()); + var maxQuantity = parseInt($(this).parent().find('.order_qte_span').text()); var quantity = parseInt($(this).val()); if (isNaN($(this).val()) && $(this).val() != '') { @@ -84,8 +84,8 @@ function showOrder(mode, var_content, file) function updateOrderLineDisplay(domCheckbox) { - var lineQuantitySpan = $(domCheckbox).parent().parent().find('span.order_qte_span'); - var lineQuantityInput = $(domCheckbox).parent().parent().find('input.order_qte_input'); + var lineQuantitySpan = $(domCheckbox).parent().parent().find('.order_qte_span'); + var lineQuantityInput = $(domCheckbox).parent().parent().find('.order_qte_input'); if($(domCheckbox).is(':checked')) { lineQuantitySpan.hide(); @@ -103,19 +103,19 @@ function updateOrderLineDisplay(domCheckbox) function sendOrderMessage() { paramString = "ajax=true"; - $('form#sendOrderMessage').find('input, textarea').each(function(){ + $('#sendOrderMessage').find('input, textarea').each(function(){ paramString += '&' + $(this).attr('name') + '=' + encodeURI($(this).val()); }); $.ajax({ type: "POST", - url: $('form#sendOrderMessage').attr("action"), + url: $('#sendOrderMessage').attr("action"), data: paramString, success: function (msg){ $('#block-order-detail').fadeOut('slow', function() { $(this).html(msg); //catch the submit event of sendOrderMessage form - $('form#sendOrderMessage').submit(function(){ + $('#sendOrderMessage').submit(function(){ return sendOrderMessage(); }); $(this).fadeIn('slow');