Sha256: 0493745359e4454a1e225621fc2e6a83c1542c0734f164252b38319de7a2a127

Contents?: true

Size: 1.33 KB

Versions: 15

Compression:

Stored size: 1.33 KB

Contents

# coding: UTF-8

module Edgarj
  # ListDrawer will be obsoleted.  Column will be handled by
  # Edgarj::Drawer::ColumnInfo
  module ListDrawer
    # Base for popup-list and normal-list column drawer
    #
    # Sub class of Drawer to draw list
    class Base
      include ERB::Util

      # * drawer        - Edgarj::Drawer::Base object
      # * options
      def initialize(drawer, options = {})
        @drawer = drawer
      end

      def draw_column_header(col, options={})
        @drawer.vc.content_tag(:th) do
          col.column_header_label(@drawer.vc, @drawer.page_info, options)
        end
      end

      def draw_column(rec, col)
        @drawer.vc.content_tag(:td, td_options(rec, col)) do
          col.column_value(rec, @drawer)
        end
      end

      private

      # <td> options
      def td_options(rec, col)
        col.tag_options
      end
    end

    # Drawer for record list in Edgarj CRUD view.
    #
    class Normal < Base
      def initialize(edgarj_drawer, options = {})
        super(edgarj_drawer, options)
      end

      # <td> options
      #
      # merge css to let Edgarj.click_listCB() work with base result.
      # When the column is parent, do nothing.
      def td_options(rec, col)
        super.merge(class: '_edgarj_list_column'){|key, _old, _new| [_old, _new].flatten}
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
edgarj-4.06.10 app/helpers/edgarj/list_drawer.rb
edgarj-4.06.09 app/helpers/edgarj/list_drawer.rb
edgarj-4.06.07 app/helpers/edgarj/list_drawer.rb
edgarj-4.06.05 app/helpers/edgarj/list_drawer.rb
edgarj-4.06.04 app/helpers/edgarj/list_drawer.rb
edgarj-4.06.03 app/helpers/edgarj/list_drawer.rb
edgarj-4.06.02 app/helpers/edgarj/list_drawer.rb
edgarj-4.06.01 app/helpers/edgarj/list_drawer.rb
edgarj-4.06.00 app/helpers/edgarj/list_drawer.rb
edgarj-4.05.04 app/helpers/edgarj/list_drawer.rb
edgarj-4.05.03 app/helpers/edgarj/list_drawer.rb
edgarj-4.05.02 app/helpers/edgarj/list_drawer.rb
edgarj-4.05.01 app/helpers/edgarj/list_drawer.rb
edgarj-4.05.00 app/helpers/edgarj/list_drawer.rb
edgarj-4.04.01 app/helpers/edgarj/list_drawer.rb