mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 13:33:24 +00:00
subs: Find elements using the new data-stream-id value.
This is preparation for no longer having the subscription inside the subscription_row object.
This commit is contained in:
@@ -93,9 +93,9 @@ exports.update_stream_color = function (sub, stream_name, color, opts) {
|
||||
sub.color = color;
|
||||
var id = parseInt(sub.stream_id, 10);
|
||||
// The swatch in the subscription row header.
|
||||
$("#subscription_" + id + " .color_swatch").css('background-color', color);
|
||||
$(".stream-row[data-stream-id='" + id + "'] .color_swatch").css('background-color', color);
|
||||
// The swatch in the color picker.
|
||||
exports.set_colorpicker_color($("#subscription_" + id + " .colorpicker"), color);
|
||||
exports.set_colorpicker_color($(".stream-row[data-stream-id='" + id + "'] .colorpicker"), color);
|
||||
|
||||
if (opts.update_historical) {
|
||||
update_historical_message_color(stream_name, color);
|
||||
|
||||
@@ -117,7 +117,7 @@ function update_in_home_view(sub, value) {
|
||||
|
||||
stream_list.set_in_home_view(sub.name, sub.in_home_view);
|
||||
|
||||
var not_in_home_view_checkbox = $("#subscription_" + sub.stream_id + " #sub_setting_not_in_home_view .sub_setting_control");
|
||||
var not_in_home_view_checkbox = $(".subscription_settings[data-stream-id='" + sub.stream_id + "'] #sub_setting_not_in_home_view .sub_setting_control");
|
||||
not_in_home_view_checkbox.prop('checked', !value);
|
||||
}
|
||||
|
||||
@@ -133,13 +133,13 @@ exports.toggle_pin_to_top_stream = function (stream_name) {
|
||||
};
|
||||
|
||||
function update_stream_desktop_notifications(sub, value) {
|
||||
var desktop_notifications_checkbox = $("#subscription_" + sub.stream_id + " #sub_desktop_notifications_setting .sub_setting_control");
|
||||
var desktop_notifications_checkbox = $(".subscription_settings[data-stream-id='" + sub.stream_id + "'] #sub_desktop_notifications_setting .sub_setting_control");
|
||||
desktop_notifications_checkbox.prop('checked', value);
|
||||
sub.desktop_notifications = value;
|
||||
}
|
||||
|
||||
function update_stream_audible_notifications(sub, value) {
|
||||
var audible_notifications_checkbox = $("#subscription_" + sub.stream_id + " #sub_audible_notifications_setting .sub_setting_control");
|
||||
var audible_notifications_checkbox = $(".subscription_settings[data-stream-id='" + sub.stream_id + "'] #sub_audible_notifications_setting .sub_setting_control");
|
||||
audible_notifications_checkbox.prop('checked', value);
|
||||
sub.audible_notifications = value;
|
||||
}
|
||||
@@ -215,18 +215,18 @@ function create_sub(stream_name, attrs) {
|
||||
|
||||
function button_for_sub(sub) {
|
||||
var id = parseInt(sub.stream_id, 10);
|
||||
return $("#subscription_" + id + " .sub_unsub_button");
|
||||
return $(".stream-row[data-stream-id='" + id + "'] .sub_unsub_button");
|
||||
}
|
||||
|
||||
function settings_for_sub(sub) {
|
||||
var id = parseInt(sub.stream_id, 10);
|
||||
return $("#subscription_settings_" + id);
|
||||
return $(".stream-row[data-stream-id='" + id + "'] .subscription_settings");
|
||||
}
|
||||
|
||||
exports.rerender_subscribers_count = function (sub) {
|
||||
var id = parseInt(sub.stream_id, 10);
|
||||
stream_data.update_subscribers_count(sub);
|
||||
$("#subscription_" + id + " .subscriber_count").text(sub.subscriber_count);
|
||||
$(".stream-row[data-stream-id='" + id + "'] .subscriber_count").text(sub.subscriber_count);
|
||||
};
|
||||
|
||||
exports.show_settings_for = function (stream_name) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<div id="subscription_settings_{{stream_id}}" class="collapse subscription_settings">
|
||||
<div id="subscription_settings_{{stream_id}}" class="collapse subscription_settings" data-stream-id="{{stream_id}}">
|
||||
<div class="regular_subscription_settings collapse {{#subscribed}}in{{/subscribed}}">
|
||||
<div class="subscription-type">
|
||||
{{partial "subscription_type"}}
|
||||
|
||||
Reference in New Issue
Block a user