fix error
This commit is contained in:
parent
f072515fa7
commit
957ab330f7
|
@ -271,7 +271,9 @@ class Admin::UniversalTablesController < OrbitAdminController
|
||||||
column.each do |c|
|
column.each do |c|
|
||||||
columns = (columns | c.column_entries.any_of(:"text.en" => regex).or(:"text.zh_tw" => regex).or(:"content.en" => regex).or(:"content.zh_tw" => regex))
|
columns = (columns | c.column_entries.any_of(:"text.en" => regex).or(:"text.zh_tw" => regex).or(:"content.en" => regex).or(:"content.zh_tw" => regex))
|
||||||
end
|
end
|
||||||
columns = Kaminari.paginate_array(columns,limit: columns.count)
|
columns_count = columns.count
|
||||||
|
columns_count = 1 if columns_count==0
|
||||||
|
columns = Kaminari.paginate_array(columns,limit: columns_count)
|
||||||
entries = TableEntry.where(:u_table_id=>table.id).sorting(params: params,table: table,column_entries: columns,page_num: params[:page],per: 10)
|
entries = TableEntry.where(:u_table_id=>table.id).sorting(params: params,table: table,column_entries: columns,page_num: params[:page],per: 10)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,11 @@ class TableEntry
|
||||||
if direction == 'desc'
|
if direction == 'desc'
|
||||||
values = values.reverse
|
values = values.reverse
|
||||||
end
|
end
|
||||||
values = Kaminari.paginate_array(values,limit: values.count)
|
if paginated || !per.nil?
|
||||||
|
values_count = values.count
|
||||||
|
values_count = 1 if values_count==0
|
||||||
|
values = Kaminari.paginate_array(values,limit: values_count)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
if !per.nil?
|
if !per.nil?
|
||||||
values = values.page(page_num).per(per)
|
values = values.page(page_num).per(per)
|
||||||
|
|
Loading…
Reference in New Issue