On 10/19/2010 10:23 PM, Mohammed Morsi wrote:
   Currently when a user adds a package to a new template, a temporary
   template gets created for use until the form is submitted. If the user
   cancels the form, the template still exists when it should not. This
   patch simply changes the create template logic to only create the
   template when the form is submitted

   This patch now works both when javascript is enabled and disabled.



Mostly ACK, this patch looks good and makes code cleaner. There are still some bugs in this code: - template id in controller actions is not checked properly and w/o JS throws exceptions on some places (see attachment)
- group selection doesn't work
- "show all" link doesn't work
- this patch expects that all selected packages are submited for each "add select" action (user can't add packages incrementally), it's not problem now, but will be problem with new selection model.

All bugs (except ids) are related to current selection model which we are now reworking, so there is no reason for spending time by fixing them.

So ACK with ids fix. Rest of above problems will be solved with new selection model, but this patch should be pushed into beta only with new selection model.

Jan
>From d8d153becf61704681e20329cf01747684207d81 Mon Sep 17 00:00:00 2001
From: Jan Provaznik <[email protected]>
Date: Wed, 20 Oct 2010 10:00:05 +0200
Subject: [PATCH aggregator 1/3] fixed ids

---
 src/app/controllers/templates_controller.rb |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/app/controllers/templates_controller.rb 
b/src/app/controllers/templates_controller.rb
index 9c77c9b..6742c6e 100644
--- a/src/app/controllers/templates_controller.rb
+++ b/src/app/controllers/templates_controller.rb
@@ -70,7 +70,7 @@ class TemplatesController < ApplicationController
   def new
     # can't use @template variable - is used by compass (or something other)
     @id  = params[:id]
-    @tpl = @id.nil? ? Template.new : Template.find(@id)
+    @tpl = @id.blank? ? Template.new : Template.find(@id)
     @tpl.attributes = params[:tpl] unless params[:tpl].nil?
     get_selected_packages(@tpl)
     render :action => :new
@@ -78,7 +78,7 @@ class TemplatesController < ApplicationController
 
   def create
     @id  = params[:tpl][:id]
-    @tpl = @id.nil? || @id == "" ? Template.new(params[:tpl]) : 
Template.find(@id)
+    @tpl = @id.blank? ? Template.new(params[:tpl]) : Template.find(@id)
 
     @tpl.xml.clear_packages
 
@@ -101,8 +101,8 @@ class TemplatesController < ApplicationController
 
   def content_selection
     @repository_manager = RepositoryManager.new
-    @id  = params[:id] if params[:id]
-    @tpl = @id.nil? ? Template.new : Template.find(@id)
+    @id  = params[:id]
+    @tpl = @id.blank? ? Template.new : Template.find(@id)
     @tpl.attributes = params[:tpl] unless params[:tpl].nil?
     @packages = []
     @packages = params[:packages].collect{ |p| { :name => p } } if 
params[:packages]
-- 
1.7.2.3

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

Reply via email to