Fix generation of static error pages in glitch-soc
This commit is contained in:
1 parent
01b576efed
commit
2f8ecb894e
3 files changed
+11
-25
No files matched your search
+5
-19
@@ -1,27 +1,13 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
def render_static_page(action, dest:, **opts)
|
||||
html = ApplicationController.render(action, opts)
|
||||
File.write(dest, html)
|
||||
end
|
||||
|
||||
namespace :assets do
|
||||
desc 'Generate static pages'
|
||||
task generate_static_pages: :environment do
|
||||
def render_static_page(action, dest:, **opts)
|
||||
renderer = Class.new(ApplicationController) do
|
||||
def current_user
|
||||
nil
|
||||
end
|
||||
|
||||
def current_flavour
|
||||
Setting.default_settings['flavour']
|
||||
end
|
||||
|
||||
def current_skin
|
||||
Setting.default_settings['skin']
|
||||
end
|
||||
end
|
||||
|
||||
html = renderer.render(action, opts)
|
||||
File.write(dest, html)
|
||||
end
|
||||
|
||||
render_static_page 'errors/500', layout: 'error', dest: Rails.public_path.join('assets', '500.html')
|
||||
end
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user