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

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

@@ -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
+63
View File
@@ -0,0 +1,63 @@
<!DOCTYPE HTML>
<html lang="zh-tw">
<head>
<meta charset="UTF-8">
<title>Bad Request</title>
<link href='https://fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'>
</head>
<body>
<style>
::selection {
color: #fff;
background: #040114;
}
body {
margin: 0;
padding: 0;
font-family: 'Roboto', sans-serif;
font-size: 100%;
background: url(/assets/error_image/404.jpg) center center fixed no-repeat;
background-size: cover;
background-color: #000;
}
#error-page {
min-height: 768px;
}
.message {
text-align: center;
position: absolute;
left: 50%;
top: 25%;
margin-left: -175px;
}
.message h1 {
margin: 0 0.2em 0 0;
color: #fff;
font-size: 8.5em;
font-weight: normal;
}
.message h2 {
margin: 0;
padding: 0;
color: #fff;
}
.message p {
color: #fff;
}
.home {
color: #fff;
}
a.home:hover {
text-decoration: none;
}
</style>
<div id="error-page">
<section class="message">
<h1>400</h1>
<h2>Bad Request</h2>
<p>Your request is invalid, <br>
get back to your home planet by <a class="home" href="/">clicking here!</a></p>
</section>
</div>
</body>
</html>