Disable notification type/method combinations that are not available

This commit is contained in:
Toby Zerner 2015-03-28 15:43:52 +10:30
parent ffca22dcc7
commit f330561025
4 changed files with 15 additions and 6 deletions

View File

@ -9,6 +9,7 @@ export default Ember.Component.extend({
classNames: ['yesno-control'],
toggleState: true,
disabled: false,
didInsertElement: function() {
var component = this;

View File

@ -43,7 +43,8 @@ export default Ember.Component.extend({
type: type,
method: method,
enabled: !!user.get(preferenceKey),
loading: false
loading: false,
disabled: typeof user.get(preferenceKey) == 'undefined'
});
cell.set('save', function(value, component) {
cell.set('loading', true);

View File

@ -31,7 +31,7 @@
border-bottom: 1px solid @fl-body-bg;
color: @fl-body-control-color;
}
& td, & th, & .yesno-cell .yesno {
& td, & th, & .yesno {
padding: 10px 15px;
}
& thead {
@ -47,12 +47,19 @@
}
}
& .yesno-cell {
padding: 0;
}
& .yesno-control {
display: block;
}
& .yesno {
text-align: center;
cursor: pointer;
padding: 0;
&:hover, &.highlighted {
background: darken(@fl-body-control-bg, 4%);
&:not(.disabled) {
&:hover, &.highlighted {
background: darken(@fl-body-control-bg, 4%);
}
}
}
& .toggle-group {

View File

@ -12,7 +12,7 @@
<tr>
<td class="toggle-group" {{action "toggleType" row.type}}>{{row.label}}</td>
{{#each row.cells as |cell|}}
<td class="yesno-cell">{{ui/yesno-input toggleState=cell.enabled changed=cell.save loading=cell.loading}}</td>
<td class="yesno-cell">{{ui/yesno-input toggleState=cell.enabled changed=cell.save loading=cell.loading disabled=cell.disabled}}</td>
{{/each}}
</tr>
{{/each}}