Add `ModalController#close` action

This commit is contained in:
Andreas Nedbal 2023-10-23 00:45:40 +02:00 committed by Andreas Nedbal
parent f30b1b820e
commit 4c393defb7
3 changed files with 16 additions and 0 deletions

View File

@ -0,0 +1,13 @@
# frozen_string_literal: true
class ModalController < ApplicationController
include ActionView::Helpers::TagHelper
include Turbo::FramesHelper
skip_before_action :find_active_announcements, :banned?
def close
redirect_to root_path unless turbo_frame_request?
render inline: turbo_frame_tag("modal")
end
end

View File

@ -32,6 +32,7 @@
= yield
= render "shared/formatting"
= render "shared/hotkeys"
= turbo_frame_tag "modal"
.d-none#toasts
- if Rails.env.development?
#debug

View File

@ -181,5 +181,7 @@ Rails.application.routes.draw do
get "/nodeinfo/2.1", to: "well_known/node_info#nodeinfo", as: :node_info
get "/modal/close", to: "modal#close", as: :modal_close
puts "processing time of routes.rb: #{"#{(Time.zone.now - start).round(3).to_s.ljust(5, '0')}s".light_green}"
end