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) -> ...@@ -14,6 +14,8 @@ privacy = ['$window', ($window) ->
return level return level
undefined undefined
isPublic = (level) -> level == VISIBILITY_PUBLIC
# Detection is needed because we run often as a third party widget and # Detection is needed because we run often as a third party widget and
# third party storage blocking often blocks cookies and local storage # third party storage blocking often blocks cookies and local storage
# https://github.com/Modernizr/Modernizr/blob/master/feature-detects/storage/localstorage.js # https://github.com/Modernizr/Modernizr/blob/master/feature-detects/storage/localstorage.js
...@@ -46,7 +48,7 @@ privacy = ['$window', ($window) -> ...@@ -46,7 +48,7 @@ privacy = ['$window', ($window) ->
permissions = controller.$modelValue permissions = controller.$modelValue
if privacy.name is VISIBILITY_PUBLIC if isPublic(privacy.name)
permissions.read = ['group:__world__'] permissions.read = ['group:__world__']
else else
permissions.read = [attrs.user] permissions.read = [attrs.user]
...@@ -70,6 +72,8 @@ privacy = ['$window', ($window) -> ...@@ -70,6 +72,8 @@ privacy = ['$window', ($window) ->
storage.setItem VISIBILITY_KEY, level.name storage.setItem VISIBILITY_KEY, level.name
controller.$setViewValue level controller.$setViewValue level
controller.$render() controller.$render()
scope.isPublic = isPublic
require: '?ngModel' require: '?ngModel'
restrict: 'E' restrict: 'E'
scope: {} scope: {}
......
...@@ -3,15 +3,15 @@ ...@@ -3,15 +3,15 @@
role="button" role="button"
class="dropdown-toggle" class="dropdown-toggle"
data-toggle="dropdown"> data-toggle="dropdown">
<i class="small" ng-class="{'h-icon-earth': level.name == 'public', <i class="small" ng-class="{'h-icon-earth': isPublic(level.name),
'h-icon-locked': level.name == 'private'}"></i> 'h-icon-locked': !isPublic(level.name)}"></i>
{{level.text}} {{level.text}}
<i class="h-icon-triangle"></i> <i class="h-icon-triangle"></i>
</span> </span>
<ul class="dropdown-menu" role="menu"> <ul class="dropdown-menu" role="menu">
<li ng-repeat="level in levels" ng-click="setLevel(level)"> <li ng-repeat="level in levels" ng-click="setLevel(level)">
<i class="small" ng-class="{'h-icon-earth': level.name == 'public', <i class="small" ng-class="{'h-icon-earth': isPublic(level.name),
'h-icon-locked': level.name == 'private'}"></i> 'h-icon-locked': !isPublic(level.name)}"></i>
{{level.text}} {{level.text}}
</li> </li>
</ul> </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