Class: Edgar::ListDrawer::Normal

Inherits:
Base
  • Object
show all
Defined in:
app/helpers/edgar/list_drawer.rb

Overview

Drawer for record list in Edgar CRUD view.

Instance Method Summary (collapse)

Methods inherited from Base

#draw_column, #draw_normal_column, #draw_trimmed_str

Constructor Details

- (Normal) initialize(template)

A new instance of Normal



127
128
129
130
# File 'app/helpers/edgar/list_drawer.rb', line 127

def initialize(template)
  super(template)
  @belongs_to_link  = true    # make link on belongs_to
end

Instance Method Details

- (Object) set_path(rec)

prepare path for the rec, which will be drawn later.



133
134
135
# File 'app/helpers/edgar/list_drawer.rb', line 133

def set_path(rec)
  @path = @t.polymorphic_path(rec, format: :js)
end

- (Object) td_options(rec, col)

<td> options

add Edgar.click_listCB() with base result. When the column is parent, do nothing.



141
142
143
144
145
146
147
148
149
# File 'app/helpers/edgar/list_drawer.rb', line 141

def td_options(rec, col)
  result = super.merge(
      style:  'cursor:pointer;',
      class:  '_edgar_list_column')
  if !@parent_column
    result[:data-url'] = @path
  end
  result
end