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
Jérome Perrin
gitlab-ce
Commits
d2be7577
Commit
d2be7577
authored
Dec 14, 2012
by
Riyad Preukschas
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2243 from jouve/fix_gfm_username_autocomplete
fix gfm autocomplete for usernames
parents
645afc38
a5861b8f
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
80 additions
and
48 deletions
+80
-48
app/assets/javascripts/gfm_auto_complete.js.coffee
app/assets/javascripts/gfm_auto_complete.js.coffee
+52
-46
doc/api/issues.md
doc/api/issues.md
+5
-0
doc/api/merge_requests.md
doc/api/merge_requests.md
+9
-0
doc/api/notes.md
doc/api/notes.md
+1
-0
doc/api/projects.md
doc/api/projects.md
+4
-0
doc/api/session.md
doc/api/session.md
+1
-0
doc/api/snippets.md
doc/api/snippets.md
+1
-0
doc/api/users.md
doc/api/users.md
+5
-0
lib/api/entities.rb
lib/api/entities.rb
+2
-2
No files found.
app/assets/javascripts/gfm_auto_complete.js.coffee
View file @
d2be7577
# Creates the variables for setting up GFM auto-completion
# Creates the variables for setting up GFM auto-completion
window
.
GitLab
?=
{}
window
.
GitLab
?=
{}
GitLab
.
GfmAutoComplete
?=
{}
GitLab
.
GfmAutoComplete
=
# Emoji
data
=
[]
template
=
"<li data-value='${insert}'>${name} <img alt='${name}' height='20' src='${image}' width='20' /></li>"
GitLab
.
GfmAutoComplete
.
Emoji
=
{
data
,
template
}
# Team Members
data
=
[]
url
=
''
;
params
=
{
private_token
:
''
,
page
:
1
}
GitLab
.
GfmAutoComplete
.
Members
=
{
data
,
url
,
params
}
# Add GFM auto-completion to all input fields, that accept GFM input.
GitLab
.
GfmAutoComplete
.
setup
=
->
input
=
$
(
'.js-gfm-input'
)
# Emoji
# Emoji
input
.
atWho
':'
,
Emoji
:
data
:
GitLab
.
GfmAutoComplete
.
Emoji
.
data
,
data
:
[]
t
pl
:
GitLab
.
GfmAutoComplete
.
Emoji
.
template
t
emplate
:
'<li data-value="${insert}">${name} <img alt="${name}" height="20" src="${image}" width="20" /></li>'
# Team Members
# Team Members
input
.
atWho
'@'
,
(
query
,
callback
)
->
Members
:
(
getMoreMembers
=
->
data
:
[]
$
.
getJSON
(
GitLab
.
GfmAutoComplete
.
Members
.
url
,
GitLab
.
GfmAutoComplete
.
Members
.
params
)
url
:
''
.
success
(
members
)
->
params
:
# pick the data we need
private_token
:
''
newMembersData
=
$
.
map
(
members
,
(
m
)
->
m
.
name
)
page
:
1
template
:
'<li data-value="${username}">${username} <small>${name}</small></li>'
# add the new page of data to the rest
$
.
merge
(
GitLab
.
GfmAutoComplete
.
Members
.
data
,
newMembersData
)
# Add GFM auto-completion to all input fields, that accept GFM input.
setup
:
->
# show the pop-up with a copy of the current data
input
=
$
(
'.js-gfm-input'
)
callback
(
GitLab
.
GfmAutoComplete
.
Members
.
data
[..])
# Emoji
# are we past the last page?
input
.
atWho
':'
,
if
newMembersData
.
length
is
0
data
:
@
Emoji
.
data
# set static data and stop callbacks
tpl
:
@
Emoji
.
template
input
.
atWho
'@'
,
data
:
GitLab
.
GfmAutoComplete
.
Members
.
data
# Team Members
callback
:
null
input
.
atWho
'@'
,
else
tpl
:
@
Members
.
template
# get next page
callback
:
(
query
,
callback
)
=>
getMoreMembers
()
(
getMoreMembers
=
=>
$
.
getJSON
(
@
Members
.
url
,
@
Members
.
params
).
done
(
members
)
=>
# so the next request gets the next page
# pick the data we need
GitLab
.
GfmAutoComplete
.
Members
.
params
.
page
+=
1
newMembersData
=
$
.
map
(
members
,
(
m
)
->
).
call
()
username
:
m
.
username
name
:
m
.
name
)
# add the new page of data to the rest
$
.
merge
(
@
Members
.
data
,
newMembersData
)
# show the pop-up with a copy of the current data
callback
(
@
Members
.
data
[..])
# are we past the last page?
if
newMembersData
.
length
is
0
# set static data and stop callbacks
input
.
atWho
'@'
,
data
:
@
Members
.
data
callback
:
null
else
# get next page
getMoreMembers
()
# so the next callback requests the next page
@
Members
.
params
.
page
+=
1
).
call
()
doc/api/issues.md
View file @
d2be7577
...
@@ -18,6 +18,7 @@ GET /issues
...
@@ -18,6 +18,7 @@ GET /issues
"assignee"
:
null
,
"assignee"
:
null
,
"author"
:
{
"author"
:
{
"id"
:
1
,
"id"
:
1
,
"username"
:
"john_smith"
,
"email"
:
"john@example.com"
,
"email"
:
"john@example.com"
,
"name"
:
"John Smith"
,
"name"
:
"John Smith"
,
"blocked"
:
false
,
"blocked"
:
false
,
...
@@ -46,6 +47,7 @@ GET /issues
...
@@ -46,6 +47,7 @@ GET /issues
},
},
"assignee"
:
{
"assignee"
:
{
"id"
:
2
,
"id"
:
2
,
"username"
:
"jack_smith"
,
"email"
:
"jack@example.com"
,
"email"
:
"jack@example.com"
,
"name"
:
"Jack Smith"
,
"name"
:
"Jack Smith"
,
"blocked"
:
false
,
"blocked"
:
false
,
...
@@ -53,6 +55,7 @@ GET /issues
...
@@ -53,6 +55,7 @@ GET /issues
},
},
"author"
:
{
"author"
:
{
"id"
:
1
,
"id"
:
1
,
"username"
:
"john_smith"
,
"email"
:
"john@example.com"
,
"email"
:
"john@example.com"
,
"name"
:
"John Smith"
,
"name"
:
"John Smith"
,
"blocked"
:
false
,
"blocked"
:
false
,
...
@@ -110,6 +113,7 @@ Parameters:
...
@@ -110,6 +113,7 @@ Parameters:
},
},
"assignee"
:
{
"assignee"
:
{
"id"
:
2
,
"id"
:
2
,
"username"
:
"jack_smith"
,
"email"
:
"jack@example.com"
,
"email"
:
"jack@example.com"
,
"name"
:
"Jack Smith"
,
"name"
:
"Jack Smith"
,
"blocked"
:
false
,
"blocked"
:
false
,
...
@@ -117,6 +121,7 @@ Parameters:
...
@@ -117,6 +121,7 @@ Parameters:
},
},
"author"
:
{
"author"
:
{
"id"
:
1
,
"id"
:
1
,
"username"
:
"john_smith"
,
"email"
:
"john@example.com"
,
"email"
:
"john@example.com"
,
"name"
:
"John Smith"
,
"name"
:
"John Smith"
,
"blocked"
:
false
,
"blocked"
:
false
,
...
...
doc/api/merge_requests.md
View file @
d2be7577
...
@@ -22,6 +22,7 @@ Parameters:
...
@@ -22,6 +22,7 @@ Parameters:
"merged"
:
false
,
"merged"
:
false
,
"author"
:{
"author"
:{
"id"
:
1
,
"id"
:
1
,
"username"
:
"admin"
,
"email"
:
"admin@local.host"
,
"email"
:
"admin@local.host"
,
"name"
:
"Administrator"
,
"name"
:
"Administrator"
,
"blocked"
:
false
,
"blocked"
:
false
,
...
@@ -29,6 +30,7 @@ Parameters:
...
@@ -29,6 +30,7 @@ Parameters:
},
},
"assignee"
:{
"assignee"
:{
"id"
:
1
,
"id"
:
1
,
"username"
:
"admin"
,
"email"
:
"admin@local.host"
,
"email"
:
"admin@local.host"
,
"name"
:
"Administrator"
,
"name"
:
"Administrator"
,
"blocked"
:
false
,
"blocked"
:
false
,
...
@@ -62,6 +64,7 @@ Parameters:
...
@@ -62,6 +64,7 @@ Parameters:
"merged"
:
false
,
"merged"
:
false
,
"author"
:{
"author"
:{
"id"
:
1
,
"id"
:
1
,
"username"
:
"admin"
,
"email"
:
"admin@local.host"
,
"email"
:
"admin@local.host"
,
"name"
:
"Administrator"
,
"name"
:
"Administrator"
,
"blocked"
:
false
,
"blocked"
:
false
,
...
@@ -69,6 +72,7 @@ Parameters:
...
@@ -69,6 +72,7 @@ Parameters:
},
},
"assignee"
:{
"assignee"
:{
"id"
:
1
,
"id"
:
1
,
"username"
:
"admin"
,
"email"
:
"admin@local.host"
,
"email"
:
"admin@local.host"
,
"name"
:
"Administrator"
,
"name"
:
"Administrator"
,
"blocked"
:
false
,
"blocked"
:
false
,
...
@@ -105,6 +109,7 @@ Parameters:
...
@@ -105,6 +109,7 @@ Parameters:
"merged"
:
false
,
"merged"
:
false
,
"author"
:{
"author"
:{
"id"
:
1
,
"id"
:
1
,
"username"
:
"admin"
,
"email"
:
"admin@local.host"
,
"email"
:
"admin@local.host"
,
"name"
:
"Administrator"
,
"name"
:
"Administrator"
,
"blocked"
:
false
,
"blocked"
:
false
,
...
@@ -112,6 +117,7 @@ Parameters:
...
@@ -112,6 +117,7 @@ Parameters:
},
},
"assignee"
:{
"assignee"
:{
"id"
:
1
,
"id"
:
1
,
"username"
:
"admin"
,
"email"
:
"admin@local.host"
,
"email"
:
"admin@local.host"
,
"name"
:
"Administrator"
,
"name"
:
"Administrator"
,
"blocked"
:
false
,
"blocked"
:
false
,
...
@@ -150,6 +156,7 @@ Parameters:
...
@@ -150,6 +156,7 @@ Parameters:
"merged"
:
false
,
"merged"
:
false
,
"author"
:{
"author"
:{
"id"
:
1
,
"id"
:
1
,
"username"
:
"admin"
,
"email"
:
"admin@local.host"
,
"email"
:
"admin@local.host"
,
"name"
:
"Administrator"
,
"name"
:
"Administrator"
,
"blocked"
:
false
,
"blocked"
:
false
,
...
@@ -157,6 +164,7 @@ Parameters:
...
@@ -157,6 +164,7 @@ Parameters:
},
},
"assignee"
:{
"assignee"
:{
"id"
:
1
,
"id"
:
1
,
"username"
:
"admin"
,
"email"
:
"admin@local.host"
,
"email"
:
"admin@local.host"
,
"name"
:
"Administrator"
,
"name"
:
"Administrator"
,
"blocked"
:
false
,
"blocked"
:
false
,
...
@@ -184,6 +192,7 @@ Will return created note with status `201 Created` on success, or `404 Not found
...
@@ -184,6 +192,7 @@ Will return created note with status `201 Created` on success, or `404 Not found
{
{
"author"
:{
"author"
:{
"id"
:
1
,
"id"
:
1
,
"username"
:
"admin"
,
"email"
:
"admin@local.host"
,
"email"
:
"admin@local.host"
,
"name"
:
"Administrator"
,
"name"
:
"Administrator"
,
"blocked"
:
false
,
"blocked"
:
false
,
...
...
doc/api/notes.md
View file @
d2be7577
...
@@ -15,6 +15,7 @@ GET /projects/:id/notes
...
@@ -15,6 +15,7 @@ GET /projects/:id/notes
"body"
:
"The solution is rather tricky"
,
"body"
:
"The solution is rather tricky"
,
"author"
:
{
"author"
:
{
"id"
:
1
,
"id"
:
1
,
"username"
:
"john_smith"
,
"email"
:
"john@example.com"
,
"email"
:
"john@example.com"
,
"name"
:
"John Smith"
,
"name"
:
"John Smith"
,
"blocked"
:
false
,
"blocked"
:
false
,
...
...
doc/api/projects.md
View file @
d2be7577
...
@@ -17,6 +17,7 @@ GET /projects
...
@@ -17,6 +17,7 @@ GET /projects
"default_branch"
:
"master"
,
"default_branch"
:
"master"
,
"owner"
:
{
"owner"
:
{
"id"
:
1
,
"id"
:
1
,
"username"
:
"john_smith"
,
"email"
:
"john@example.com"
,
"email"
:
"john@example.com"
,
"name"
:
"John Smith"
,
"name"
:
"John Smith"
,
"blocked"
:
false
,
"blocked"
:
false
,
...
@@ -38,6 +39,7 @@ GET /projects
...
@@ -38,6 +39,7 @@ GET /projects
"default_branch"
:
"api"
,
"default_branch"
:
"api"
,
"owner"
:
{
"owner"
:
{
"id"
:
1
,
"id"
:
1
,
"username"
:
"john_smith"
,
"email"
:
"john@example.com"
,
"email"
:
"john@example.com"
,
"name"
:
"John Smith"
,
"name"
:
"John Smith"
,
"blocked"
:
false
,
"blocked"
:
false
,
...
@@ -75,6 +77,7 @@ Parameters:
...
@@ -75,6 +77,7 @@ Parameters:
"default_branch"
:
"api"
,
"default_branch"
:
"api"
,
"owner"
:
{
"owner"
:
{
"id"
:
1
,
"id"
:
1
,
"username"
:
"john_smith"
,
"email"
:
"john@example.com"
,
"email"
:
"john@example.com"
,
"name"
:
"John Smith"
,
"name"
:
"John Smith"
,
"blocked"
:
false
,
"blocked"
:
false
,
...
@@ -141,6 +144,7 @@ Parameters:
...
@@ -141,6 +144,7 @@ Parameters:
{
{
"id"
:
1
,
"id"
:
1
,
"username"
:
"john_smith"
,
"email"
:
"john@example.com"
,
"email"
:
"john@example.com"
,
"name"
:
"John Smith"
,
"name"
:
"John Smith"
,
"blocked"
:
false
,
"blocked"
:
false
,
...
...
doc/api/session.md
View file @
d2be7577
...
@@ -13,6 +13,7 @@ Parameters:
...
@@ -13,6 +13,7 @@ Parameters:
```
json
```
json
{
{
"id"
:
1
,
"id"
:
1
,
"username"
:
"john_smith"
,
"email"
:
"john@example.com"
,
"email"
:
"john@example.com"
,
"name"
:
"John Smith"
,
"name"
:
"John Smith"
,
"private_token"
:
"dd34asd13as"
,
"private_token"
:
"dd34asd13as"
,
...
...
doc/api/snippets.md
View file @
d2be7577
...
@@ -30,6 +30,7 @@ Parameters:
...
@@ -30,6 +30,7 @@ Parameters:
"file_name"
:
"add.rb"
,
"file_name"
:
"add.rb"
,
"author"
:
{
"author"
:
{
"id"
:
1
,
"id"
:
1
,
"username"
:
"john_smith"
,
"email"
:
"john@example.com"
,
"email"
:
"john@example.com"
,
"name"
:
"John Smith"
,
"name"
:
"John Smith"
,
"blocked"
:
false
,
"blocked"
:
false
,
...
...
doc/api/users.md
View file @
d2be7577
...
@@ -10,6 +10,7 @@ GET /users
...
@@ -10,6 +10,7 @@ GET /users
[
[
{
{
"id"
:
1
,
"id"
:
1
,
"username"
:
"john_smith"
,
"email"
:
"john@example.com"
,
"email"
:
"john@example.com"
,
"name"
:
"John Smith"
,
"name"
:
"John Smith"
,
"blocked"
:
false
,
"blocked"
:
false
,
...
@@ -23,6 +24,7 @@ GET /users
...
@@ -23,6 +24,7 @@ GET /users
},
},
{
{
"id"
:
2
,
"id"
:
2
,
"username"
:
"jack_smith"
,
"email"
:
"jack@example.com"
,
"email"
:
"jack@example.com"
,
"name"
:
"Jack Smith"
,
"name"
:
"Jack Smith"
,
"blocked"
:
false
,
"blocked"
:
false
,
...
@@ -52,6 +54,7 @@ Parameters:
...
@@ -52,6 +54,7 @@ Parameters:
```
json
```
json
{
{
"id"
:
1
,
"id"
:
1
,
"username"
:
"john_smith"
,
"email"
:
"john@example.com"
,
"email"
:
"john@example.com"
,
"name"
:
"John Smith"
,
"name"
:
"John Smith"
,
"blocked"
:
false
,
"blocked"
:
false
,
...
@@ -75,6 +78,7 @@ POST /users
...
@@ -75,6 +78,7 @@ POST /users
Parameters:
Parameters:
+
`email`
(required) - Email
+
`email`
(required) - Email
+
`password`
(required) - Password
+
`password`
(required) - Password
+
`username`
(required) - Username
+
`name`
(required) - Name
+
`name`
(required) - Name
+
`skype`
- Skype ID
+
`skype`
- Skype ID
+
`linkedin`
- Linkedin
+
`linkedin`
- Linkedin
...
@@ -95,6 +99,7 @@ GET /user
...
@@ -95,6 +99,7 @@ GET /user
```
json
```
json
{
{
"id"
:
1
,
"id"
:
1
,
"username"
:
"john_smith"
,
"email"
:
"john@example.com"
,
"email"
:
"john@example.com"
,
"name"
:
"John Smith"
,
"name"
:
"John Smith"
,
"blocked"
:
false
,
"blocked"
:
false
,
...
...
lib/api/entities.rb
View file @
d2be7577
module
Gitlab
module
Gitlab
module
Entities
module
Entities
class
User
<
Grape
::
Entity
class
User
<
Grape
::
Entity
expose
:id
,
:email
,
:name
,
:bio
,
:skype
,
:linkedin
,
:twitter
,
expose
:id
,
:
username
,
:
email
,
:name
,
:bio
,
:skype
,
:linkedin
,
:twitter
,
:dark_scheme
,
:theme_id
,
:blocked
,
:created_at
:dark_scheme
,
:theme_id
,
:blocked
,
:created_at
end
end
class
UserBasic
<
Grape
::
Entity
class
UserBasic
<
Grape
::
Entity
expose
:id
,
:email
,
:name
,
:blocked
,
:created_at
expose
:id
,
:
username
,
:
email
,
:name
,
:blocked
,
:created_at
end
end
class
UserLogin
<
UserBasic
class
UserLogin
<
UserBasic
...
...
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