Skip to content

Commit

Permalink
Merge cd11314 into 7c58df8
Browse files Browse the repository at this point in the history
  • Loading branch information
lslezak committed Mar 18, 2020
2 parents 7c58df8 + cd11314 commit 97667dc
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 23 deletions.
44 changes: 22 additions & 22 deletions library/cwm/src/lib/cwm/multi_status_selector.rb
Expand Up @@ -299,12 +299,12 @@ def self.event_id
def self.help
help_text = "<p>"
# TRANSLATORS: help text for a not selected check box
help_text << "#{icon_for(UNSELECTED)} = #{_("Not selected")}<br />"
help_text << "#{icon_for(UNSELECTED, mode: mode)} = #{_("Not selected")}<br />"
# TRANSLATORS: help text for a selected check box
help_text << "#{icon_for(SELECTED)} = #{_("Selected")}<br />"
help_text << "#{icon_for(SELECTED, mode: mode)} = #{_("Selected")}<br />"
# TRANSLATORS: help text for an automatically selected check box
# (it has a different look that a user selected check box)
help_text << "#{icon_for(AUTO_SELECTED)} = #{_("Auto selected")}"
help_text << "#{icon_for(AUTO_SELECTED, mode: mode)} = #{_("Auto selected")}"
help_text << "</p>"
help_text
end
Expand Down Expand Up @@ -405,11 +405,28 @@ def to_richtext
"#{checkbox_input} #{checkbox_label}"
end

# Determines whether running in installation mode
#
# We do not use Stage.initial because of firstboot, which runs in 'installation' mode
# but in 'firstboot' stage.
#
# @return [Boolean] Boolean if running in installation or update mode
def self.installation?
Yast::Mode.installation || Yast::Mode.update
end

# Returns the current mode
#
# @return [String] "normal" in a running system; "inst" during the installation
def self.mode
installation? ? "inst" : "normal"
end

private

# @see .icon_for
def icon
self.class.icon_for(status, mode: mode, state: state)
self.class.icon_for(status, mode: self.class.mode, state: state)
end

# Builds the check box input representation
Expand All @@ -434,13 +451,6 @@ def checkbox_label
end
end

# Returns the current mode
#
# @return [String] "normal" in a running system; "inst" during the installation
def mode
installation? ? "inst" : "normal"
end

# Returns the current input state
#
# @return [String] "enabled" when item must be enabled; "disabled" otherwise
Expand All @@ -462,20 +472,10 @@ def text_style
# "black" otherwise
def color
return "grey" unless enabled?
return "white" if installation?
return "white" if self.class.installation?

"black"
end

# Determines whether running in installation mode
#
# We do not use Stage.initial because of firstboot, which runs in 'installation' mode
# but in 'firstboot' stage.
#
# @return [Boolean] Boolean if running in installation or update mode
def installation?
Yast::Mode.installation || Yast::Mode.update
end
end
end
end
24 changes: 24 additions & 0 deletions library/cwm/test/multi_status_selector_test.rb
Expand Up @@ -436,4 +436,28 @@ def initialize(id, status, enabled)
end
end
end

describe ".help" do
context "in installation" do
before do
allow(Yast::Mode).to receive(:installation).and_return(true)
allow(Yast::Mode).to receive(:update).and_return(false)
end

it "uses the installation icon" do
expect(subject.class.help).to include("inst_checkbox-on.svg")
end
end

context "in installed system" do
before do
allow(Yast::Mode).to receive(:installation).and_return(false)
allow(Yast::Mode).to receive(:update).and_return(false)
end

it "uses the standard icon" do
expect(subject.class.help).to include("checkbox-on.svg")
end
end
end
end
7 changes: 7 additions & 0 deletions package/yast2.changes
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Tue Mar 17 15:46:35 UTC 2020 - Ladislav Slezák <lslezak@suse.cz>

- Fixed CWM::MultiStatusSelector help text icons displayed during
installation (related to bsc#1157780, bsc#1161308, bsc#1161200)
- 4.2.74

-------------------------------------------------------------------
Fri Mar 13 01:54:58 UTC 2020 - David Diaz <dgonzalez@suse.com>

Expand Down
2 changes: 1 addition & 1 deletion package/yast2.spec
Expand Up @@ -17,7 +17,7 @@


Name: yast2
Version: 4.2.73
Version: 4.2.74
Release: 0
Summary: YaST2 Main Package
License: GPL-2.0-only
Expand Down

0 comments on commit 97667dc

Please sign in to comment.