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
b31365d3
Commit
b31365d3
authored
Jul 30, 2013
by
csillag
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tweak the tag editor widget to to propagate click events
Fixes #555
parent
f0f046b6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
0 deletions
+18
-0
directives.coffee
h/js/directives.coffee
+2
-0
tag-it.js
h/lib/tag-it.js
+16
-0
No files found.
h/js/directives.coffee
View file @
b31365d3
...
...
@@ -271,6 +271,8 @@ tags = ['$window', ($window) ->
caseSensitive
:
false
placeholderText
:
attr
.
placeholder
keepPlaceholder
:
true
propagateTagClicks
:
false
propagateRemoveClicks
:
false
preprocessTag
:
(
val
)
->
val
.
toLowerCase
().
replace
/[^a-z0-9\-\_\s]/g
,
''
afterTagAdded
:
(
evt
,
ui
)
->
...
...
h/lib/tag-it.js
View file @
b31365d3
...
...
@@ -81,6 +81,12 @@
// Whether to animate tag removals or not.
animate
:
true
,
// Whether to propagete the click events when removing tags
propagateRemoveClicks
:
true
,
// Whether to propagete the click events on tabs
propagateTagClicks
:
true
,
// Optionally set a tabindex attribute on the input that gets
// created for tag-it.
tabIndex
:
null
,
...
...
@@ -180,6 +186,11 @@
.
click
(
function
(
e
)
{
var
target
=
$
(
e
.
target
);
if
(
target
.
hasClass
(
'tagit-label'
))
{
// Don't propagate this even, unless configured to
if
(
!
that
.
options
.
propagateTagClicks
)
{
e
.
stopPropagation
()
}
var
tag
=
target
.
closest
(
'.tagit-choice'
);
if
(
!
tag
.
hasClass
(
'removed'
))
{
that
.
_trigger
(
'onTagClicked'
,
e
,
{
tag
:
tag
,
tagLabel
:
that
.
tagLabel
(
tag
)});
...
...
@@ -439,6 +450,11 @@
.
click
(
function
(
e
)
{
// Removes a tag when the little 'x' is clicked.
that
.
removeTag
(
tag
);
// Don't propagate this even, unless configured to
if
(
!
that
.
options
.
propagateRemoveClicks
)
{
e
.
stopPropagation
()
}
});
tag
.
append
(
removeTag
);
}
...
...
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