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
53a7b213
Commit
53a7b213
authored
Jul 19, 2013
by
csillag
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
First implementation of tags
parent
8004d9ed
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
0 deletions
+52
-0
common.scss
h/css/common.scss
+17
-0
directives.coffee
h/js/directives.coffee
+35
-0
No files found.
h/css/common.scss
View file @
53a7b213
...
...
@@ -1027,3 +1027,20 @@ pre {outline: 1px solid #ccc; padding: 5px; margin: 5px; }
margin
:
-1em
0
;
}
}
// Tags for the annotations
.tags
{
input
{
width
:
100%
;
}
.display
{
margin-top
:
0
.5em
;
margin-bottom
:
1em
;
overflow
:
hidden
;
}
.word
{
background-color
:
lightgray
;
padding
:
0
.25em
;
margin
:
0
.25em
;
}
}
h/js/directives.coffee
View file @
53a7b213
...
...
@@ -292,6 +292,40 @@ repeatAnim = ->
.
css
({
'margin-left'
:
itemElm
.
width
()
})
.
animate
({
'margin-left'
:
'0px'
},
1500
)
# Directive to edit/display a word list. Used for tags.
wordlist
=
[
'$filter'
,
'$timeout'
,
(
$filter
,
$timeout
)
->
link
:
(
scope
,
elem
,
attr
,
ctrl
)
->
return
unless
ctrl
?
input
=
elem
.
find
(
'input'
)
# Re-render the word list when the view needs updating.
ctrl
.
$render
=
->
# Push value to input box
input
.
attr
'value'
,
(
ctrl
.
$viewValue
or
[]).
join
" "
# Push value to rendered HTML
scope
.
rendered_words
=
ctrl
.
$viewValue
or
[]
# console.log "Rendered words:"
# console.log scope.rendered_words
# React to the changes to the input box
input
.
bind
'blur change keyup'
,
->
# TODO: filter for invalid chars, deduplicate
new_words
=
input
[
0
].
value
.
trim
().
toLowerCase
().
split
" "
# console.log "Got new words: "
# console.log new_words
ctrl
.
$setViewValue
new_words
scope
.
$digest
()
require
:
'?ngModel'
restrict
:
'E'
scope
:
readonly
:
'@'
placeholder
:
'@'
templateUrl
:
'wordlist.html'
]
angular
.
module
(
'h.directives'
,
[
'ngSanitize'
])
.
directive
(
'annotation'
,
annotation
)
.
directive
(
'authentication'
,
authentication
)
...
...
@@ -305,4 +339,5 @@ angular.module('h.directives', ['ngSanitize'])
.
directive
(
'userPicker'
,
userPicker
)
.
directive
(
'ngBlur'
,
ngBlur
)
.
directive
(
'repeatAnim'
,
repeatAnim
)
.
directive
(
'wordlist'
,
wordlist
)
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