sort fixes and edit fix
This commit is contained in:
parent
4ce8637c53
commit
52c12560ef
|
@ -15,7 +15,7 @@ class Admin::UniversalTablesController < OrbitAdminController
|
|||
if !@table.nil?
|
||||
@columns = @table.table_columns.asc(:order)
|
||||
@table_fields = @columns.collect{|tc| tc.title}
|
||||
@entries = @table.table_entries.page(params[:page_id]).per(10)
|
||||
@entries = @table.table_entries.desc(:created_at).page(params[:page_id]).per(10)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -37,8 +37,8 @@ class Admin::UniversalTablesController < OrbitAdminController
|
|||
end
|
||||
|
||||
def edit_entry
|
||||
id = params[:universal_table_id]
|
||||
@entry = TableEntry.find(id)
|
||||
id = params[:universal_table_id].split("-").last
|
||||
@entry = TableEntry.where(:uid => id).first
|
||||
@table = @entry.u_table
|
||||
if !@table.nil?
|
||||
@columns = @table.table_columns.asc(:order)
|
||||
|
|
|
@ -39,9 +39,10 @@ class UniversalTablesController < ApplicationController
|
|||
columns.each do |column|
|
||||
entries << column.table_entry
|
||||
end
|
||||
entries = entries.sort{|k,v| v["created_at"] <=> k["created_at"]}
|
||||
entries = Kaminari.paginate_array(entries).page(params["page_no"]).per(OrbitHelper.page_data_count)
|
||||
else
|
||||
entries = table.table_entries.page(params["page_no"]).per(OrbitHelper.page_data_count)
|
||||
entries = table.table_entries.desc(:created_at).page(params["page_no"]).per(OrbitHelper.page_data_count)
|
||||
end
|
||||
entries.each do |te|
|
||||
cols = []
|
||||
|
|
Loading…
Reference in New Issue