Sha256: 36a8bce8f1459fe0d9a79e5a8c79686064b39113a4451d726058f13f13d461dd
Contents?: true
Size: 1.74 KB
Versions: 2
Compression:
Stored size: 1.74 KB
Contents
module UiBibz::Ui # Create DropdownList # # This element is an extend of UiBibz::Ui::Component. # Use '---' in content to add a separator # # ==== Attributes # # * +content+ - Content of element # * +options+ - Options of element # * +html_options+ - Html Options of element # # ==== Options # # You can add HTML attributes using the +html_options+. # You can pass arguments in options attribute: # * +status+ - State of élement with symbol value: # (+:active+) # * +url+ - String # * +glyph+ - Add glyph with name or hash options # * +name+ - String # * +size+ - Integer # * +type+ - Symbol # # ==== Signatures # # UiBibz::Ui::DropdownList.new(content, options = nil, html_options = nil) # # UiBibz::Ui::DropdownList.new(options = nil, html_options = nil) do # content # end # # ==== Examples # # UiBibz::Ui::DropdownList.new('Home', { glyph: 'home', status: :active },{ class: 'test' }).render # # UiBibz::Ui::DropdownList.new({glyph: { name: 'eye', size: 3}, { class: 'test' }) do # 'Home' # end.render # # UiBibz::UiBibz::DropdownList.new('---').render # To add a separator # class DropdownList < Component DIVIDER = '---' def initialize content = nil, options = nil, html_options = nil, &block super end def render @content == DIVIDER ? divider_html : link_html end private def divider_html content_tag :li, '', class_and_html_options('divider').merge({ role: 'presentation' }) end def link_html content_tag :li, class_and_html_options(type).merge({ role: 'presentation' }) do @content end end def type "dropdown-header" if @options[:type] == :header end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ui_bibz-1.0.0 | lib/ui_bibz/ui/dropdown/components/dropdown_list.rb |
ui_bibz-0.9.0 | lib/ui_bibz/ui/dropdown/components/dropdown_list.rb |