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
Tatuya Kamada
gitlab-ce
Commits
af7e7798
Commit
af7e7798
authored
Jun 25, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show VERSION information on project sidebar
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
79ee94ec
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
0 deletions
+36
-0
app/models/repository.rb
app/models/repository.rb
+13
-0
app/views/projects/show.html.haml
app/views/projects/show.html.haml
+6
-0
features/project/project.feature
features/project/project.feature
+5
-0
features/steps/project/project.rb
features/steps/project/project.rb
+12
-0
No files found.
app/models/repository.rb
View file @
af7e7798
...
...
@@ -128,6 +128,7 @@ class Repository
Rails
.
cache
.
delete
(
cache_key
(
:commit_count
))
Rails
.
cache
.
delete
(
cache_key
(
:graph_log
))
Rails
.
cache
.
delete
(
cache_key
(
:readme
))
Rails
.
cache
.
delete
(
cache_key
(
:version
))
Rails
.
cache
.
delete
(
cache_key
(
:contribution_guide
))
end
...
...
@@ -156,12 +157,24 @@ class Repository
Gitlab
::
Git
::
Blob
.
find
(
self
,
sha
,
path
)
end
def
blob_by_oid
(
oid
)
Gitlab
::
Git
::
Blob
.
raw
(
self
,
oid
)
end
def
readme
Rails
.
cache
.
fetch
(
cache_key
(
:readme
))
do
tree
(
:head
).
readme
end
end
def
version
Rails
.
cache
.
fetch
(
cache_key
(
:version
))
do
tree
(
:head
).
blobs
.
find
do
|
file
|
file
.
name
.
downcase
==
'version'
end
end
end
def
contribution_guide
Rails
.
cache
.
fetch
(
cache_key
(
:contribution_guide
))
do
tree
(
:head
).
contribution_guide
...
...
app/views/projects/show.html.haml
View file @
af7e7798
...
...
@@ -44,6 +44,12 @@
=
link_to
project_blob_path
(
@project
,
tree_join
(
@repository
.
root_ref
,
readme
.
name
)),
class:
'btn btn-block'
do
=
readme
.
name
-
if
@repository
.
version
-
version
=
@repository
.
version
=
link_to
project_blob_path
(
@project
,
tree_join
(
@repository
.
root_ref
,
version
.
name
)),
class:
'btn btn-block'
do
Version:
=
@repository
.
blob_by_oid
(
version
.
id
).
data
.prepend-top-10
%p
%span
.light
Created on
...
...
features/project/project.feature
View file @
af7e7798
...
...
@@ -24,3 +24,8 @@ Feature: Project Feature
When
I visit edit project
"Shop"
page
And
change project path settings
Then
I should see project with new path settings
Scenario
:
I
should see project readme and version
When
I visit project
"Shop"
page
Then
I should see project
"Shop"
README link
And
I should see project
"Shop"
version
features/steps/project/project.rb
View file @
af7e7798
...
...
@@ -24,4 +24,16 @@ class ProjectFeature < Spinach::FeatureSteps
step
'I should see project with new path settings'
do
project
.
path
.
should
==
"new-path"
end
step
'I should see project "Shop" README link'
do
within
'.project-side'
do
page
.
should
have_content
"README.md"
end
end
step
'I should see project "Shop" version'
do
within
'.project-side'
do
page
.
should
have_content
"Version: 2.2.0"
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