Skip to content

Commit

Permalink
user settings: Make "Mobile push notifications always" a subsetting.
Browse files Browse the repository at this point in the history
"Mobile push notifications always" is now indented and a
sub-setting of "Mobile push notifications when offline".
It can be selected only when the outer setting is
selected, otherwise it is greyed out.

Fixes zulip#6570.
  • Loading branch information
alirizwi authored and timabbott committed Sep 30, 2017
1 parent 6c1c294 commit 6c0ea18
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
10 changes: 10 additions & 0 deletions static/js/settings_notifications.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,16 @@ exports.set_up = function () {
$("#pm_content_in_desktop_notifications_label").parent().addClass("control-label-disabled");
}
});

$("#enable_offline_push_notifications").change(function () {
if (this.checked) {
$("#enable_online_push_notifications").prop("disabled", false);
$("#enable_online_push_notifications_label").parent().removeClass("control-label-disabled");
} else {
$("#enable_online_push_notifications").prop("disabled", true);
$("#enable_online_push_notifications_label").parent().addClass("control-label-disabled");
}
});
};

function _update_page() {
Expand Down
5 changes: 3 additions & 2 deletions static/templates/settings/notification-settings.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,16 @@
</label>
</div>

<div class="input-group">
<div class="input-group disableable {{#unless page_params.enable_offline_push_notifications}}control-label-disabled{{/unless}}">
<label class="checkbox">
<input type="checkbox" name="enable_online_push_notifications" id="enable_online_push_notifications"
{{#unless page_params.enable_offline_push_notifications}}disabled="disabled"{{/unless}}
{{#if page_params.enable_online_push_notifications}}
checked="checked"
{{/if}} />
<span></span>
</label>
<label for="enable_online_push_notifications" class="inline-block">
<label for="enable_online_push_notifications" id="enable_online_push_notifications_label" class="inline-block">
{{t "Mobile push notifications always (even when online)" }}
</label>
</div>
Expand Down

0 comments on commit 6c0ea18

Please sign in to comment.