public/javascripts/datasets/collections.js
//Method to remove the dataset from collection and redirect back to a specific URL on completion
Method to remove the dataset from collection and redirect back to a specific URL on completion
Method to remove the dataset from collection and redirect back to a specific URL on completion
function removeDatasetFromCollectionAndRedirect(collectionId, datasetId, isreload, url){
    var request = jsRoutes.api.Collections.removeDataset(collectionId, datasetId).ajax({
        type: 'POST'
    });
    request.done(function (response, textStatus, jqXHR){
        console.log(collectionId, datasetId, isreload, url);
        if(isreload === "true")
            if(url === undefined) {
                reloadPage = "/collections";
            } else {
                window.location.href=url;
            }
        else {
            $('#col_' + collectionId).remove();
        }
    });
    request.fail(function (jqXHR, textStatus, errorThrown){
        console.error("The following error occurred: " + textStatus, errorThrown);
        var errMsg = "You must be logged in to remove a dataset from a collection.";
        if (!checkErrorAndRedirect(jqXHR, errMsg)) {
            notify("The dataset was not removed from the collection due to : " + errorThrown, "error");
        }
    });
}
function removeDatasetFromCollectionAndRedirect ( collectionId , datasetId , isreload , url ) { var request = jsRoutes . api . Collections . removeDataset ( collectionId , datasetId ) . ajax ( { type : 'POST' } ) ; request . done ( function ( response , textStatus , jqXHR ) { console . log ( collectionId , datasetId , isreload , url ) ; if ( isreload === "true" ) if ( url === undefined ) { reloadPage = "/collections" ; } else { window . location . href = url ; } else { $ ( '#col_' + collectionId ) . remove ( ) ; } } ) ; request . fail ( function ( jqXHR , textStatus , errorThrown ) { console . error ( "The following error occurred: " + textStatus , errorThrown ) ; var errMsg = "You must be logged in to remove a dataset from a collection." ; if ( ! checkErrorAndRedirect ( jqXHR , errMsg ) ) { notify ( "The dataset was not removed from the collection due to : " + errorThrown , "error" ) ; } } ) ; }
Method to remove the dataset from collection and redirect back to a specific URL on completion
Method to remove the dataset from collection and redirect back to a specific URL on completion