Skip to content

Commit

Permalink
fix inversion hide/show
Browse files Browse the repository at this point in the history
  • Loading branch information
ggazzo committed Jan 27, 2018
1 parent 1b77402 commit dbacccb
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@
<main class="rc-user-info__scroll">
<div class="rc-user-info__row rc-user-info__row--separator">
<div class="rc-switch-double">
<div class="rc-switch-double__label {{#if disableNotifications}}disabled{{/if}}">
<div class="rc-switch-double__label {{#if notificationIsEnabled}}disabled{{/if}}">
{{_ "Turn_OFF"}}
<div class="rc-switch-double__description">
{{_ "Mute_all_notifications"}}
</div>
</div>
<div class="rc-switch rc-switch--blue">
<label class="rc-switch__label">
<input type="checkbox" class="rc-switch__input js-input-check" value="0" id="disableNotifications" name="disableNotifications" checked="{{$eq disableNotifications true}}">
<input type="checkbox" class="rc-switch__input js-input-check" value="0" id="disableNotifications" name="disableNotifications" checked="{{$eq notificationIsEnabled true}}">
<span class="rc-switch__button">
<span class="rc-switch__button-inside"></span>
</span>
</label>
</div>
<div class="rc-switch-double__label {{#unless disableNotifications}}disabled{{/unless}}">
<div class="rc-switch-double__label {{#unless notificationIsEnabled}}disabled{{/unless}}">
{{_ "Turn_ON"}}
<div class="rc-switch-double__description">
{{_ "Receive_alerts"}}
Expand All @@ -26,29 +26,29 @@
</div>
<div class="rc-user-info__row rc-user-info__row--separator">
<div class="rc-switch-double">
<div class="rc-switch-double__label {{#if hideUnreadStatus}}disabled{{/if}}">
<div class="rc-switch-double__label {{#if showUnreadStatus}}disabled{{/if}}">
{{_ "Hide_counter"}}
<div class="rc-switch-double__description">
{{_ "Do_not_display_unread_counter"}}
</div>
</div>
<div class="rc-switch rc-switch--blue">
<label class="rc-switch__label">
<input type="checkbox" class="rc-switch__input js-input-check" id="hideUnreadStatus" name="hideUnreadStatus" value="1" checked="{{$eq hideUnreadStatus true}}">
<input type="checkbox" class="rc-switch__input js-input-check" id="hideUnreadStatus" name="hideUnreadStatus" value="1" checked="{{$eq showUnreadStatus true}}">
<span class="rc-switch__button">
<span class="rc-switch__button-inside"></span>
</span>
</label>
</div>
<div class="rc-switch-double__label {{#unless hideUnreadStatus}}disabled{{/unless}}">
<div class="rc-switch-double__label {{#unless showUnreadStatus}}disabled{{/unless}}">
{{_ "Show_counter"}}
<div class="rc-switch-double__description">
{{_ "Display_unread_counter"}}
</div>
</div>
</div>
</div>
{{#if disableNotifications}}
{{#if notificationIsEnabled}}
<div class="rc-user-info__row rc-user-info__row--separator">
<div class="rc-user-info__config">
<div class="rc-user-info__config-header">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,15 @@ const call = (method, ...params) => {
};

Template.pushNotificationsFlexTab.helpers({
notificationIsEnabled() {
return !Template.instance().form.disableNotifications.get();
},
disableNotifications() {
return Template.instance().form.disableNotifications.get();
},
showUnreadStatus() {
return !Template.instance().form.hideUnreadStatus.get();
},
hideUnreadStatus() {
return Template.instance().form.hideUnreadStatus.get();
},
Expand Down Expand Up @@ -197,7 +203,9 @@ Template.pushNotificationsFlexTab.events({

'change input[type=checkbox]'(e, instance) {
e.preventDefault();
instance.form[$(e.currentTarget).attr('name')].set(e.currentTarget.checked);
const name = $(e.currentTarget).attr('name');
const checked = ['disableNotifications', 'hideUnreadStatus'].includes(name) ? !e.currentTarget.checked : e.currentTarget.checked;
instance.form[name].set(checked);
},

'click .rc-user-info__config-value'(e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
&__wrapper {
overflow-x: hidden;
overflow-y: auto;

height: 100%;
}

&__header,
Expand Down

0 comments on commit dbacccb

Please sign in to comment.