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
ddbdf4e6
Commit
ddbdf4e6
authored
Aug 24, 2016
by
winniehell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restore get_id in ExtractsPath
parent
75d48ae3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
11 deletions
+11
-11
app/controllers/projects_controller.rb
app/controllers/projects_controller.rb
+1
-8
lib/extracts_path.rb
lib/extracts_path.rb
+10
-3
No files found.
app/controllers/projects_controller.rb
View file @
ddbdf4e6
...
...
@@ -5,7 +5,7 @@ class ProjectsController < Projects::ApplicationController
before_action
:project
,
except:
[
:new
,
:create
]
before_action
:repository
,
except:
[
:new
,
:create
]
before_action
:assign_ref_vars
,
only:
[
:show
],
if: :repo_exists?
before_action
:
assign_tree_vars
,
only:
[
:show
],
if:
[
:repo_exists?
,
:project_view_files?
]
before_action
:
tree
,
only:
[
:show
],
if:
[
:repo_exists?
,
:project_view_files?
]
# Authorize
before_action
:authorize_admin_project!
,
only:
[
:edit
,
:update
,
:housekeeping
,
:download_export
,
:export
,
:remove_export
,
:generate_new_export
]
...
...
@@ -332,11 +332,4 @@ class ProjectsController < Projects::ApplicationController
def
get_id
project
.
repository
.
root_ref
end
# ExtractsPath will set @id = project.path on the show route, but it has to be the
# branch name for the tree view to work correctly.
def
assign_tree_vars
@id
=
get_id
tree
end
end
lib/extracts_path.rb
View file @
ddbdf4e6
...
...
@@ -94,9 +94,7 @@ module ExtractsPath
@options
=
params
.
select
{
|
key
,
value
|
allowed_options
.
include?
(
key
)
&&
!
value
.
blank?
}
@options
=
HashWithIndifferentAccess
.
new
(
@options
)
@id
=
params
[
:id
]
||
params
[
:ref
]
@id
+=
"/"
+
params
[
:path
]
unless
params
[
:path
].
blank?
@id
=
get_id
@ref
,
@path
=
extract_ref
(
@id
)
@repo
=
@project
.
repository
if
@options
[
:extended_sha1
].
blank?
...
...
@@ -118,4 +116,13 @@ module ExtractsPath
def
tree
@tree
||=
@repo
.
tree
(
@commit
.
id
,
@path
)
end
private
# overriden in subclasses, do not remove
def
get_id
id
=
params
[
:id
]
||
params
[
:ref
]
id
+=
"/"
+
params
[
:path
]
unless
params
[
:path
].
blank?
id
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