
Security News
CISA’s 2025 SBOM Guidance Adds Hashes, Licenses, Tool Metadata, and Context
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
Shows cute notifications in frontend. No need to manually create your own html/css/js to show Rails's flash[:notice] or other flashes. This gem handles it nicely + you can customize it.
Requirements: Rails 3.1.0, jQuery
gem install frontend_notifier
@import "frontend_notifier";
#= require lib/_frontend_notifier
= render :partial => "shared/frontend_notifier"
Regular reuqests
FrontendNotifier will pick up any flash with the names :error
, :alert
, :warning
, :success
or :notice
. You can customize this by creating your own views/shared/frontend_notifier
template.
Ajax requests
Sometimes you may need to display the notification after an ajax request. For that, you may want to use #notify_frontend
method now available in your controller and pass it either a model with (or without) errors:
def create
...
notify_frontend(@user)
end
or a message and an error type:
def create
...
notify_frontend("Email can't be blank", :error)
end
Both will result in rendering the following json:
{ type: "error", message: "Email can't be blank" }
Now you can deal with this in your ajax request callback. Assuming this is a jQuery $.ajax function:
success: function(response) { FrontendNotifier.show(response) }
In this case, FrontendNotifier.show
will recognize the type of the notification (either "success" or "error") and display appropriately styled notification (by default, green background for success and red for error).
You can also specify the type of error to the FrontendNotifier class manually and call the .show() function anywhere in your js: FrontendNotifier.show("Testing notifications", "success")
There's also a handy #join_model_errors method added to the ApplicationController, which you might want to look at. It basically takes errors from the model and compiles them into a one line message which may then be handed to the FrontendNotifier. So, you may want to use it like this:
flash[:error] = join_model_errors(@user, include_field_names: true) # :include_field_names is true by default
For now, the gem lacks generators, so if you want to customize scss styles or haml templates, just copy .scss/.haml files from their gem dirs into your app dirs and change them.
FAQs
Unknown package
We found that frontend_notifier demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.
Security News
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.