mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 13:33:24 +00:00
ui: Add ability to hide ui feedback messages.
This adds the option to hide the container element after a given duration in the message and success functions in the ui_report module.
This commit is contained in:
committed by
Tim Abbott
parent
605916f6d7
commit
95634b9d17
@@ -9,7 +9,7 @@ var exports = {};
|
|||||||
type- used to define more complex logic for special cases
|
type- used to define more complex logic for special cases
|
||||||
*/
|
*/
|
||||||
|
|
||||||
exports.message = function (response, status_box, cls, type) {
|
exports.message = function (response, status_box, cls, type, remove_after) {
|
||||||
if (cls === undefined) {
|
if (cls === undefined) {
|
||||||
cls = 'alert';
|
cls = 'alert';
|
||||||
}
|
}
|
||||||
@@ -22,7 +22,11 @@ exports.message = function (response, status_box, cls, type) {
|
|||||||
// via i18n.t when interpolating data.
|
// via i18n.t when interpolating data.
|
||||||
status_box.removeClass(common.status_classes).addClass(cls)
|
status_box.removeClass(common.status_classes).addClass(cls)
|
||||||
.html(response).stop(true).fadeTo(0, 1);
|
.html(response).stop(true).fadeTo(0, 1);
|
||||||
|
if (remove_after) {
|
||||||
|
setTimeout(function () {
|
||||||
|
status_box.fadeTo(200, 0);
|
||||||
|
}, remove_after);
|
||||||
|
}
|
||||||
status_box.addClass("show");
|
status_box.addClass("show");
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -45,8 +49,8 @@ exports.error = function (response, xhr, status_box, type) {
|
|||||||
exports.message(response, status_box, 'alert-error', type);
|
exports.message(response, status_box, 'alert-error', type);
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.success = function (response, status_box, type) {
|
exports.success = function (response, status_box, type, remove_after) {
|
||||||
exports.message(response, status_box, 'alert-success', type);
|
exports.message(response, status_box, 'alert-success', type, remove_after);
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.generic_embed_error = function (error) {
|
exports.generic_embed_error = function (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user