Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

BZ 806846 ImageController: removed duplicate code, fixed flash displa…

…ying
  • Loading branch information...
commit 144afb2834b7589e6a1860b846c2ee5c6913eb93 1 parent bdc6f3e
Jozef Zigmund jzigmund authored
15 src/app/controllers/images_controller.rb
View
@@ -64,8 +64,6 @@ def show
load_builds
load_target_images(@build)
@target_image_exists = @target_images_by_target.any?
- @account_groups_listing = @account_groups.select{ |driver, group| group[:included] || @target_images_by_target[driver] || (@build and @builder.find_active_build(@build.id, driver)) }
- flash[:error] = t("images.flash.error.no_provider_accounts") if @account_groups_listing.blank?
@user_can_build =
(@environment && check_privilege(Privilege::USE, @environment))
@@ -168,14 +166,13 @@ def template
def new
@environment = PoolFamily.find(params[:environment])
check_permissions
- if 'import' == params[:tab]
- @accounts = @environment.provider_accounts.enabled.list_for_user(current_user, Privilege::USE)
- if !@accounts.any?
- flash[:error] = t("images.flash.error.no_provider_accounts_for_import")
- end
- render :import and return
+ @accounts = @environment.provider_accounts.enabled.list_for_user(current_user, Privilege::USE)
+ if @accounts.empty?
+ flash.now[:error] = params[:tab] == 'import' ?
+ t("images.flash.error.no_provider_accounts_for_import") :
+ t("images.flash.error.no_provider_accounts")
end
-
+ render 'import' == params[:tab] ? :import : :new
end
def import
2  src/config/locales/en.yml
View
@@ -865,7 +865,7 @@ en:
no_file: You must specify the template XML file
no_template: "The image doesn't have a template because it's been imported."
no_provider_accounts: "Images cannot be built, as there are no enabled Provider Accounts associated to this Environment."
- no_provider_accounts_for_import: Images cannot be imported, as no provider accounts are currently enabled for this environment.
+ no_provider_accounts_for_import: "Images cannot be imported, as no Provider Accounts are currently enabled for this Environment."
new:
new_image: New Image
description:
Please sign in to comment.
Something went wrong with that request. Please try again.