Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Public Service Announcement is a Rails Engine allowing for the centralized management of public alerts.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 app
Octocat-spinner-32 config
Octocat-spinner-32 db
Octocat-spinner-32 lib
Octocat-spinner-32 test
Octocat-spinner-32 .gitignore
Octocat-spinner-32 Gemfile
Octocat-spinner-32 Gemfile.lock
Octocat-spinner-32 MIT-LICENSE
Octocat-spinner-32 README.md
Octocat-spinner-32 Rakefile
Octocat-spinner-32 public_service_announcement.gemspec
README.md

Public Service Announcement

Public Service Announcement is a Rails Engine allowing for the centralized management of public alerts.

Install

Add this line to your Gemfile:

gem 'public_service_announcement'

Then at the commandline:

bundle install
rake psa:migrations:copy
rake db:migrate

Finally, add the code to output the messages to your application.html.erb file:

<ul class="announcements">
    <% public_service_announcements.each do |announcement| %>
        <li><%= announcement %></li>
    <% end %>
</ul>

And for haml:

%ul.announcements
    - public_service_announcements.each do |announcement|
        li=announcement

Of course, you can actually format them anyway you like but this is how I do it.

Usage

Navigate to:

/psas

Create new announcement with a message, start date, and end date. You may, optionally, include max views, route regex to match, and/or user agent regex to match. The route and user agent regexes will default to exact match unless you specify either ^ or $.

Something went wrong with that request. Please try again.