Skip to content

Commit

Permalink
Explicitly state annotation permissions level when editing
Browse files Browse the repository at this point in the history
- Privacy directives calls setLevel on the parent annotation's scope
to display a clarifying message about who will be able to see the annotation
on save.
- Small styling refinements have been added to make the annotation-license
and the newly added clarifying text the same size.
  • Loading branch information
JakeHartnell committed Jun 15, 2015
1 parent 501f1e8 commit 9ed0025
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
4 changes: 4 additions & 0 deletions h/static/scripts/directive/annotation.coffee
Expand Up @@ -311,6 +311,10 @@ AnnotationController = [
updateTimestamp = angular.noop
drafts.remove model

# Called by the privacy directive.
$scope.setLevel = (level) ->
$scope.level = level

# Watch the model.
# XXX: TODO: don't clobber the view when collaborating
$scope.$watch (-> model), (model, old) =>
Expand Down
1 change: 1 addition & 0 deletions h/static/scripts/directive/privacy.coffee
Expand Up @@ -50,6 +50,7 @@ module.exports = ['localStorage', 'permissions', (localStorage, permissions) ->
controller.$setViewValue level

scope.level = controller.$viewValue
scope.$parent.setLevel(scope.level)

scope.levels = levels
scope.setLevel = (level) ->
Expand Down
6 changes: 3 additions & 3 deletions h/static/styles/annotations.scss
Expand Up @@ -79,7 +79,7 @@
.annotation-license {
clear: both;
border-top: #cccccc 1px solid;
font-size: 0.9em;
font-size: 0.8em;
padding-top: 0.583em;

a {
Expand All @@ -88,8 +88,8 @@
}

@include icons {
font-size: 16px;
vertical-align: -3px;
font-size: 13px;
vertical-align: -2px;
margin-right: 1px;
}
}
Expand Down
7 changes: 7 additions & 0 deletions h/templates/client/annotation.html
Expand Up @@ -97,6 +97,13 @@
</div>
<!-- / Tags -->

<div class="annotation-section small" ng-if="vm.editing">
<p ng-show="level.text == 'Only Me'">
<i class="h-icon-lock"></i> This annotation is viewable only to you.</p>
<p ng-show="level.text == 'Public'">
<i class="h-icon-public"></i> This annotation is viewable to everyone.</p>
</div>

<div class="annotation-section form-actions"
ng-if="vm.editing"
ng-switch="vm.action">
Expand Down

0 comments on commit 9ed0025

Please sign in to comment.