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
d4d9b731
Commit
d4d9b731
authored
May 17, 2017
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dm-changelog-viewer' into 'master'
Add auxiliary blob viewer for CHANGELOG See merge request !11365
parents
17e79998
d1bce8ea
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
52 additions
and
2 deletions
+52
-2
app/models/blob.rb
app/models/blob.rb
+2
-1
app/models/blob_viewer/base.rb
app/models/blob_viewer/base.rb
+2
-0
app/models/blob_viewer/changelog.rb
app/models/blob_viewer/changelog.rb
+16
-0
app/models/blob_viewer/license.rb
app/models/blob_viewer/license.rb
+1
-1
app/views/projects/blob/viewers/_changelog.html.haml
app/views/projects/blob/viewers/_changelog.html.haml
+4
-0
spec/models/blob_viewer/changelog_spec.rb
spec/models/blob_viewer/changelog_spec.rb
+27
-0
No files found.
app/models/blob.rb
View file @
d4d9b731
...
...
@@ -41,7 +41,8 @@ class Blob < SimpleDelegator
BlobViewer
::
RouteMap
,
BlobViewer
::
License
,
BlobViewer
::
Contributing
BlobViewer
::
Contributing
,
BlobViewer
::
Changelog
].
freeze
attr_reader
:project
...
...
app/models/blob_viewer/base.rb
View file @
d4d9b731
...
...
@@ -11,6 +11,8 @@ module BlobViewer
attr_reader
:blob
attr_accessor
:override_max_size
delegate
:project
,
to: :blob
def
initialize
(
blob
)
@blob
=
blob
end
...
...
app/models/blob_viewer/changelog.rb
0 → 100644
View file @
d4d9b731
module
BlobViewer
class
Changelog
<
Base
include
Auxiliary
include
Static
self
.
partial_name
=
'changelog'
self
.
file_types
=
%i(changelog)
self
.
binary
=
false
def
render_error
return
if
project
.
repository
.
tag_count
>
0
:no_tags
end
end
end
app/models/blob_viewer/license.rb
View file @
d4d9b731
...
...
@@ -8,7 +8,7 @@ module BlobViewer
self
.
binary
=
false
def
license
blob
.
project
.
repository
.
license
project
.
repository
.
license
end
def
render_error
...
...
app/views/projects/blob/viewers/_changelog.html.haml
0 → 100644
View file @
d4d9b731
=
icon
(
'history fw'
)
=
succeed
'.'
do
To find the state of this project's repository at the time of any of these versions, check out
=
link_to
"the tags"
,
namespace_project_tags_path
(
viewer
.
project
.
namespace
,
viewer
.
project
)
spec/models/blob_viewer/changelog_spec.rb
0 → 100644
View file @
d4d9b731
require
'spec_helper'
describe
BlobViewer
::
Changelog
,
model:
true
do
include
FakeBlobHelpers
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:blob
)
{
fake_blob
(
path:
'CHANGELOG'
)
}
subject
{
described_class
.
new
(
blob
)
}
describe
'#render_error'
do
context
'when there are no tags'
do
before
do
allow
(
project
.
repository
).
to
receive
(
:tag_count
).
and_return
(
0
)
end
it
'returns :no_tags'
do
expect
(
subject
.
render_error
).
to
eq
(
:no_tags
)
end
end
context
'when there are tags'
do
it
'returns nil'
do
expect
(
subject
.
render_error
).
to
be_nil
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