Fixes
https://bugzilla.redhat.com/show_bug.cgi?id=717541
---
src/app/controllers/instances_controller.rb | 4 +++-
src/config/locales/en.yml | 1 +
2 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/src/app/controllers/instances_controller.rb
b/src/app/controllers/instances_controller.rb
index 004da1f..0b43fad 100644
--- a/src/app/controllers/instances_controller.rb
+++ b/src/app/controllers/instances_controller.rb
@@ -124,7 +124,7 @@ class InstancesController < ApplicationController
def multi_stop
notices = ""
errors = ""
- Instance.find(params[:instance_selected]).each do |instance|
+ Instance.find(params[:instance_selected] || []).each do |instance|
begin
require_privilege(Privilege::USE,instance)
unless instance.valid_action?('stop')
@@ -143,6 +143,8 @@ class InstancesController < ApplicationController
errors << "#{instance.name}: " + err + "<br/>"
end
end
+ # If nothing is selected, display an error message:
+ errors = t('instances.none_selected') if errors.blank? &&
notices.blank?
flash[:notice] = notices unless notices.blank?
flash[:error] = errors unless errors.blank?
respond_to do |format|
diff --git a/src/config/locales/en.yml b/src/config/locales/en.yml
index 079503a..b76dfa2 100644
--- a/src/config/locales/en.yml
+++ b/src/config/locales/en.yml
@@ -101,6 +101,7 @@ en:
not_deleted:
one: "The instance %{list} could not be deleted."
other: "The instances %{list} could not be deleted."
+ none_selected: "You must select one or more instances to stop."
searches: Searches
image_factory: Image Factory
assemblies: Assemblies
--
1.7.4.4