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

} }


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

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





function setFlashMessages(flashMessages){ function setFlashMessages(flashMessages){
var currentFlash =new Array();
for (var type in flashMessages) { for (var type in flashMessages) {
for (var key in flashMessages[type]) { 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) { 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); 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({ /*var n = noty({
text: text, text: text,
type: type, type: type,

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

opacity:1; opacity:1;
cursor:pointer; cursor:pointer;
} }
#toast-container:before {
content:'x';
#toast-close-all {
border:0;
position: absolute; position: absolute;
pointer-events: auto; pointer-events: auto;
z-index: 999999999999999999999; z-index: 999999999999999999999;
border-radius: 3px; border-radius: 3px;
color:#fff; color:#fff;
opacity:0.8; opacity:0.8;
top: 1px;
top: 2px;
width: 50px; width: 50px;
height: 50px; height: 50px;
font-size: 30px; font-size: 30px;

Loading…
Cancel
Save