-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move <ask> widgets to its own namespace
- Loading branch information
Showing
17 changed files
with
1,047 additions
and
778 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# Copyright (c) [2021] SUSE LLC | ||
# | ||
# All Rights Reserved. | ||
# | ||
# This program is free software; you can redistribute it and/or modify it | ||
# under the terms of version 2 of the GNU General Public License as published | ||
# by the Free Software Foundation. | ||
# | ||
# This program is distributed in the hope that it will be useful, but WITHOUT | ||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
# more details. | ||
# | ||
# You should have received a copy of the GNU General Public License along | ||
# with this program; if not, contact SUSE LLC. | ||
# | ||
# To contact SUSE LLC about this file by physical or electronic mail, you may | ||
# find current contact information at www.suse.com. | ||
|
||
require "yast" | ||
require "cwm" | ||
require "autoinstall/widgets/ask/field" | ||
|
||
module Y2Autoinstall | ||
module Widgets | ||
module Ask | ||
# CheckBox widget for <ask> questions | ||
# | ||
# @see Dialog | ||
class CheckBox < CWM::CheckBox | ||
include Field | ||
|
||
# @param question [Y2Autoinstall::Ask::Question] Question to represent | ||
def initialize(question) | ||
textdomain "autoinst" | ||
@question = question | ||
end | ||
|
||
# @macro seeAbstractWidget | ||
def opt | ||
[:notify] | ||
end | ||
|
||
# @macro seeAbstractWidget | ||
def init | ||
if !@question.value.nil? | ||
self.value = @question.value | ||
return | ||
end | ||
|
||
if @question.default_value_script | ||
default_from_script = run_script(@question.default_value_script) | ||
end | ||
|
||
self.value = if default_from_script.nil? | ||
@question.default == "true" | ||
else | ||
default_from_script == "true" | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Copyright (c) [2021] SUSE LLC | ||
# | ||
# All Rights Reserved. | ||
# | ||
# This program is free software; you can redistribute it and/or modify it | ||
# under the terms of version 2 of the GNU General Public License as published | ||
# by the Free Software Foundation. | ||
# | ||
# This program is distributed in the hope that it will be useful, but WITHOUT | ||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
# more details. | ||
# | ||
# You should have received a copy of the GNU General Public License along | ||
# with this program; if not, contact SUSE LLC. | ||
# | ||
# To contact SUSE LLC about this file by physical or electronic mail, you may | ||
# find current contact information at www.suse.com. | ||
|
||
require "yast" | ||
require "cwm" | ||
require "autoinstall/widgets/ask/field" | ||
|
||
module Y2Autoinstall | ||
module Widgets | ||
module Ask | ||
# Combo Box widget for <ask> questions | ||
# | ||
# @see Dialog | ||
class ComboBox < CWM::ComboBox | ||
include Field | ||
|
||
# @param question [Y2Autoinstall::Ask::Question] Question to represent | ||
def initialize(question) | ||
@question = question | ||
end | ||
|
||
# @macro seeAbstractWidget | ||
def opt | ||
[:notify, :immediate] | ||
end | ||
|
||
# @macro seeComboBox | ||
def items | ||
@question.options.map do |option| | ||
label = option.label || option.value | ||
[option.value, label] | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.