From: Jozef Zigmund jzigmund@redhat.com
--- src/app/controllers/deployments_controller.rb | 8 ++++---- src/app/views/layouts/_new_notification.haml | 16 ++++++++++++++-- 2 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/src/app/controllers/deployments_controller.rb b/src/app/controllers/deployments_controller.rb index 98171a9..b74bebb 100644 --- a/src/app/controllers/deployments_controller.rb +++ b/src/app/controllers/deployments_controller.rb @@ -234,8 +234,8 @@ class DeploymentsController < ApplicationController end
def multi_stop - notices = "" - errors = "" + notices = [] + errors = [] Deployment.find(params[:deployments_selected] || []).each do |deployment| deployment.instances.each do |instance| begin @@ -250,9 +250,9 @@ class DeploymentsController < ApplicationController raise ActionError.new("stop cannot be performed on this instance.") end Taskomatic.stop_instance(@task) - notices << "Deployment: #{instance.deployment.name}, Instance: #{instance.name}: stop action was successfully queued.<br/>" + notices << "Deployment: #{instance.deployment.name}, Instance: #{instance.name}: stop action was successfully queued." rescue Exception => err - errors << "Deployment: #{instance.deployment.name}, Instance: #{instance.name}: " + err + "<br/>" + errors << "Deployment: #{instance.deployment.name}, Instance: #{instance.name}: " + err end end end diff --git a/src/app/views/layouts/_new_notification.haml b/src/app/views/layouts/_new_notification.haml index 33a654c..e248684 100644 --- a/src/app/views/layouts/_new_notification.haml +++ b/src/app/views/layouts/_new_notification.haml @@ -14,7 +14,11 @@ %div.heading =image_tag 'flash_notice_icon.png', :alt => 'Notices' %ul.flashes - %li= flash[:notice] + -if flash[:notice].kind_of?(Array) + -flash[:notice].each do |msg| + %li= msg + -else flash[:notice] + %li= flash[:notice]
-if flash[:warning] .warning.flash-group @@ -30,7 +34,7 @@ %div.heading =image_tag 'flash_error_icon.png', :alt => 'Errors' =flash[:error] - -else + -elsif flash[:error].kind_of?(Hash) -unless flash[:error][:successes].blank? .notice.flash-group .flash-subset @@ -55,3 +59,11 @@ -else -flash[:error].each do |e| %li= e + -elsif flash[:error].kind_of?(Array) + .error.flash-group + .flash-subset + %div.heading + =image_tag 'flash_error_icon.png', :alt => 'Errors' + %ul.flashes + -flash[:error].each do |msg| + %li= msg
On 09/27/2011 06:46 PM, jzigmund@redhat.com wrote:
From: Jozef Zigmundjzigmund@redhat.com
src/app/controllers/deployments_controller.rb | 8 ++++---- src/app/views/layouts/_new_notification.haml | 16 ++++++++++++++-- 2 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/src/app/controllers/deployments_controller.rb b/src/app/controllers/deployments_controller.rb index 98171a9..b74bebb 100644 --- a/src/app/controllers/deployments_controller.rb +++ b/src/app/controllers/deployments_controller.rb @@ -234,8 +234,8 @@ class DeploymentsController< ApplicationController end
def multi_stop
- notices = ""
- errors = ""
- notices = []
- errors = [] Deployment.find(params[:deployments_selected] || []).each do |deployment| deployment.instances.each do |instance| begin
@@ -250,9 +250,9 @@ class DeploymentsController< ApplicationController raise ActionError.new("stop cannot be performed on this instance.") end Taskomatic.stop_instance(@task)
notices<< "Deployment: #{instance.deployment.name}, Instance: #{instance.name}: stop action was successfully queued.<br/>"
notices<< "Deployment: #{instance.deployment.name}, Instance: #{instance.name}: stop action was successfully queued." rescue Exception => err
errors<< "Deployment: #{instance.deployment.name}, Instance: #{instance.name}: " + err +"<br/>"
errors<< "Deployment: #{instance.deployment.name}, Instance: #{instance.name}: " + err end end end
diff --git a/src/app/views/layouts/_new_notification.haml b/src/app/views/layouts/_new_notification.haml index 33a654c..e248684 100644 --- a/src/app/views/layouts/_new_notification.haml +++ b/src/app/views/layouts/_new_notification.haml @@ -14,7 +14,11 @@ %div.heading =image_tag 'flash_notice_icon.png', :alt => 'Notices' %ul.flashes
%li= flash[:notice]
-if flash[:notice].kind_of?(Array)
-flash[:notice].each do |msg|
%li= msg
-else flash[:notice]
%li= flash[:notice]
-if flash[:warning] .warning.flash-group
@@ -30,7 +34,7 @@ %div.heading =image_tag 'flash_error_icon.png', :alt => 'Errors' =flash[:error]
- -else
- -elsif flash[:error].kind_of?(Hash) -unless flash[:error][:successes].blank? .notice.flash-group .flash-subset
@@ -55,3 +59,11 @@ -else -flash[:error].each do |e| %li= e
- -elsif flash[:error].kind_of?(Array)
.error.flash-group
.flash-subset
%div.heading
=image_tag 'flash_error_icon.png', :alt => 'Errors'
%ul.flashes
-flash[:error].each do |msg|
%li= msg
ACK
aeolus-devel@lists.fedorahosted.org