gritter 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -4
- data/README.md +353 -300
- data/lib/gritter/helpers.rb +3 -2
- data/lib/gritter/version.rb +2 -2
- metadata +4 -4
data/.gitignore
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
.DS_Store
|
2
|
-
gritter*.gem
|
3
|
-
.bundle
|
4
|
-
pkg
|
1
|
+
.DS_Store
|
2
|
+
gritter*.gem
|
3
|
+
.bundle
|
4
|
+
pkg
|
5
|
+
.project
|
data/README.md
CHANGED
@@ -1,301 +1,354 @@
|
|
1
|
-
# gritter
|
2
|
-
|
3
|
-
version 1.0.
|
4
|
-
Robin Brouwer
|
5
|
-
Daniël Zwijnenburg
|
6
|
-
45north
|
7
|
-
|
8
|
-
This Ruby on Rails gem allows you to easily add Growl-like notifications to your application using a jQuery plugin called 'gritter'. [Check out the demo for this plugin](http://boedesign.com/demos/gritter/).
|
9
|
-
|
10
|
-
## Note
|
11
|
-
|
12
|
-
This is a Rails 3.1 gem. Are you using Rails 3.0 or lower? Check out [the 'old' branch on Github](https://github.com/RobinBrouwer/gritter/tree/old). Want support for IE6?
|
13
|
-
Also check out that branch, because the newer version of gritter inside this gem dropped support for it.
|
14
|
-
|
15
|
-
|
16
|
-
## Installation
|
17
|
-
|
18
|
-
You can use this gem by putting the following inside your Gemfile:
|
19
|
-
|
20
|
-
gem "gritter", "1.0.
|
21
|
-
|
22
|
-
Now generate the locale for gritter:
|
23
|
-
|
24
|
-
rails g gritter:locale
|
25
|
-
|
26
|
-
Add the following to `/app/assets/javascripts/application.js`:
|
27
|
-
|
28
|
-
//= require gritter
|
29
|
-
|
30
|
-
And the following to `/app/assets/stylesheets/application.css`:
|
31
|
-
|
32
|
-
*= require gritter
|
33
|
-
|
34
|
-
And that's it!
|
35
|
-
|
36
|
-
## Changes
|
37
|
-
|
38
|
-
Version 1.0.
|
39
|
-
|
40
|
-
-
|
41
|
-
|
42
|
-
Version 1.0.
|
43
|
-
|
44
|
-
-
|
45
|
-
|
46
|
-
Version 1.0.
|
47
|
-
|
48
|
-
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
-
|
53
|
-
-
|
54
|
-
-
|
55
|
-
-
|
56
|
-
-
|
57
|
-
-
|
58
|
-
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
:
|
95
|
-
:
|
96
|
-
:
|
97
|
-
:
|
98
|
-
:
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
:
|
103
|
-
:
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
:time =>
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
The :
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
:
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
end
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
1
|
+
# gritter
|
2
|
+
|
3
|
+
version 1.0.3
|
4
|
+
Robin Brouwer
|
5
|
+
Daniël Zwijnenburg
|
6
|
+
45north
|
7
|
+
|
8
|
+
This Ruby on Rails gem allows you to easily add Growl-like notifications to your application using a jQuery plugin called 'gritter'. [Check out the demo for this plugin](http://boedesign.com/demos/gritter/).
|
9
|
+
|
10
|
+
## Note
|
11
|
+
|
12
|
+
This is a Rails 3.1 gem. Are you using Rails 3.0 or lower? Check out [the 'old' branch on Github](https://github.com/RobinBrouwer/gritter/tree/old). Want support for IE6?
|
13
|
+
Also check out that branch, because the newer version of gritter inside this gem dropped support for it.
|
14
|
+
|
15
|
+
|
16
|
+
## Installation
|
17
|
+
|
18
|
+
You can use this gem by putting the following inside your Gemfile:
|
19
|
+
|
20
|
+
gem "gritter", "1.0.3"
|
21
|
+
|
22
|
+
Now generate the locale for gritter:
|
23
|
+
|
24
|
+
rails g gritter:locale
|
25
|
+
|
26
|
+
Add the following to `/app/assets/javascripts/application.js`:
|
27
|
+
|
28
|
+
//= require gritter
|
29
|
+
|
30
|
+
And the following to `/app/assets/stylesheets/application.css`:
|
31
|
+
|
32
|
+
*= require gritter
|
33
|
+
|
34
|
+
And that's it!
|
35
|
+
|
36
|
+
## Changes
|
37
|
+
|
38
|
+
Version 1.0.3 changes (26/01/2013):
|
39
|
+
|
40
|
+
- :nodom_wrap added by indykish
|
41
|
+
|
42
|
+
Version 1.0.2 changes (03/09/2012):
|
43
|
+
|
44
|
+
- Merged pull request #22 (namespaced controllers gflash fix).
|
45
|
+
|
46
|
+
Version 1.0.1 changes (23/01/2012):
|
47
|
+
|
48
|
+
- Fixed gflash(:js => true) in Ruby 1.9.2 and 1.9.3.
|
49
|
+
|
50
|
+
Version 1.0.0 changes (17/11/2011):
|
51
|
+
|
52
|
+
- Gritter now only works in Rails 3.1. You should check out the 'old' branch for other Rails versions.
|
53
|
+
- Removed everything that isn't needed for Rails 3.1.
|
54
|
+
- Added new version for the gritter jQuery plugin (1.7.1).
|
55
|
+
- Added position option for your gritter messages.
|
56
|
+
- Locale isn't automatically generated. You need to use the gritter:locale generator.
|
57
|
+
- Adding locale-based gflash messages got a bit easier.
|
58
|
+
- You can now use a :gflash option inside the redirect_to method.
|
59
|
+
- Using SCSS image_path instead of ERB image_path inside the CSS.
|
60
|
+
- Added CSS3 support for gritter.
|
61
|
+
- Refactored some parts of the gem.
|
62
|
+
- Changed the README quite a bit.
|
63
|
+
|
64
|
+
|
65
|
+
## Usage
|
66
|
+
|
67
|
+
There are several helpers you can use with gritter. All of them print out Javascript code without script-tags.
|
68
|
+
|
69
|
+
add_gritter
|
70
|
+
remove_gritter
|
71
|
+
extend_gritter
|
72
|
+
|
73
|
+
To add the script-tags we added another function called `js`. It allows you to easily add script-tags around your javascript.
|
74
|
+
It can be used in combination with gritter, but also other Javascript you want to run.
|
75
|
+
|
76
|
+
The most popular feature of this gem is `gflash`. This replaces the regular flash messages in Rails and
|
77
|
+
automatically puts these in gritter boxes. Read further to learn more about gflash.
|
78
|
+
|
79
|
+
|
80
|
+
### add_gritter
|
81
|
+
|
82
|
+
The `add_gritter` helper allows you to add a gritter notification to your application.
|
83
|
+
It outputs Javascript directly into your template. It works like this inside a `js.erb` file:
|
84
|
+
|
85
|
+
<%= add_gritter("This is a notification just for you!") %>
|
86
|
+
|
87
|
+
The `add_gritter` helper allows you to easily set the text for the notification.
|
88
|
+
When you want to change the title, just pass the `:title` argument to the helper:
|
89
|
+
|
90
|
+
<%= add_gritter("This is a notification just for you!", :title => "Please pay attention!") %>
|
91
|
+
|
92
|
+
There are many more arguments you can pass to the helper:
|
93
|
+
|
94
|
+
:title => "This is a title" # => Allows you to set the title for the notification.
|
95
|
+
:image => "/images/rails.png" # => Allows you to add an image to the notification.
|
96
|
+
:sticky => true # => Allows you to make the notification sticky.
|
97
|
+
:time => 4000 # => Allows you to set the time when the notification disappears (in ms).
|
98
|
+
:class_name => "gritter" # => Allows you to set a different classname.
|
99
|
+
:before_open => "alert('Opening!');" # => Execute javascript before opening.
|
100
|
+
:after_open => "alert('Opened!');" # => Execute javascript after opening.
|
101
|
+
:before_close => "alert('Closing!');" # => Execute javascript before closing.
|
102
|
+
:after_close => "alert('Closed!');" # => Execute javascript after closing.
|
103
|
+
:nodom_wrap => true # => Removes the DOM wrap on the produced JQuery code. Default, this argument
|
104
|
+
is false or not present, hence you always get a DOM wrap.
|
105
|
+
|
106
|
+
The `:image` argument also allows you to easily set five different images:
|
107
|
+
|
108
|
+
:success
|
109
|
+
:warning
|
110
|
+
:notice
|
111
|
+
:error
|
112
|
+
:progress
|
113
|
+
|
114
|
+
It works like this in combination with flash[:notice] and the `js` helper:
|
115
|
+
|
116
|
+
<%= js add_gritter(flash[:notice], :image => :notice, :title => "Pay attention!", :sticky => true) %>
|
117
|
+
|
118
|
+
The js helper is almost the same as the javascript_tag helper. The difference is that you can pass several scripts at once.
|
119
|
+
You don't need to pass these scripts as an Array. The helper also adds a linebreak (\n) after each script.
|
120
|
+
|
121
|
+
<%= js add_gritter("See my notification"), add_gritter("Another one") %>
|
122
|
+
|
123
|
+
It puts all the scripts inside a single script-tag.
|
124
|
+
|
125
|
+
And that's it! You just added Growl-like notifications to your Rails application.
|
126
|
+
It's great for all kinds of notifications, including the flash notifications you want to show to your users.
|
127
|
+
|
128
|
+
|
129
|
+
### remove_gritter
|
130
|
+
|
131
|
+
The `remove_gritter` helper removes all gritter notifications from the screen. You can use it inside a `js.erb` file:
|
132
|
+
|
133
|
+
<%= remove_gritter %>
|
134
|
+
|
135
|
+
You can pass two extra arguments to this helper.
|
136
|
+
|
137
|
+
:before_close => "alert('Closing!');" # => Execute javascript before closing.
|
138
|
+
:after_close => "alert('Closed!');" # => Execute javascript after closing.
|
139
|
+
|
140
|
+
You can also use the `js` helper to add script-tags around this helper.
|
141
|
+
|
142
|
+
|
143
|
+
### extend_gritter
|
144
|
+
|
145
|
+
The `extend_gritter` helper allows you to set the default gritter options.
|
146
|
+
|
147
|
+
<%= extend_gritter :time => 1000 %>
|
148
|
+
|
149
|
+
These are the options you can pass to `extend_gritter`:
|
150
|
+
|
151
|
+
:fade_in_speed => "medium" # => Allows you to set the fade-in-speed. Can be String or Integer (in ms).
|
152
|
+
:fade_out_speed => 1000 # => Allows you to set the fade-out-speed. Can be String or Integer (in ms).
|
153
|
+
:time => 8000 # => Allows you to set the time the notification stays. Must be an Integer (in ms).
|
154
|
+
:position => :bottom_left # => Allows you to set the position for all gritter messages.
|
155
|
+
|
156
|
+
The :fade_in_speed and :fade_out_speed options accept the following Strings:
|
157
|
+
|
158
|
+
"slow"
|
159
|
+
"medium"
|
160
|
+
"fast"
|
161
|
+
|
162
|
+
The :position option accepts four different Symbols:
|
163
|
+
|
164
|
+
:top_left
|
165
|
+
:top_right # Default
|
166
|
+
:bottom_left
|
167
|
+
:bottom_right
|
168
|
+
|
169
|
+
You can also use the `js` helper , add_gritter("Another one") to add script-tags around this helper.
|
170
|
+
|
171
|
+
|
172
|
+
### gflash
|
173
|
+
|
174
|
+
The `gflash` helper is a different kind of `flash[:notice]` message. It uses the `add_gritter` helper and the default images used in this plugin.
|
175
|
+
It uses a session to remember the flash messages. Add the following inside your controller action:
|
176
|
+
|
177
|
+
def create
|
178
|
+
gflash :success => "The product has been created successfully!"
|
179
|
+
end
|
180
|
+
|
181
|
+
Now you can add the following to your layout view inside the body-tag:
|
182
|
+
|
183
|
+
<%= gflash %>
|
184
|
+
|
185
|
+
The flash-message will be shown with 'success.png' as the image and 'Success' as the title.
|
186
|
+
To change the title you can add the following to the `gflash` helper inside the layout:
|
187
|
+
|
188
|
+
<%= gflash :success => "It has been successful!" %>
|
189
|
+
|
190
|
+
Now the default title will be overwritten. You can also use gflash inside `js.erb` files:
|
191
|
+
|
192
|
+
<%= gflash :js => true %>
|
193
|
+
|
194
|
+
The :success key isn't the only option supported by gflash. You can use the following gflash options:
|
195
|
+
|
196
|
+
:success
|
197
|
+
:warning
|
198
|
+
:notice
|
199
|
+
:error
|
200
|
+
:progress
|
201
|
+
|
202
|
+
Each uses the corresponding image and title. You can also add multiple gritter notifications at once:
|
203
|
+
|
204
|
+
def create
|
205
|
+
gflash :success => "The product has been created successfully!", :notice => "This product doesn't have a category."
|
206
|
+
end
|
207
|
+
|
208
|
+
Besides passing the exact text inside the controller, gflash also supports locales (both for messages and titles).
|
209
|
+
When you start your server a new locale file will be added to /config/locales called `gflash.en.yml`.
|
210
|
+
Here you can set the locales for all your gflash messages and the titles. It works like this:
|
211
|
+
|
212
|
+
en:
|
213
|
+
gflash:
|
214
|
+
titles:
|
215
|
+
notice: "Custom notice title"
|
216
|
+
success: "Success"
|
217
|
+
warning: "Warning"
|
218
|
+
error: "Error"
|
219
|
+
progress: "Progress"
|
220
|
+
products: # => Controller name
|
221
|
+
create: # => Action name
|
222
|
+
notice: "Custom notice message"
|
223
|
+
|
224
|
+
Now you can do the following inside your Controller:
|
225
|
+
|
226
|
+
def create
|
227
|
+
gflash :notice => true
|
228
|
+
end
|
229
|
+
|
230
|
+
The locales for the `:notice` title and message will now be used. You can still pass a `String` to override a locale.
|
231
|
+
Since gritter version 1.0 you can also do the following to add the gritter messages:
|
232
|
+
|
233
|
+
def create
|
234
|
+
gflash :notice, :success, :error
|
235
|
+
end
|
236
|
+
|
237
|
+
No need to pass `true` to each key.
|
238
|
+
|
239
|
+
You can change the default time, sticky and class_name options for each gritter message.
|
240
|
+
This is done inside the Controller and works like this:
|
241
|
+
|
242
|
+
gflash :success => { :time => 2000, :class_name => "my_class", :sticky => true }
|
243
|
+
gflash :success => { :value => true, :time => 2000, :class_name => "my_class", :sticky => true }
|
244
|
+
gflash :error => { :value => "Custom error", :time => 3000, :class_name => "my_error_class", :sticky => false }
|
245
|
+
|
246
|
+
When you don't pass a `:value` it uses the locale. Same goes for when you pass `true` to `:value`. When you give `:value` a String, that String will be used to display the message. Here's another example:
|
247
|
+
|
248
|
+
def create
|
249
|
+
@user = User.new(params[:user])
|
250
|
+
if @user.save
|
251
|
+
gflash :success => { :value => "Account has been created!", :time => 5000 },
|
252
|
+
:notice => { :value => "You have received an e-mail notification.", :sticky => true }
|
253
|
+
redirect_to :root
|
254
|
+
else
|
255
|
+
gflash :error => { :value => "Something went wrong.", :time => 4000 },
|
256
|
+
:warning => { :value => "Some fields weren't filled in correctly.", :time => 7000 }
|
257
|
+
render :new
|
258
|
+
end
|
259
|
+
end
|
260
|
+
|
261
|
+
You can also use gflash directly inside the `redirect_to` method.
|
262
|
+
|
263
|
+
def create
|
264
|
+
redirect_to @post, :gflash => [:notice, :success]
|
265
|
+
end
|
266
|
+
|
267
|
+
def destroy
|
268
|
+
redirect_to :posts, :gflash => { :warning => "You just deleted something important." }
|
269
|
+
end
|
270
|
+
|
271
|
+
def logged_in?
|
272
|
+
redirect_to :login, :gflash => { :error => { :value => "You are not logged in!", :sticky => true } }
|
273
|
+
end
|
274
|
+
|
275
|
+
And that's how you add gflash to your Rails application!
|
276
|
+
|
277
|
+
|
278
|
+
### Using `nodom_wrap` to change the JQuery code produced
|
279
|
+
|
280
|
+
##### Default. (when nodom_wrap is not present)
|
281
|
+
The `add_gritter` helper produces JQuery code as shown below.
|
282
|
+
|
283
|
+
```ruby
|
284
|
+
<%= add_gritter(:success, "See my notification")%>
|
285
|
+
```
|
286
|
+
|
287
|
+
```js
|
288
|
+
jQuery(function() {
|
289
|
+
jQuery.gritter.add({image:'/assets/success.png',title:'Success',text:'See my notification'})
|
290
|
+
});
|
291
|
+
```
|
292
|
+
|
293
|
+
##### nodom_wrap
|
294
|
+
|
295
|
+
If you don't want to wrap `jQuery.gritter.add({` inside a `jQuery(function()` then include the argument `:nodom_wrap`
|
296
|
+
|
297
|
+
The modified `add_gritter` helper with `nodom_wrap` looks like this:
|
298
|
+
|
299
|
+
```ruby
|
300
|
+
<%= add_gritter(:success, "See my notification", :nodom_wrap => true )%>
|
301
|
+
```
|
302
|
+
|
303
|
+
With `:nodom_wrap` included, the following JQuery code will be produced.
|
304
|
+
|
305
|
+
```js
|
306
|
+
jQuery.gritter.add({
|
307
|
+
image: '/assets/success.png',
|
308
|
+
title: 'Success',
|
309
|
+
text: 'The product has been created successfully!'
|
310
|
+
});
|
311
|
+
```
|
312
|
+
|
313
|
+
The argument can be included in `gflash` helper as well.
|
314
|
+
|
315
|
+
```ruby
|
316
|
+
gflash :success => { :value => "Account has been created!", :time => 5000, :nodom_wrap => true }
|
317
|
+
|
318
|
+
redirect_to signin_path(@user), :gflash =>
|
319
|
+
{ :success => { :value => "Welcome back #{@user.first_name}.
|
320
|
+
Your email #{@user.email} is verified. Thank you.", :sticky => false, :nodom_wrap => true } }
|
321
|
+
```
|
322
|
+
|
323
|
+
|
324
|
+
## Copyright
|
325
|
+
|
326
|
+
Copyright (C) 2010 Robin Brouwer
|
327
|
+
|
328
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
329
|
+
this software and associated documentation files (the "Software"), to deal in
|
330
|
+
the Software without restriction, including without limitation the rights to
|
331
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
332
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
333
|
+
so, subject to the following conditions:
|
334
|
+
|
335
|
+
The above copyright notice and this permission notice shall be included in all
|
336
|
+
copies or substantial portions of the Software.
|
337
|
+
|
338
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
339
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
340
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
341
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
342
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
343
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
344
|
+
SOFTWARE.
|
345
|
+
|
346
|
+
## Special Thanks
|
347
|
+
|
348
|
+
We'd like to express our gratitude to the following people:
|
349
|
+
|
350
|
+
Many thanks to Jordan Boesch, creator of the AWESOME jQuery plugin gritter.
|
351
|
+
http://boedesign.com/blog/2009/07/11/growl-for-jquery-gritter/
|
352
|
+
|
353
|
+
Also special thanks to Liam McKay for creating the awesome icons!
|
301
354
|
http://wefunction.com/2008/07/function-free-icon-set/
|
data/lib/gritter/helpers.rb
CHANGED
@@ -4,7 +4,8 @@ module Gritter
|
|
4
4
|
options = args.extract_options!
|
5
5
|
options[:title] = "Notification" if options[:title].blank?
|
6
6
|
options[:image] = asset_path("#{options[:image]}#{options[:image] == 'progress' ? '.gif' : '.png'}") if %w(success warning error notice progress).include?(options[:image].to_s)
|
7
|
-
notification =
|
7
|
+
notification = Array.new
|
8
|
+
notification.push("jQuery(function(){") if !options[:nodom_wrap].present?
|
8
9
|
notification.push("jQuery.gritter.add({")
|
9
10
|
notification.push("image:'#{options[:image]}',") if options[:image].present?
|
10
11
|
notification.push("sticky:#{options[:sticky]},") if options[:sticky].present?
|
@@ -17,7 +18,7 @@ module Gritter
|
|
17
18
|
notification.push("title:'#{escape_javascript(options[:title])}',")
|
18
19
|
notification.push("text:'#{escape_javascript(text)}'")
|
19
20
|
notification.push("});")
|
20
|
-
notification.push("});")
|
21
|
+
notification.push("});") if !options[:nodom_wrap].present?
|
21
22
|
text.present? ? notification.join.html_safe : nil
|
22
23
|
end
|
23
24
|
|
data/lib/gritter/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
module Gritter
|
2
|
-
VERSION = "1.0.
|
1
|
+
module Gritter
|
2
|
+
VERSION = "1.0.3"
|
3
3
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gritter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 3
|
10
|
+
version: 1.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Robin Brouwer
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date:
|
19
|
+
date: 2013-01-26 00:00:00 +01:00
|
20
20
|
default_executable:
|
21
21
|
dependencies: []
|
22
22
|
|