Class: Edgarj::ListDrawer::Base
- Inherits:
-
Object
- Object
- Edgarj::ListDrawer::Base
- Includes:
- ERB::Util
- Defined in:
- app/helpers/edgarj/list_drawer.rb
Overview
Base for popup-list and normal-list column drawer
Sub class of Drawer to draw list
Direct Known Subclasses
Instance Method Summary collapse
- #draw_column(rec, col) ⇒ Object
- #draw_column_header(col, options = {}) ⇒ Object
-
#initialize(drawer, options = {}) ⇒ Base
constructor
-
drawer - Edgarj::Drawer::Base object * options.
-
Constructor Details
#initialize(drawer, options = {}) ⇒ Base
-
drawer - Edgarj::Drawer::Base object
-
options
TODO: enum_cache は止め、グローバルに1つのキャッシュを作る。
15 16 17 18 19 20 21 22 23 |
# File 'app/helpers/edgarj/list_drawer.rb', line 15 def initialize(drawer, = {}) @drawer = drawer @options = .dup @vc = drawer.vc @enum_cache = {} @bitset_cache = {} @parent_rec = nil @belongs_to_link = false # doesn't make link on belongs_to end |
Instance Method Details
#draw_column(rec, col) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'app/helpers/edgarj/list_drawer.rb', line 31 def draw_column(rec, col) @parent_rec = rec.belongs_to_AR(col) @vc.content_tag(:td, (rec, col)) do # edgarj_address column is prior to draw_belongs_to() because of # avoiding link_to process on the 'belongs_to' column. =begin if rec.class.edgarj_address?(col) col_name = rec.class.get_column_name(col) adrs = Edgarj::Address.find_by_id(rec.send(col_name)) adrs ? draw_trimmed_str(adrs.name) : '' =end if @parent_rec then if @belongs_to_link @vc.link_to(@parent_rec.name, @drawer.popup_path(col), remote: true) else h(@parent_rec.name) end else draw_normal_column(rec, col) end end end |
#draw_column_header(col, options = {}) ⇒ Object
25 26 27 28 29 |
# File 'app/helpers/edgarj/list_drawer.rb', line 25 def draw_column_header(col, ={}) @vc.content_tag(:th) do draw_column_header_sub(col, ) end end |