public/javascripts/spaceModify.js
//Method to remove the dataset from space and redirect back to a specific URL on completion
Method to remove the dataset from space and redirect back to a specific URL on completion
Method to remove the dataset from space and redirect back to a specific URL on completion
function removeDatasetFromSpaceAndRedirect(spaceId, datasetId, isreload, url){
    var request = jsRoutes.api.Spaces.removeDataset(spaceId, datasetId).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");
                $('#dataset-users').addClass("hidden");
            }
            if($('#spacesList .row').length == 0) {
            	$('#publish').addClass('disabled');
           	}
            if(response.isTrial.valueOf() ==="true"){
                $('#access').hide();
            }
        }
    });
    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.";
        if (!checkErrorAndRedirect(jqXHR, errMsg)) {
            notify("The dataset was not removed due to : " + errorThrown, "error");
        }
    });
}
function removeDatasetFromSpaceAndRedirect ( spaceId , datasetId , isreload , url ) { var request = jsRoutes . api . Spaces . removeDataset ( spaceId , datasetId ) . 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" ) ; $ ( '#dataset-users' ) . addClass ( "hidden" ) ; } if ( $ ( '#spacesList .row' ) . length == 0 ) { $ ( '#publish' ) . addClass ( 'disabled' ) ; } if ( response . isTrial . valueOf ( ) === "true" ) { $ ( '#access' ) . hide ( ) ; } } } ) ; 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." ; if ( ! checkErrorAndRedirect ( jqXHR , errMsg ) ) { notify ( "The dataset was not removed due to : " + errorThrown , "error" ) ; } } ) ; }
Method to remove the dataset from space and redirect back to a specific URL on completion
Method to remove the dataset from space and redirect back to a specific URL on completion