fixed sorting and also name issue for backend for files

This commit is contained in:
Harry Bomrah 2014-06-30 15:31:10 +08:00
parent c938fc2798
commit f4d405979b
2 changed files with 4 additions and 4 deletions

View File

@ -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,

View File

@ -21,7 +21,7 @@
</label>
<span class="add-on icons-pencil" title="<%= t('file.name') %>"></span>
<span class="tab-content">
<% I18n.available_locales.each_with_index do |locale, i| %>
<% @site_in_use_locales.each_with_index do |locale, i| %>
<span class="tab-pane fade <%= ( i == 0 ) ? "in active" : '' %> <%= 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 @@
<span class="add-on btn-group btn" title="<%= t('archive.show_lang') %>">
<i class="icons-earth"></i> <span class="caret"></span>
<ul class="dropdown-menu">
<% I18n.available_locales.each do |locale| %>
<% @site_in_use_locales.each do |locale| %>
<li>
<label class="checkbox">
<%= check_box_tag "archive_file[archive_file_multiples_attributes][#{( form_file.new_record? ? 'new_archive_file_multiples' : "#{i}" )}][choose_lang][]", locale, (form_file.choose_lang.nil? ? true : form_file.choose_lang.include?(locale)) %>