Browse Source

[Backend] Fermeture flash messages via bouton

feature/module_traiteur_v1
Fab 4 years ago
parent
commit
602e5eb89d
3 changed files with 25 additions and 13 deletions
  1. +3
    -3
      ShopBundle/Resources/public/css/backend/custom.css
  2. +19
    -7
      ShopBundle/Resources/public/js/backend/script/default/utils.js
  3. +3
    -3
      ShopBundle/Resources/public/sass/backend/custom.scss

+ 3
- 3
ShopBundle/Resources/public/css/backend/custom.css View File

@@ -880,8 +880,8 @@ table.products-collection-table tr.disabled {
}

/* line 314, ../../sass/backend/custom.scss */
#toast-container:before {
content: 'x';
#toast-close-all {
border: 0;
position: absolute;
pointer-events: auto;
z-index: 999999999999999999999;
@@ -889,7 +889,7 @@ table.products-collection-table tr.disabled {
border-radius: 3px;
color: #fff;
opacity: 0.8;
top: 1px;
top: 2px;
width: 50px;
height: 50px;
font-size: 30px;

+ 19
- 7
ShopBundle/Resources/public/js/backend/script/default/utils.js View File

@@ -149,23 +149,35 @@ function userNotAllowToEdit() {


function setFlashMessages(flashMessages){
var currentFlash =new Array();
for (var type in flashMessages) {
for (var key in flashMessages[type]) {
generateNotice(type, flashMessages[type][key]);
if(!currentFlash.includes(flashMessages[type][key])) {
currentFlash.push(flashMessages[type][key]);
generateNotice(type, flashMessages[type][key]);
}
}
}
}

function generateNotice(type, text) {
$('#toast-container:before').on('click', function (){
alert('niche')
});
toastr.options.timeOut = 3000000;
toastr.options.extendedTimeOut = 3000000;

toastr.options.preventDuplicates = true;
toastr.options.timeOut = 3000;
toastr.options.onHidden = function() {
if($('#toast-container .toast').length==0)$('#toast-close-all').remove();
};
//toastr.options.preventDuplicates = true;
toastr[type](text);

if($('#toast-close-all').length==0) {
$('#toast-container').prepend('<button id="toast-close-all"><i class="fa fa-times"></i></button>');
}
$('#toast-close-all').off('click');
$('#toast-close-all').on('click', function (){
toastr.remove();
if($('#toast-container .toast').length==0)$('#toast-close-all').remove();
});

/*var n = noty({
text: text,
type: type,

+ 3
- 3
ShopBundle/Resources/public/sass/backend/custom.scss View File

@@ -311,8 +311,8 @@ table.products-collection-table tr.disabled{opacity: 0.5}
opacity:1;
cursor:pointer;
}
#toast-container:before {
content:'x';
#toast-close-all {
border:0;
position: absolute;
pointer-events: auto;
z-index: 999999999999999999999;
@@ -320,7 +320,7 @@ table.products-collection-table tr.disabled{opacity: 0.5}
border-radius: 3px;
color:#fff;
opacity:0.8;
top: 1px;
top: 2px;
width: 50px;
height: 50px;
font-size: 30px;

Loading…
Cancel
Save