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
fbc749a9
Commit
fbc749a9
authored
Jun 15, 2018
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reuse viewer param and move logic to blob controller
parent
4ac381a5
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
10 deletions
+10
-10
app/assets/javascripts/ide/services/index.js
app/assets/javascripts/ide/services/index.js
+1
-1
app/controllers/concerns/renders_blob.rb
app/controllers/concerns/renders_blob.rb
+0
-2
app/controllers/projects/blob_controller.rb
app/controllers/projects/blob_controller.rb
+6
-5
spec/controllers/projects/blob_controller_spec.rb
spec/controllers/projects/blob_controller_spec.rb
+3
-2
No files found.
app/assets/javascripts/ide/services/index.js
View file @
fbc749a9
...
@@ -9,7 +9,7 @@ export default {
...
@@ -9,7 +9,7 @@ export default {
return
Vue
.
http
.
get
(
endpoint
,
{
params
:
{
format
:
'
json
'
}
});
return
Vue
.
http
.
get
(
endpoint
,
{
params
:
{
format
:
'
json
'
}
});
},
},
getFileData
(
endpoint
)
{
getFileData
(
endpoint
)
{
return
Vue
.
http
.
get
(
endpoint
,
{
params
:
{
format
:
'
json
'
,
html_render
:
'
fals
e
'
}
});
return
Vue
.
http
.
get
(
endpoint
,
{
params
:
{
format
:
'
json
'
,
viewer
:
'
non
e
'
}
});
},
},
getRawFileData
(
file
)
{
getRawFileData
(
file
)
{
if
(
file
.
tempFile
)
{
if
(
file
.
tempFile
)
{
...
...
app/controllers/concerns/renders_blob.rb
View file @
fbc749a9
...
@@ -14,8 +14,6 @@ module RendersBlob
...
@@ -14,8 +14,6 @@ module RendersBlob
return
unless
viewer
return
unless
viewer
return
{}
if
params
[
:html_render
]
==
'false'
{
{
html:
view_to_html_string
(
"projects/blob/_viewer"
,
viewer:
viewer
,
load_async:
false
)
html:
view_to_html_string
(
"projects/blob/_viewer"
,
viewer:
viewer
,
load_async:
false
)
}
}
...
...
app/controllers/projects/blob_controller.rb
View file @
fbc749a9
...
@@ -197,14 +197,11 @@ class Projects::BlobController < Projects::ApplicationController
...
@@ -197,14 +197,11 @@ class Projects::BlobController < Projects::ApplicationController
end
end
def
show_json
def
show_json
json
=
blob_json
(
@blob
)
return
render_404
unless
json
path_segments
=
@path
.
split
(
'/'
)
path_segments
=
@path
.
split
(
'/'
)
path_segments
.
pop
path_segments
.
pop
tree_path
=
path_segments
.
join
(
'/'
)
tree_path
=
path_segments
.
join
(
'/'
)
render
json:
json
.
merge
(
json
=
{
id:
@blob
.
id
,
id:
@blob
.
id
,
path:
blob
.
path
,
path:
blob
.
path
,
name:
blob
.
name
,
name:
blob
.
name
,
...
@@ -221,6 +218,10 @@ class Projects::BlobController < Projects::ApplicationController
...
@@ -221,6 +218,10 @@ class Projects::BlobController < Projects::ApplicationController
commits_path:
project_commits_path
(
project
,
@id
),
commits_path:
project_commits_path
(
project
,
@id
),
tree_path:
project_tree_path
(
project
,
File
.
join
(
@ref
,
tree_path
)),
tree_path:
project_tree_path
(
project
,
File
.
join
(
@ref
,
tree_path
)),
permalink:
project_blob_path
(
project
,
File
.
join
(
@commit
.
id
,
@path
))
permalink:
project_blob_path
(
project
,
File
.
join
(
@commit
.
id
,
@path
))
)
}
json
.
merge!
(
blob_json
(
@blob
)
||
{})
unless
params
[
:viewer
]
==
'none'
render
json:
json
end
end
end
end
spec/controllers/projects/blob_controller_spec.rb
View file @
fbc749a9
...
@@ -56,7 +56,7 @@ describe Projects::BlobController do
...
@@ -56,7 +56,7 @@ describe Projects::BlobController do
end
end
end
end
context
"
html_render=fals
e"
do
context
"
with viewer=non
e"
do
let
(
:id
)
{
'master/README.md'
}
let
(
:id
)
{
'master/README.md'
}
before
do
before
do
...
@@ -65,12 +65,13 @@ describe Projects::BlobController do
...
@@ -65,12 +65,13 @@ describe Projects::BlobController do
project_id:
project
,
project_id:
project
,
id:
id
,
id:
id
,
format: :json
,
format: :json
,
html_render:
'fals
e'
)
viewer:
'non
e'
)
end
end
it
do
it
do
expect
(
response
).
to
be_ok
expect
(
response
).
to
be_ok
expect
(
json_response
).
not_to
have_key
'html'
expect
(
json_response
).
not_to
have_key
'html'
expect
(
json_response
).
to
have_key
'raw_path'
end
end
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