From: Jan Provaznik jprovazn@redhat.com
params[:image][:template_id] replaced by params[:template_id] because params[:image] is not used anywhere. --- src/app/controllers/templates_controller.rb | 14 +++++++------- src/app/views/templates/build_form.haml | 8 ++++---- 2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/src/app/controllers/templates_controller.rb b/src/app/controllers/templates_controller.rb index d80f329..4e19df8 100644 --- a/src/app/controllers/templates_controller.rb +++ b/src/app/controllers/templates_controller.rb @@ -32,7 +32,7 @@ class TemplatesController < ApplicationController elsif params[:edit] redirect_to :action => 'new', :id => get_selected_id elsif params[:build] - redirect_to :action => 'build_form', 'image[template_id]' => get_selected_id + redirect_to :action => 'build_form', :template_id => get_selected_id else raise "Unknown action" end @@ -104,8 +104,8 @@ class TemplatesController < ApplicationController end
def build_form - raise "select template to build" unless params[:image] and params[:image][:template_id] - @image = Image.new(params[:image]) + raise "Select template to build" unless id = params[:template_id] + @tpl = Template.find(id) @all_targets = Image.available_targets end
@@ -115,8 +115,8 @@ class TemplatesController < ApplicationController return end
- tpl_id = params[:image][:template_id] - tpl = Template.find(tpl_id) + tpl_id = params[:template_id] + @tpl = Template.find(tpl_id) @all_targets = Image.available_targets
targets = params[:targets].to_a @@ -126,9 +126,9 @@ class TemplatesController < ApplicationController return end
- tpl.upload_template unless tpl.uploaded + @tpl.upload_template unless @tpl.uploaded targets.each do |target| - unless img = Image.build(tpl, target) + unless img = Image.build(@tpl, target) flash[:error] ||= {} flash[:error][:failures] ||= {} flash[:error][:failures][target] = img.errors.full_messages.join(", ") diff --git a/src/app/views/templates/build_form.haml b/src/app/views/templates/build_form.haml index 75f8a34..7084f39 100644 --- a/src/app/views/templates/build_form.haml +++ b/src/app/views/templates/build_form.haml @@ -1,6 +1,6 @@ %h2 BUILD REQUEST -- form_for @image, :url => { :action => "build" } do - = hidden_field :image, :template_id +- form_tag :action => 'build' do + = hidden_field_tag :template_id, @tpl.id %h3 Deployment Definition %fieldset.clearfix = label_tag :deploy_name, 'Deployment Definition Name:', :class => 'grid_4' @@ -25,7 +25,7 @@ %fieldset.clearfix .grid_6 %label OS: - = @image.template.platform + = @tpl.platform .grid_3 Hardware Profile .grid_3.suffix_3 @@ -33,7 +33,7 @@ %fieldset.clearfix .grid_3 %label OS Version: - = @image.template.platform_version + = @tpl.platform_version .grid_3.ra %label Global Settings: .grid_3