BootstrapFeedbacker displays a modal form for collecting feedback and emails it to a configured address, along with the referring page URL (when available) and the current user's details.
- Ruby 3.3 or later and Rails 7.1 or later
- Import Maps, Turbo, and Stimulus
- Bootstrap 5 CSS and JavaScript, with
window.bootstrap.Modalavailable - A user model with an
emailattribute and a name method (default:name) - A
current_usermethod available to the application's controllers - Action Mailer configured to deliver email
-
Add the gem to your Gemfile and run
bundle install:gem "bootstrap_feedbacker"
-
Install and run the migrations:
bin/rails bootstrap_feedbacker:install:migrations bin/rails db:migrate
-
Mount the engine in
config/routes.rb:mount BootstrapFeedbacker::Engine, at: "/bootstrap_feedbacker"
-
Include Bootstrap 5 CSS and JavaScript in your application. For example, with the Bootstrap gem's JavaScript assets and Import Maps, pin the non-ES module build in
config/importmap.rb:pin "bootstrap", to: "bootstrap.min.js"
Import it in
app/javascript/application.js:import "bootstrap"
The gem's Stimulus controller uses
window.bootstrap.Modalto open the form. Ensure your application also loads its Stimulus controllers, for example withlazyLoadControllersFrom. -
Add the feedback link and modal container to a view:
<%= bootstrap_feedbacker_link %> <%= bootstrap_feedbacker_modal %>
Set the recipient address in config/initializers/bootstrap_feedbacker.rb:
BootstrapFeedbacker::SETTINGS.email_to = "support@example.com"The same address is used as the sender; replies go to the current user's email address. You can also configure these settings:
BootstrapFeedbacker::SETTINGS.update do |settings|
settings.email_to = "support@example.com"
settings.email_prefix = "[FEEDBACKER]" # default
settings.modal_content_id = "bootstrap_feedbacker_remark_modal_content" # default
settings.modal_id = "bootstrap_feedbacker_remark_modal" # default
settings.user_class = "User" # default
settings.user_name_method = :name # default
endBootstrap Feedbacker is released under the MIT License.