"use strict"; //type: error, question, information //options: can contain id for component which use this dialog //options: can contain parent id where will append the dialog template(mandatory) //options: can contain a map object which overwrite the dialog content; // ex:{information:text, question: text, error: text }(optional) var Dialog = function(type, options){ this.$template; this.messages = { information: "Information", error: "This is an error", question: "You sure you want to delete this?" } this.config = {}; this.setConfig = function(){ if(!options) alert("dialog with incorrect params"); this.config = { parentID: (options.parentID) ? options.parentID : alert("parent ID is missing"), creatorID: (options.creatorID) ? options.creatorID : alert("creator ID is missing") } if(options.map){ this.config.messages = { information: (options.map.information) ? options.map.information : this.messages.information, error: (options.map.error) ? options.map.error : this.messages.error, question: (options.map.question) ? options.map.question : this.messages.question } }else{ this.config.messages = this.messages; } return this; } this.createTemplate = function(){ this.$template = $("
").addClass("dialog-content-text").html((type) ? this.config.messages[type] : "").css("margin-top","20px")) .append($("