Skip to content

Commit 21680ef

Browse files
committed
Merge pull request #423 from /issues/343/1
Fixes #343 - Use flash:error event in issue model.
2 parents 84d3087 + e465834 commit 21680ef

File tree

1 file changed

+4
-18
lines changed

1 file changed

+4
-18
lines changed

webcompat/static/js/lib/models/issue.js

+4-18
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,8 @@
6868
}
6969
},
7070
error: function() {
71-
$('<div></div>', {
72-
'class': 'flash error',
73-
'text': 'There was an error editing this issues\'s status.'
74-
}).appendTo('body');
75-
76-
setTimeout(function(){
77-
var __flashmsg = $('.flash');
78-
if (__flashmsg.length) {__flashmsg.fadeOut();}
79-
}, 2000);
71+
var msg = 'There was an error editing this issues\'s status.';
72+
wcEvents.trigger('flash:error', {message: msg, timeout: 2000});
8073
}
8174
});
8275
},
@@ -102,15 +95,8 @@
10295
self.set('labels', response);
10396
},
10497
error: function() {
105-
$('<div></div>', {
106-
'class': 'flash error',
107-
'text': 'There was an error setting labels.'
108-
}).appendTo('body');
109-
110-
setTimeout(function(){
111-
var __flashmsg = $('.flash');
112-
if (__flashmsg.length) {__flashmsg.fadeOut();}
113-
}, 2000);
98+
var msg = 'There was an error setting labels.';
99+
wcEvents.trigger('flash:error', {message: msg, timeout: 2000});
114100
}
115101
});
116102
}

0 commit comments

Comments
 (0)