Add prettier and reformat code

This commit is contained in:
Gautier Pelloux-Prayer 2019-05-16 21:31:06 +02:00
parent 68eb00bae9
commit 970a34981f
37 changed files with 3459 additions and 1969 deletions

View file

@ -4,45 +4,52 @@ BR.Message = L.Class.extend({
// Bootstrap data-api's auto-initialization doesn't work in Controls because of stopPropagation
alert: false
},
initialize: function (id, options) {
initialize: function(id, options) {
L.setOptions(this, options);
this.id = id;
},
_show: function (msg, type) {
_show: function(msg, type) {
var ele = L.DomUtil.get(this.id),
iconClass = (type === 'warning') ? 'fa-exclamation-triangle' : 'fa-times-circle',
alertClass = (type === 'warning') ? 'alert-warning' : 'alert-danger';
iconClass =
type === 'warning'
? 'fa-exclamation-triangle'
: 'fa-times-circle',
alertClass = type === 'warning' ? 'alert-warning' : 'alert-danger';
L.DomEvent.disableClickPropagation(ele);
ele.innerHTML =
'<div class="alert ' + alertClass + ' alert-dismissible fade in" role="alert">'
+ ' <button type="button" class="close" data-dismiss="alert" aria-label="Close">'
+ ' <span aria-hidden="true">&times;</span>'
+ ' </button>'
+ ' <span class="fa ' + iconClass + '" aria-hidden="true"/></span>'
+ msg
+ '</div>';
'<div class="alert ' +
alertClass +
' alert-dismissible fade in" role="alert">' +
' <button type="button" class="close" data-dismiss="alert" aria-label="Close">' +
' <span aria-hidden="true">&times;</span>' +
' </button>' +
' <span class="fa ' +
iconClass +
'" aria-hidden="true"/></span>' +
msg +
'</div>';
if (this.options.alert) {
$('#' + this.id + ' .alert').alert();
}
},
hide: function () {
hide: function() {
$('#' + this.id + ' .alert').alert('close');
},
showError: function (err) {
showError: function(err) {
if (err == 'Error: target island detected for section 0\n') {
err = i18next.t('warning.no-route-found');
}
this._show(err, 'error');
},
showWarning: function (msg) {
showWarning: function(msg) {
this._show(msg, 'warning');
}
});