class UiBibz::Ui::Ux::Tables::Searchable
Public Class Methods
new(store, options, html_options = nil)
click to toggle source
# File lib/ui_bibz/ui/ux/tables/extensions/searchable.rb, line 5 def initialize(store, options, html_options = nil) @store = store @options = options @html_options = html_options end
Public Instance Methods
render()
click to toggle source
Render html tag
# File lib/ui_bibz/ui/ux/tables/extensions/searchable.rb, line 12 def render content_tag :div, @html_options do concat content_tag(:div, table_name, class: 'title') concat TableSearchField.new({ store: @store, wrap_form: @options[:wrap_form] }).render if searchable? concat tag :br, class: 'ui-bibz-clear' end end
searchable?()
click to toggle source
# File lib/ui_bibz/ui/ux/tables/extensions/searchable.rb, line 20 def searchable? @options[:searchable].nil? ? true : @options[:searchable] end
Private Instance Methods
model_name()
click to toggle source
# File lib/ui_bibz/ui/ux/tables/extensions/searchable.rb, line 37 def model_name @store.model.to_s.underscore end
table_glyph()
click to toggle source
# File lib/ui_bibz/ui/ux/tables/extensions/searchable.rb, line 45 def table_glyph UiBibz::Ui::Core::Icons::Glyph.new(@options[:glyph]).render unless @options[:glyph].nil? end
table_name()
click to toggle source
# File lib/ui_bibz/ui/ux/tables/extensions/searchable.rb, line 41 def table_name "#{table_glyph}#{table_title}".html_safe end
table_title()
click to toggle source
# File lib/ui_bibz/ui/ux/tables/extensions/searchable.rb, line 30 def table_title return unless @options[:title] != false title = @options[:title] || "#{@store.controller.humanize} list" UiBibz::Utils::Internationalization.new("ui_bibz.table.title.#{model_name}", default: ['ui_bibz.table.title.defaults', title]).translate end
translate_searchable_attributes_by_active_record(attr)
click to toggle source
# File lib/ui_bibz/ui/ux/tables/extensions/searchable.rb, line 26 def translate_searchable_attributes_by_active_record(attr) @store.model.human_attribute_name(attr) end