From: Jan Provaznik <[email protected]>

https://bugzilla.redhat.com/show_bug.cgi?id=643162
---
 src/app/controllers/templates_controller.rb |    2 +-
 src/app/views/templates/new.haml            |    9 ++++++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/app/controllers/templates_controller.rb 
b/src/app/controllers/templates_controller.rb
index 12cea95..0952406 100644
--- a/src/app/controllers/templates_controller.rb
+++ b/src/app/controllers/templates_controller.rb
@@ -106,7 +106,7 @@ class TemplatesController < ApplicationController
     @tpl.attributes = params[:tpl] unless params[:tpl].nil?
     @packages = []
     @packages = params[:packages].collect{ |p| { :name => p } } if 
params[:packages]
-    @groups = 
@repository_manager.all_groups_with_tagged_selected_packages(@packages, 
params[:repository])
+    @groups = 
@repository_manager.all_groups_with_tagged_selected_packages(@packages, 
@tpl.platform)
     @embed  = params[:embed]
     if @embed
       render :layout => false
diff --git a/src/app/views/templates/new.haml b/src/app/views/templates/new.haml
index 674eeca..7bd62af 100644
--- a/src/app/views/templates/new.haml
+++ b/src/app/views/templates/new.haml
@@ -7,7 +7,8 @@
       e.preventDefault();
       $submit.hide();
       var data = {
-        'packages[]': $("input[name='packages[]']").map(function() {return 
$(this).val()}).get()
+        'packages[]': $("input[name='packages[]']").map(function() {return 
$(this).val()}).get(),
+        'tpl[platform]': $("select[name='tpl[platform]']").val() || ''
       }
       var url = '#{url_for :action => 'content_selection', :embed => true, :id 
=> @id}';
       $content_container.empty().show();
@@ -63,6 +64,12 @@
       });
     });
     $('.remove_package').click(function() { 
$(this).parent().parent().remove(); });
+    // select correct package repo when we change platform
+    $("select[name='tpl[platform]']").change(function() {
+      if ($submit.is(':hidden')) {
+        $submit.trigger('click');
+      }
+    });
   });
 
 .grid_16
-- 
1.7.2.3

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

Reply via email to