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.



106
107
108
# File 'library/general/src/modules/Summary.rb', line 106

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.



115
116
117
# File 'library/general/src/modules/Summary.rb', line 115

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()'.



149
150
151
# File 'library/general/src/modules/Summary.rb', line 149

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.



123
124
125
# File 'library/general/src/modules/Summary.rb', line 123

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.



160
161
162
163
164
165
# File 'library/general/src/modules/Summary.rb', line 160

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

#CloseList(summary) ⇒ String

End a list within a summary.



139
140
141
# File 'library/general/src/modules/Summary.rb', line 139

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

#Device(name, description) ⇒ String

Function that creates description of one device.



97
98
99
# File 'library/general/src/modules/Summary.rb', line 97

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.



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

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

  text
end

#mainObject



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

def main
  textdomain "base"

  Yast.import "Mode"
end

#NotConfiguredObject

Function that creates a 'Not configured.' message.



64
65
66
67
# File 'library/general/src/modules/Summary.rb', line 64

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.



131
132
133
# File 'library/general/src/modules/Summary.rb', line 131

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