From 7a6068c3ad67f2839161021d0a3a87de169489fd Mon Sep 17 00:00:00 2001 From: Waseem Daher Date: Tue, 15 Jan 2013 16:19:38 -0500 Subject: [PATCH] Colorize the stream bar in the composebox based on where we're writing. (imported from commit 8e9bddf465661826d63fe0f79e3f1bd6b903cf4d) --- zephyr/static/js/compose.js | 10 ++++++++++ zephyr/static/js/ui.js | 2 ++ 2 files changed, 12 insertions(+) diff --git a/zephyr/static/js/compose.js b/zephyr/static/js/compose.js index ae0592ea82..d65bc96041 100644 --- a/zephyr/static/js/compose.js +++ b/zephyr/static/js/compose.js @@ -51,6 +51,15 @@ function show(tabname, focus_area) { focus_area.select(); } +// In an attempt to decrease mixing, make the composebox's +// stream bar look like what you're replying to. +// (In particular, if there's a color associated with it, +// have that color be reflected here too.) +exports.decorate_stream_bar = function (stream_name) { + var color = subs.get_color(stream_name); + $("#stream-message .message_header_stream").css("background-color", color); +}; + exports.start = function (msg_type, opts) { if (reload.is_in_progress()) { return; @@ -89,6 +98,7 @@ exports.start = function (msg_type, opts) { } is_composing_message = msg_type; + exports.decorate_stream_bar(opts.stream); $(document).trigger($.Event('compose_started.zephyr', opts)); }; diff --git a/zephyr/static/js/ui.js b/zephyr/static/js/ui.js index f1fa1f873a..e8d0975727 100644 --- a/zephyr/static/js/ui.js +++ b/zephyr/static/js/ui.js @@ -685,6 +685,8 @@ $(function () { $("#search_up") .on("click", function () { search.search_button_handler(true); }); $("#search_down").on("click", function () { search.search_button_handler(false); }); $("#search_exit").on("click", search.clear_search); + + $("#stream").on('blur', function () { compose.decorate_stream_bar(this.value); }); }); return exports;