Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
447cd126
Commit
447cd126
authored
May 18, 2015
by
Randall Leeds
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Front-end feature flags
parent
08a1ba1e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
11 deletions
+36
-11
app.coffee
h/static/scripts/app.coffee
+6
-3
accounts.coffee
h/static/scripts/config/accounts.coffee
+6
-8
features.coffee
h/static/scripts/config/features.coffee
+24
-0
No files found.
h/static/scripts/app.coffee
View file @
447cd126
...
...
@@ -78,6 +78,11 @@ setupStreamer = [
$http
.
defaults
.
headers
.
common
[
'X-Client-Id'
]
=
clientId
]
angular
.
module
(
'h.config'
,
[])
.
provider
(
'identity'
,
require
(
'./identity'
))
.
provider
(
'session'
,
require
(
'./session'
))
module
.
exports
=
angular
.
module
(
'h'
,
[
'angulartics'
'angulartics.google.analytics'
...
...
@@ -88,6 +93,7 @@ module.exports = angular.module('h', [
'ngSanitize'
'ngTagsInput'
'toastr'
'h.config'
])
.
controller
(
'AppController'
,
require
(
'./app-controller'
))
...
...
@@ -118,9 +124,6 @@ module.exports = angular.module('h', [
.
filter
(
'persona'
,
require
(
'./filter/persona'
))
.
filter
(
'urlencode'
,
require
(
'./filter/urlencode'
))
.
provider
(
'identity'
,
require
(
'./identity'
))
.
provider
(
'session'
,
require
(
'./session'
))
.
service
(
'annotator'
,
->
new
Annotator
(
angular
.
element
(
'<div>'
)))
.
service
(
'annotationMapper'
,
require
(
'./annotation-mapper'
))
.
service
(
'annotationUI'
,
require
(
'./annotation-ui'
))
...
...
h/static/scripts/config/accounts.coffee
View file @
447cd126
...
...
@@ -11,15 +11,18 @@ SESSION_ACTIONS = [
]
configure
=
[
'$httpProvider'
,
'identityProvider'
,
'sessionProvider'
(
$httpProvider
,
identityProvider
,
sessionProvider
)
->
module
.
exports
=
[
'$httpProvider'
,
'
$provide'
,
'
identityProvider'
,
'sessionProvider'
(
$httpProvider
,
$provide
,
identityProvider
,
sessionProvider
)
->
# Pending authentication check
authCheck
=
null
# Use the Pyramid XSRF header name
$httpProvider
.
defaults
.
xsrfHeaderName
=
'X-CSRF-Token'
# Provide an XSRF token for the session provider
$provide
.
constant
(
'xsrf'
,
token
:
null
)
identityProvider
.
checkAuthentication
=
[
'$q'
,
'session'
,
(
$q
,
session
)
->
...
...
@@ -70,8 +73,3 @@ configure = [
__formid__
:
action
withCredentials
:
true
]
angular
.
module
(
'h'
)
.
value
(
'xsrf'
,
token
:
null
)
.
config
(
configure
)
h/static/scripts/config/features.coffee
0 → 100644
View file @
447cd126
FEATURES
=
{
accounts
:
"""{{ feature('accounts') | json }}"""
,
notification
:
"""{{ feature('notification') | json }}"""
,
streamer
:
"""{{ feature('streamer') | json }}"""
}
feature
=
(
name
)
->
value
=
FEATURES
[
name
]
if
value
?
return
!!
value
else
throw
new
Error
(
"unknown feature:
#{
name
}
"
)
config
=
(
fn
)
->
module
.
exports
.
config
(
fn
)
angular
=
require
(
'angular'
)
module
.
exports
=
angular
.
module
(
'h.config'
).
value
(
'feature'
,
feature
)
if
feature
(
'accounts'
)
config
(
require
(
'./accounts'
))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment