From 381e9e620bf03973817901da79193a6063ed7187 Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Mon, 25 Sep 2017 17:58:44 +0800 Subject: [PATCH] now directly downloadable from widget if has only one file --- app/controllers/archives_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/archives_controller.rb b/app/controllers/archives_controller.rb index 76ba5d7..d9910e0 100644 --- a/app/controllers/archives_controller.rb +++ b/app/controllers/archives_controller.rb @@ -136,9 +136,10 @@ class ArchivesController < ApplicationController end cats = @categories.collect do |cat| 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_url" => "/xhr/archive/download?file=#{archive.id}" + "archive_url" => url } end {