Sha256: 69252cae2b33b8eedac96cc55e1376ff1c7a0ed4e203ff37d9e8a3b86746d73a

Contents?: true

Size: 1.12 KB

Versions: 13

Compression:

Stored size: 1.12 KB

Contents

module ProMotion
  module TableDataBuilder
    def set_data_cell_defaults(data_cell)
      data_cell[:cell_style] ||= begin
        data_cell[:subtitle] ? UITableViewCellStyleSubtitle : UITableViewCellStyleDefault
      end
      data_cell[:cell_class] ||= PM::TableViewCell
      data_cell[:cell_identifier] ||= build_cell_identifier(data_cell)
      data_cell[:properties] ||= data_cell[:style] || data_cell[:styles]

      data_cell[:accessory] = {
        view: data_cell[:accessory],
        value: data_cell[:accessory_value],
        action: data_cell[:accessory_action],
        arguments: data_cell[:accessory_arguments]
      } unless data_cell[:accessory].nil? || data_cell[:accessory].is_a?(Hash)

      data_cell
    end

    def build_cell_identifier(data_cell)
      ident = "#{data_cell[:cell_class].to_s}"
      ident << "-#{data_cell[:stylename].to_s}" if data_cell[:stylename] # For Teacup
      ident << "-accessory" if data_cell[:accessory]
      ident << "-subtitle" if data_cell[:subtitle]
      ident << "-remoteimage" if data_cell[:remote_image]
      ident << "-image" if data_cell[:image]
      ident
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
ProMotion-3.0.0 lib/ProMotion/table/data/table_data_builder.rb
ProMotion-2.8.2 lib/ProMotion/table/data/table_data_builder.rb
ProMotion-2.8.1 lib/ProMotion/table/data/table_data_builder.rb
ProMotion-2.8.0 lib/ProMotion/table/data/table_data_builder.rb
ProMotion-2.7.1 lib/ProMotion/table/data/table_data_builder.rb
ProMotion-2.7.0 lib/ProMotion/table/data/table_data_builder.rb
ProMotion-2.6.1 lib/ProMotion/table/data/table_data_builder.rb
ProMotion-2.6.0 lib/ProMotion/table/data/table_data_builder.rb
ProMotion-2.5.0 lib/ProMotion/table/data/table_data_builder.rb
ProMotion-2.5.0.beta1 lib/ProMotion/table/data/table_data_builder.rb
ProMotion-2.4.2 lib/ProMotion/table/data/table_data_builder.rb
ProMotion-2.4.1 lib/ProMotion/table/data/table_data_builder.rb
ProMotion-2.4.0 lib/ProMotion/table/data/table_data_builder.rb