Sha256: b810406f605891752f660d9c74d344a7f0c5771d1b4fc1efb6a4c6e0f8ea29e2

Contents?: true

Size: 1.13 KB

Versions: 4

Compression:

Stored size: 1.13 KB

Contents

$(function(){
  $( "#facets" ).sortable({
    axis: "y",
    handle: ".handle",
    update: function (e, ui){
      $.post($(this).data('update-url'), $(this).sortable('serialize')+"&catalog_id="+$(this).data('catalog_id'))
    }  
  });
  
  $("#assets li.asset").draggable({
    handle: ".handle",
    helper: "clone",
    connectToSortable: "#tray ol",
    start:function(e, ui) {
      $('#tray ol').addClass("active");
    },
    stop:function(e, ui) {
      $('#tray ol').removeClass("active");
    }
  });

  $("#catalog_main").droppable({
    accept:'.asset',
    activeClass:'active',
    hoverClass:'hover',
    drop:function(ev,ui){
      var id;
      var asset = $(ui.draggable).clone();
      if ($(ui.draggable).is("[id^='tp']")) {
        id = $(ui.draggable).attr("rel");
        asset.find("input").remove();
        asset.attr("id", "asset_" + id);
      } else {
        id = $(ui.draggable).attr("asset_id");
      }
      $.ajax({
        type: 'put',
        url: window.location.href + "/add_asset",
        data: "&asset_id="+id,
        success: function(){
          window.location.reload();
        }
      });
    }
  });
});

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fassets_core-0.4.0 app/assets/javascripts/fassets_core/catalogs.js
fassets_core-0.3.1 app/assets/javascripts/fassets_core/catalogs.js
fassets_core-0.3.0 app/assets/javascripts/fassets_core/catalogs.js
fassets_core-0.2.0 app/assets/javascripts/fassets_core/catalogs.js