mirror of
https://github.com/zulip/zulip.git
synced 2025-11-12 01:47:41 +00:00
Make make_loading_indicator take its optional text via an options argument
(imported from commit 935f9049c00183f52bad80d54520f81efceb3e49)
This commit is contained in:
@@ -131,7 +131,7 @@ $(function () {
|
||||
jQuery.each($('#bot_avatar_file_input')[0].files, function (i, file) {
|
||||
formData.append('file-'+i, file);
|
||||
});
|
||||
util.make_loading_indicator($('#create_bot_spinner'), 'Adding bot');
|
||||
util.make_loading_indicator($('#create_bot_spinner'), {text: 'Adding bot'});
|
||||
$('#create_bot_button').hide();
|
||||
$.ajax({
|
||||
url: '/json/create_bot',
|
||||
|
||||
@@ -5,7 +5,7 @@ $(function () {
|
||||
// Display loading indicator. This disappears after the first
|
||||
// get_updates completes.
|
||||
if (page_params.have_initial_messages) {
|
||||
util.make_loading_indicator($('#page_loading_indicator'), 'Loading...');
|
||||
util.make_loading_indicator($('#page_loading_indicator'), {text: 'Loading...'});
|
||||
} else if (!page_params.needs_tutorial) {
|
||||
util.show_first_run_message();
|
||||
}
|
||||
|
||||
@@ -32,15 +32,16 @@ exports.set_favicon = function (url) {
|
||||
}
|
||||
};
|
||||
|
||||
exports.make_loading_indicator = function (container, text) {
|
||||
exports.make_loading_indicator = function (container, opts) {
|
||||
opts = $.extend({}, opts);
|
||||
container.empty();
|
||||
var spinner_elem = $('<div class="loading_indicator_spinner"></div>');
|
||||
container.append(spinner_elem);
|
||||
var text_width = 0;
|
||||
|
||||
if (text !== '' && text !== undefined) {
|
||||
if (opts.text !== undefined && opts.text !== '') {
|
||||
var text_elem = $('<span class="loading_indicator_text"></span>');
|
||||
text_elem.text(text);
|
||||
text_elem.text(opts.text);
|
||||
container.append(text_elem);
|
||||
// See note, below
|
||||
text_width = 20 + text_elem.width();
|
||||
|
||||
Reference in New Issue
Block a user