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
c337a278
Commit
c337a278
authored
Jul 09, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'browse_file' into 'master'
Browse file Fixes #1335 See merge request !951
parents
70848097
91e01275
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
54 additions
and
2 deletions
+54
-2
app/helpers/commits_helper.rb
app/helpers/commits_helper.rb
+11
-0
app/views/projects/commits/_commit.html.haml
app/views/projects/commits/_commit.html.haml
+2
-1
features/project/source/browse_files.feature
features/project/source/browse_files.feature
+13
-1
features/steps/project/browse_files.rb
features/steps/project/browse_files.rb
+28
-0
No files found.
app/helpers/commits_helper.rb
View file @
c337a278
...
...
@@ -180,6 +180,17 @@ module CommitsHelper
return
old_lines
,
new_lines
end
def
link_to_browse_code
(
project
,
commit
)
if
current_controller?
(
:projects
,
:commits
)
if
@repo
.
blob_at
(
commit
.
id
,
@path
)
return
link_to
"Browse File »"
,
project_blob_path
(
project
,
tree_join
(
commit
.
id
,
@path
)),
class:
"pull-right"
elsif
@path
.
present?
return
link_to
"Browse Dir »"
,
project_tree_path
(
project
,
tree_join
(
commit
.
id
,
@path
)),
class:
"pull-right"
end
end
link_to
"Browse Code »"
,
project_tree_path
(
project
,
commit
),
class:
"pull-right"
end
protected
# Private: Returns a link to a person. If the person has a matching user and
...
...
app/views/projects/commits/_commit.html.haml
View file @
c337a278
...
...
@@ -7,7 +7,8 @@
-
if
commit
.
description?
%a
.text-expander.js-toggle-button
...
=
link_to
"Browse Code »"
,
project_tree_path
(
project
,
commit
),
class:
"pull-right"
=
link_to_browse_code
(
project
,
commit
)
.notes_count
-
if
@note_counts
-
note_count
=
@note_counts
.
fetch
(
commit
.
id
,
0
)
...
...
features/project/source/browse_files.feature
View file @
c337a278
...
...
@@ -38,4 +38,16 @@ Feature: Project Browse files
And
I click link
"Diff"
Then
I see diff
Scenario
:
I
can browse directory with Browse Dir
Given
I click on app directory
And
I click on history link
Then
I see Browse dir link
Scenario
:
I
can browse file with Browse File
Given
I click on readme file
And
I click on history link
Then
I see Browse file link
Scenario
:
I
can browse code with Browse Code
Given
I click on history link
Then
I see Browse code link
features/steps/project/browse_files.rb
View file @
c337a278
...
...
@@ -62,4 +62,32 @@ class ProjectBrowseFiles < Spinach::FeatureSteps
page
.
should
have_content
"File name"
page
.
should
have_content
"Commit message"
end
step
'I click on app directory'
do
click_link
'app'
end
step
'I click on history link'
do
click_link
'history'
end
step
'I see Browse dir link'
do
page
.
should
have_link
'Browse Dir »'
page
.
should_not
have_link
'Browse Code »'
end
step
'I click on readme file'
do
click_link
'README.md'
end
step
'I see Browse file link'
do
page
.
should
have_link
'Browse File »'
page
.
should_not
have_link
'Browse Code »'
end
step
'I see Browse code link'
do
page
.
should
have_link
'Browse Code »'
page
.
should_not
have_link
'Browse File »'
page
.
should_not
have_link
'Browse Dir »'
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