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.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/app/controllers/exports_controller.rb b/app/controllers/exports_controller.rb
index ee7e186b9..3b8fee566 100644
--- a/app/controllers/exports_controller.rb
+++ b/app/controllers/exports_controller.rb
@@ -5,8 +5,15 @@ class ExportsController < ChouetteController
belongs_to :referential
+ def new
+ new! do
+ available_exports
+ end
+ end
+
def create
create! do |success, failure|
+ available_exports
success.html { redirect_to referential_exports_path(@referential) }
end
end
@@ -28,6 +35,16 @@ class ExportsController < ChouetteController
protected
+ def available_exports
+ @available_exports ||= Export.types.collect do |type|
+ unless @export.type == type
+ @referential.exports.build :type => type
+ else
+ @export
+ end
+ end
+ end
+
# FIXME why #resource_id is nil ??
def build_resource
super.tap do |export|