public/javascripts/spaceModify.js
//Method to remove the collection from space and redirect back to a specific URL on completion
Method to remove the collection from space and redirect back to a specific URL on completion
Method to remove the collection from space and redirect back to a specific URL on completion
function removeCollectionFromSpaceAndRedirect(spaceId, collectionId, isreload, url) {
    console.log(url);
    var removeDatasets =$('#removedatasets').is(':checked');
    var request = jsRoutes.api.Spaces.removeCollection(spaceId, collectionId, removeDatasets).ajax({
        type: 'POST'
    });
    request.done(function (response, textStatus, jqXHR){
        if(isreload === "true")
            if(url === undefined) {
                reloadPage = "/spaces";
            } else {
                window.location.href=url;
            }
        else {
            $('#col_' + spaceId).remove();
            if(!isSharingEnabled && $('#spacesList .row').length == 0 ) {
                $("#add-to-space-widget").removeClass("hidden");
            }
        }
    });
    request.fail(function (jqXHR, textStatus, errorThrown){
        console.error("The following error occurred: " + textStatus, errorThrown);
        var errMsg = "You must be logged in to remove a collection.";
        if (!checkErrorAndRedirect(jqXHR, errMsg)) {
            notify("The collection was not removed due to : " + errorThrown, "error");
        }
    });
}
function removeCollectionFromSpaceAndRedirect ( spaceId , collectionId , isreload , url ) { console . log ( url ) ; var removeDatasets = $ ( '#removedatasets' ) . is ( ':checked' ) ; var request = jsRoutes . api . Spaces . removeCollection ( spaceId , collectionId , removeDatasets ) . ajax ( { type : 'POST' } ) ; request . done ( function ( response , textStatus , jqXHR ) { if ( isreload === "true" ) if ( url === undefined ) { reloadPage = "/spaces" ; } else { window . location . href = url ; } else { $ ( '#col_' + spaceId ) . remove ( ) ; if ( ! isSharingEnabled && $ ( '#spacesList .row' ) . length == 0 ) { $ ( "#add-to-space-widget" ) . removeClass ( "hidden" ) ; } } } ) ; request . fail ( function ( jqXHR , textStatus , errorThrown ) { console . error ( "The following error occurred: " + textStatus , errorThrown ) ; var errMsg = "You must be logged in to remove a collection." ; if ( ! checkErrorAndRedirect ( jqXHR , errMsg ) ) { notify ( "The collection was not removed due to : " + errorThrown , "error" ) ; } } ) ; }
Method to remove the collection from space and redirect back to a specific URL on completion
Method to remove the collection from space and redirect back to a specific URL on completion