GoalModelEditor/FrontEnd/public/js/dashboard.js
/**
 * Ajax function for creating a template
 *
 * @params {formData} template - formData with encapsulated template to be created
 */
Ajax function for creating a template
@params {formData} template - formData with encapsulated template to be created
Ajax function for creating a template @params { formData } template - formData with encapsulated template to be created
function createTemplate(template) {
    $.ajax(POST_TEMPLATE_URL, {
        data: template,
        type: "POST",
        headers: {Authorization: "Bearer" + TOKEN},
        success: template => {
            let templateHTML = parseTemplate(template);
            $("#templates-container").append(templateHTML);
            successMessageSlide("Template: " + template.template_name + " successfully created.");
            removeCustomizedEventListeners();
            addListenersToNewItem();
            $("#add-template .modal-body input").val("");
        }
    }).fail(function (jqXHR) {
        warningMessageSlide(jqXHR.responseJSON.message + "<br>Please try again.");
    });
}
function createTemplate ( template ) { $ . ajax ( POST_TEMPLATE_URL , { data : template , type : "POST" , headers : { Authorization : "Bearer" + TOKEN } , success : template => { let templateHTML = parseTemplate ( template ) ; $ ( "#templates-container" ) . append ( templateHTML ) ; successMessageSlide ( "Template: " + template . template_name + " successfully created." ) ; removeCustomizedEventListeners ( ) ; addListenersToNewItem ( ) ; $ ( "#add-template .modal-body input" ) . val ( "" ) ; } } ) . fail ( function ( jqXHR ) { warningMessageSlide ( jqXHR . responseJSON . message + "<br>Please try again." ) ; } ) ; }
Ajax function for creating a template
 @params {formData} template - formData with encapsulated template to be created
Ajax function for creating a template @params { formData } template - formData with encapsulated template to be created
// Append the project to current UI // add Listeners // Re-initialize the input for the modal