announcements 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,3 +1,7 @@
1
+ # announcements
2
+
3
+ The Announcements gem provides an easy way to publish short messages in your views, which the user can then hide permanently. It is influenced by the gem `paul_revere` by thoughtbot, but is
4
+ much much simpler - no partials used, 'type' attribute for different types of announcements, and others.
1
5
 
2
6
  ## Quick start
3
7
 
@@ -10,10 +14,53 @@
10
14
 
11
15
  ## Styling
12
16
 
17
+ By default, the announcement text and hide message text are wrapped in a div called "info" (if you want to customise that, see the Customisation section below).
18
+ You can use the following css in your application.css file to start:
19
+
20
+ ```css
21
+ .info {
22
+ background: #D5EDF8;
23
+ color: #205791;
24
+ padding: 0.8em;
25
+ margin-bottom: 1em;
26
+ border: 2px solid #92CAE4;
27
+ }
28
+
29
+ .hide_announcement {
30
+ cursor: pointer;
31
+ float: right;
32
+ }
33
+ ```
34
+
13
35
  ## Customisation
14
36
 
37
+ The default HTML output of the `announce` helper is
38
+
39
+ ```html
40
+ <div class="info">
41
+ My announcement!
42
+ <span class="hide_announcement" data-announcementid="1">hide message</span>
43
+ </div>
44
+ ```
45
+
46
+ The default div class is `info`. You can specify you own like that:
47
+
48
+ ```ruby
49
+ <%= announce Announcement.newest, :div_class => "mydiv" %>
50
+ ```
51
+
52
+ You can also change the "hide message" text:
53
+
54
+ ```ruby
55
+ <%= announce Announcement.newest, :div_class => "mydiv", :hide_message => "X" %>
56
+ ```
57
+
15
58
  ## How it works
16
59
 
60
+ The gem creates an Announcement model with a few class methods like `Announcement.newest`. The Announcement model has a body:text (the actual announcement text)
61
+ and a type:string (which you can use for different types of announcements, e.g. public (everyone) and private (only for registered users)). There is also a js file in vendor/assets/javascripts
62
+ which permanently hides the announcement by creating a cookie (that's when you click on the 'hide message' text).
63
+
17
64
  ## How to uninstall
18
65
 
19
66
  There is no uninstaller at this point, but you can simply remove the following files manually:
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
8
8
  s.authors = ["Svilen Gospodinov"]
9
9
  s.email = ["svilen@gospodinov.co.uk"]
10
10
  s.homepage = ""
11
- s.summary = "Announcements for Rails >= 3.1.0"
11
+ s.summary = "Announcements gem for Rails"
12
12
  s.description = "The Announcements gem makes it easier to display short announcement messages in your views"
13
13
 
14
14
  s.rubyforge_project = "announcements"
@@ -20,6 +20,6 @@ Gem::Specification.new do |s|
20
20
 
21
21
  # specify any dependencies here; for example:
22
22
  # s.add_development_dependency "rspec"
23
- s.add_runtime_dependency "jquery-rails"
24
- s.add_runtime_dependency "rails", ">= 3.1.0"
23
+ s.add_runtime_dependency "rails", "~> 3.1"
24
+
25
25
  end
@@ -1,3 +1,3 @@
1
1
  module Announcements
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: announcements
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,28 +11,17 @@ bindir: bin
11
11
  cert_chain: []
12
12
  date: 2012-01-22 00:00:00.000000000Z
13
13
  dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: jquery-rails
16
- requirement: &26346180 !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
21
- version: '0'
22
- type: :runtime
23
- prerelease: false
24
- version_requirements: *26346180
25
14
  - !ruby/object:Gem::Dependency
26
15
  name: rails
27
- requirement: &26345736 !ruby/object:Gem::Requirement
16
+ requirement: &25371696 !ruby/object:Gem::Requirement
28
17
  none: false
29
18
  requirements:
30
- - - ! '>='
19
+ - - ~>
31
20
  - !ruby/object:Gem::Version
32
- version: 3.1.0
21
+ version: '3.1'
33
22
  type: :runtime
34
23
  prerelease: false
35
- version_requirements: *26345736
24
+ version_requirements: *25371696
36
25
  description: The Announcements gem makes it easier to display short announcement messages
37
26
  in your views
38
27
  email:
@@ -76,5 +65,5 @@ rubyforge_project: announcements
76
65
  rubygems_version: 1.8.11
77
66
  signing_key:
78
67
  specification_version: 3
79
- summary: Announcements for Rails >= 3.1.0
68
+ summary: Announcements gem for Rails
80
69
  test_files: []