BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
85d5f606
Commit
85d5f606
authored
Dec 18, 2012
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Labels autocomplete
parent
2b921a6c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
0 deletions
+45
-0
main.js.coffee
app/assets/javascripts/main.js.coffee
+6
-0
issues_helper.rb
app/helpers/issues_helper.rb
+6
-0
_form.html.haml
app/views/issues/_form.html.haml
+33
-0
No files found.
app/assets/javascripts/main.js.coffee
View file @
85d5f606
...
...
@@ -13,6 +13,12 @@ window.errorMessage = (message) ->
ehtml
.
html
(
message
)
ehtml
window
.
split
=
(
val
)
->
return
val
.
split
(
/,\s*/
)
window
.
extractLast
=
(
term
)
->
return
split
(
term
).
pop
()
# Disable button if text field is empty
window
.
disableButtonIfEmptyField
=
(
field_selector
,
button_selector
)
->
field
=
$
(
field_selector
)
...
...
app/helpers/issues_helper.rb
View file @
85d5f606
...
...
@@ -30,4 +30,10 @@ module IssuesHelper
open:
"open"
}
end
def
labels_autocomplete_source
labels
=
@project
.
issues_labels
.
order
(
'count DESC'
)
labels
=
labels
.
map
{
|
l
|
{
label:
l
.
name
,
value:
l
.
name
}
}
labels
.
to_json
end
end
app/views/issues/_form.html.haml
View file @
85d5f606
...
...
@@ -55,3 +55,36 @@
=
link_to
"Cancel"
,
project_issues_path
(
@project
),
class:
cancel_class
-
else
=
link_to
"Cancel"
,
project_issue_path
(
@project
,
@issue
),
class:
cancel_class
:javascript
$
(
function
(){
$
(
"#issue_label_list"
)
.
bind
(
"keydown"
,
function
(
event
)
{
if
(
event
.
keyCode
===
$
.
ui
.
keyCode
.
TAB
&&
$
(
this
).
data
(
"autocomplete"
).
menu
.
active
)
{
event
.
preventDefault
();
}
})
.
autocomplete
({
minLength
:
0
,
source
:
function
(
request
,
response
)
{
response
(
$
.
ui
.
autocomplete
.
filter
(
#{
raw
labels_autocomplete_source
}
,
extractLast
(
request
.
term
)
)
);
},
focus
:
function
()
{
return
false
;
},
select
:
function
(
event
,
ui
)
{
var
terms
=
split
(
this
.
value
);
terms
.
pop
();
terms
.
push
(
ui
.
item
.
value
);
terms
.
push
(
""
);
this
.
value
=
terms
.
join
(
", "
);
return
false
;
}
});
});
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