Skip to content

Commit

Permalink
Cleanup code - replace added block with toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
ferdifly committed Feb 19, 2018
1 parent 7925eaf commit 23e0195
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
20 changes: 8 additions & 12 deletions packages/rocketchat-ui-account/client/accountPreferences.html
Original file line number Diff line number Diff line change
Expand Up @@ -215,23 +215,19 @@ <h1>{{_ "Messages"}}</h1>
</div>
<div class="input-line double-col" id="emailNotificationMode">
<label>{{_ "Email_Notification_Mode"}}</label>
{{# if allowNotificationsChange}}
<div>
<select class="input-monitor rc-input__element" name="emailNotificationMode">
<option value="disabled" selected="{{selected 'emailNotificationMode' 'disabled'}}">{{_ "Email_Notification_Mode_Disabled"}}</option>
{{# with canChange=allowNotificationsChange}}
<select class="input-monitor rc-input__element" name="emailNotificationMode" {{ifThenElse canChange '' 'disabled'}}>
<option value="disabled" selected="{{selected 'emailNotificationMode' 'disabled'}}" >{{_ "Email_Notification_Mode_Disabled"}}</option>
<option value="all" selected="{{selected 'emailNotificationMode' 'all'}}">{{_ "Email_Notification_Mode_All"}}</option>
</select>
<div class="info">{{_ "You_need_to_verifiy_your_email_address_to_get_notications"}}</div>
</div>
{{else}}
<div>
<select class="input-monitor rc-input__element" name="emailNotificationMode" disabled>
<option value="disabled" selected>{{_ "Email_Notification_Mode_Disabled"}}</option>
<option value="all">{{_ "Email_Notification_Mode_All"}}</option>
</select>
{{# if canChange}}
<div class="info">{{_ "You_need_to_verifiy_your_email_address_to_get_notications"}}</div>
{{else}}
<div class="info">{{_ "Email_Notifications_Change_Disabled"}}</div>
{{/if}}
{{/with}}
</div>
{{/if}}
</div>
</div>
</div>
Expand Down
3 changes: 3 additions & 0 deletions packages/rocketchat-ui-account/client/accountPreferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ Template.accountPreferences.helpers({
}
return result;
},
ifThenElse(condition, val, not = '') {
return condition ? val : not;
},
checked(property, value, defaultValue=undefined) {
return checkedSelected(property, value, defaultValue);
},
Expand Down

0 comments on commit 23e0195

Please sign in to comment.