From f4d405979bab08233eef3eee6fc4fdb1e1adb03c Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Mon, 30 Jun 2014 15:31:10 +0800 Subject: [PATCH] fixed sorting and also name issue for backend for files --- app/controllers/archives_controller.rb | 4 ++-- app/views/admin/archive_files/_form_file.html.erb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/archives_controller.rb b/app/controllers/archives_controller.rb index a7c46d1..7957a95 100644 --- a/app/controllers/archives_controller.rb +++ b/app/controllers/archives_controller.rb @@ -17,14 +17,14 @@ class ArchivesController < ApplicationController end end cats = @categories.collect do |cat| - archives = ArchiveFile.where(:category_id => cat["id"]).collect do |archive| + archives = ArchiveFile.where(:category_id => cat["id"]).order_by(:sort_number=>'asc').collect do |archive| statuses = archive.statuses_with_classname.collect do |status| { "status" => status["name"], "status-class" => "status-#{status['classname']}" } end - files = archive.archive_file_multiples.collect do |file| + files = archive.archive_file_multiples.order_by(:sort_number=>'asc').collect do |file| { "file-name" => file.file_title, "file-type" => file.file.file.extension.downcase, diff --git a/app/views/admin/archive_files/_form_file.html.erb b/app/views/admin/archive_files/_form_file.html.erb index 0f2e426..0d020f9 100644 --- a/app/views/admin/archive_files/_form_file.html.erb +++ b/app/views/admin/archive_files/_form_file.html.erb @@ -21,7 +21,7 @@ - <% I18n.available_locales.each_with_index do |locale, i| %> + <% @site_in_use_locales.each_with_index do |locale, i| %> <%= locale %>"> <%= f.fields_for :file_title_translations do |f| %> <%= f.text_field locale, :class => "input-medium", placeholder: t('file.name'), :value => (form_file.file_title_translations[locale] rescue nil) %> @@ -38,7 +38,7 @@