Fixes a bug where previewing hardware profile matches would fail
when editing an existing HWP.
Resolves
https://bugzilla.redhat.com/show_bug.cgi?id=805586
---
.../controllers/hardware_profiles_controller.rb | 8 +++++++-
src/app/views/hardware_profiles/_form.html.haml | 2 +-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/app/controllers/hardware_profiles_controller.rb
b/src/app/controllers/hardware_profiles_controller.rb
index f845654..ccebaa4 100644
--- a/src/app/controllers/hardware_profiles_controller.rb
+++ b/src/app/controllers/hardware_profiles_controller.rb
@@ -81,6 +81,12 @@ class HardwareProfilesController < ApplicationController
require_privilege(Privilege::CREATE, HardwareProfile)
build_hardware_profile(params[:hardware_profile])
+
+ if params[:commit] == t('hardware_profiles.form.check_matches')
+ find_matching_provider_hardware_profiles
+ render :new and return
+ end
+
if @hardware_profile.save
redirect_to hardware_profiles_path
else
@@ -133,7 +139,7 @@ class HardwareProfilesController < ApplicationController
build_hardware_profile(params[:hardware_profile])
end
- if params[:commit] == "Check Matches"
+ if params[:commit] == t('hardware_profiles.form.check_matches')
require_privilege(Privilege::VIEW, HardwareProfile)
find_matching_provider_hardware_profiles
render :edit and return
diff --git a/src/app/views/hardware_profiles/_form.html.haml
b/src/app/views/hardware_profiles/_form.html.haml
index 58e6c1c..5b130b5 100644
--- a/src/app/views/hardware_profiles/_form.html.haml
+++ b/src/app/views/hardware_profiles/_form.html.haml
@@ -19,5 +19,5 @@
-else
= hwpp_form.text_field(:value)
-= restful_submit_tag t('hardware_profiles.form.check_matches'),
'matching_provider_hardware_profiles',
matching_provider_hardware_profiles_hardware_profiles_path, 'POST', :class =>
'button danger', :id => 'check_matches', 'data-none_selected'
=> t('deployments.flash.error.none_selected')
+= hwp_form.submit t('hardware_profiles.form.check_matches'), :class =>
'danger button', :id => 'check_matches'
= hwp_form.submit t('save'), :class => 'submit button', :id =>
'save_button'
--
1.7.7.6