mirror of https://github.com/zulip/zulip.git
Make check-box subscription settings' HTML more generic
(imported from commit 58c02449245bd03eedab1ee6eabebdbd972d1678)
This commit is contained in:
parent
3424bbd8d7
commit
b8a5ba56b9
|
@ -148,24 +148,11 @@ function set_stream_property(stream_name, property, value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function stream_home_view_clicked(e) {
|
function stream_home_view_clicked(e) {
|
||||||
var in_home_view, cb;
|
|
||||||
if (e.target.type === "checkbox") {
|
|
||||||
in_home_view = e.target.checked;
|
|
||||||
} else {
|
|
||||||
cb = $(e.target).closest('.sub_setting_show_in_home').children('.sub_setting_show_in_home_cb')[0];
|
|
||||||
in_home_view = !cb.checked;
|
|
||||||
$(cb).prop("checked", in_home_view);
|
|
||||||
}
|
|
||||||
|
|
||||||
var sub_row = $(e.target).closest('.subscription_row');
|
var sub_row = $(e.target).closest('.subscription_row');
|
||||||
var stream = sub_row.find('.subscription_name').text();
|
var stream = sub_row.find('.subscription_name').text();
|
||||||
|
|
||||||
if (in_home_view === undefined) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var sub = get_sub(stream);
|
var sub = get_sub(stream);
|
||||||
sub.in_home_view = in_home_view;
|
sub.in_home_view = ! sub.in_home_view;
|
||||||
|
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
home_msg_list.clear({clear_selected_id: false});
|
home_msg_list.clear({clear_selected_id: false});
|
||||||
|
@ -192,7 +179,7 @@ function stream_home_view_clicked(e) {
|
||||||
}, 0);
|
}, 0);
|
||||||
|
|
||||||
exports.maybe_toggle_all_messages();
|
exports.maybe_toggle_all_messages();
|
||||||
set_stream_property(stream, 'in_home_view', in_home_view);
|
set_stream_property(stream, 'in_home_view', sub.in_home_view);
|
||||||
}
|
}
|
||||||
|
|
||||||
function set_color(stream_name, color) {
|
function set_color(stream_name, color) {
|
||||||
|
@ -738,7 +725,15 @@ $(function () {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#subscriptions_table").on("click", ".sub_setting_show_in_home", stream_home_view_clicked);
|
$("#subscriptions_table").on("click", ".sub_setting_checkbox", function (e) {
|
||||||
|
var control = $(e.target).closest('.sub_setting_checkbox').find('.sub_setting_control');
|
||||||
|
// A hack. Don't change the state of the checkbox if we
|
||||||
|
// clicked on the checkbox itself.
|
||||||
|
if (control[0] !== e.target) {
|
||||||
|
control.prop("checked", ! control.prop("checked"));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$("#subscriptions_table").on("click", "#sub_setting_in_home_view", stream_home_view_clicked);
|
||||||
|
|
||||||
if (! should_render_subscribers()) {
|
if (! should_render_subscribers()) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -875,13 +875,8 @@ table.floating_recipient {
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sub_setting_show_in_home {
|
.sub_setting_control[type="checkbox"] {
|
||||||
margin-left: 20px;
|
margin: 0 30px 5px 20px;
|
||||||
margin-bottom: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sub_setting_show_in_home_label {
|
|
||||||
margin-left: 30px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.sub_setting_control {
|
.sub_setting_control {
|
||||||
|
|
|
@ -26,9 +26,9 @@
|
||||||
</p>
|
</p>
|
||||||
<span class="sub_settings_title">Settings</span>
|
<span class="sub_settings_title">Settings</span>
|
||||||
<ul>
|
<ul>
|
||||||
<li><div class="sub_setting_show_in_home">
|
<li><div id="sub_setting_in_home_view" class="sub_setting_checkbox">
|
||||||
<input class="sub_setting_show_in_home_cb" type="checkbox" name="Include in home" value="in_home_view" {{#if in_home_view}}checked{{/if}} />
|
<input class="sub_setting_control" type="checkbox" {{#if in_home_view}}checked{{/if}} />
|
||||||
<span class="sub_setting_show_in_home_label">Include in home view</span></div>
|
Include in home view</div>
|
||||||
</li>
|
</li>
|
||||||
<li><span class="sub_setting_control"><input class="colorpicker" type="text" value="{{color}}" /></span>
|
<li><span class="sub_setting_control"><input class="colorpicker" type="text" value="{{color}}" /></span>
|
||||||
Stream color
|
Stream color
|
||||||
|
|
Loading…
Reference in New Issue