Commit dae681ef by NGUYEN HOANG SON

implement load confirm modal auto if elementId is null

parent 8e848331
...@@ -91,7 +91,6 @@ ...@@ -91,7 +91,6 @@
<!-- select template modal --> <!-- select template modal -->
<div id="includeTemplateModal"></div> <div id="includeTemplateModal"></div>
<div id="includeConfirmModal"></div>
<script type="text/javascript" src="../common/js/app.js"></script> <script type="text/javascript" src="../common/js/app.js"></script>
<script src="../common/js/event.js?__UPDATEID__"></script> <script src="../common/js/event.js?__UPDATEID__"></script>
</body> </body>
......
...@@ -128,7 +128,7 @@ SendMessage.init = function () { ...@@ -128,7 +128,7 @@ SendMessage.init = function () {
//Check if user is logged in //Check if user is logged in
COMMON.checkAuth(false); COMMON.checkAuth(false);
TEMPLATE.loadHeader('#includedHeader'); TEMPLATE.loadHeader('#includedHeader');
TEMPLATE.loadConfirmModal('#includeConfirmModal'); TEMPLATE.loadConfirmModal();
const navs = [ const navs = [
{ {
titleLang: 'dashboard', titleLang: 'dashboard',
......
...@@ -33,10 +33,19 @@ TEMPLATE.loadDashboardSetting = function (elmentId, changeCallback) { ...@@ -33,10 +33,19 @@ TEMPLATE.loadDashboardSetting = function (elmentId, changeCallback) {
}; };
/** /**
* Template load confirm model * Template load confirm model to element
* @param {*} elmentId * @param {string} elmentId - The element where contain confirm modal html,
* if it empty, auto append div with id includedConfirmModal
*/ */
TEMPLATE.loadConfirmModal = function (elmentId) { TEMPLATE.loadConfirmModal = function (elmentId) {
if (typeof elmentId === undefined || !elmentId) {
if ($('#includedConfirmModal').length < 1) {
//append div with id = includedConfirmModal
let div = $('<div id="includedConfirmModal" />');
$('body').append(div);
elmentId = '#includedConfirmModal';
}
}
$(elmentId).load('../common/html/confirmModal.html', function () { $(elmentId).load('../common/html/confirmModal.html', function () {
HEADER.initLogout(); HEADER.initLogout();
I18N.initi18n(); I18N.initi18n();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment