mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 21:13:36 +00:00
js: Normalize strings to double quotes.
Prettier would do this anyway, but it’s separated out for a more reviewable diff. Generated by ESLint. Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
06691e1e45
commit
f3726db89a
@@ -1,11 +1,11 @@
|
||||
const render_alert_word_settings_item = require('../templates/settings/alert_word_settings_item.hbs');
|
||||
const render_alert_word_settings_item = require("../templates/settings/alert_word_settings_item.hbs");
|
||||
|
||||
exports.render_alert_words_ui = function () {
|
||||
const words = alert_words.get_word_list();
|
||||
words.sort();
|
||||
const word_list = $('#alert_words_list');
|
||||
const word_list = $("#alert_words_list");
|
||||
|
||||
word_list.find('.alert-word-item').remove();
|
||||
word_list.find(".alert-word-item").remove();
|
||||
|
||||
for (const alert_word of words) {
|
||||
const rendered_alert_word = render_alert_word_settings_item({
|
||||
@@ -15,23 +15,23 @@ exports.render_alert_words_ui = function () {
|
||||
}
|
||||
|
||||
// Focus new alert word name text box.
|
||||
$('#create_alert_word_name').focus();
|
||||
$("#create_alert_word_name").focus();
|
||||
};
|
||||
|
||||
function update_alert_word_status(status_text, is_error) {
|
||||
const alert_word_status = $('#alert_word_status');
|
||||
const alert_word_status = $("#alert_word_status");
|
||||
if (is_error) {
|
||||
alert_word_status.removeClass('alert-success').addClass('alert-danger');
|
||||
alert_word_status.removeClass("alert-success").addClass("alert-danger");
|
||||
} else {
|
||||
alert_word_status.removeClass('alert-danger').addClass('alert-success');
|
||||
alert_word_status.removeClass("alert-danger").addClass("alert-success");
|
||||
}
|
||||
alert_word_status.find('.alert_word_status_text').text(status_text);
|
||||
alert_word_status.find(".alert_word_status_text").text(status_text);
|
||||
alert_word_status.show();
|
||||
}
|
||||
|
||||
function add_alert_word(alert_word) {
|
||||
alert_word = $.trim(alert_word);
|
||||
if (alert_word === '') {
|
||||
if (alert_word === "") {
|
||||
update_alert_word_status(i18n.t("Alert word can't be empty!"), true);
|
||||
return;
|
||||
} else if (alert_words.has_alert_word(alert_word)) {
|
||||
@@ -42,13 +42,13 @@ function add_alert_word(alert_word) {
|
||||
const words_to_be_added = [alert_word];
|
||||
|
||||
channel.post({
|
||||
url: '/json/users/me/alert_words',
|
||||
url: "/json/users/me/alert_words",
|
||||
data: {alert_words: JSON.stringify(words_to_be_added)},
|
||||
success: function () {
|
||||
const message = i18n.t('Alert word "__word__" added successfully!',
|
||||
{word: words_to_be_added[0]});
|
||||
update_alert_word_status(message, false);
|
||||
$('#create_alert_word_name').val('');
|
||||
$("#create_alert_word_name").val("");
|
||||
},
|
||||
error: function () {
|
||||
update_alert_word_status(i18n.t("Error adding alert word!"), true);
|
||||
@@ -60,7 +60,7 @@ function remove_alert_word(alert_word) {
|
||||
const words_to_be_removed = [alert_word];
|
||||
|
||||
channel.del({
|
||||
url: '/json/users/me/alert_words',
|
||||
url: "/json/users/me/alert_words",
|
||||
data: {alert_words: JSON.stringify(words_to_be_removed)},
|
||||
success: function () {
|
||||
update_alert_word_status(i18n.t("Alert word removed successfully!"), false);
|
||||
@@ -76,17 +76,17 @@ exports.set_up_alert_words = function () {
|
||||
|
||||
exports.render_alert_words_ui();
|
||||
|
||||
$('#create_alert_word_form').on('click', '#create_alert_word_button', () => {
|
||||
const word = $('#create_alert_word_name').val();
|
||||
$("#create_alert_word_form").on("click", "#create_alert_word_button", () => {
|
||||
const word = $("#create_alert_word_name").val();
|
||||
add_alert_word(word);
|
||||
});
|
||||
|
||||
$('#alert_words_list').on('click', '.remove-alert-word', (event) => {
|
||||
const word = $(event.currentTarget).parents('li').find('.value').text();
|
||||
$("#alert_words_list").on("click", ".remove-alert-word", (event) => {
|
||||
const word = $(event.currentTarget).parents("li").find(".value").text();
|
||||
remove_alert_word(word);
|
||||
});
|
||||
|
||||
$('#create_alert_word_form').on('keypress', '#create_alert_word_name', (event) => {
|
||||
$("#create_alert_word_form").on("keypress", "#create_alert_word_name", (event) => {
|
||||
const key = event.which;
|
||||
// Handle enter (13) as "add".
|
||||
if (key === 13) {
|
||||
@@ -97,9 +97,9 @@ exports.set_up_alert_words = function () {
|
||||
}
|
||||
});
|
||||
|
||||
$('#alert-word-settings').on('click', '.close-alert-word-status', (event) => {
|
||||
$("#alert-word-settings").on("click", ".close-alert-word-status", (event) => {
|
||||
event.preventDefault();
|
||||
const alert = $(event.currentTarget).parents('.alert');
|
||||
const alert = $(event.currentTarget).parents(".alert");
|
||||
alert.hide();
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user