Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kazuhiko Shiozaki
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
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
0 deletions
+45
-0
app/assets/javascripts/main.js.coffee
app/assets/javascripts/main.js.coffee
+6
-0
app/helpers/issues_helper.rb
app/helpers/issues_helper.rb
+6
-0
app/views/issues/_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) ->
...
@@ -13,6 +13,12 @@ window.errorMessage = (message) ->
ehtml
.
html
(
message
)
ehtml
.
html
(
message
)
ehtml
ehtml
window
.
split
=
(
val
)
->
return
val
.
split
(
/,\s*/
)
window
.
extractLast
=
(
term
)
->
return
split
(
term
).
pop
()
# Disable button if text field is empty
# Disable button if text field is empty
window
.
disableButtonIfEmptyField
=
(
field_selector
,
button_selector
)
->
window
.
disableButtonIfEmptyField
=
(
field_selector
,
button_selector
)
->
field
=
$
(
field_selector
)
field
=
$
(
field_selector
)
...
...
app/helpers/issues_helper.rb
View file @
85d5f606
...
@@ -30,4 +30,10 @@ module IssuesHelper
...
@@ -30,4 +30,10 @@ module IssuesHelper
open:
"open"
open:
"open"
}
}
end
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
end
app/views/issues/_form.html.haml
View file @
85d5f606
...
@@ -55,3 +55,36 @@
...
@@ -55,3 +55,36 @@
=
link_to
"Cancel"
,
project_issues_path
(
@project
),
class:
cancel_class
=
link_to
"Cancel"
,
project_issues_path
(
@project
),
class:
cancel_class
-
else
-
else
=
link_to
"Cancel"
,
project_issue_path
(
@project
,
@issue
),
class:
cancel_class
=
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