aboutsummaryrefslogtreecommitdiff
path: root/app/controllers/exports_controller.rb
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <mikisabate@gmail.com>2025-07-01 08:40:49 +0200
committerMiquel Sabaté Solà <mikisabate@gmail.com>2025-07-01 08:53:56 +0200
commit34e16b7d7a88013578014be0402ab686b03f235b (patch)
tree5ef848d3c44f72ff95a24b123e5da88bc5aef1a2 /app/controllers/exports_controller.rb
parent24714068efc5866999311ad482d54f5c7a90c449 (diff)
downloadoperum-34e16b7d7a88013578014be0402ab686b03f235b.tar.gz
operum-34e16b7d7a88013578014be0402ab686b03f235b.zip
lib: Introduce the PlainExporter
This class exports things into plain text. It follows a close format to that of the one for UOC, but without any formatting. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
Diffstat (limited to 'app/controllers/exports_controller.rb')
-rw-r--r--app/controllers/exports_controller.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/controllers/exports_controller.rb b/app/controllers/exports_controller.rb
index 4303ea6..812cf39 100644
--- a/app/controllers/exports_controller.rb
+++ b/app/controllers/exports_controller.rb
@@ -8,6 +8,12 @@ class ExportsController < ApplicationController
respond_to do |format|
format.csv { set_file_name!(ext: 'csv') }
format.uoc { set_file_name!(ext: 'tex') }
+ format.text do
+ send_data PlainExporter.new(things: @results).export,
+ type: 'text/plain',
+ disposition: 'attachment',
+ filename: "#{@search.name}.txt"
+ end
end
end