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
Boxiang Sun
gitlab-ce
Commits
4328bc17
Commit
4328bc17
authored
7 years ago
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow blob viewer to support multiple filetypes
parent
361b2b13
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
7 deletions
+7
-7
app/models/blob_viewer/base.rb
app/models/blob_viewer/base.rb
+4
-4
app/models/blob_viewer/gitlab_ci_yml.rb
app/models/blob_viewer/gitlab_ci_yml.rb
+1
-1
app/models/blob_viewer/license.rb
app/models/blob_viewer/license.rb
+1
-1
app/models/blob_viewer/route_map.rb
app/models/blob_viewer/route_map.rb
+1
-1
No files found.
app/models/blob_viewer/base.rb
View file @
4328bc17
...
...
@@ -2,7 +2,7 @@ module BlobViewer
class
Base
PARTIAL_PATH_PREFIX
=
'projects/blob/viewers'
.
freeze
class_attribute
:partial_name
,
:loading_partial_name
,
:type
,
:extensions
,
:file_type
,
:client_side
,
:binary
,
:switcher_icon
,
:switcher_title
,
:max_size
,
:absolute_max_size
class_attribute
:partial_name
,
:loading_partial_name
,
:type
,
:extensions
,
:file_type
s
,
:client_side
,
:binary
,
:switcher_icon
,
:switcher_title
,
:max_size
,
:absolute_max_size
self
.
loading_partial_name
=
'loading'
...
...
@@ -54,17 +54,17 @@ module BlobViewer
def
self
.
can_render?
(
blob
,
verify_binary:
true
)
return
false
if
verify_binary
&&
binary?
!=
blob
.
binary?
return
true
if
extensions
&
.
include?
(
blob
.
extension
)
return
true
if
file_type
&&
Gitlab
::
FileDetector
.
type_of
(
blob
.
path
)
==
file_type
return
true
if
file_type
s
&
.
include?
(
Gitlab
::
FileDetector
.
type_of
(
blob
.
path
))
false
end
def
too_large?
blob
.
raw_size
>
max_size
max_size
&&
blob
.
raw_size
>
max_size
end
def
absolutely_too_large?
blob
.
raw_size
>
absolute_max_size
absolute_max_size
&&
blob
.
raw_size
>
absolute_max_size
end
def
can_override_max_size?
...
...
This diff is collapsed.
Click to expand it.
app/models/blob_viewer/gitlab_ci_yml.rb
View file @
4328bc17
...
...
@@ -5,7 +5,7 @@ module BlobViewer
self
.
partial_name
=
'gitlab_ci_yml'
self
.
loading_partial_name
=
'gitlab_ci_yml_loading'
self
.
file_type
=
:gitlab_ci
self
.
file_type
s
=
%i(gitlab_ci)
self
.
binary
=
false
def
validation_message
...
...
This diff is collapsed.
Click to expand it.
app/models/blob_viewer/license.rb
View file @
4328bc17
...
...
@@ -7,7 +7,7 @@ module BlobViewer
include
Auxiliary
self
.
partial_name
=
'license'
self
.
file_type
=
:license
self
.
file_type
s
=
%i(license)
self
.
binary
=
false
def
license
...
...
This diff is collapsed.
Click to expand it.
app/models/blob_viewer/route_map.rb
View file @
4328bc17
...
...
@@ -5,7 +5,7 @@ module BlobViewer
self
.
partial_name
=
'route_map'
self
.
loading_partial_name
=
'route_map_loading'
self
.
file_type
=
:route_map
self
.
file_type
s
=
%i(route_map)
self
.
binary
=
false
def
validation_message
...
...
This diff is collapsed.
Click to expand it.
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