gritter 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +12 -7
- data/{vendor → app}/assets/images/error.png +0 -0
- data/{vendor → app}/assets/images/gritter-close.png +0 -0
- data/{vendor → app}/assets/images/gritter.png +0 -0
- data/{vendor → app}/assets/images/ie-spacer.gif +0 -0
- data/{vendor → app}/assets/images/notice.png +0 -0
- data/{vendor → app}/assets/images/progress.gif +0 -0
- data/{vendor → app}/assets/images/success.png +0 -0
- data/{vendor → app}/assets/images/warning.png +0 -0
- data/{vendor → app}/assets/javascripts/gritter.js +24 -3
- data/{vendor → app}/assets/stylesheets/gritter.css.scss +6 -6
- data/gritter.gemspec +2 -2
- data/lib/gritter/helpers.rb +3 -1
- data/lib/gritter/railtie.rb +1 -0
- data/lib/gritter/version.rb +1 -1
- metadata +15 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54551106ba744c1616af221540c32425cad73c52
|
4
|
+
data.tar.gz: 2626b99d7700a1238e8592c815507c93a14ee69f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b1bc25056d1afe902436d82e2a014ba91425c9c46416936a234b224334b47652d7cc7a1434e71d9b7f7bf37bb42b1c308a2e2b5e827d269802fda9b3d5748053
|
7
|
+
data.tar.gz: 32aee095cae9c5453cf874a57cb171774252a4d8228f933679b4fed56f8e3ea95c5fb4702feb1a7d067f396427f24404bf8efb151629ff54593fb3c3a3421bef
|
data/README.md
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
# gritter
|
2
2
|
|
3
|
-
version 1.
|
3
|
+
version 1.2.0
|
4
4
|
Robin Brouwer
|
5
|
-
montblanc
|
6
5
|
|
7
6
|
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/).
|
8
7
|
|
@@ -16,7 +15,7 @@ Also check out that branch, because the newer version of gritter inside this gem
|
|
16
15
|
|
17
16
|
You can use this gem by putting the following inside your Gemfile:
|
18
17
|
|
19
|
-
gem "gritter", "1.
|
18
|
+
gem "gritter", "1.2.0"
|
20
19
|
|
21
20
|
Now generate the locale for gritter:
|
22
21
|
|
@@ -34,9 +33,14 @@ And that's it!
|
|
34
33
|
|
35
34
|
## Changes
|
36
35
|
|
36
|
+
Version 1.2.0 changes (02/08/2015):
|
37
|
+
|
38
|
+
- Added Rails 4 support.
|
39
|
+
- Added on_click support.
|
40
|
+
|
37
41
|
Version 1.1.0 changes (31/01/2013):
|
38
42
|
|
39
|
-
- All gflash messages
|
43
|
+
- All gflash messages can also be stored in the Rails flash messages (optional).
|
40
44
|
- Added i18n interpolation for gflash messages.
|
41
45
|
- Added default values for the gflash messages.
|
42
46
|
- Fixed several other issues.
|
@@ -111,6 +115,7 @@ There are many more arguments you can pass to the helper:
|
|
111
115
|
:class_name => "gritter" # => Allows you to set a different classname.
|
112
116
|
:before_open => "alert('Opening!');" # => Execute javascript before opening.
|
113
117
|
:after_open => "alert('Opened!');" # => Execute javascript after opening.
|
118
|
+
:on_click => "alert('Clicked!');" # => Execute javascript on click (close button click is ignored).
|
114
119
|
:before_close => "alert('Closing!');" # => Execute javascript before closing.
|
115
120
|
:after_close => "alert('Closed!');" # => Execute javascript after closing.
|
116
121
|
:nodom_wrap => true # => Removes the DOM wrap on the produced JQuery code. Default, this argument
|
@@ -275,7 +280,7 @@ Here you can set the locales for all your gflash messages and the titles. It wor
|
|
275
280
|
progress: "Progress"
|
276
281
|
products: # => Controller name
|
277
282
|
create: # => Action name
|
278
|
-
notice: "Custom notice message"
|
283
|
+
notice: "Custom notice message"case
|
279
284
|
|
280
285
|
It's also possible to add default gflash messages.
|
281
286
|
|
@@ -331,7 +336,7 @@ def create
|
|
331
336
|
render :new
|
332
337
|
end
|
333
338
|
end
|
334
|
-
```
|
339
|
+
```
|
335
340
|
|
336
341
|
You can also use gflash directly inside the `redirect_to` method.
|
337
342
|
|
@@ -438,4 +443,4 @@ Many thanks to Jordan Boesch, creator of the AWESOME jQuery plugin gritter.
|
|
438
443
|
http://boedesign.com/blog/2009/07/11/growl-for-jquery-gritter/
|
439
444
|
|
440
445
|
Also special thanks to Liam McKay for creating the awesome icons!
|
441
|
-
http://wefunction.com/2008/07/function-free-icon-set/
|
446
|
+
http://wefunction.com/2008/07/function-free-icon-set/
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -10,7 +10,7 @@
|
|
10
10
|
*/
|
11
11
|
|
12
12
|
// Modernizr for CSS3 support check.
|
13
|
-
window.
|
13
|
+
window.GritterModernizr = function (a, b, c) {
|
14
14
|
function A(a, b) {
|
15
15
|
var c = a.charAt(0).toUpperCase() + a.substr(1),
|
16
16
|
d = (a + " " + m.join(c + " ") + c).split(" ");
|
@@ -127,7 +127,7 @@ window.Modernizr = function (a, b, c) {
|
|
127
127
|
*/
|
128
128
|
var gritter_item;
|
129
129
|
var gritter_content = '[[close]][[image]]<div class="[[class_name]]"><span class="gritter-title">[[username]]</span><p>[[text]]</p></div><div style="clear:both"></div>';
|
130
|
-
if(
|
130
|
+
if(GritterModernizr.borderradius && GritterModernizr.rgba) {
|
131
131
|
gritter_item = '<div class="gritter-item gritter-css3">'+ gritter_content +'</div>';
|
132
132
|
} else {
|
133
133
|
gritter_item = '<div class="gritter-top"></div><div class="gritter-item gritter-css2">'+ gritter_content +'</div><div class="gritter-bottom"></div>';
|
@@ -186,7 +186,7 @@ window.Modernizr = function (a, b, c) {
|
|
186
186
|
tmp = this._tpl_item;
|
187
187
|
|
188
188
|
// Assign callbacks
|
189
|
-
$(['before_open', 'after_open', 'before_close', 'after_close']).each(function(i, val){
|
189
|
+
$(['before_open', 'after_open', 'before_close', 'after_close', 'on_click']).each(function(i, val){
|
190
190
|
Gritter['_' + val + '_' + number] = ($.isFunction(params[val])) ? params[val] : function(){}
|
191
191
|
});
|
192
192
|
|
@@ -219,6 +219,27 @@ window.Modernizr = function (a, b, c) {
|
|
219
219
|
if(!sticky){
|
220
220
|
this._setFadeTimer(item, number);
|
221
221
|
}
|
222
|
+
|
223
|
+
// Add on_click listener
|
224
|
+
$(item).click(function(){
|
225
|
+
Gritter['_' + 'on_click' + '_' + number]($(this));
|
226
|
+
});
|
227
|
+
|
228
|
+
/**
|
229
|
+
* In order to avoid conflicts between on_click and before/after_close
|
230
|
+
* Disable on_click event when hover over close button
|
231
|
+
* Enable on_click event on mouse leave
|
232
|
+
*/
|
233
|
+
$(item).find('.gritter-close').bind('mouseenter mouseleave', function(event){
|
234
|
+
if(event.type == 'mouseenter'){
|
235
|
+
$(item).off("click");
|
236
|
+
}
|
237
|
+
else {
|
238
|
+
$(item).on("click",function(){
|
239
|
+
Gritter['_' + 'on_click' + '_' + number]($(this));
|
240
|
+
});
|
241
|
+
}
|
242
|
+
});
|
222
243
|
|
223
244
|
// Bind the hover/unhover states
|
224
245
|
$(item).bind('mouseenter mouseleave', function(event){
|
@@ -28,18 +28,18 @@
|
|
28
28
|
.gritter-item-wrapper {
|
29
29
|
position:relative;
|
30
30
|
margin:0 0 10px 0;
|
31
|
-
background:url(
|
31
|
+
background:url(asset-url('ie-spacer.gif')); // ie7/8 fix
|
32
32
|
}
|
33
33
|
|
34
34
|
.gritter-top {
|
35
|
-
background:url(
|
35
|
+
background:url(asset-url('gritter.png')) no-repeat left -30px;
|
36
36
|
height:10px;
|
37
37
|
}
|
38
38
|
.hover .gritter-top {
|
39
39
|
background-position:right -30px;
|
40
40
|
}
|
41
41
|
.gritter-bottom {
|
42
|
-
background:url(
|
42
|
+
background:url(asset-url('gritter.png')) no-repeat left bottom;
|
43
43
|
height:8px;
|
44
44
|
margin:0;
|
45
45
|
}
|
@@ -56,7 +56,7 @@
|
|
56
56
|
filter:inherit; // ie8 fix
|
57
57
|
|
58
58
|
&.gritter-css2 {
|
59
|
-
background:url(
|
59
|
+
background:url(asset-url('gritter.png')) no-repeat left -40px;
|
60
60
|
}
|
61
61
|
&.gritter-css3 {
|
62
62
|
background:rgba(0, 0, 0, 0.8);
|
@@ -91,10 +91,10 @@
|
|
91
91
|
filter:inherit; // ie8 fix
|
92
92
|
}
|
93
93
|
.gritter-css2 .gritter-close {
|
94
|
-
background:url(
|
94
|
+
background:url(asset-url('gritter.png')) no-repeat left top;
|
95
95
|
}
|
96
96
|
.gritter-css3 .gritter-close {
|
97
|
-
background:url(
|
97
|
+
background:url(asset-url('gritter-close.png')) no-repeat;
|
98
98
|
}
|
99
99
|
|
100
100
|
.gritter-title {
|
data/gritter.gemspec
CHANGED
@@ -7,8 +7,8 @@ Gem::Specification.new do |s|
|
|
7
7
|
s.version = Gritter::VERSION
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
9
|
s.authors = ["Robin Brouwer"]
|
10
|
-
s.email = ["robin@
|
11
|
-
s.homepage = "http://www.
|
10
|
+
s.email = ["robin@sparkforce.nl"]
|
11
|
+
s.homepage = "http://www.sparkforce.nl"
|
12
12
|
s.summary = %q{Growl notifications for your Rails application.}
|
13
13
|
s.description = %q{This Ruby on Rails gem allows you to easily add Growl-like notifications to your application using a jQuery plugin called 'gritter'.}
|
14
14
|
|
data/lib/gritter/helpers.rb
CHANGED
@@ -3,7 +3,7 @@ module Gritter
|
|
3
3
|
def add_gritter text, *args
|
4
4
|
options = args.extract_options!
|
5
5
|
options[:title] = "Notification" if options[:title].blank?
|
6
|
-
options[:image] =
|
6
|
+
options[:image] = image_path("#{options[:image]}#{options[:image].to_s == 'progress' ? '.gif' : '.png'}") if %w(success warning error notice progress).include?(options[:image].to_s)
|
7
7
|
notification = Array.new
|
8
8
|
notification.push("jQuery(function(){") if options[:nodom_wrap].blank?
|
9
9
|
notification.push("jQuery.gritter.add({")
|
@@ -15,6 +15,7 @@ module Gritter
|
|
15
15
|
notification.push("after_open:function(e){#{options[:after_open]}},") if options[:after_open].present?
|
16
16
|
notification.push("before_close:function(e){#{options[:before_close]}},") if options[:before_close].present?
|
17
17
|
notification.push("after_close:function(e){#{options[:after_close]}},") if options[:after_close].present?
|
18
|
+
notification.push("on_click:function(e){#{options[:on_click]}},") if options[:on_click].present?
|
18
19
|
notification.push("title:'#{escape_javascript(options[:title])}',")
|
19
20
|
notification.push("text:'#{escape_javascript(text)}'")
|
20
21
|
notification.push("});")
|
@@ -54,6 +55,7 @@ module Gritter
|
|
54
55
|
titles = gflash_titles(options)
|
55
56
|
flashes = []
|
56
57
|
session[:gflash].each do |key, value|
|
58
|
+
key = key.to_sym
|
57
59
|
value.each do |gflash_value|
|
58
60
|
gritter_options = { :image => key, :title => titles[key], :nodom_wrap => nodom_wrap }
|
59
61
|
if gflash_value.is_a?(Hash)
|
data/lib/gritter/railtie.rb
CHANGED
data/lib/gritter/version.rb
CHANGED
metadata
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gritter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robin Brouwer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-08-02 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: This Ruby on Rails gem allows you to easily add Growl-like notifications
|
14
14
|
to your application using a jQuery plugin called 'gritter'.
|
15
15
|
email:
|
16
|
-
- robin@
|
16
|
+
- robin@sparkforce.nl
|
17
17
|
executables: []
|
18
18
|
extensions: []
|
19
19
|
extra_rdoc_files: []
|
@@ -22,6 +22,16 @@ files:
|
|
22
22
|
- Gemfile
|
23
23
|
- README.md
|
24
24
|
- Rakefile
|
25
|
+
- app/assets/images/error.png
|
26
|
+
- app/assets/images/gritter-close.png
|
27
|
+
- app/assets/images/gritter.png
|
28
|
+
- app/assets/images/ie-spacer.gif
|
29
|
+
- app/assets/images/notice.png
|
30
|
+
- app/assets/images/progress.gif
|
31
|
+
- app/assets/images/success.png
|
32
|
+
- app/assets/images/warning.png
|
33
|
+
- app/assets/javascripts/gritter.js
|
34
|
+
- app/assets/stylesheets/gritter.css.scss
|
25
35
|
- gritter.gemspec
|
26
36
|
- init.rb
|
27
37
|
- lib/generators/gritter/USAGE
|
@@ -33,17 +43,7 @@ files:
|
|
33
43
|
- lib/gritter/helpers.rb
|
34
44
|
- lib/gritter/railtie.rb
|
35
45
|
- lib/gritter/version.rb
|
36
|
-
|
37
|
-
- vendor/assets/images/gritter-close.png
|
38
|
-
- vendor/assets/images/gritter.png
|
39
|
-
- vendor/assets/images/ie-spacer.gif
|
40
|
-
- vendor/assets/images/notice.png
|
41
|
-
- vendor/assets/images/progress.gif
|
42
|
-
- vendor/assets/images/success.png
|
43
|
-
- vendor/assets/images/warning.png
|
44
|
-
- vendor/assets/javascripts/gritter.js
|
45
|
-
- vendor/assets/stylesheets/gritter.css.scss
|
46
|
-
homepage: http://www.montblanc.nl
|
46
|
+
homepage: http://www.sparkforce.nl
|
47
47
|
licenses: []
|
48
48
|
metadata: {}
|
49
49
|
post_install_message:
|
@@ -62,7 +62,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
62
62
|
version: '0'
|
63
63
|
requirements: []
|
64
64
|
rubyforge_project: nowarning
|
65
|
-
rubygems_version: 2.2.
|
65
|
+
rubygems_version: 2.2.2
|
66
66
|
signing_key:
|
67
67
|
specification_version: 4
|
68
68
|
summary: Growl notifications for your Rails application.
|