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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
439d03bb
Commit
439d03bb
authored
Dec 12, 2012
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix namespace api autocomplete
parent
105f5ba3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
6 deletions
+15
-6
app/views/layouts/_init_auto_complete.html.haml
app/views/layouts/_init_auto_complete.html.haml
+1
-1
lib/api/helpers.rb
lib/api/helpers.rb
+14
-5
No files found.
app/views/layouts/_init_auto_complete.html.haml
View file @
439d03bb
:javascript
:javascript
$
(
function
()
{
$
(
function
()
{
GitLab
.
GfmAutoComplete
.
Members
.
url
=
"
#{
"/api/v2/projects/#{@project.
path
}/members"
if
@project
}
"
;
GitLab
.
GfmAutoComplete
.
Members
.
url
=
"
#{
"/api/v2/projects/#{@project.
id
}/members"
if
@project
}
"
;
GitLab
.
GfmAutoComplete
.
Members
.
params
.
private_token
=
"
#{
current_user
.
private_token
}
"
;
GitLab
.
GfmAutoComplete
.
Members
.
params
.
private_token
=
"
#{
current_user
.
private_token
}
"
;
GitLab
.
GfmAutoComplete
.
Emoji
.
data
=
#{
raw
emoji_autocomplete_source
}
;
GitLab
.
GfmAutoComplete
.
Emoji
.
data
=
#{
raw
emoji_autocomplete_source
}
;
...
...
lib/api/helpers.rb
View file @
439d03bb
...
@@ -5,13 +5,18 @@ module Gitlab
...
@@ -5,13 +5,18 @@ module Gitlab
end
end
def
user_project
def
user_project
if
@project
||=
current_user
.
projects
.
find_by_id
(
params
[
:id
])
||
@project
||=
find_project
current_user
.
projects
.
find_by_path
(
params
[
:id
])
@project
||
not_found!
else
not_found!
end
end
@project
def
find_project
project
=
Project
.
find_by_id
(
params
[
:id
])
||
Project
.
find_with_namespace
(
params
[
:id
])
if
project
&&
can?
(
current_user
,
:read_project
,
project
)
project
else
nil
end
end
end
def
paginate
(
object
)
def
paginate
(
object
)
...
@@ -32,6 +37,10 @@ module Gitlab
...
@@ -32,6 +37,10 @@ module Gitlab
end
end
end
end
def
can?
(
object
,
action
,
subject
)
abilities
.
allowed?
(
object
,
action
,
subject
)
end
def
attributes_for_keys
(
keys
)
def
attributes_for_keys
(
keys
)
attrs
=
{}
attrs
=
{}
keys
.
each
do
|
key
|
keys
.
each
do
|
key
|
...
...
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