Commit 44cf2470 authored by Douwe Maan's avatar Douwe Maan

Render blob using blob viewers

parent 30db305d
...@@ -26,9 +26,4 @@ ...@@ -26,9 +26,4 @@
%article.file-holder %article.file-holder
= render "projects/blob/header", blob: blob = render "projects/blob/header", blob: blob
- if blob.empty? = render 'projects/blob/content', blob: blob
.file-content.code
.nothing-here-block
Empty file
- else
= render blob.to_partial_path(@project), blob: blob
- simple_viewer = blob.simple_viewer
- rich_viewer = blob.rich_viewer
- active_viewer = rich_viewer && params[:viewer] != 'simple' ? :rich : :simple
= render 'projects/blob/viewer_wrapper', viewer: simple_viewer, hidden: (active_viewer != :simple)
- if rich_viewer
= render 'projects/blob/viewer_wrapper', viewer: rich_viewer, hidden: (active_viewer != :rich)
- if error = viewer.render_error(override_max_size: params[:override_max_size])
= render 'projects/blob/render_error', viewer: viewer, error: error
- else
- viewer.prepare!
= render viewer.partial_path, viewer: viewer
- hidden = local_assigns.fetch(:hidden, false)
- url = url_for(params.merge(format: :json, viewer: viewer.type)) if viewer.server_side?
.blob-viewer{ data: { type: viewer.type, url: url }, class: ('hidden' if hidden) }
- if viewer.server_side?
.text-center.prepend-top-default.append-bottom-default
= icon('spinner spin 2x', 'aria-hidden' => 'true', 'aria-label' => 'Loading content')
- else
= render 'projects/blob/viewer', viewer: viewer
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment