Module: MotionPrime::CellSectionMixin
- Extended by:
- MotionSupport::Concern
- Included in:
- BaseFieldSection, StaticFieldSection
- Defined in:
- motion-prime/sections/_cell_section_mixin.rb
Defined Under Namespace
Modules: ClassMethods
Instance Attribute Summary collapse
- #collection_section ⇒ Object
-
#pending_display ⇒ Object
readonly
Returns the value of attribute pending_display.
Instance Method Summary collapse
- #cell ⇒ Object
- #cell_section_name ⇒ Object
- #cell_type ⇒ Object
- #container_bounds ⇒ Object
- #dealloc ⇒ Object
- #display ⇒ Object
- #init_container_element(options = {}) ⇒ Object
- #pending_display! ⇒ Object
-
#render_container(options = {}, &block) ⇒ Object
should do nothing, because collection section will care about it.
- #section_styles ⇒ Object
- #table ⇒ Object
Instance Attribute Details
#collection_section ⇒ Object
16 17 18 |
# File 'motion-prime/sections/_cell_section_mixin.rb', line 16 def collection_section @collection_section ||= [:collection_section].try(:weak_ref) end |
#pending_display ⇒ Object (readonly)
Returns the value of attribute pending_display.
9 10 11 |
# File 'motion-prime/sections/_cell_section_mixin.rb', line 9 def pending_display @pending_display end |
Instance Method Details
#cell ⇒ Object
69 70 71 72 73 74 75 |
# File 'motion-prime/sections/_cell_section_mixin.rb', line 69 def cell container_view || begin first_element = elements.values.first return unless first_element.is_a?(BaseElement) && first_element.view first_element.view.superview.superview end end |
#cell_section_name ⇒ Object
35 36 37 38 39 40 41 |
# File 'motion-prime/sections/_cell_section_mixin.rb', line 35 def cell_section_name self.class.custom_cell_section_name || begin return name unless collection_section table_name = collection_section.name.gsub('_table', '') name.gsub("#{table_name}_", '') end end |
#cell_type ⇒ Object
29 30 31 32 33 |
# File 'motion-prime/sections/_cell_section_mixin.rb', line 29 def cell_type @cell_type ||= begin self.is_a?(BaseFieldSection) ? :field : :cell end end |
#container_bounds ⇒ Object
43 44 45 |
# File 'motion-prime/sections/_cell_section_mixin.rb', line 43 def container_bounds @container_bounds ||= CGRectMake(0, 0, collection_section.collection_view.bounds.size.width, container_height) end |
#dealloc ⇒ Object
77 78 79 80 81 |
# File 'motion-prime/sections/_cell_section_mixin.rb', line 77 def dealloc # TODO: remove this when solve this problem: dealloc TableCells on TableView.reloadData (in case when reuseIdentifier has been used) container_view.section = nil if container_view.respond_to?(:setSection) super end |
#display ⇒ Object
64 65 66 67 |
# File 'motion-prime/sections/_cell_section_mixin.rb', line 64 def display @pending_display = false container_view.try(:setNeedsDisplay) end |
#init_container_element(options = {}) ⇒ Object
52 53 54 55 56 57 |
# File 'motion-prime/sections/_cell_section_mixin.rb', line 52 def init_container_element( = {}) [:styles] ||= [] [:styles] = [:"#{collection_section.name}_first_cell"] if collection_section.data.first == self [:styles] = [:"#{collection_section.name}_last_cell"] if collection_section.data.last == self super() end |
#pending_display! ⇒ Object
59 60 61 62 |
# File 'motion-prime/sections/_cell_section_mixin.rb', line 59 def pending_display! @pending_display = true display unless collection_section. end |
#render_container(options = {}, &block) ⇒ Object
should do nothing, because collection section will care about it.
48 49 50 |
# File 'motion-prime/sections/_cell_section_mixin.rb', line 48 def render_container( = {}, &block) block.call end |
#section_styles ⇒ Object
25 26 27 |
# File 'motion-prime/sections/_cell_section_mixin.rb', line 25 def section_styles @section_styles ||= collection_section.try(:cell_section_styles, self) || {} end |
#table ⇒ Object
20 21 22 23 |
# File 'motion-prime/sections/_cell_section_mixin.rb', line 20 def table Prime.logger.info "Section#table is deprecated: #{caller[0]}" collection_section end |