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
Boxiang Sun
gitlab-ce
Commits
eda2c0c6
Commit
eda2c0c6
authored
Mar 25, 2014
by
Marin Jankovski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Include commits.
parent
02850210
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
3 deletions
+24
-3
app/controllers/projects_controller.rb
app/controllers/projects_controller.rb
+23
-2
app/views/layouts/_init_auto_complete.html.haml
app/views/layouts/_init_auto_complete.html.haml
+1
-1
No files found.
app/controllers/projects_controller.rb
View file @
eda2c0c6
...
...
@@ -123,12 +123,21 @@ class ProjectsController < ApplicationController
end
def
autocomplete_sources
participating_users
=
@project
.
team
.
members
.
sort_by
(
&
:username
).
map
{
|
user
|
{
username:
user
.
username
,
name:
user
.
name
}
}
+
User
.
participating
(
@project
.
notes
).
select
([
:username
,
:name
]).
sort_by
(
&
:username
).
map
{
|
user
|
{
username:
user
.
username
,
name:
user
.
name
}
}
note_type
=
params
[
'type'
]
note_id
=
params
[
'type_id'
]
participating
=
if
note_type
&&
note_id
participants_in
(
note_type
,
note_id
)
else
[]
end
team_members
=
@project
.
team
.
members
.
sort_by
(
&
:username
).
map
{
|
user
|
{
username:
user
.
username
,
name:
user
.
name
}
}
participants
=
team_members
+
participating
#participating = @project.issues.map { |issue| issue.participants.sort_by(&:username).map { |user| { username: user.username, name: user.name } } }.flatten
@suggestions
=
{
emojis:
Emoji
.
names
.
map
{
|
e
|
{
name:
e
,
path:
view_context
.
image_url
(
"emoji/
#{
e
}
.png"
)
}
},
issues:
@project
.
issues
.
select
([
:iid
,
:title
,
:description
]),
mergerequests:
@project
.
merge_requests
.
select
([
:iid
,
:title
,
:description
]),
members:
participa
ting_user
s
.
uniq
members:
participa
nt
s
.
uniq
}
respond_to
do
|
format
|
...
...
@@ -163,4 +172,16 @@ class ProjectsController < ApplicationController
def
user_layout
current_user
?
"projects"
:
"public_projects"
end
def
participants_in
(
type
,
id
)
note
=
case
type
when
"Issue"
,
"MergeRequest"
type
.
constantize
.
find_by_iid
(
id
)
when
"Commits"
type
.
constantize
.
find
(
id
)
else
[]
end
note
.
participants
.
sort_by
(
&
:username
).
map
{
|
user
|
{
username:
user
.
username
,
name:
user
.
name
}
}
end
end
app/views/layouts/_init_auto_complete.html.haml
View file @
eda2c0c6
:javascript
GitLab
.
GfmAutoComplete
.
dataSource
=
"
#{
autocomplete_sources_project_path
(
@project
)
}
"
GitLab
.
GfmAutoComplete
.
dataSource
=
"
#{
autocomplete_sources_project_path
(
@project
,
type:
@noteable
.
class
,
type_id:
params
[
:id
]
)
}
"
GitLab
.
GfmAutoComplete
.
setup
();
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