From: Jan Provaznik <[email protected]>

---
 src/app/controllers/templates_controller.rb |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/app/controllers/templates_controller.rb 
b/src/app/controllers/templates_controller.rb
index 46649dc..97a8cec 100644
--- a/src/app/controllers/templates_controller.rb
+++ b/src/app/controllers/templates_controller.rb
@@ -56,10 +56,18 @@ class TemplatesController < ApplicationController
   #end
 
   def create
+    if params[:cancel]
+      redirect_to :action => 'index'
+      return
+    end
+
     @tpl = (params[:tpl] && !params[:tpl][:id].to_s.empty?) ? 
Template.find(params[:tpl][:id]) : Template.new(params[:tpl])
-    # this is crazy, but we have most attrs in xml and also in model,
-    # synchronize it at first to xml
-    @tpl.update_xml_attributes!(params[:tpl])
+
+    unless params[:add_software_form] and request.xhr?
+      # this is crazy, but we have most attrs in xml and also in model,
+      # synchronize it at first to xml
+      @tpl.update_xml_attributes!(params[:tpl])
+    end
 
     # if remove pkg, we only update xml and render 'new' template
     # again
-- 
1.7.2.3

_______________________________________________
deltacloud-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/deltacloud-devel

Reply via email to