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
284921ea
Commit
284921ea
authored
Jul 30, 2014
by
Aron Carroll
Committed by
Randall Leeds
Aug 01, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move the status button setup into the compile phase
parent
1b14908d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
12 deletions
+13
-12
status-button.coffee
h/static/scripts/directives/status-button.coffee
+13
-12
No files found.
h/static/scripts/directives/status-button.coffee
View file @
284921ea
...
...
@@ -23,21 +23,22 @@ statusButton = ->
</span>
'''
link
:
(
scope
,
elem
,
attr
)
->
targetForm
=
attr
.
statusButton
compile
:
->
pre
:
(
scope
,
elem
,
attr
)
->
targetForm
=
attr
.
statusButton
unless
targetForm
throw
new
Error
(
'status-button attribute should provide a form name'
)
unless
targetForm
throw
new
Error
(
'status-button attribute should provide a form name'
)
wrapper
=
angular
.
element
(
template
)
wrapper
.
insertBefore
(
elem
)
wrapper
.
append
(
elem
)
wrapper
=
angular
.
element
(
template
)
wrapper
.
insertBefore
(
elem
)
wrapper
.
append
(
elem
)
scope
.
$on
'formState'
,
(
event
,
formName
,
formState
)
->
return
unless
formName
==
targetForm
unless
formState
in
[
STATE_LOADING
,
STATE_SUCCESS
]
formState
=
''
wrapper
.
attr
(
STATE_ATTRIBUTE
,
formState
)
scope
.
$on
'formState'
,
(
event
,
formName
,
formState
)
->
return
unless
formName
==
targetForm
unless
formState
in
[
STATE_LOADING
,
STATE_SUCCESS
]
formState
=
''
wrapper
.
attr
(
STATE_ATTRIBUTE
,
formState
)
angular
.
module
(
'h.directives'
).
directive
(
'statusButton'
,
statusButton
)
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