Sha256: 3e7ead986a6346c97b9a81bfbdc0fb3d1c05bd91f803b86be22f2413e29cf5d2

Contents?: true

Size: 1.51 KB

Versions: 2

Compression:

Stored size: 1.51 KB

Contents

if ($('.ui.modals').length === 0) {
  $('body').append('<%= j(render 'index') %>');
} else {
  $('.ui.modals').html('<%= j(render 'index') %>');
}

$('#good_serves_index').modal('setting', {autofocus: false}).modal('show');

$('.ui.slider.checkbox').checkbox({
  onChecked: function(){
    var url = this.dataset['url'];
    var params = {
      method: 'POST',
      credentials: 'include',
      headers: {
        'Content-Type': 'application/javascript',
        'X-CSRF-Token': document.head.querySelector("[name=csrf-token]").content
      }
    };
    fetch(url, params).then(function(response) {
      return response.text()
    }).then(function(response) {
      var script = document.createElement('script');
      script.text = response;
      document.head.appendChild(script).parentNode.removeChild(script);
    }).catch(function(ex) {
      console.log('parsing failed', ex)
    })
  },
  onUnchecked: function(){
    var url = this.dataset['url'];
    var params = {
      method: 'DELETE',
      credentials: 'include',
      headers: {
        'Content-Type': 'application/javascript',
        'X-CSRF-Token': document.head.querySelector("[name=csrf-token]").content
      }
    };
    fetch(url, params).then(function(response) {
      return response.text()
    }).then(function(response) {
      var script = document.createElement('script');
      script.text = response;
      document.head.appendChild(script).parentNode.removeChild(script);
    }).catch(function(ex) {
      console.log('parsing failed', ex)
    })
  }
});

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rails_trade-0.0.2 app/views/trade/admin/cart_item_serves/index.js.erb
rails_trade-0.0.1 app/views/rails_trade_admin/cart_item_serves/index.js.erb