Sha256: 056da7bea6ab8158fb464d69e3152ffa58754ef1a71971c19375742a379fd15a

Contents?: true

Size: 1.55 KB

Versions: 2

Compression:

Stored size: 1.55 KB

Contents

check_remove_icon_status('delivery-rule');
odd_even = 1;

function add_delivery_rule(name) {
  var delivery_rule = jQuery('.' + name + '.pattern');
  delivery_rules = jQuery('#delivery-rules');

  new_rule = '<div id="item_'+ false_id +' " class="delivery-rule '+ (odd_even%2 == 0 ? '' : 'even') +'">';
    new_rule += delivery_rule.html().replace(/undefined_id/g, false_id);
  new_rule += '</div>';

  delivery_rules.append(new_rule);
  check_remove_icon_status('delivery-rule');

  false_id--;
  odd_even++;
}

function remove_delivery_rule(element){
  rule_id = get_rails_element_id(jQuery(element).parent());

  if (rule_id > 0) {
    _delete = '<input type="hidden" id="shipping_methods_to_delete_" name="shipping_methods_to_delete[]" value="'+ rule_id +'" />'
    jQuery('#delivery-rules').append(_delete);
  }

  jQuery(element).parent().remove();
  check_remove_icon_status('delivery-rule');
}


function change_rule_for(element){

  delivery_type = element.options[element.selectedIndex].value;
  delivery_rules = jQuery('#delivery-rules');

  delivery_rules.html('');

  rule = '<div id="item_0" class="delivery-rule">'
  rule += jQuery('.delivery-rule.'+ delivery_type +'.pattern').html().replace(/undefined_id/g, 0);
  rule += '</div>';

  delivery_rules.append(rule);

  check_remove_icon_status('delivery-rule');
  false_id = -1;
  odd_even = 1;

}

function check_remove_icon_status(name){
  var c = jQuery('#' + name + 's .' + name);
  var icon = c.find('a.red-minus:first');

  if (c.size() == 1) {
    jQuery(icon).hide();
  } else {
    jQuery(icon).show();
  }
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
forgeos_commerce-1.9.1.rc1 app/assets/javascripts/forgeos/admin/functions/forgeos_commerce/transporters.js
forgeos_commerce-1.9.0 app/assets/javascripts/forgeos/admin/functions/forgeos_commerce/transporters.js