Class: Installation::Widgets::HidingPlace

Inherits:
CWM::ReplacePoint
  • Object
show all
Defined in:
src/lib/installation/widgets/hiding_place.rb

Overview

This class offers a placeholder that to hide/show a given widget

Instance Method Summary collapse

Constructor Details

#initialize(main_widget) ⇒ HidingPlace

Constructor

Parameters:

  • main_widget (CWM::AbstractWidget)

31
32
33
34
35
# File 'src/lib/installation/widgets/hiding_place.rb', line 31

def initialize(main_widget)
  @main_widget = main_widget
  @empty = CWM::Empty.new("no_#{main_widget.widget_id}_placeholder")
  super(id: "#{main_widget.widget_id}_placeholder", widget: @empty)
end

Instance Method Details

#hideObject

Hide the main widget


44
45
46
47
# File 'src/lib/installation/widgets/hiding_place.rb', line 44

def hide
  @main_widget_value = main_widget.value
  replace(empty)
end

#showObject

Show the main widget


38
39
40
41
# File 'src/lib/installation/widgets/hiding_place.rb', line 38

def show
  replace(main_widget)
  main_widget.value = @main_widget_value if @main_widget_value
end

#storeObject

Save the main widget value


50
51
52
53
# File 'src/lib/installation/widgets/hiding_place.rb', line 50

def store
  @main_widget_value = main_widget.value
  super
end