From 2fedf64387834f7bfc1e0b7073285a3b5d7bba19 Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Fri, 18 Dec 2015 15:33:43 +0800 Subject: [PATCH] small sorting fix for import --- app/controllers/admin/universal_tables_controller.rb | 4 ++-- app/views/admin/universal_tables/export_structure.xlsx.axlsx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/admin/universal_tables_controller.rb b/app/controllers/admin/universal_tables_controller.rb index be18f84..c518055 100644 --- a/app/controllers/admin/universal_tables_controller.rb +++ b/app/controllers/admin/universal_tables_controller.rb @@ -64,14 +64,14 @@ class Admin::UniversalTablesController < OrbitAdminController case tc.type when "text" v = {} - @site_in_use_locales.each_with_index do |locale,x| + @site_in_use_locales.sort.each_with_index do |locale,x| v[locale.to_s] = row.cells[index + x].value rescue nil skip = skip + 1 end ce.text_translations = v when "editor" v = {} - @site_in_use_locales.each_with_index do |locale,x| + @site_in_use_locales.sort.each_with_index do |locale,x| v[locale.to_s] = row.cells[index + x].value rescue nil skip = skip + 1 end diff --git a/app/views/admin/universal_tables/export_structure.xlsx.axlsx b/app/views/admin/universal_tables/export_structure.xlsx.axlsx index 99f8323..aec52a9 100644 --- a/app/views/admin/universal_tables/export_structure.xlsx.axlsx +++ b/app/views/admin/universal_tables/export_structure.xlsx.axlsx @@ -13,13 +13,13 @@ wb.add_worksheet(name: "Structure") do |sheet| @table.table_columns.asc(:order).each do |column| case column.type when "text" - @site_in_use_locales.each do |locale| + @site_in_use_locales.sort.each do |locale| row << column.title + " - " + t(locale.to_s) row1 << column.key row2 << column.type + "-#{locale}" end when "editor" - @site_in_use_locales.each do |locale| + @site_in_use_locales.sort.each do |locale| row << column.title + " - " + t(locale.to_s) row1 << column.key row2 << column.type + "-#{locale}"