mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 04:53:36 +00:00
alert_words_ui: Convert error message alert to status message alert.
Convert the error message alert to a status message alert which can be used to display the status of any operation performed.
This commit is contained in:
committed by
Tim Abbott
parent
b0d7d05ef6
commit
643936454e
@@ -2,6 +2,17 @@ var alert_words_ui = (function () {
|
||||
|
||||
var exports = {};
|
||||
|
||||
function update_alert_word_status(status_text, is_error) {
|
||||
var alert_word_status = $('#alert_word_status');
|
||||
if (is_error) {
|
||||
alert_word_status.removeClass('alert-success').addClass('alert-danger');
|
||||
} else {
|
||||
alert_word_status.removeClass('alert-danger').addClass('alert-success');
|
||||
}
|
||||
alert_word_status.find('.alert_word_status_text').text(status_text);
|
||||
alert_word_status.show();
|
||||
}
|
||||
|
||||
function update_alert_words() {
|
||||
var words = _.map($('.alert-word-item'), function (e) {
|
||||
return $(e).data('word').toString();
|
||||
@@ -17,7 +28,7 @@ function update_alert_words() {
|
||||
|
||||
function add_alert_word(word, event) {
|
||||
if ($.trim(word) === '') {
|
||||
$("#empty_alert_word_error").show();
|
||||
update_alert_word_status(i18n.t("Alert words can't be empty!"), true);
|
||||
return;
|
||||
}
|
||||
var final_li = templates.render('alert_word_settings_item', {word: word, editing: false});
|
||||
@@ -70,7 +81,7 @@ exports.set_up_alert_words = function () {
|
||||
}
|
||||
});
|
||||
|
||||
$('#alert_words_list').on('click', '.close-empty-alert-word-error', function (event) {
|
||||
$('#alert-word-settings').on('click', '.close-alert-word-status', function (event) {
|
||||
event.preventDefault();
|
||||
var alert = $(event.currentTarget).parents('.alert');
|
||||
alert.hide();
|
||||
|
@@ -736,18 +736,6 @@ input[type=checkbox].inline-block {
|
||||
width: 8em;
|
||||
}
|
||||
|
||||
#empty_alert_word_error {
|
||||
display: none;
|
||||
width: 90%;
|
||||
margin: 0 auto;
|
||||
margin-bottom: 15px;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
#empty_alert_word_error .close {
|
||||
position: inherit;
|
||||
}
|
||||
|
||||
#attachments_list {
|
||||
list-style-type: none;
|
||||
margin: auto;
|
||||
|
@@ -4,11 +4,11 @@
|
||||
{{t "Alert words allow you to be notified as if you were @-mentioned when certain words or phrases are used in Zulip."}}
|
||||
</p>
|
||||
</form>
|
||||
<div class="alert alert-danger" id="empty_alert_word_error" role="alert">
|
||||
<button type="button" class="close close-empty-alert-word-error" aria-label="Close">
|
||||
<div class="alert" id="alert_word_status" role="alert">
|
||||
<button type="button" class="close close-alert-word-status" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<span>{{t "Alert words can't be empty!"}}</span>
|
||||
<span class="alert_word_status_text"></span>
|
||||
</div>
|
||||
<ul id="alert_words_list"></ul>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user