Skip to content

Commit

Permalink
Fix product's validation on welcome screen
Browse files Browse the repository at this point in the history
  • Loading branch information
imobachgs committed Sep 1, 2017
1 parent 9bd0787 commit b16006c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/lib/installation/clients/inst_complex_welcome.rb
Expand Up @@ -84,6 +84,10 @@ def handle_ret(ret)

when :next
return nil unless Language.CheckIncompleteTranslation(@language)
if selected_product.nil?
Yast::Popup.Error(_("Please select a product to install."))
return nil
end
setup_final_choice
merge_and_run_workflow if selected_product
:next
Expand Down
2 changes: 1 addition & 1 deletion src/lib/installation/dialogs/complex_welcome.rb
Expand Up @@ -77,7 +77,7 @@ def contents
#
# @return [::Installation::Widgets::ProductSelector]
def product_selector
::Installation::Widgets::ProductSelector.new(products)
::Installation::Widgets::ProductSelector.new(products, skip_validation: true)
end

# Product license widget
Expand Down
13 changes: 11 additions & 2 deletions src/lib/installation/widgets/product_selector.rb
Expand Up @@ -13,9 +13,11 @@ class ProductSelector < CWM::RadioButtons
attr_reader :product

# @param products [Array<Installation::Product>] to display
def initialize(products)
# @param skip_validation [Boolean] Skip value validation
def initialize(products, skip_validation: false)
@products = products
@items = products.map { |p| [p.name, p.label] }
@skip_validation = skip_validation
textdomain "installation"
end

Expand Down Expand Up @@ -49,11 +51,18 @@ def store
end

def validate
return true if value
return true if value || skip_validation?

Yast::Popup.Error(_("Please select a product to install."))
false
end

# Determine whether the validation should be skipped
#
# @see #initialize
def skip_validation?
@skip_validation
end
end
end
end

0 comments on commit b16006c

Please sign in to comment.