{"size": 1319, "ext": "js", "max_stars_repo_path": "datatags-app/app/assets/js/DeleteVersion.js", "max_stars_repo_name": "IQSS/DataTaggingServer", "max_stars_repo_stars_event_min_datetime": "2018-12-12T13:52:22.000Z", "max_stars_repo_stars_event_max_datetime": "2019-09-13T20:46:29.000Z", "max_issues_repo_path": "datatags-app/app/assets/js/DeleteVersion.js", "max_issues_repo_name": "IQSS/DataTaggingServer", "max_issues_repo_issues_event_min_datetime": "2015-09-17T07:26:46.000Z", "max_issues_repo_issues_event_max_datetime": "2021-11-22T08:17:03.000Z", "max_forks_repo_path": "datatags-app/app/assets/js/DeleteVersion.js", "max_forks_repo_name": "IQSS/DataTaggingServer", "max_forks_repo_forks_event_min_datetime": "2018-05-02T18:24:42.000Z", "max_forks_repo_forks_event_max_datetime": "2018-05-02T18:24:42.000Z"}
{"max_stars_count": 2, "max_issues_count": 143, "max_forks_count": 1, "avg_line_length": 32.975, "max_line_length": 96, "alphanum_fraction": 0.4139499621}
var DeleteVersion = (function(){
    function deleteVersion(modelId, version) {
        swal({
            title: "Are you sure?",
            text:  "You will not be able to recover this version.",
            dangerMode: true,
            buttons:{
                cancel: {
                    text: "Cancel",
                    value: null,
                    visible: true,
                    className: "",
                    closeModal: true
                },
                confirm: {
                    text: "OK",
                    value: true,
                    visible: true,
                    className: "",
                    closeModal: false
                }
            }
        }).then(function(isConfirm){
            if (isConfirm) {
                var call = jsRoutes.controllers.ModelCtrl.deleteVersion(modelId, version);
                $.ajax(call.url, {
                    type: call.type,
                    contentType: "application/json; charset=utf-8"
                }).done(function (data, status, jqXhr) {
                    window.location = jsRoutes.controllers.ModelCtrl.showModelPage(modelId).url;
                });
            } else {
                swal.close();
            }
        });
    }
    return {
        deleteVersion: deleteVersion
    };
})();