Commit eae9958d authored by gergely-ujvari's avatar gergely-ujvari

Merge pull request #1743 from hypothesis/remove-privacy-strings

Remove strings from the privacy template
parents 30cbdbf1 b5145653
......@@ -14,6 +14,8 @@ privacy = ['$window', ($window) ->
return level
undefined
isPublic = (level) -> level == VISIBILITY_PUBLIC
# Detection is needed because we run often as a third party widget and
# third party storage blocking often blocks cookies and local storage
# https://github.com/Modernizr/Modernizr/blob/master/feature-detects/storage/localstorage.js
......@@ -46,7 +48,7 @@ privacy = ['$window', ($window) ->
permissions = controller.$modelValue
if privacy.name is VISIBILITY_PUBLIC
if isPublic(privacy.name)
permissions.read = ['group:__world__']
else
permissions.read = [attrs.user]
......@@ -70,6 +72,8 @@ privacy = ['$window', ($window) ->
storage.setItem VISIBILITY_KEY, level.name
controller.$setViewValue level
controller.$render()
scope.isPublic = isPublic
require: '?ngModel'
restrict: 'E'
scope: {}
......
......@@ -3,15 +3,15 @@
role="button"
class="dropdown-toggle"
data-toggle="dropdown">
<i class="small" ng-class="{'h-icon-earth': level.name == 'public',
'h-icon-locked': level.name == 'private'}"></i>
<i class="small" ng-class="{'h-icon-earth': isPublic(level.name),
'h-icon-locked': !isPublic(level.name)}"></i>
{{level.text}}
<i class="h-icon-triangle"></i>
</span>
<ul class="dropdown-menu" role="menu">
<li ng-repeat="level in levels" ng-click="setLevel(level)">
<i class="small" ng-class="{'h-icon-earth': level.name == 'public',
'h-icon-locked': level.name == 'private'}"></i>
<i class="small" ng-class="{'h-icon-earth': isPublic(level.name),
'h-icon-locked': !isPublic(level.name)}"></i>
{{level.text}}
</li>
</ul>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment