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 %>