On 10/13/10 - 02:33:51PM, [email protected] wrote:
> From: Jan Provaznik <[email protected]>
> 
> Display error message when deleting template and no template is selected
> ---
>  src/app/controllers/templates_controller.rb |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/src/app/controllers/templates_controller.rb 
> b/src/app/controllers/templates_controller.rb
> index ec31012..8c8466a 100644
> --- a/src/app/controllers/templates_controller.rb
> +++ b/src/app/controllers/templates_controller.rb
> @@ -159,7 +159,9 @@ class TemplatesController < ApplicationController
>    end
>  
>    def delete
> -    Template.destroy(params[:ids].to_a)
> +    ids = params[:ids].to_a
> +    raise "No Template Selected" if ids.empty?
> +    Template.destroy(ids)
>      redirect_to :action => 'index'
>    end
>  
> @@ -188,7 +190,7 @@ class TemplatesController < ApplicationController
>    def get_selected_id
>      ids = params[:ids].to_a
>      if ids.size != 1
> -      raise "No template is selected" if ids.empty?
> +      raise "No Template Selected" if ids.empty?
>        raise "You can select only one template" if ids.size > 1
>      end
>      return ids.first

Correct me if I am wrong, but I'm not sure that we need this patch anymore.
The recent UI updates have made it so that the "Delete" link only becomes
active when you actually check something, so this is an "impossible" situation
to run into.

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

Reply via email to