Class: Yast::SummaryClass

Inherits:
Module
  • Object
show all
Defined in:
library/general/src/modules/Summary.rb

Instance Method Summary collapse

Instance Method Details

#AddHeader(summary, header) ⇒ String

Add a RichText section header to an existing summary.



108
109
110
# File 'library/general/src/modules/Summary.rb', line 108

def AddHeader(summary, header)
  Ops.add(Ops.add(Ops.add(summary, "<h3>"), header), "</h3>")
end

#AddLine(summary, line) ⇒ String

Add a line to an existing summary.



117
118
119
# File 'library/general/src/modules/Summary.rb', line 117

def AddLine(summary, line)
  Ops.add(Ops.add(Ops.add(summary, "<p>"), line), "</p>")
end

#AddListItem(summary, item) ⇒ String

Add a list item to an existing summary. Requires a previous call to 'summaryOpenList()'.



151
152
153
# File 'library/general/src/modules/Summary.rb', line 151

def AddListItem(summary, item)
  Ops.add(Ops.add(Ops.add(summary, "\n<li>"), item), "</li>")
end

#AddNewLine(summary) ⇒ String

Add a newline to an existing summary.



125
126
127
# File 'library/general/src/modules/Summary.rb', line 125

def AddNewLine(summary)
  Ops.add(summary, "<br>")
end

#AddSimpleSection(summary, header, item) ⇒ String

Add a simple section to an existing summary, consisting of a header and one single item.



162
163
164
165
166
167
168
169
# File 'library/general/src/modules/Summary.rb', line 162

def AddSimpleSection(summary, header, item)
  summary = AddHeader(summary, header)
  summary = OpenList(summary)
  summary = AddListItem(summary, item)
  summary = CloseList(summary)

  summary
end

#CloseList(summary) ⇒ String

End a list within a summary.



141
142
143
# File 'library/general/src/modules/Summary.rb', line 141

def CloseList(summary)
  Ops.add(summary, "</ul>")
end

#Device(name, description) ⇒ String

Function that creates description of one device.



99
100
101
# File 'library/general/src/modules/Summary.rb', line 99

def Device(name, description)
  Builtins.sformat("<li><p>%1<br>%2</p></li>", name, description)
end

#DevicesList(devices) ⇒ String

Function that creates the whole final product. “Not detected” will be returned if the list is empty.



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'library/general/src/modules/Summary.rb', line 76

def DevicesList(devices)
  devices = deep_copy(devices)
  text = ""
  if Builtins.size(devices) == 0
    text = if !Mode.config
      # translators: summary if no hardware was detected
      Builtins.sformat("<ul><li>%1</li></ul>", _("Not detected."))
    else
      Builtins.sformat("<ul><li>%1</li></ul>", NotConfigured())
    end
  else
    Builtins.foreach(devices) { |dev| text = Ops.add(text, dev) }
    text = Builtins.sformat("<ul>%1</ul>", text)
  end

  text
end

#mainObject



58
59
60
61
62
# File 'library/general/src/modules/Summary.rb', line 58

def main
  textdomain "base"

  Yast.import "Mode"
end

#NotConfiguredObject

Function that creates a 'Not configured.' message.



66
67
68
69
# File 'library/general/src/modules/Summary.rb', line 66

def NotConfigured
  # translators: summary if the module has not been used yet in AutoYaST profile
  _("Not configured yet.")
end

#OpenList(summary) ⇒ String

Start a list within a summary.



133
134
135
# File 'library/general/src/modules/Summary.rb', line 133

def OpenList(summary)
  Ops.add(summary, "<ul>")
end