Sha256: bf81b074543f501a0458775907a5996673af72424c16ecfde11933dd3ec6ab55

Contents?: true

Size: 659 Bytes

Versions: 7

Compression:

Stored size: 659 Bytes

Contents

/**
  radioControlsVisibilityOfElement:
  Apply to individual radio button that makes another element visible when checked
**/
document.addEventListener('DOMContentLoaded', function() {
  $.fn.radioControlsVisibilityOfElement = function(dependentElementSelector) {
    if (!this.get(0)) { return }
    var showValue = this.get(0).value
    var radioGroup = $("input[name='" + this.get(0).name + "']")
    radioGroup.each(function() {
      $(this).click(function() {
        // eslint-disable-next-line eqeqeq
        $(dependentElementSelector).visible(this.checked && this.value == showValue)
      })
      if (this.checked) { this.click() }
    })
  }
})

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
spree_backend-4.3.3 app/assets/javascripts/spree/backend/global/radio_panel_toggle.es6
spree_backend-4.3.2 app/assets/javascripts/spree/backend/global/radio_panel_toggle.es6
spree_backend-4.3.1 app/assets/javascripts/spree/backend/global/radio_panel_toggle.es6
spree_backend-4.3.0 app/assets/javascripts/spree/backend/global/radio_panel_toggle.es6
spree_backend-4.3.0.rc3 app/assets/javascripts/spree/backend/global/radio_panel_toggle.es6
spree_backend-4.3.0.rc2 app/assets/javascripts/spree/backend/global/radio_panel_toggle.es6
spree_backend-4.3.0.rc1 app/assets/javascripts/spree/backend/global/radio_panel_toggle.es6