Sha256: 7d90b07f8237e7b6bce6b4f87459a1c61a8bf9a0f76e1be7a70d271aa1bc381f

Contents?: true

Size: 831 Bytes

Versions: 1

Compression:

Stored size: 831 Bytes

Contents

module MotionPrime
  module CellSectionMixin
    attr_writer :table

    def table
      @table ||= options[:table]
    end

    def section_styles
      @section_styles ||= table.try(:cell_styles, self) || {}
    end

    def cell_type
      @cell_type ||= begin
        self.is_a?(BaseFieldSection) ? :field : :cell
      end
    end

    def cell_name
      self.class.cell_name || begin
        return name unless table
        table_name = table.name.gsub('_table', '')
        name.gsub("#{table_name}_", '')
      end
    end

    def load_container_element(options = {})
      @container_element ||= begin
        options.merge!({
          screen: screen,
          section: self,
          has_drawn_content: true
        })
        MotionPrime::BaseElement.factory(:table_view_cell, options)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
motion-prime-0.4.3 motion-prime/sections/_cell_section_mixin.rb