mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 05:53:43 +00:00
Extract topic_list.update_count_in_dom().
This creates the new topic_list.js module, and the first function that we extract is topic_list.update_count_in_dom(). This function needed to be decoupled from some non-topic-list stuff which was overly complicated.
This commit is contained in:
@@ -362,8 +362,7 @@ exports.set_subject_count = function (stream, subject, count) {
|
||||
return;
|
||||
}
|
||||
|
||||
count_span.removeClass("zero_count");
|
||||
update_count_in_dom(count_span, value_span, count);
|
||||
topic_list.update_count_in_dom(count_span, value_span, count);
|
||||
};
|
||||
|
||||
|
||||
|
||||
20
static/js/topic_list.js
Normal file
20
static/js/topic_list.js
Normal file
@@ -0,0 +1,20 @@
|
||||
var topic_list = (function () {
|
||||
|
||||
var exports = {};
|
||||
|
||||
exports.update_count_in_dom = function (count_span, value_span, count) {
|
||||
if (count === 0) {
|
||||
count_span.hide();
|
||||
value_span.text('');
|
||||
} else {
|
||||
count_span.removeClass("zero_count");
|
||||
count_span.show();
|
||||
value_span.text(count);
|
||||
}
|
||||
};
|
||||
|
||||
return exports;
|
||||
}());
|
||||
if (typeof module !== 'undefined') {
|
||||
module.exports = topic_list;
|
||||
}
|
||||
@@ -29,7 +29,7 @@ var globals =
|
||||
+ ' avatar feature_flags search_suggestion referral stream_color Dict'
|
||||
+ ' Filter summary admin stream_data muting WinChan muting_ui Socket channel gear_menu'
|
||||
+ ' message_flags bot_data loading favicon resize scroll_bar condense floating_recipient_bar'
|
||||
+ ' copy_and_paste click_handlers'
|
||||
+ ' copy_and_paste click_handlers topic_list'
|
||||
|
||||
// colorspace.js
|
||||
+ ' colorspace'
|
||||
|
||||
@@ -760,6 +760,7 @@ JS_SPECS = {
|
||||
'js/viewport.js',
|
||||
'js/rows.js',
|
||||
'js/unread.js',
|
||||
'js/topic_list.js',
|
||||
'js/stream_list.js',
|
||||
'js/filter.js',
|
||||
'js/message_list_view.js',
|
||||
|
||||
Reference in New Issue
Block a user