fix error for comment and bundle update

This commit is contained in:
chiu committed 2023-05-06 16:53:11 +08:00
1 parent 742382ed67
commit 14822f2bbf
7 files changed
+941 -1

No files matched your search

@@ -1,4 +1,5 @@
class AnnouncementsController < ApplicationController
ViewRootDir = File.expand_path("../../views", __FILE__)
include AnnouncementsHelper
DefaultImgSrc = "/assets/announcement-default.jpg\" onerror=\"this.src=&quot;/assets/announcement-default-2.jpg&quot;;this.onerror='';"
def initialize
@@ -29,6 +30,12 @@ class AnnouncementsController < ApplicationController
AnnouncementSetting.first.enable_manually_sort rescue false
end
end
def render_400
render(:file => "#{ViewRootDir}/announcements/400.html", :layout => false, :status => 400, :formats => [:html])
end
def render_404
render(:file => "#{Rails.root}/app/views/errors/404.html", :layout => false, :status => 404, :formats => [:html])
end
def comment
@bulletin = Bulletin.where(:uid=>params[:uid]).first
comment_val = params['comment']
@@ -38,6 +45,8 @@ class AnnouncementsController < ApplicationController
b.bulletin_id = @bulletin.id
b.save
render :json => {}
else
render_404
end
end
def index
@@ -1018,6 +1027,15 @@ class AnnouncementsController < ApplicationController
},
"total_pages" => total_pages
}
@layout_type = params[:layout_type]
if @layout_type.blank?
@layout_type = 'annc_index1'
else
@layout_type = @layout_type.to_s
if File.dirname(@layout_type) != '.'
render_400 and return
end
end
render :layout => false
end