aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/exports_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/exports_controller.rb')
-rw-r--r--app/controllers/exports_controller.rb34
1 files changed, 34 insertions, 0 deletions
diff --git a/app/controllers/exports_controller.rb b/app/controllers/exports_controller.rb
new file mode 100644
index 000000000..6a77f7f45
--- /dev/null
+++ b/app/controllers/exports_controller.rb
@@ -0,0 +1,34 @@
+class ExportsController < ChouetteController
+
+ respond_to :html, :xml, :json
+ respond_to :zip, :only => :show
+
+ belongs_to :referential
+
+ def create
+ create! do |success, failure|
+ success.html { redirect_to referential_exports_path(@referential) }
+ end
+ end
+
+ def show
+ show! do |format|
+ format.zip { send_file @export.file, :type => :zip }
+ end
+ end
+
+
+ protected
+
+ # FIXME why #resource_id is nil ??
+ def build_resource
+ super.tap do |export|
+ export.referential_id = @referential.id
+ end
+ end
+
+ def collection
+ @exports ||= end_of_association_chain.paginate(:page => params[:page])
+ end
+
+end