mirror of https://github.com/zulip/zulip.git
Display the correct stream color in the color picker when (re-)subscribing.
(imported from commit 56d96799f3a049a0c64cef3bab7f82c9d6420cca)
This commit is contained in:
parent
0adf687bfd
commit
0ad6d7ead1
|
@ -141,12 +141,21 @@ function update_historical_message_color(stream_name, color) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function set_colorpicker_color(colorpicker, color) {
|
||||||
|
colorpicker.spectrum($.extend(subscriptions_table_colorpicker_options,
|
||||||
|
{color: color}));
|
||||||
|
}
|
||||||
|
|
||||||
function update_stream_color(stream_name, color, opts) {
|
function update_stream_color(stream_name, color, opts) {
|
||||||
opts = $.extend({}, {update_historical: false}, opts);
|
opts = $.extend({}, {update_historical: false}, opts);
|
||||||
var sub = get_sub(stream_name);
|
var sub = get_sub(stream_name);
|
||||||
sub.color = color;
|
sub.color = color;
|
||||||
var id = parseInt(sub.id, 10);
|
var id = parseInt(sub.id, 10);
|
||||||
|
// The swatch in the subscription row header.
|
||||||
$("#subscription_" + id + " .color_swatch").css('background-color', color);
|
$("#subscription_" + id + " .color_swatch").css('background-color', color);
|
||||||
|
// The swatch in the color picker.
|
||||||
|
set_colorpicker_color($("#subscription_" + id + " .colorpicker"), color);
|
||||||
|
|
||||||
if (opts.update_historical) {
|
if (opts.update_historical) {
|
||||||
update_historical_message_color(stream_name, color);
|
update_historical_message_color(stream_name, color);
|
||||||
}
|
}
|
||||||
|
@ -810,7 +819,9 @@ $(function () {
|
||||||
$("#subscriptions_table").on("show", ".subscription_settings", function (e) {
|
$("#subscriptions_table").on("show", ".subscription_settings", function (e) {
|
||||||
var subrow = $(e.target).closest('.subscription_row');
|
var subrow = $(e.target).closest('.subscription_row');
|
||||||
var colorpicker = subrow.find('.colorpicker');
|
var colorpicker = subrow.find('.colorpicker');
|
||||||
colorpicker.spectrum(subscriptions_table_colorpicker_options);
|
|
||||||
|
var color = exports.get_color(subrow.find('.subscription_name').text());
|
||||||
|
set_colorpicker_color(colorpicker, color);
|
||||||
|
|
||||||
// To figure out the worst case for an expanded row's height, we do some math:
|
// To figure out the worst case for an expanded row's height, we do some math:
|
||||||
// .subscriber_list_container max-height,
|
// .subscriber_list_container max-height,
|
||||||
|
|
Loading…
Reference in New Issue