settings: Move display_checkmark to settings_ui.js.

This commit is contained in:
Tim Abbott 2018-03-04 18:13:29 -08:00
parent 6a06e453c7
commit 4d8e18e58f
3 changed files with 11 additions and 10 deletions

View File

@ -7,13 +7,6 @@ var exports = {};
// string within it. // string within it.
var strings = {}; var strings = {};
exports.display_checkmark = function ($elem) {
var check_mark = document.createElement("img");
check_mark.src = "/static/images/checkbox-green.svg";
$elem.prepend(check_mark);
$(check_mark).css("width","13px");
};
function change_display_setting(data, status_element, success_msg) { function change_display_setting(data, status_element, success_msg) {
var spinner = $(status_element).expectOne(); var spinner = $(status_element).expectOne();
loading.make_indicator(spinner, {text: strings.saving}); loading.make_indicator(spinner, {text: strings.saving});
@ -26,7 +19,7 @@ function change_display_setting(data, status_element, success_msg) {
data: data, data: data,
success: function () { success: function () {
ui_report.success(success_msg, $(status_element).expectOne()); ui_report.success(success_msg, $(status_element).expectOne());
exports.display_checkmark(spinner); settings_ui.display_checkmark(spinner);
}, },
error: function (xhr) { error: function (xhr) {
ui_report.error(strings.failure, xhr, $(status_element).expectOne()); ui_report.error(strings.failure, xhr, $(status_element).expectOne());
@ -151,7 +144,7 @@ exports.report_emojiset_change = function () {
ui_report.success(i18n.t("Emojiset changed successfully!"), ui_report.success(i18n.t("Emojiset changed successfully!"),
$('#emoji-settings-status').expectOne()); $('#emoji-settings-status').expectOne());
var spinner = $("#emoji-settings-status").expectOne(); var spinner = $("#emoji-settings-status").expectOne();
exports.display_checkmark(spinner); settings_ui.display_checkmark(spinner);
} }
} }

View File

@ -2,6 +2,13 @@ var settings_ui = (function () {
var exports = {}; var exports = {};
exports.display_checkmark = function ($elem) {
var check_mark = document.createElement("img");
check_mark.src = "/static/images/checkbox-green.svg";
$elem.prepend(check_mark);
$(check_mark).css("width", "13px");
};
// This function is used to disable sub-setting when main setting is checked or unchecked // This function is used to disable sub-setting when main setting is checked or unchecked
// or two settings are inter-dependent on their values values. // or two settings are inter-dependent on their values values.
// * is_checked is boolean, shows if the main setting is checked or not. // * is_checked is boolean, shows if the main setting is checked or not.

View File

@ -49,7 +49,8 @@ enforce_fully_covered = {
'static/js/recent_senders.js', 'static/js/recent_senders.js',
'static/js/rtl.js', 'static/js/rtl.js',
'static/js/search_suggestion.js', 'static/js/search_suggestion.js',
'static/js/settings_ui.js', # Removed because we're migrating code from uncovered other settings pages to here.
# 'static/js/settings_ui.js',
'static/js/settings_user_groups.js', 'static/js/settings_user_groups.js',
'static/js/stream_data.js', 'static/js/stream_data.js',
'static/js/stream_events.js', 'static/js/stream_events.js',