Move index_path_to_section_index into Table::Utils

This commit is contained in:
Ryan Linton
2014-08-22 13:47:05 -07:00
parent e291e2c5d1
commit aa9f9bcc69
3 changed files with 16 additions and 16 deletions

View File

@@ -1,5 +1,7 @@
module ProMotion
class TableData
include ProMotion::Table::Utils
attr_accessor :data, :filtered_data, :search_string, :original_search_string, :filtered, :table_view
def initialize(data, table_view)
@@ -94,13 +96,5 @@ module ProMotion
self.search_string = search_string.downcase.strip
self.original_search_string = search_string
end
def index_path_to_section_index(params)
if params[:index_path]
params[:section] = params[:index_path].section
params[:index] = params[:index_path].row
end
params
end
end
end

View File

@@ -5,6 +5,7 @@ module ProMotion
include ProMotion::Table::Refreshable
include ProMotion::Table::Indexable
include ProMotion::Table::Longpressable
include ProMotion::Table::Utils
attr_reader :promotion_table_data
@@ -109,14 +110,6 @@ module ProMotion
create_table_cell(data_cell)
end
def index_path_to_section_index(params)
if params[:index_path]
params[:section] = params[:index_path].section
params[:index] = params[:index_path].row
end
params
end
def create_table_cell(data_cell)
table_cell = table_view.dequeueReusableCellWithIdentifier(data_cell[:cell_identifier]) || begin
table_cell = data_cell[:cell_class].alloc.initWithStyle(data_cell[:cell_style], reuseIdentifier:data_cell[:cell_identifier])

View File

@@ -0,0 +1,13 @@
module ProMotion
module Table
module Utils
def index_path_to_section_index(params)
if params[:index_path]
params[:section] = params[:index_path].section
params[:index] = params[:index_path].row
end
params
end
end
end
end