Disable individual users TC control when TC is on for everyone; add styling for disabled toggles.

This commit is contained in:
Paulo Reis 2017-06-28 15:31:28 +01:00
parent 318d32360e
commit 3e7027d9ca
2 changed files with 16 additions and 4 deletions

View file

@ -57,28 +57,32 @@
review-panel-toggle( review-panel-toggle(
ng-model="reviewPanel.trackChangesOnForEveryone" ng-model="reviewPanel.trackChangesOnForEveryone"
on-toggle="toggleTrackChangesForEveryone(isOn);" on-toggle="toggleTrackChangesForEveryone(isOn);"
disabled="!project.features.trackChanges"
on-disabled-click="openTrackChangesUpgradeModal"
) )
//- disabled="!project.features.trackChanges"
//- on-disabled-click="openTrackChangesUpgradeModal"
li.rp-tc-state-item li.rp-tc-state-item
span.rp-tc-state-item-name.rp-tc-state-item-self( span.rp-tc-state-item-name.rp-tc-state-item-self(
ng-class="{ 'rp-tc-state-item-name-disabled' : reviewPanel.trackChangesOnForEveryone}"
style="color: hsl({{ users[user.id].hue }}, 70%, 40%);" style="color: hsl({{ users[user.id].hue }}, 70%, 40%);"
) {{ users[user.id].name }} ) {{ users[user.id].name }}
//- {{user.id}} //- {{user.id}}
//- Missing on-toggle attribute because we also need to pass user_id to the toggleTrackChangesForUser //- Missing on-toggle attribute because we also need to pass user_id to the toggleTrackChangesForUser
//- method, and it's not clear how. //- method, and it's not clear how.
review-panel-toggle( review-panel-toggle(
ng-model="reviewPanel.trackChangesState[user.id]" ng-model="reviewPanel.trackChangesOnForEveryone || reviewPanel.trackChangesState[user.id]"
on-toggle="toggleTrackChangesForUser(isOn, user.id);" on-toggle="toggleTrackChangesForUser(isOn, user.id);"
disabled="reviewPanel.trackChangesOnForEveryone"
) )
li.rp-tc-state-item(ng-repeat="member in project.members") li.rp-tc-state-item(ng-repeat="member in project.members")
span.rp-tc-state-item-name( span.rp-tc-state-item-name(
ng-class="{ 'rp-tc-state-item-name-disabled' : reviewPanel.trackChangesOnForEveryone}"
style="color: hsl({{ users[member._id].hue }}, 70%, 40%);" style="color: hsl({{ users[member._id].hue }}, 70%, 40%);"
) {{ users[member._id].name }} ) {{ users[member._id].name }}
//- {{member._id}} //- {{member._id}}
review-panel-toggle( review-panel-toggle(
ng-model="reviewPanel.trackChangesState[member._id]" ng-model="reviewPanel.trackChangesOnForEveryone || reviewPanel.trackChangesState[member._id]"
on-toggle="toggleTrackChangesForUser(isOn, member._id);" on-toggle="toggleTrackChangesForUser(isOn, member._id);"
disabled="reviewPanel.trackChangesOnForEveryone"
) )
//- span.review-panel-toolbar-label(ng-if="permissions.write") //- span.review-panel-toolbar-label(ng-if="permissions.write")

View file

@ -182,6 +182,9 @@
.rp-tc-state-item-name-everyone { .rp-tc-state-item-name-everyone {
color: @red; color: @red;
} }
.rp-tc-state-item-name-disabled {
opacity: .35;
}
.rp-entry-list { .rp-entry-list {
display: none; display: none;
@ -802,6 +805,11 @@
background-color: #FFF; background-color: #FFF;
} }
} }
&:disabled + .rp-toggle-btn {
cursor: default;
opacity: .35;
}
} }
.ace-editor-wrapper { .ace-editor-wrapper {