diff options
Diffstat (limited to 'app/controllers/concerns/renders_blob.rb')
-rw-r--r-- | app/controllers/concerns/renders_blob.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/app/controllers/concerns/renders_blob.rb b/app/controllers/concerns/renders_blob.rb new file mode 100644 index 00000000000..9faf68e6d97 --- /dev/null +++ b/app/controllers/concerns/renders_blob.rb @@ -0,0 +1,21 @@ +module RendersBlob + extend ActiveSupport::Concern + + def render_blob_json(blob) + viewer = + if params[:viewer] == 'rich' + blob.rich_viewer + else + blob.simple_viewer + end + return render_404 unless viewer + + render json: { + html: view_to_html_string("projects/blob/_viewer", viewer: viewer, load_asynchronously: false) + } + end + + def override_max_blob_size(blob) + blob.override_max_size! if params[:override_max_size] == 'true' + end +end |