From b20cacc50e07aa6d701176686b1820342059dff2 Mon Sep 17 00:00:00 2001 From: Bohung Date: Mon, 19 Apr 2021 11:56:33 +0800 Subject: [PATCH] Fix bug. --- app/controllers/announcements_controller.rb | 2 +- app/views/admin/announcements/_form.html.erb | 9 +++++++++ app/views/admin/announcements/_form_file.html.erb | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/app/controllers/announcements_controller.rb b/app/controllers/announcements_controller.rb index a8d5b8f..deba329 100644 --- a/app/controllers/announcements_controller.rb +++ b/app/controllers/announcements_controller.rb @@ -565,7 +565,7 @@ class AnnouncementsController < ApplicationController } } rescue [] files = announcement.bulletin_files.map do |file| { "file_url" => "/xhr/announcements/file/#{file.id}/#{file['file']}" + "\" title=\"#{file.file_title}", - "file_title" => (file.title.blank? ? URI.unescape(File.basename(file.file.path)) : file.title rescue '') } if file.enabled_for?(locale) + "file_title" => (file.title.blank? ? URI.unescape(File.basename(file.file.path)) : file.title rescue '') } rescue nil if file.enabled_for?(locale) end rescue [] files.delete(nil) files.each do |file| diff --git a/app/views/admin/announcements/_form.html.erb b/app/views/admin/announcements/_form.html.erb index 5c4c563..3dbb71f 100644 --- a/app/views/admin/announcements/_form.html.erb +++ b/app/views/admin/announcements/_form.html.erb @@ -509,6 +509,14 @@ }) <% end %> +