class UiBibz::Ui::Ux::Tables::As

As

Public Class Methods

new(col, record, content, table_options) click to toggle source
# File lib/ui_bibz/ui/ux/tables/components/as.rb, line 7
def initialize(col, record, content, table_options)
  @col     = col
  @record  = record
  @content = content
  @form    = table_options.try(:[], :form)
end

Public Instance Methods

render() click to toggle source
# File lib/ui_bibz/ui/ux/tables/components/as.rb, line 14
def render
  case @col.as
  when :boolean
    boolean_render
  when :progress
    progress_render
  when :input
    inp_options = (@col.input_options || {}).merge({ label: false })
    @form.input @col.data_index, inp_options
  end
end

Private Instance Methods

boolean_render() click to toggle source
# File lib/ui_bibz/ui/ux/tables/components/as.rb, line 28
def boolean_render
  glyph = if @content == true
            UiBibz::Ui::Core::Icons::Glyph.new('check-circle', status: :success)
          else
            UiBibz::Ui::Core::Icons::Glyph.new('minus-circle', status: :danger)
          end
  glyph.render
end
progress_render() click to toggle source
# File lib/ui_bibz/ui/ux/tables/components/as.rb, line 37
def progress_render
  UiBibz::Ui::Core::Notifications::ProgressBar.new(@content, @col.progress_options).render
end