class HDropDown
Public Class Methods
new(sourceView: nil, caption: "select", items: [], **args)
click to toggle source
Calls superclass method
HDivTag::new
# File lib/hwidgets/hdropdown.rb, line 3 def initialize(sourceView: nil, caption: "select", items: [], **args) @sourceView = sourceView @caption = caption @items = items return super(class: 'hdropdown', **args) end
Public Instance Methods
a(innerHTML = '', icon: nil, **args)
click to toggle source
# File lib/hwidgets/hdropdown.rb, line 16 def a(innerHTML = '', icon: nil, **args) a = HWidget.new("a", "", args) a << HWidget.new('span', class: icon) if icon a << HWidget.new('span', innerHTML) return a end
content()
click to toggle source
# File lib/hwidgets/hdropdown.rb, line 25 def content contentDiv = HDivTag.new(class: 'dropdown-content') @items.each do |item| action = item.delete(:action) link = self.a(item.delete(:name), icon: item.delete(:icon), **item) link.connect(:onclick, @sourceView, "rpcAction", args: {action: action}, id: @sourceView.oid, mode: 'none', attributes: ":hdbTableView.ids(obj) => ids") contentDiv << link end return contentDiv end
html()
click to toggle source
Calls superclass method
HWidget#html
# File lib/hwidgets/hdropdown.rb, line 39 def html self << self.button << self.content return super end