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
c2834665
Commit
c2834665
authored
Apr 26, 2018
by
Nick Thomas
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'ide-relative-url-fix' of gitlab.com:gitlab-org/gitlab-ce
parents
f5524d55
8b321679
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
2 deletions
+27
-2
app/assets/javascripts/ide/stores/actions/file.js
app/assets/javascripts/ide/stores/actions/file.js
+1
-1
app/helpers/blob_helper.rb
app/helpers/blob_helper.rb
+1
-1
spec/helpers/blob_helper_spec.rb
spec/helpers/blob_helper_spec.rb
+25
-0
No files found.
app/assets/javascripts/ide/stores/actions/file.js
View file @
c2834665
...
@@ -63,7 +63,7 @@ export const getFileData = ({ state, commit, dispatch }, { path, makeFileActive
...
@@ -63,7 +63,7 @@ export const getFileData = ({ state, commit, dispatch }, { path, makeFileActive
const
file
=
state
.
entries
[
path
];
const
file
=
state
.
entries
[
path
];
commit
(
types
.
TOGGLE_LOADING
,
{
entry
:
file
});
commit
(
types
.
TOGGLE_LOADING
,
{
entry
:
file
});
return
service
return
service
.
getFileData
(
file
.
url
)
.
getFileData
(
`
${
gon
.
relative_url_root
?
gon
.
relative_url_root
:
''
}${
file
.
url
}
`
)
.
then
(
res
=>
{
.
then
(
res
=>
{
const
pageTitle
=
decodeURI
(
normalizeHeaders
(
res
.
headers
)[
'
PAGE-TITLE
'
]);
const
pageTitle
=
decodeURI
(
normalizeHeaders
(
res
.
headers
)[
'
PAGE-TITLE
'
]);
setPageTitle
(
pageTitle
);
setPageTitle
(
pageTitle
);
...
...
app/helpers/blob_helper.rb
View file @
c2834665
...
@@ -17,7 +17,7 @@ module BlobHelper
...
@@ -17,7 +17,7 @@ module BlobHelper
end
end
def
ide_edit_path
(
project
=
@project
,
ref
=
@ref
,
path
=
@path
,
options
=
{})
def
ide_edit_path
(
project
=
@project
,
ref
=
@ref
,
path
=
@path
,
options
=
{})
"
#{
ide_path
}
/project
#{
edit_blob_path
(
project
,
ref
,
path
,
options
)
}
"
"
#{
ide_path
}
/project
#{
url_for
([
project
,
"edit"
,
"blob"
,
id:
[
ref
,
path
],
script_name:
"/"
]
)
}
"
end
end
def
edit_blob_button
(
project
=
@project
,
ref
=
@ref
,
path
=
@path
,
options
=
{})
def
edit_blob_button
(
project
=
@project
,
ref
=
@ref
,
path
=
@path
,
options
=
{})
...
...
spec/helpers/blob_helper_spec.rb
View file @
c2834665
...
@@ -242,4 +242,29 @@ describe BlobHelper do
...
@@ -242,4 +242,29 @@ describe BlobHelper do
end
end
end
end
end
end
describe
'#ide_edit_path'
do
let
(
:project
)
{
create
(
:project
)
}
around
do
|
example
|
old_script_name
=
Rails
.
application
.
routes
.
default_url_options
[
:script_name
]
begin
example
.
run
ensure
Rails
.
application
.
routes
.
default_url_options
[
:script_name
]
=
old_script_name
end
end
it
'returns full IDE path'
do
Rails
.
application
.
routes
.
default_url_options
[
:script_name
]
=
nil
expect
(
helper
.
ide_edit_path
(
project
,
"master"
,
""
)).
to
eq
(
"/-/ide/project/
#{
project
.
namespace
.
path
}
/
#{
project
.
path
}
/edit/master/"
)
end
it
'returns IDE path without relative_url_root'
do
Rails
.
application
.
routes
.
default_url_options
[
:script_name
]
=
"/gitlab"
expect
(
helper
.
ide_edit_path
(
project
,
"master"
,
""
)).
to
eq
(
"/gitlab/-/ide/project/
#{
project
.
namespace
.
path
}
/
#{
project
.
path
}
/edit/master/"
)
end
end
end
end
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