Handle track changles toggling when the feature is not enabled.

This commit is contained in:
Paulo Reis 2017-02-02 12:12:14 +00:00
parent f50967295d
commit 8f9e43f339
3 changed files with 18 additions and 8 deletions

View file

@ -20,12 +20,18 @@
is-loading="reviewPanel.dropdown.loading"
permissions="permissions"
)
span.review-panel-toolbar-label(ng-if="permissions.write", ng-click="fooBarBaz($event);")
span.review-panel-toolbar-label(ng-if="permissions.write")
span(ng-click="toggleTrackChanges(true)", ng-if="editor.wantTrackChanges === false") Track Changes is
strong off
span(ng-click="toggleTrackChanges(false)", ng-if="editor.wantTrackChanges === true") Track Changes is
strong on
review-panel-toggle(ng-if="editor.wantTrackChanges == editor.trackChanges", ng-model="editor.wantTrackChanges", on-toggle="toggleTrackChanges")
review-panel-toggle(
ng-if="editor.wantTrackChanges == editor.trackChanges"
ng-model="editor.wantTrackChanges"
on-toggle="toggleTrackChanges"
disabled="!project.features.hasTrackChanges"
on-disabled-click="openTrackChangesUpgradeModal"
)
span.review-panel-toolbar-label.review-panel-toolbar-label-disabled(ng-if="!permissions.write")
span(ng-if="editor.wantTrackChanges === false") Track Changes is
strong off

View file

@ -1,3 +1,4 @@
define [], () ->
ONEHOUR = 1000 * 60 * 60
class ConnectionManager

View file

@ -7,6 +7,10 @@ define [
App.controller "ReviewPanelController", ($scope, $element, ide, $timeout, $http, $modal, event_tracking) ->
$reviewPanelEl = $element.find "#review-panel"
# TODO Mocked feature flag, remove.
$scope.$on "project:joined", () ->
$scope.project.features.hasTrackChanges = false
$scope.SubViews =
CUR_FILE : "cur_file"
OVERVIEW : "overview"
@ -431,13 +435,12 @@ define [
ide.editorManager.openDocId(doc_id, { gotoOffset: entry.offset })
$scope.toggleTrackChanges = (value) ->
if true # TODO check feature/permission
$scope.openTrackChangesUpgradeModal()
return
if $scope.project.features.hasTrackChanges
$scope.editor.wantTrackChanges = value
$http.post "/project/#{$scope.project_id}/track_changes", {_csrf: window.csrfToken, on: value}
event_tracking.sendMB "rp-trackchanges-toggle", { value }
else
$scope.openTrackChangesUpgradeModal()
ide.socket.on "toggle-track-changes", (value) ->
$scope.$apply () ->