Commit 509861ae authored by Guillaume Agniéray's avatar Guillaume Agniéray Committed by Johan Cwiklinski
Browse files

Replace jQuery bgFade with SUI flash transition

Rename the toasts template not to be specific to toasts messages
parent e956578e
{# Enable dismissable messages #}
$('.message .close')
.on('click', function() {
$(this)
.closest('.message')
.transition('fade')
;
})
;
{# Apply transitions on inline messages #}
$('.message.with-transition')
.transition('flash')
;
{# Let's see if there are success messages to show #}
{% set successes = flash.getMessage('success_detected') %}
{% if success_detected is defined and success_detected is iterable %}
......
......@@ -44,7 +44,7 @@
{% include "modals/telemetry.html.twig" with {part: "jsdialog"} %}
{% endif %}
{% include "elements/js/messages_toasts.js.twig" %}
{% include "elements/js/messages.js.twig" %}
});
</script>
......
......@@ -132,7 +132,6 @@
};
var _initdb_bindings = function(res){
$('.initdb-modal input:submit, .initdb-modal .button, .initdb-modal input:reset' ).button();
_messagesEffects();
$("#plugins_initdb_form").submit(function(event) {
/* stop form from submitting normally */
event.preventDefault();
......
......@@ -26,21 +26,6 @@
* @since Available since 0.7dev - 2007-10-06
*/
var _messagesEffects = function(){
/**
* Errorbox animation
*/
$('#errorbox').backgroundFade({sColor:'#ffffff',eColor:'#ff9999',steps:50},function() {
$(this).backgroundFade({sColor:'#ff9999',eColor:'#ffffff'});
});
$('#warningbox').backgroundFade({sColor:'#ffffff',eColor:'#FFB619',steps:50},function() {
$(this).backgroundFade({sColor:'#FFB619',eColor:'#ffffff'});
});
$('#infobox, #successbox').backgroundFade({sColor:'#ffffff',eColor:'#99FF99',steps:50},function() {
$(this).backgroundFade({sColor:'#99FF99',eColor:'#ffffff'});
});
}
var _bind_check = function(boxelt){
if (typeof(boxelt) == 'undefined') {
boxelt = 'member_sel'
......@@ -81,7 +66,6 @@ var _bind_legend = function() {
}
$(function() {
_messagesEffects();
$('.debuginfos span').hide();
/** TODO: find a way to translate this message ==> ajax ? */
$('.debuginfos').attr('title', 'Click to get more details.');
......
jQuery.fn.backgroundFade = function(s,callback) {
var defaults = {
sColor: [255,0,0],
eColor: [255,255,255],
fColor: null,
steps: 200,
intervals: 5,
powr: 4
},
params = jQuery.extend(defaults,s);
return this.each(function() {
this.bgFade_sColor = jQuery.backgroundFade.parseHexColor(params.sColor);
this.bgFade_eColor = jQuery.backgroundFade.parseHexColor(params.eColor);
this.bgFade_fColor = params.fColor ? params.fColor : jQuery(this).css('backgroundColor');
this.bgFade_steps = params.steps;
this.bgFade_intervals = params.intervals;
this.bgFade_powr = params.powr;
this.bgFade_fn = callback;
jQuery.backgroundFade.doFade(this);
});
};
jQuery.backgroundFade = {
parseHexColor: function(c) {
if (c.constructor == String && c.substr(0,1) == '#') {
return [parseInt(c.substr(1,2),16),parseInt(c.substr(3,2),16),parseInt(c.substr(5,2),16)];
}
return c;
},
easeInOut: function(minValue,maxValue,totalSteps,actualStep,powr) {
var delta = maxValue - minValue;
var stepp = minValue+(Math.pow(((1 / totalSteps)*actualStep),powr)*delta);
return Math.ceil(stepp);
},
doFade: function(e) {
if (e.bgFadeInt) window.clearInterval(e.bgFadeInt);
var act_step = 0;
e.bgFadeInt = window.setInterval(function() {
e.style.backgroundColor =
"rgb("+
jQuery.backgroundFade.easeInOut(e.bgFade_sColor[0],e.bgFade_eColor[0],
e.bgFade_steps,act_step,e.bgFade_powr)+","+
jQuery.backgroundFade.easeInOut(e.bgFade_sColor[1],e.bgFade_eColor[1],
e.bgFade_steps,act_step,e.bgFade_powr)+","+
jQuery.backgroundFade.easeInOut(e.bgFade_sColor[2],e.bgFade_eColor[2],
e.bgFade_steps,act_step,e.bgFade_powr)+")";
act_step++;
if (act_step > e.bgFade_steps) {
window.clearInterval(e.bgFadeInt);
e.bgFade_sColor = undefined;
e.bgFade_eColor = undefined;
e.bgFade_fColor = undefined;
e.bgFade_steps = undefined;
e.bgFade_intervals = undefined;
e.bgFade_powr = undefined;
if (typeof(e.bgFade_fn) == 'function') {
e.bgFade_fn.call(e);
}
e.style.backgroundColor = e.bgFade_fColor;
}
},e.bgFade_intervals);
}
};
\ No newline at end of file
......@@ -25,7 +25,6 @@ var main_scripts = [
'./node_modules/jquery-ui-dist/jquery-ui.js',
'./node_modules/jquery-ui/ui/i18n/*',
'./node_modules/js-cookie/dist/js.cookie.min.js',
'./galette/webroot/js/jquery/jquery.bgFade.js',
'./node_modules/summernote/dist/summernote-lite.min.js',
'./galette/webroot/js/common.js',
];
......
Supports Markdown
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