gritter_notices 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +59 -8
- data/VERSION +1 -1
- data/gritter_notices.gemspec +3 -3
- data/lib/gritter_notices/rspec_matcher.rb +4 -0
- data/lib/gritter_notices/view_helpers.rb +4 -4
- metadata +47 -47
data/README.rdoc
CHANGED
@@ -6,31 +6,56 @@
|
|
6
6
|
|
7
7
|
Визуально выглядит так: http://boedesign.com/demos/gritter/
|
8
8
|
|
9
|
-
|
9
|
+
Рабочий пример использования этого модуля: http://gritter-notices-example.heroku.com/
|
10
|
+
|
11
|
+
Модуль родился и активно используется в проекте http://planposter.com
|
12
|
+
|
13
|
+
http://dl.dropbox.com/u/155427/gritter_notices.png
|
10
14
|
|
11
15
|
== Установка
|
12
16
|
|
13
17
|
Включаем модуль в Gemfile, незабываем затем сделать bundle install:
|
14
18
|
|
15
|
-
gem 'gritter' # неабываем его далее установить согласно документации
|
16
19
|
gem 'gritter_notices'
|
17
20
|
|
18
|
-
|
21
|
+
Копируем jQuery-плагин Gritter (https://github.com/jboesch/Gritter) в проект:
|
22
|
+
|
23
|
+
rake gritter:install
|
24
|
+
|
25
|
+
## Если хотим посылать персональные сообщения пользователям (помимо отображения flash)
|
26
|
+
|
27
|
+
Создаем таблицу `gritter_notices` где будут храниться сообщения:
|
19
28
|
|
20
29
|
rails g gritter_notices
|
21
30
|
rake db:migrate
|
22
31
|
|
23
|
-
Подключаем
|
32
|
+
Подключаем notices в модель user:
|
24
33
|
|
25
|
-
|
34
|
+
class User < ActiveRecord::Base
|
35
|
+
has_gritter_notices
|
36
|
+
...
|
26
37
|
|
27
|
-
Где-то в layout делаем
|
38
|
+
Где-то в layout делаем так:
|
39
|
+
|
40
|
+
* haml-пример:
|
28
41
|
|
29
42
|
%head
|
30
43
|
= include_gritter
|
31
44
|
%body
|
32
|
-
= gflash
|
33
|
-
= gritter_flash_messages
|
45
|
+
= gflash # session сообщения добавляемые через gritter-овский gflash :success=>траляля
|
46
|
+
= gritter_flash_messages # Все остальные сообщения добавляемые через вызовы типа flash[:success] или user.notice_*
|
47
|
+
|
48
|
+
* erb-пример:
|
49
|
+
|
50
|
+
<head>
|
51
|
+
<%= include_gritter %>
|
52
|
+
...
|
53
|
+
<body>
|
54
|
+
<%= gflash %>
|
55
|
+
<%= gritter_flash_messages %>
|
56
|
+
|
57
|
+
|
58
|
+
Вместо `include_fritter` можно делать сразу `include_gritter_and_jquery` подробнее тут: https://github.com/RobinBrouwer/gritter
|
34
59
|
|
35
60
|
== Использование
|
36
61
|
|
@@ -81,6 +106,9 @@
|
|
81
106
|
|
82
107
|
flash[:notice] = ['Сообщение1', 'Сообщение2']
|
83
108
|
|
109
|
+
О плагине jQuery Gritter - http://ruseller.com/adds.php?rub=11&id=2106
|
110
|
+
Также некоторая информация есть здесь: http://habrahabr.ru/blogs/ror/116754/
|
111
|
+
|
84
112
|
== TODO
|
85
113
|
|
86
114
|
1. Удалять gritter_notice только после того как они закроются или их закроют
|
@@ -92,6 +120,23 @@
|
|
92
120
|
3. обычные notices по методу 1, sticky notices по методу 2.
|
93
121
|
|
94
122
|
2. Показывать push-сообщения
|
123
|
+
3. Написать драйверы для других способов отображения (список ниже)
|
124
|
+
|
125
|
+
== Другие способы отображения
|
126
|
+
|
127
|
+
* https://github.com/wavded/humane-js
|
128
|
+
* https://github.com/rubiety/message_block
|
129
|
+
* http://plapier.github.com/sexy-css3-flashes/
|
130
|
+
* https://github.com/jyoungblood/smoke.js
|
131
|
+
* КТО ЗНАЕТ ЕЩЕ ПРИМЕРЫ ??? Напишите пожалуйста мне.
|
132
|
+
|
133
|
+
== Примеры:
|
134
|
+
|
135
|
+
* http://gritter-notices-example.heroku.com/
|
136
|
+
код: http://github.com/dapi/gritter_notices_example
|
137
|
+
* http://planposter.com/
|
138
|
+
|
139
|
+
Друзья, присылайте ссылка на ваши проекты использующие gritter_notices.
|
95
140
|
|
96
141
|
== Нечто отдаленно подобное:
|
97
142
|
|
@@ -101,6 +146,12 @@
|
|
101
146
|
https://github.com/QuBiT/universal_flash_messages
|
102
147
|
|
103
148
|
|
149
|
+
== Пишут от gritter_notices
|
150
|
+
|
151
|
+
* http://dapi.ru/flash-delayedjob
|
152
|
+
* http://pavlovnew.livejournal.com/20139.html
|
153
|
+
* http://habrahabr.ru/blogs/ror/116754/
|
154
|
+
|
104
155
|
== Credits
|
105
156
|
* Robin Brouwer https://github.com/RobinBrouwer/gritter
|
106
157
|
* Jordan Boesch http://boedesign.com/blog/2009/07/11/growl-for-jquery-gritter/
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.3
|
data/gritter_notices.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{gritter_notices}
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Danil Pismenny"]
|
12
|
-
s.date = %q{2011-
|
12
|
+
s.date = %q{2011-07-18}
|
13
13
|
s.description = %q{Provide `notice` method to user model to save notices and to shows them later in views with Gritter (growl-like jQuery plugin). Fully support of Rails flash messages also. Helpful to send flash messages from background jobs.}
|
14
14
|
s.email = %q{danil@orionet.ru}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -43,7 +43,7 @@ Gem::Specification.new do |s|
|
|
43
43
|
s.homepage = %q{http://github.com/dapi/gritter_notices}
|
44
44
|
s.licenses = ["MIT"]
|
45
45
|
s.require_paths = ["lib"]
|
46
|
-
s.rubygems_version = %q{1.6.
|
46
|
+
s.rubygems_version = %q{1.6.2}
|
47
47
|
s.summary = %q{Show growl-like flashes and saved user's notices with Gritter}
|
48
48
|
s.test_files = [
|
49
49
|
"spec/gritter_notice_spec.rb",
|
@@ -19,11 +19,11 @@ module GritterNotices::ViewHelpers
|
|
19
19
|
options = args.extract_options!
|
20
20
|
titles = gflash_titles(options)
|
21
21
|
gritters = []
|
22
|
-
|
22
|
+
debugger
|
23
23
|
# Собираем flash-сообщения
|
24
24
|
add_flashes_to_gritters( gritters, flash, titles )
|
25
|
-
|
26
|
-
current_user.gritter_notices.fresh, titles)
|
25
|
+
defined?(current_user) and current_user.respond_to?(:gritter_notices) and
|
26
|
+
add_notices_to_gitters( gritters, current_user.gritter_notices.fresh, titles)
|
27
27
|
|
28
28
|
js(gritters).html_safe unless gritters.empty?
|
29
29
|
end
|
@@ -40,7 +40,7 @@ module GritterNotices::ViewHelpers
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def add_flashes_to_gritters(gritters, list, titles)
|
43
|
-
list.each_pair do |key, message_array|
|
43
|
+
list.to_hash.each_pair do |key, message_array|
|
44
44
|
next unless message_array
|
45
45
|
message_array = [message_array] unless message_array.is_a? Array
|
46
46
|
message_array.flatten.each { |message|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gritter_notices
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 3
|
10
|
+
version: 0.3.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Danil Pismenny
|
@@ -15,11 +15,11 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-07-18 00:00:00 +04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
|
-
|
22
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
23
23
|
none: false
|
24
24
|
requirements:
|
25
25
|
- - ">="
|
@@ -28,12 +28,12 @@ dependencies:
|
|
28
28
|
segments:
|
29
29
|
- 0
|
30
30
|
version: "0"
|
31
|
-
version_requirements: *id001
|
32
31
|
name: gritter
|
33
|
-
prerelease: false
|
34
32
|
type: :runtime
|
33
|
+
prerelease: false
|
34
|
+
requirement: *id001
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
|
-
|
36
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
37
37
|
none: false
|
38
38
|
requirements:
|
39
39
|
- - ~>
|
@@ -43,12 +43,12 @@ dependencies:
|
|
43
43
|
- 3
|
44
44
|
- 0
|
45
45
|
version: "3.0"
|
46
|
-
version_requirements: *id002
|
47
46
|
name: activerecord
|
48
|
-
prerelease: false
|
49
47
|
type: :runtime
|
48
|
+
prerelease: false
|
49
|
+
requirement: *id002
|
50
50
|
- !ruby/object:Gem::Dependency
|
51
|
-
|
51
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
52
52
|
none: false
|
53
53
|
requirements:
|
54
54
|
- - ~>
|
@@ -58,12 +58,12 @@ dependencies:
|
|
58
58
|
- 3
|
59
59
|
- 0
|
60
60
|
version: "3.0"
|
61
|
-
version_requirements: *id003
|
62
61
|
name: actionpack
|
63
|
-
prerelease: false
|
64
62
|
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
requirement: *id003
|
65
65
|
- !ruby/object:Gem::Dependency
|
66
|
-
|
66
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
67
67
|
none: false
|
68
68
|
requirements:
|
69
69
|
- - ">="
|
@@ -72,12 +72,12 @@ dependencies:
|
|
72
72
|
segments:
|
73
73
|
- 0
|
74
74
|
version: "0"
|
75
|
-
version_requirements: *id004
|
76
75
|
name: ruby-debug
|
77
|
-
prerelease: false
|
78
76
|
type: :development
|
77
|
+
prerelease: false
|
78
|
+
requirement: *id004
|
79
79
|
- !ruby/object:Gem::Dependency
|
80
|
-
|
80
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
81
81
|
none: false
|
82
82
|
requirements:
|
83
83
|
- - ">="
|
@@ -86,12 +86,12 @@ dependencies:
|
|
86
86
|
segments:
|
87
87
|
- 0
|
88
88
|
version: "0"
|
89
|
-
version_requirements: *id005
|
90
89
|
name: sqlite3
|
91
|
-
prerelease: false
|
92
90
|
type: :development
|
91
|
+
prerelease: false
|
92
|
+
requirement: *id005
|
93
93
|
- !ruby/object:Gem::Dependency
|
94
|
-
|
94
|
+
version_requirements: &id006 !ruby/object:Gem::Requirement
|
95
95
|
none: false
|
96
96
|
requirements:
|
97
97
|
- - ">="
|
@@ -100,12 +100,12 @@ dependencies:
|
|
100
100
|
segments:
|
101
101
|
- 0
|
102
102
|
version: "0"
|
103
|
-
version_requirements: *id006
|
104
103
|
name: watchr
|
105
|
-
prerelease: false
|
106
104
|
type: :development
|
105
|
+
prerelease: false
|
106
|
+
requirement: *id006
|
107
107
|
- !ruby/object:Gem::Dependency
|
108
|
-
|
108
|
+
version_requirements: &id007 !ruby/object:Gem::Requirement
|
109
109
|
none: false
|
110
110
|
requirements:
|
111
111
|
- - ">="
|
@@ -114,12 +114,12 @@ dependencies:
|
|
114
114
|
segments:
|
115
115
|
- 0
|
116
116
|
version: "0"
|
117
|
-
version_requirements: *id007
|
118
117
|
name: factory_girl
|
119
|
-
prerelease: false
|
120
118
|
type: :development
|
119
|
+
prerelease: false
|
120
|
+
requirement: *id007
|
121
121
|
- !ruby/object:Gem::Dependency
|
122
|
-
|
122
|
+
version_requirements: &id008 !ruby/object:Gem::Requirement
|
123
123
|
none: false
|
124
124
|
requirements:
|
125
125
|
- - ">="
|
@@ -128,12 +128,12 @@ dependencies:
|
|
128
128
|
segments:
|
129
129
|
- 0
|
130
130
|
version: "0"
|
131
|
-
version_requirements: *id008
|
132
131
|
name: shoulda
|
133
|
-
prerelease: false
|
134
132
|
type: :development
|
133
|
+
prerelease: false
|
134
|
+
requirement: *id008
|
135
135
|
- !ruby/object:Gem::Dependency
|
136
|
-
|
136
|
+
version_requirements: &id009 !ruby/object:Gem::Requirement
|
137
137
|
none: false
|
138
138
|
requirements:
|
139
139
|
- - ~>
|
@@ -144,12 +144,12 @@ dependencies:
|
|
144
144
|
- 5
|
145
145
|
- 0
|
146
146
|
version: 2.5.0
|
147
|
-
version_requirements: *id009
|
148
147
|
name: rspec
|
149
|
-
prerelease: false
|
150
148
|
type: :development
|
149
|
+
prerelease: false
|
150
|
+
requirement: *id009
|
151
151
|
- !ruby/object:Gem::Dependency
|
152
|
-
|
152
|
+
version_requirements: &id010 !ruby/object:Gem::Requirement
|
153
153
|
none: false
|
154
154
|
requirements:
|
155
155
|
- - ">="
|
@@ -158,12 +158,12 @@ dependencies:
|
|
158
158
|
segments:
|
159
159
|
- 0
|
160
160
|
version: "0"
|
161
|
-
version_requirements: *id010
|
162
161
|
name: rspec-rails
|
163
|
-
prerelease: false
|
164
162
|
type: :development
|
163
|
+
prerelease: false
|
164
|
+
requirement: *id010
|
165
165
|
- !ruby/object:Gem::Dependency
|
166
|
-
|
166
|
+
version_requirements: &id011 !ruby/object:Gem::Requirement
|
167
167
|
none: false
|
168
168
|
requirements:
|
169
169
|
- - ~>
|
@@ -174,12 +174,12 @@ dependencies:
|
|
174
174
|
- 0
|
175
175
|
- 0
|
176
176
|
version: 1.0.0
|
177
|
-
version_requirements: *id011
|
178
177
|
name: bundler
|
179
|
-
prerelease: false
|
180
178
|
type: :development
|
179
|
+
prerelease: false
|
180
|
+
requirement: *id011
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
|
-
|
182
|
+
version_requirements: &id012 !ruby/object:Gem::Requirement
|
183
183
|
none: false
|
184
184
|
requirements:
|
185
185
|
- - ~>
|
@@ -190,12 +190,12 @@ dependencies:
|
|
190
190
|
- 5
|
191
191
|
- 2
|
192
192
|
version: 1.5.2
|
193
|
-
version_requirements: *id012
|
194
193
|
name: jeweler
|
195
|
-
prerelease: false
|
196
194
|
type: :development
|
195
|
+
prerelease: false
|
196
|
+
requirement: *id012
|
197
197
|
- !ruby/object:Gem::Dependency
|
198
|
-
|
198
|
+
version_requirements: &id013 !ruby/object:Gem::Requirement
|
199
199
|
none: false
|
200
200
|
requirements:
|
201
201
|
- - ">="
|
@@ -204,12 +204,12 @@ dependencies:
|
|
204
204
|
segments:
|
205
205
|
- 0
|
206
206
|
version: "0"
|
207
|
-
version_requirements: *id013
|
208
207
|
name: rcov
|
209
|
-
prerelease: false
|
210
208
|
type: :development
|
209
|
+
prerelease: false
|
210
|
+
requirement: *id013
|
211
211
|
- !ruby/object:Gem::Dependency
|
212
|
-
|
212
|
+
version_requirements: &id014 !ruby/object:Gem::Requirement
|
213
213
|
none: false
|
214
214
|
requirements:
|
215
215
|
- - ~>
|
@@ -219,10 +219,10 @@ dependencies:
|
|
219
219
|
- 0
|
220
220
|
- 6
|
221
221
|
version: "0.6"
|
222
|
-
version_requirements: *id014
|
223
222
|
name: gritter
|
224
|
-
prerelease: false
|
225
223
|
type: :runtime
|
224
|
+
prerelease: false
|
225
|
+
requirement: *id014
|
226
226
|
description: Provide `notice` method to user model to save notices and to shows them later in views with Gritter (growl-like jQuery plugin). Fully support of Rails flash messages also. Helpful to send flash messages from background jobs.
|
227
227
|
email: danil@orionet.ru
|
228
228
|
executables: []
|
@@ -285,7 +285,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
285
285
|
requirements: []
|
286
286
|
|
287
287
|
rubyforge_project:
|
288
|
-
rubygems_version: 1.6.
|
288
|
+
rubygems_version: 1.6.2
|
289
289
|
signing_key:
|
290
290
|
specification_version: 3
|
291
291
|
summary: Show growl-like flashes and saved user's notices with Gritter
|