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
3f35cccf
Commit
3f35cccf
authored
Nov 21, 2011
by
gitlabhq
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ref controller refactored
parent
4bf4efe7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
11 deletions
+10
-11
app/controllers/refs_controller.rb
app/controllers/refs_controller.rb
+9
-11
app/models/tree.rb
app/models/tree.rb
+1
-0
No files found.
app/controllers/refs_controller.rb
View file @
3f35cccf
class
RefsController
<
ApplicationController
before_filter
:project
before_filter
:ref
before_filter
:define_tree_vars
,
:only
=>
[
:tree
,
:blob
]
layout
"project"
# Authorize
...
...
@@ -22,12 +23,6 @@ class RefsController < ApplicationController
# Repository preview
#
def
tree
@repo
=
project
.
repo
@commit
=
@repo
.
commits
(
@ref
).
first
@tree
=
Tree
.
new
(
@commit
.
tree
,
project
,
@ref
,
params
[
:path
])
@tree
=
TreeDecorator
.
new
(
@tree
)
respond_to
do
|
format
|
format
.
html
format
.
js
do
...
...
@@ -40,11 +35,7 @@ class RefsController < ApplicationController
end
def
blob
@repo
=
project
.
repo
@commit
=
project
.
commit
(
@ref
)
@tree
=
project
.
tree
(
@commit
,
params
[
:path
])
if
@tree
.
is_a?
(
Grit
::
Blob
)
if
@tree
.
is_blob?
send_data
(
@tree
.
data
,
:type
=>
@tree
.
mime_type
,
:disposition
=>
'inline'
,
:filename
=>
@tree
.
name
)
else
head
(
404
)
...
...
@@ -55,6 +46,13 @@ class RefsController < ApplicationController
protected
def
define_tree_vars
@repo
=
project
.
repo
@commit
=
project
.
commit
(
@ref
)
@tree
=
Tree
.
new
(
@commit
.
tree
,
project
,
@ref
,
params
[
:path
])
@tree
=
TreeDecorator
.
new
(
@tree
)
end
def
ref
@ref
=
params
[
:id
]
end
...
...
app/models/tree.rb
View file @
3f35cccf
...
...
@@ -5,6 +5,7 @@ class Tree
:basename
,
:name
,
:data
,
:mime_type
,
:text?
,
:colorize
,
:to
=>
:tree
...
...
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