From 18d4162c7e45ccc49e2057cf7bc4d0da18963dbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B1=E5=8D=9A=E4=BA=9E?= Date: Sat, 3 Aug 2024 13:03:50 +0800 Subject: [PATCH] Fix page_for_archive_file. --- app/helpers/admin/archive_files_helper.rb | 10 +++++++--- app/views/admin/archive_files/_index.html.erb | 2 +- app/views/archive_feeds/rssfeed.rss.builder | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/helpers/admin/archive_files_helper.rb b/app/helpers/admin/archive_files_helper.rb index 18dbe12..dc25c0d 100644 --- a/app/helpers/admin/archive_files_helper.rb +++ b/app/helpers/admin/archive_files_helper.rb @@ -1,5 +1,5 @@ module Admin::ArchiveFilesHelper - def page_for_archive_file(archive_file) + def page_for_archive_file(archive_file, full_url=false) archive_file_page = nil pages = Page.where(:module=>'archive').select{|page| page.enabled_for.include?(I18n.locale.to_s)} @@ -18,8 +18,12 @@ module Admin::ArchiveFilesHelper end break if !archive_file_page.nil? end + archive_file_page = pages.first if archive_file_page.nil? + end + if full_url + request.protocol+(request.host_with_port+archive_file_page.url+'/'+archive_file.to_param).gsub('//','/') rescue "#" + else + "#{archive_file_page.url}?title=#{archive_file.title}" end - archive_file_page = pages.first if archive_file_page.nil? - request.protocol+(request.host_with_port+archive_file_page.url+'/'+archive_file.to_param).gsub('//','/') rescue "#" end end \ No newline at end of file diff --git a/app/views/admin/archive_files/_index.html.erb b/app/views/admin/archive_files/_index.html.erb index d07ec7c..db1871e 100644 --- a/app/views/admin/archive_files/_index.html.erb +++ b/app/views/admin/archive_files/_index.html.erb @@ -113,7 +113,7 @@ <% end %> - <%= archive.title %> + <%= archive.title %>