Skip to content

Commit f38b5d0

Browse files
authored
Merge pull request #189 from rmemon/develop
Flash message should be fade out after certain seconds
2 parents 7d0b964 + 0f38a01 commit f38b5d0

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

public/js/backend/admin.js

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
var Backend = {}; // common variable used in all the files of the backend
33

44
(function (){
5+
56
Backend = {
67

78
Utils: {
@@ -96,7 +97,7 @@ var Backend = {}; // common variable used in all the files of the backend
9697
Pages:
9798
{
9899
init: function () {
99-
Backend.tinyMCE.init();
100+
Backend.tinyMCE.init();
100101
},
101102
},
102103

@@ -149,16 +150,16 @@ var Backend = {}; // common variable used in all the files of the backend
149150
Users:
150151
{
151152
selectors: {
152-
select2: $(".select2"),
153+
select2: jQuery(".select2"),
153154
getPremissionURL: "",
154155
showPermission: document.querySelectorAll(".show-permissions")
155156
},
156-
init: function (page) {
157+
init: function (page) {
157158
this.setSelectors();
158-
this.addHandlers(page);
159+
this.addHandlers(page);
159160
},
160161
setSelectors: function () {
161-
this.selectors.select2 = $(".select2");
162+
this.selectors.select2 = jQuery(".select2");
162163
this.selectors.getRoleForPermissions = document.querySelectorAll(".get-role-for-permissions");
163164
this.selectors.getAvailabelPermissions = document.querySelector(".get-available-permissions");
164165
this.selectors.Role3 = document.getElementById("role-3");
@@ -221,7 +222,7 @@ var Backend = {}; // common variable used in all the files of the backend
221222

222223
},
223224
windowloadhandler: function () {
224-
225+
225226
// scripts to be handeled on user create and edit when window is laoaded
226227
Backend.Users.selectors.showPermission.forEach(function (element) {
227228
element.onclick = function (event) {
@@ -441,7 +442,7 @@ var Backend = {}; // common variable used in all the files of the backend
441442

442443
// ! Backend.emailTemplate.addHandlers
443444
addHandlers: function () {
444-
$(".select2").select2();
445+
jQuery(".select2").select2();
445446
// to add placeholder in to active textarea
446447
document.getElementById("addPlaceHolder").onclick = function (event) {
447448
Backend.emailTemplate.addPlaceHolder(event);
@@ -456,15 +457,15 @@ var Backend = {}; // common variable used in all the files of the backend
456457
addPlaceHolder: function (event) {
457458
var placeHolder = document.getElementById('placeHolder').value;
458459
if (placeHolder != '') {
459-
tinymce.activeEditor.execCommand('mceInsertContent', false, "[" + $('#placeHolder :selected').text() + "]");
460+
tinymce.activeEditor.execCommand('mceInsertContent', false, "[" + jQuery('#placeHolder :selected').text() + "]");
460461
}
461462
},
462463

463464
// ! Backend.emailTemplate.showPreview
464465
showPreview: function (event) {
465466
document.querySelector(".modal-body").innerHTML = tinyMCE.get('txtBody').getContent();
466467
//jQuery( ".modal-body" ).html(tinyMCE.get('txtBody').getContent());
467-
$(".model-wrapper").modal('show');
468+
jQuery(".model-wrapper").modal('show');
468469

469470
},
470471
},
@@ -526,9 +527,12 @@ var Backend = {}; // common variable used in all the files of the backend
526527
},
527528

528529
init: function (dataTable) {
529-
530+
530531
this.setSelectors();
531-
this.addHandlers(dataTable);
532+
533+
this.setSelectors.divAlerts.delay(2000).fadeOut(800);
534+
535+
this.addHandlers(dataTable);
532536

533537
},
534538
setSelectors: function () {
@@ -541,6 +545,7 @@ var Backend = {}; // common variable used in all the files of the backend
541545
this.setSelectors.excelButton = document.getElementById("excelButton");
542546
this.setSelectors.pdfButton = document.getElementById("pdfButton");
543547
this.setSelectors.printButton = document.getElementById("printButton");
548+
this.setSelectors.divAlerts = jQuery('div.alert').not('.alert-important');
544549

545550
},
546551
cloneElement: function (element, callback) {
@@ -683,6 +688,7 @@ var Backend = {}; // common variable used in all the files of the backend
683688
}
684689
}
685690
};
691+
686692
})();
687693

688694

0 commit comments

Comments
 (0)