now directly downloadable from widget if has only one file

This commit is contained in:
Harry Bomrah 2017-09-25 17:58:44 +08:00
parent 212a7e22de
commit 381e9e620b
1 changed files with 2 additions and 1 deletions

View File

@ -136,9 +136,10 @@ class ArchivesController < ApplicationController
end end
cats = @categories.collect do |cat| cats = @categories.collect do |cat|
archives = ArchiveFile.can_display.where(:category_id => cat["id"]).collect do |archive| archives = ArchiveFile.can_display.where(:category_id => cat["id"]).collect do |archive|
url = archive.archive_file_multiples.count > 1 ? OrbitHelper.widget_more_url : "/xhr/archive/download?file=#{archive.archive_file_multiples.first.id}"
{ {
"archive-title" => archive.title, "archive-title" => archive.title,
"archive_url" => "/xhr/archive/download?file=#{archive.id}" "archive_url" => url
} }
end end
{ {