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
f112a03c
Commit
f112a03c
authored
Apr 13, 2017
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add simple blob viewers
parent
13891a03
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
66 additions
and
2 deletions
+66
-2
app/models/blob_viewer/client_side.rb
app/models/blob_viewer/client_side.rb
+11
-0
app/models/blob_viewer/download.rb
app/models/blob_viewer/download.rb
+13
-0
app/models/blob_viewer/empty.rb
app/models/blob_viewer/empty.rb
+9
-0
app/models/blob_viewer/simple.rb
app/models/blob_viewer/simple.rb
+11
-0
app/models/blob_viewer/text.rb
app/models/blob_viewer/text.rb
+11
-0
app/views/projects/blob/_text.html.haml
app/views/projects/blob/_text.html.haml
+0
-2
app/views/projects/blob/viewers/_download.html.haml
app/views/projects/blob/viewers/_download.html.haml
+7
-0
app/views/projects/blob/viewers/_empty.html.haml
app/views/projects/blob/viewers/_empty.html.haml
+3
-0
app/views/projects/blob/viewers/_text.html.haml
app/views/projects/blob/viewers/_text.html.haml
+1
-0
No files found.
app/models/blob_viewer/client_side.rb
0 → 100644
View file @
f112a03c
module
BlobViewer
module
ClientSide
extend
ActiveSupport
::
Concern
included
do
self
.
client_side
=
true
self
.
max_size
=
10
.
megabytes
self
.
absolute_max_size
=
50
.
megabytes
end
end
end
app/models/blob_viewer/download.rb
0 → 100644
View file @
f112a03c
module
BlobViewer
class
Download
<
Base
include
Simple
include
ServerSide
self
.
partial_name
=
'download'
self
.
text_based
=
false
def
render_error
(
*
)
nil
end
end
end
app/models/blob_viewer/empty.rb
0 → 100644
View file @
f112a03c
module
BlobViewer
class
Empty
<
Base
include
Simple
include
ServerSide
self
.
partial_name
=
'empty'
self
.
text_based
=
false
end
end
app/models/blob_viewer/simple.rb
0 → 100644
View file @
f112a03c
module
BlobViewer
module
Simple
extend
ActiveSupport
::
Concern
included
do
self
.
type
=
:simple
self
.
switcher_icon
=
'code'
self
.
switcher_title
=
'source'
end
end
end
app/models/blob_viewer/text.rb
0 → 100644
View file @
f112a03c
module
BlobViewer
class
Text
<
Base
include
Simple
include
ServerSide
self
.
partial_name
=
'text'
self
.
text_based
=
true
self
.
max_size
=
1
.
megabyte
self
.
absolute_max_size
=
10
.
megabytes
end
end
app/views/projects/blob/_text.html.haml
deleted
100644 → 0
View file @
13891a03
-
blob
.
load_all_data!
(
@repository
)
=
render
'shared/file_highlight'
,
blob:
blob
,
repository:
@repository
app/views/projects/blob/_download.html.haml
→
app/views/projects/blob/
viewers/
_download.html.haml
View file @
f112a03c
.file-content.blob_file.blob-no-preview
.file-content.blob_file.blob-no-preview
.center
.center
=
link_to
namespace_project_raw_path
(
@project
.
namespace
,
@project
,
@id
)
do
=
link_to
blob_raw_url
do
%h1
.light
%h1
.light
%i
.fa.fa-download
=
icon
(
'download'
)
%h4
%h4
Download (
#{
number_to_human_size
blob_size
(
blob
)
}
)
Download (
#{
number_to_human_size
(
viewer
.
blob
.
raw_size
)
}
)
app/views/projects/blob/viewers/_empty.html.haml
0 → 100644
View file @
f112a03c
.file-content.code
.nothing-here-block
Empty file
app/views/projects/blob/viewers/_text.html.haml
0 → 100644
View file @
f112a03c
=
render
'shared/file_highlight'
,
blob:
viewer
.
blob
,
repository:
@repository
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