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
Léo-Paul Géneau
gitlab-ce
Commits
82c2296a
Commit
82c2296a
authored
May 14, 2017
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add auxiliary viewer for README
parent
d4d9b731
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
31 additions
and
4 deletions
+31
-4
app/models/blob.rb
app/models/blob.rb
+1
-0
app/models/blob_viewer/auxiliary.rb
app/models/blob_viewer/auxiliary.rb
+6
-0
app/models/blob_viewer/readme.rb
app/models/blob_viewer/readme.rb
+14
-0
app/views/projects/blob/_auxiliary_viewer.html.haml
app/views/projects/blob/_auxiliary_viewer.html.haml
+5
-0
app/views/projects/blob/_blob.html.haml
app/views/projects/blob/_blob.html.haml
+1
-4
app/views/projects/blob/viewers/_readme.html.haml
app/views/projects/blob/viewers/_readme.html.haml
+4
-0
No files found.
app/models/blob.rb
View file @
82c2296a
...
...
@@ -40,6 +40,7 @@ class Blob < SimpleDelegator
BlobViewer
::
GitlabCiYml
,
BlobViewer
::
RouteMap
,
BlobViewer
::
Readme
,
BlobViewer
::
License
,
BlobViewer
::
Contributing
,
BlobViewer
::
Changelog
...
...
app/models/blob_viewer/auxiliary.rb
View file @
82c2296a
...
...
@@ -2,11 +2,17 @@ module BlobViewer
module
Auxiliary
extend
ActiveSupport
::
Concern
include
Gitlab
::
Allowable
included
do
self
.
loading_partial_name
=
'loading_auxiliary'
self
.
type
=
:auxiliary
self
.
overridable_max_size
=
100
.
kilobytes
self
.
max_size
=
100
.
kilobytes
end
def
visible_to?
(
current_user
)
true
end
end
end
app/models/blob_viewer/readme.rb
0 → 100644
View file @
82c2296a
module
BlobViewer
class
Readme
<
Base
include
Auxiliary
include
Static
self
.
partial_name
=
'readme'
self
.
file_types
=
%i(readme)
self
.
binary
=
false
def
visible_to?
(
current_user
)
can?
(
current_user
,
:read_wiki
,
project
)
end
end
end
app/views/projects/blob/_auxiliary_viewer.html.haml
0 → 100644
View file @
82c2296a
-
blob
=
local_assigns
.
fetch
(
:blob
)
-
auxiliary_viewer
=
blob
.
auxiliary_viewer
-
if
auxiliary_viewer
&&
auxiliary_viewer
.
render_error
.
nil?
&&
auxiliary_viewer
.
visible_to?
(
current_user
)
.well-segment.blob-auxiliary-viewer
=
render
'projects/blob/viewer'
,
viewer:
auxiliary_viewer
app/views/projects/blob/_blob.html.haml
View file @
82c2296a
...
...
@@ -6,10 +6,7 @@
-
blob_commit
=
@repository
.
last_commit_for_path
(
@commit
.
id
,
blob
.
path
)
=
render
blob_commit
,
project:
@project
,
ref:
@ref
-
auxiliary_viewer
=
blob
.
auxiliary_viewer
-
if
auxiliary_viewer
&&
!
auxiliary_viewer
.
render_error
.well-segment.blob-auxiliary-viewer
=
render
'projects/blob/viewer'
,
viewer:
auxiliary_viewer
=
render
"projects/blob/auxiliary_viewer"
,
blob:
blob
#blob-content-holder
.blob-content-holder
%article
.file-holder
...
...
app/views/projects/blob/viewers/_readme.html.haml
0 → 100644
View file @
82c2296a
=
icon
(
'info-circle fw'
)
=
succeed
'.'
do
To learn more about this project, read
=
link_to
"the wiki"
,
namespace_project_wikis_path
(
viewer
.
project
.
namespace
,
viewer
.
project
)
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