mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 22:13:26 +00:00
compose_ui: Extract method to set color of stream header bar.
Similar method will be used to set color for stream selection bar when editing stream of topic/message.
This commit is contained in:
@@ -30,4 +30,28 @@ exports.blur_active_element = function () {
|
||||
document.activeElement.blur();
|
||||
};
|
||||
|
||||
function update_lock_icon_for_stream(stream_name) {
|
||||
const icon = $("#compose-lock-icon");
|
||||
const streamfield = $("#stream_message_recipient_stream");
|
||||
if (stream_data.get_invite_only(stream_name)) {
|
||||
icon.show();
|
||||
streamfield.addClass("lock-padding");
|
||||
} else {
|
||||
icon.hide();
|
||||
streamfield.removeClass("lock-padding");
|
||||
}
|
||||
}
|
||||
|
||||
// In an attempt to decrease mixing, set stream bar
|
||||
// color look like the stream being used.
|
||||
// (In particular, if there's a color associated with it,
|
||||
// have that color be reflected here too.)
|
||||
exports.decorate_stream_bar = function (stream_name, element) {
|
||||
const color = stream_data.get_color(stream_name);
|
||||
update_lock_icon_for_stream(stream_name);
|
||||
element.css('background-color', color)
|
||||
.removeClass(stream_color.color_classes)
|
||||
.addClass(stream_color.get_color_class(color));
|
||||
};
|
||||
|
||||
window.ui_util = exports;
|
||||
|
||||
Reference in New Issue
Block a user