make jobs schedules disabled if the user doesn't have permission to edit

This commit is contained in:
John Mitchell
2017-01-30 13:29:21 -05:00
parent ba2ff026b3
commit 4b2daba3f7
4 changed files with 17 additions and 6 deletions

View File

@@ -25,6 +25,7 @@ export default
ngClick: "toggleSchedule($event, schedule.id)", ngClick: "toggleSchedule($event, schedule.id)",
nosort: true, nosort: true,
awToolTip: "{{ schedule.play_tip }}", awToolTip: "{{ schedule.play_tip }}",
ngDisabled: "!schedule.summary_fields.user_capabilities.edit",
dataTipWatch: "schedule.play_tip", dataTipWatch: "schedule.play_tip",
dataPlacement: 'top' dataPlacement: 'top'
}, },

View File

@@ -6,9 +6,11 @@
border-radius: 5px; border-radius: 5px;
border: 1px solid @default-icon; border: 1px solid @default-icon;
background-color: @default-icon; background-color: @default-icon;
width: 40px; width: 42px;
margin-top: 2px; margin-top: 2px;
cursor: pointer; cursor: pointer;
display: flex;
height: 18px;
} }
.ScheduleToggle-switch { .ScheduleToggle-switch {
@@ -22,6 +24,10 @@
font-size: 11px; font-size: 11px;
border-top-right-radius: 4px; border-top-right-radius: 4px;
border-bottom-right-radius: 4px; border-bottom-right-radius: 4px;
padding-top: 0px;
margin-top: 0px;
border-top: 0px;
border-bottom: 0px;
} }
.ScheduleToggle.is-on { .ScheduleToggle.is-on {

View File

@@ -509,12 +509,16 @@ angular.module('GeneratorHelpers', [systemStatus.name])
html += (field['class']) ? " " + field['class'] : ""; html += (field['class']) ? " " + field['class'] : "";
html += " " + field.columnClass; html += " " + field.columnClass;
html += "\"><div class='ScheduleToggle' ng-class='{\"is-on\": " + list.iterator + "."; html += "\"><div class='ScheduleToggle' ng-class='{\"is-on\": " + list.iterator + ".";
html += (field.flag) ? field.flag : "enabled"; html += (field.flag) ? field.flag : "enabled\}' ";
html += "\}' aw-tool-tip='" + field.awToolTip + "' data-placement='" + field.dataPlacement + "' data-tip-watch='" + field.dataTipWatch + "'><div ng-show='" + list.iterator + "." ; html += "aw-tool-tip='" + field.awToolTip + "' data-placement='" + field.dataPlacement + "' data-tip-watch='" + field.dataTipWatch + "'><button ";
html += (field['ngDisabled']) ? `ng-disabled="${field['ngDisabled']}" ` : "";
html += "ng-show='" + list.iterator + "." ;
html += (field.flag) ? field.flag : 'enabled'; html += (field.flag) ? field.flag : 'enabled';
html += "' class='ScheduleToggle-switch is-on' ng-click='" + field.ngClick + "'>ON</div><div ng-show='!" + list.iterator + "." ; html += "' class='ScheduleToggle-switch is-on' ng-click='" + field.ngClick + "'>ON</button><button ";
html += (field['ngDisabled']) ? `ng-disabled="${field['ngDisabled']}" ` : "";
html += "ng-show='!" + list.iterator + "." ;
html += (field.flag) ? field.flag : "enabled"; html += (field.flag) ? field.flag : "enabled";
html += "' class='ScheduleToggle-switch' ng-click='" + field.ngClick + "'>OFF</div></div></td>"; html += "' class='ScheduleToggle-switch' ng-click='" + field.ngClick + "'>OFF</button></div></td>";
} else { } else {
html += "<td class=\"List-tableCell " + fld + "-column"; html += "<td class=\"List-tableCell " + fld + "-column";
html += (field['class']) ? " " + field['class'] : ""; html += (field['class']) ? " " + field['class'] : "";