Skip to content

Commit

Permalink
Fixed mootools code so it works with MT1.2
Browse files Browse the repository at this point in the history
Moved code from base view to entrypoint so it is loaded when making
direct calls to plugins
  • Loading branch information
rdiaztushman committed Oct 30, 2012
1 parent 0a0cee9 commit aa78757
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 30 deletions.
4 changes: 2 additions & 2 deletions tienda/media/js/tienda.js
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ function tiendaAddCoupon(form, mult_enabled) {
}
}

el = $ES('.tiendaAjaxGrayDiv', 'coupon_code_area');
el = $$('#coupon_code_area .tiendaAjaxGrayDiv');
if (el != '')
el.destroy();
tiendaSetColorInContainer('coupon_code_area', '');
Expand Down Expand Up @@ -566,7 +566,7 @@ function tiendaGrayOutAjaxDiv(container, text, suffix) {

function tiendaSetColorInContainer(container, color) {
$(container).setStyle('color', color);
$ES('*', container).each(function(el) {
$$('#' + container + ' *' ).each(function(el) {
el.setStyle('color', color);
});
}
Expand Down
15 changes: 8 additions & 7 deletions tienda/media/js/tienda_checkout.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ function tiendaGetShippingRates( container, form, callback )
else
{
tiendaDeleteShippingGrayDiv();
if( callback )
callback();
if (typeof callback == 'function') {
callback();
}
}
return true;
}
Expand Down Expand Up @@ -160,7 +161,7 @@ function tiendaManageShippingRates()

function tiendaDeleteAddressGrayDiv()
{
el_billing = $E( '.tiendaAjaxGrayDiv', 'billingAddress' );
el_billing = $$( '#billingAddress .tiendaAjaxGrayDiv' );
if( !el_billing )
return;
tiendaSetColorInContainer( 'billingAddress', '' );
Expand All @@ -169,7 +170,7 @@ function tiendaDeleteAddressGrayDiv()
if( $( 'shippingAddress' ) && ( !$( 'sameasbilling' ) || ( $( 'sameasbilling' ) && !$( 'sameasbilling' ).checked ) ) )
{
tiendaSetColorInContainer( 'shippingAddress', '' );
$E( '.tiendaAjaxGrayDiv', 'shippingAddress' ).destroy();
$$( '#shippingAddress .tiendaAjaxGrayDiv' ).destroy();
}
}

Expand All @@ -181,7 +182,7 @@ function tiendaDeletePaymentGrayDiv()

function tiendaDeleteTotalAmountDueGrayDiv()
{
el = $ES( '.tiendaAjaxGrayDiv', 'payment_info' );
el = $$( '#payment_info .tiendaAjaxGrayDiv' );
if( el != '' )
el.destroy();

Expand All @@ -193,7 +194,7 @@ function tiendaDeleteShippingGrayDiv()
if( $( 'onCheckoutShipping_wrapper' ) == null )
return;

el = $ES( '.tiendaAjaxGrayDiv', 'onCheckoutShipping_wrapper' );
el = $$( '#onCheckoutShipping_wrapper .tiendaAjaxGrayDiv' );
if( el != '' )
el.destroy();

Expand All @@ -206,7 +207,7 @@ function tiendaDeleteShippingGrayDiv()
if( $( 'shipping_name' ) )
{
shipping_plugin = $( 'shipping_name' ).get( 'value' );
$ES( 'input[type=radio]', 'onCheckoutShipping_wrapper' ).each( function( e ){
$$( '#onCheckoutShipping_wrapper input[type=radio]' ).each( function( e ){
if( e.get( 'rel' ) == shipping_plugin )
e.set( 'checked', true );
} );
Expand Down
4 changes: 2 additions & 2 deletions tienda/media/js/tienda_checkout_onepage.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
});*/

function tiendaGetPaymentOptions(container, form, msg, callback) {
var payment_plugin = $E('input[name=payment_plugin]:checked');
var payment_plugin = $$('input[name=payment_plugin]:checked');

if (payment_plugin)
payment_plugin = payment_plugin.value;
Expand All @@ -40,7 +40,7 @@ function tiendaGetPaymentOptions(container, form, msg, callback) {
tiendaGrayOutAjaxDiv('onCheckoutPayment_wrapper', Joomla.JText._('COM_TIENDA_UPDATING_PAYMENT_METHODS'));

if (payment_plugin) {
$ES('input[name=payment_plugin]', 'onCheckoutPayment_wrapper').each(function(e) {
$$('#onCheckoutPayment_wrapper input[name=payment_plugin]').each(function(e) {
if (e.get('value') == payment_plugin)
e.set('checked', true);
});
Expand Down
6 changes: 6 additions & 0 deletions tienda/site/tienda.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@

$doc->addScriptDeclaration($js);

$parentPath = JPATH_ADMINISTRATOR . '/components/com_tienda/helpers';
DSCLoader::discover('TiendaHelper', $parentPath, true);

$parentPath = JPATH_ADMINISTRATOR . '/components/com_tienda/library';
DSCLoader::discover('Tienda', $parentPath, true);

// load the plugins
JPluginHelper::importPlugin( 'tienda' );

Expand Down
28 changes: 9 additions & 19 deletions tienda/site/views/_base.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

class TiendaViewBase extends DSCViewSite
{


/**
* First displays the submenu, then displays the output
* but only if a valid _doTask is set in the view object
Expand All @@ -27,25 +25,17 @@ class TiendaViewBase extends DSCViewSite
*/
function display($tpl=null, $perform = true )
{
//JHTML::_('stylesheet', 'menu.css', 'media/com_tienda/css/');

$parentPath = JPATH_ADMINISTRATOR . '/components/com_tienda/helpers';
DSCLoader::discover('TiendaHelper', $parentPath, true);

$parentPath = JPATH_ADMINISTRATOR . '/components/com_tienda/library';
DSCLoader::discover('Tienda', $parentPath, true);

if( $perform )
if( $perform )
{
$this->getLayoutVars($tpl);

Tienda::load( 'TiendaMenu', 'library.menu' );

if (!JRequest::getInt('hidemainmenu') && empty($this->hidemenu))
{
$this->getLayoutVars($tpl);

Tienda::load( 'TiendaMenu', 'library.menu' );

if (!JRequest::getInt('hidemainmenu') && empty($this->hidemenu))
{
$this->displaySubmenu();
}
$this->displaySubmenu();
}
}

parent::display($tpl);
}
Expand Down

0 comments on commit aa78757

Please sign in to comment.