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?
 | 
							if !@table.nil?
 | 
				
			||||||
			@columns = @table.table_columns.asc(:order)
 | 
								@columns = @table.table_columns.asc(:order)
 | 
				
			||||||
			@table_fields = @columns.collect{|tc| tc.title}
 | 
								@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
 | 
				
			||||||
	end
 | 
						end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -37,8 +37,8 @@ class Admin::UniversalTablesController < OrbitAdminController
 | 
				
			||||||
	end
 | 
						end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	def edit_entry
 | 
						def edit_entry
 | 
				
			||||||
		id = params[:universal_table_id]
 | 
							id = params[:universal_table_id].split("-").last
 | 
				
			||||||
		@entry = TableEntry.find(id)
 | 
							@entry = TableEntry.where(:uid => id).first
 | 
				
			||||||
		@table = @entry.u_table
 | 
							@table = @entry.u_table
 | 
				
			||||||
		if !@table.nil?
 | 
							if !@table.nil?
 | 
				
			||||||
			@columns = @table.table_columns.asc(:order)
 | 
								@columns = @table.table_columns.asc(:order)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -39,9 +39,10 @@ class UniversalTablesController < ApplicationController
 | 
				
			||||||
				columns.each do |column|
 | 
									columns.each do |column|
 | 
				
			||||||
					entries << column.table_entry
 | 
										entries << column.table_entry
 | 
				
			||||||
				end
 | 
									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)
 | 
									entries = Kaminari.paginate_array(entries).page(params["page_no"]).per(OrbitHelper.page_data_count)
 | 
				
			||||||
			else
 | 
								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
 | 
								end
 | 
				
			||||||
			entries.each do |te|
 | 
								entries.each do |te|
 | 
				
			||||||
				cols = []
 | 
									cols = []
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue