public_service_announcement 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -4,3 +4,5 @@ pkg/
4
4
  test/dummy/db/*.sqlite3
5
5
  test/dummy/log/*.log
6
6
  test/dummy/tmp/
7
+
8
+ public_service_announcement-*.gem
data/README.md ADDED
@@ -0,0 +1,43 @@
1
+ Public Service Announcement
2
+ ===========================
3
+
4
+ Public Service Announcement is a Rails Engine allowing for the centralized management of public alerts.
5
+
6
+
7
+ Install
8
+ -------
9
+
10
+ Add this line to your Gemfile:
11
+
12
+ gem 'public_service_announcement'
13
+
14
+ Then at the commandline:
15
+
16
+ bundle install
17
+ rake psa:migrations:copy
18
+ rake db:migrate
19
+
20
+ Finally, add the code to output the messages to your application.html.erb file:
21
+
22
+ <ul class="announcements">
23
+ <% public_service_announcements.each do |announcement| %>
24
+ <li><%= announcement %></li>
25
+ <% end %>
26
+ </ul>
27
+
28
+ And for haml:
29
+
30
+ %ul.announcements
31
+ - public_service_announcements.each do |announcement|
32
+ li=announcement
33
+
34
+ Of course, you can actually format them anyway you like but this is how I do it.
35
+
36
+ Usage
37
+ -----
38
+
39
+ Navigate to:
40
+
41
+ /psas
42
+
43
+ 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 $.
data/app/models/psa.rb CHANGED
@@ -15,4 +15,8 @@ class Psa < ActiveRecord::Base
15
15
  val = nil if val.empty?
16
16
  write_attribute :user_agent, val
17
17
  end
18
+
19
+ def to_s
20
+ message
21
+ end
18
22
  end
@@ -6,11 +6,11 @@ Gem::Specification.new do |s|
6
6
  s.homepage = "http://github.com/gabeanzelini/public_service_announcement"
7
7
  s.name = "public_service_announcement"
8
8
  s.summary = "Insert PublicServiceAnnouncement summary."
9
- s.description = "Insert PublicServiceAnnouncement description."
9
+ s.description = "Rails Engine allowing centralized management of public alerts."
10
10
  s.add_dependency "rails", "3.0.3"
11
11
  s.add_dependency "inherited_resources"
12
12
  s.add_dependency "simple_form"
13
13
  s.files = `git ls-files`.split("\n")
14
14
  s.require_paths = ["lib"]
15
- s.version = "0.1.0"
15
+ s.version = "0.1.1"
16
16
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 0
9
- version: 0.1.0
8
+ - 1
9
+ version: 0.1.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Gabe Anzelini
@@ -58,7 +58,7 @@ dependencies:
58
58
  version: "0"
59
59
  type: :runtime
60
60
  version_requirements: *id003
61
- description: Insert PublicServiceAnnouncement description.
61
+ description: Rails Engine allowing centralized management of public alerts.
62
62
  email: me@gabeanzelini.com
63
63
  executables: []
64
64
 
@@ -71,7 +71,7 @@ files:
71
71
  - Gemfile
72
72
  - Gemfile.lock
73
73
  - MIT-LICENSE
74
- - README.rdoc
74
+ - README.md
75
75
  - Rakefile
76
76
  - app/controllers/psas_controller.rb
77
77
  - app/models/psa.rb
data/README.rdoc DELETED
@@ -1,3 +0,0 @@
1
- = PublicServiceAnnouncement
2
-
3
- This project rocks and uses MIT-LICENSE.