mirror of
https://github.com/zhigang1992/ProMotion.git
synced 2026-05-15 07:37:21 +08:00
Move index_path_to_section_index into Table::Utils
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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])
|
||||
|
||||
13
lib/ProMotion/table/table_utils.rb
Normal file
13
lib/ProMotion/table/table_utils.rb
Normal 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
|
||||
Reference in New Issue
Block a user