language stuff fixed
This commit is contained in:
parent
9460619846
commit
dd8574b8c3
|
@ -19,17 +19,21 @@ class ArchivesController < ApplicationController
|
||||||
"status-class" => "status-#{status['classname']}"
|
"status-class" => "status-#{status['classname']}"
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
files = archive.archive_file_multiples.order_by(:sort_number=>'asc').collect do |file|
|
files = []
|
||||||
|
archive.archive_file_multiples.order_by(:sort_number=>'asc').each do |file|
|
||||||
|
if file.choose_lang.include?(I18n.locale.to_s)
|
||||||
title = (file.file_title.blank? ? File.basename(file.file.path) : file.file_title) rescue ""
|
title = (file.file_title.blank? ? File.basename(file.file.path) : file.file_title) rescue ""
|
||||||
extension = file.file.file.extension.downcase rescue ""
|
extension = file.file.file.extension.downcase rescue ""
|
||||||
# url = file.file.url rescue ""
|
# url = file.file.url rescue ""
|
||||||
{
|
files << {
|
||||||
"file-name" => title,
|
"file-name" => title,
|
||||||
"file-type" => extension,
|
"file-type" => extension,
|
||||||
"file-url" => "/xhr/archive/download?file=#{file.id}"
|
"file-url" => "/xhr/archive/download?file=#{file.id}"
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
{
|
{
|
||||||
"archive-title" => archive.title || "",
|
"archive-title" => archive.title || "",
|
||||||
"statuses" => statuses,
|
"statuses" => statuses,
|
||||||
|
|
|
@ -8,7 +8,7 @@ class ArchiveFileMultiple
|
||||||
field :file_title, localize: true
|
field :file_title, localize: true
|
||||||
# field :description
|
# field :description
|
||||||
field :download_count, type: Integer, default: 0
|
field :download_count, type: Integer, default: 0
|
||||||
field :choose_lang, :type => Array, :default => nil
|
field :choose_lang, :type => Array, :default => ["en","zh_tw"]
|
||||||
|
|
||||||
field :should_destroy, :type => Boolean
|
field :should_destroy, :type => Boolean
|
||||||
field :sort_number, :type => Integer
|
field :sort_number, :type => Integer
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
<% @site_in_use_locales.each do |locale| %>
|
<% @site_in_use_locales.each do |locale| %>
|
||||||
<li>
|
<li>
|
||||||
<label class="checkbox">
|
<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)) %>
|
<%= 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.include?(locale.to_s) %>
|
||||||
<%= t(locale.to_s) %>
|
<%= t(locale.to_s) %>
|
||||||
</label>
|
</label>
|
||||||
</li>
|
</li>
|
||||||
|
|
Loading…
Reference in New Issue