cacheable_flash 0.3.2 → 0.3.3
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 +7 -0
- data/.document +5 -5
- data/CHANGELOG +5 -0
- data/LICENSE +23 -23
- data/README.rdoc +21 -5
- data/init.rb +6 -6
- data/install.rb +18 -18
- data/lib/cacheable_flash.rb +7 -5
- data/lib/cacheable_flash/config.rb +3 -1
- data/lib/cacheable_flash/engine.rb +10 -7
- data/lib/cacheable_flash/middleware.rb +6 -22
- data/lib/cacheable_flash/railtie.rb +10 -10
- data/lib/cacheable_flash/rspec_matchers.rb +6 -6
- data/lib/cacheable_flash/test_helpers.rb +1 -1
- data/lib/cacheable_flash/version.rb +3 -3
- data/lib/generators/cacheable_flash/install/install_generator.rb +24 -23
- data/lib/tasks/cacheable-flash_tasks.rake +4 -4
- data/spec/cacheable_flash/cacheable_flash_spec.rb +17 -12
- data/spec/cacheable_flash/install_spec.rb +68 -68
- data/spec/controllers/controller_test_using_test_unit_spec.rb +28 -0
- data/spec/dummy/Rakefile +7 -7
- data/spec/dummy/app/assets/javascripts/application.js +15 -15
- data/spec/dummy/app/assets/stylesheets/application.css +13 -13
- data/spec/dummy/app/controllers/application_controller.rb +3 -3
- data/spec/dummy/app/helpers/application_helper.rb +2 -2
- data/spec/dummy/app/views/layouts/application.html.erb +14 -14
- data/spec/dummy/config.ru +4 -4
- data/spec/dummy/config/application.rb +62 -62
- data/spec/dummy/config/boot.rb +9 -9
- data/spec/dummy/config/database.yml +25 -25
- data/spec/dummy/config/environment.rb +5 -5
- data/spec/dummy/config/environments/development.rb +39 -39
- data/spec/dummy/config/environments/production.rb +67 -67
- data/spec/dummy/config/environments/test.rb +39 -39
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -7
- data/spec/dummy/config/initializers/inflections.rb +15 -15
- data/spec/dummy/config/initializers/mime_types.rb +5 -5
- data/spec/dummy/config/initializers/secret_token.rb +7 -7
- data/spec/dummy/config/initializers/session_store.rb +8 -8
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -14
- data/spec/dummy/config/locales/en.yml +5 -5
- data/spec/dummy/public/404.html +26 -26
- data/spec/dummy/public/422.html +26 -26
- data/spec/dummy/public/500.html +25 -25
- data/spec/dummy/script/rails +6 -6
- data/spec/js_unit/cookie_test.html +60 -60
- data/spec/js_unit/flash_test.html +112 -112
- data/tasks/cacheable_flash_tasks.rake +3 -3
- data/vendor/assets/javascripts/{flash.js → flash.js.erb} +2 -2
- data/vendor/assets/javascripts/jquery.cookie.js +47 -47
- metadata +29 -49
@@ -1,4 +1,4 @@
|
|
1
|
-
# desc "Explaining what the task does"
|
2
|
-
# task :cacheable_flash do
|
3
|
-
# # Task goes here
|
1
|
+
# desc "Explaining what the task does"
|
2
|
+
# task :cacheable_flash do
|
3
|
+
# # Task goes here
|
4
4
|
# end
|
@@ -7,12 +7,12 @@ Flash.transferFromCookies = function() {
|
|
7
7
|
var data = JSON.parse(unescape($.cookie("flash")));
|
8
8
|
if(!data) data = {};
|
9
9
|
Flash.data = data;
|
10
|
-
$.cookie('flash',null, {path: '/'});
|
10
|
+
$.cookie('flash', null, {path: '/', domain: '<%=CacheableFlash::Config.config[:domain]%>'});
|
11
11
|
};
|
12
12
|
|
13
13
|
Flash.writeDataTo = function(name, element, callback) {
|
14
14
|
element = $(element);
|
15
|
-
var
|
15
|
+
var message = "";
|
16
16
|
if (Flash.data[name]) {
|
17
17
|
message = Flash.data[name].toString().replace(/\+/g, ' ');
|
18
18
|
element.html(message);
|
@@ -1,47 +1,47 @@
|
|
1
|
-
/*!
|
2
|
-
* jQuery Cookie Plugin
|
3
|
-
* https://github.com/carhartl/jquery-cookie
|
4
|
-
*
|
5
|
-
* Copyright 2011, Klaus Hartl
|
6
|
-
* Dual licensed under the MIT or GPL Version 2 licenses.
|
7
|
-
* http://www.opensource.org/licenses/mit-license.php
|
8
|
-
* http://www.opensource.org/licenses/GPL-2.0
|
9
|
-
*/
|
10
|
-
(function($) {
|
11
|
-
$.cookie = function(key, value, options) {
|
12
|
-
|
13
|
-
// key and at least value given, set cookie...
|
14
|
-
if (arguments.length > 1 && (!/Object/.test(Object.prototype.toString.call(value)) || value === null || value === undefined)) {
|
15
|
-
options = $.extend({}, options);
|
16
|
-
|
17
|
-
if (value === null || value === undefined) {
|
18
|
-
options.expires = -1;
|
19
|
-
}
|
20
|
-
|
21
|
-
if (typeof options.expires === 'number') {
|
22
|
-
var days = options.expires, t = options.expires = new Date();
|
23
|
-
t.setDate(t.getDate() + days);
|
24
|
-
}
|
25
|
-
|
26
|
-
value = String(value);
|
27
|
-
|
28
|
-
return (document.cookie = [
|
29
|
-
encodeURIComponent(key), '=', options.raw ? value : encodeURIComponent(value),
|
30
|
-
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
|
31
|
-
options.path ? '; path=' + options.path : '',
|
32
|
-
options.domain ? '; domain=' + options.domain : '',
|
33
|
-
options.secure ? '; secure' : ''
|
34
|
-
].join(''));
|
35
|
-
}
|
36
|
-
|
37
|
-
// key and possibly options given, get cookie...
|
38
|
-
options = value || {};
|
39
|
-
var decode = options.raw ? function(s) { return s; } : decodeURIComponent;
|
40
|
-
|
41
|
-
var pairs = document.cookie.split('; ');
|
42
|
-
for (var i = 0, pair; pair = pairs[i] && pairs[i].split('='); i++) {
|
43
|
-
if (decode(pair[0]) === key) return decode(pair[1] || ''); // IE saves cookies with empty string as "c; ", e.g. without "=" as opposed to EOMB, thus pair[1] may be undefined
|
44
|
-
}
|
45
|
-
return null;
|
46
|
-
};
|
47
|
-
})(jQuery);
|
1
|
+
/*!
|
2
|
+
* jQuery Cookie Plugin
|
3
|
+
* https://github.com/carhartl/jquery-cookie
|
4
|
+
*
|
5
|
+
* Copyright 2011, Klaus Hartl
|
6
|
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
7
|
+
* http://www.opensource.org/licenses/mit-license.php
|
8
|
+
* http://www.opensource.org/licenses/GPL-2.0
|
9
|
+
*/
|
10
|
+
(function($) {
|
11
|
+
$.cookie = function(key, value, options) {
|
12
|
+
|
13
|
+
// key and at least value given, set cookie...
|
14
|
+
if (arguments.length > 1 && (!/Object/.test(Object.prototype.toString.call(value)) || value === null || value === undefined)) {
|
15
|
+
options = $.extend({}, options);
|
16
|
+
|
17
|
+
if (value === null || value === undefined) {
|
18
|
+
options.expires = -1;
|
19
|
+
}
|
20
|
+
|
21
|
+
if (typeof options.expires === 'number') {
|
22
|
+
var days = options.expires, t = options.expires = new Date();
|
23
|
+
t.setDate(t.getDate() + days);
|
24
|
+
}
|
25
|
+
|
26
|
+
value = String(value);
|
27
|
+
|
28
|
+
return (document.cookie = [
|
29
|
+
encodeURIComponent(key), '=', options.raw ? value : encodeURIComponent(value),
|
30
|
+
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
|
31
|
+
options.path ? '; path=' + options.path : '',
|
32
|
+
options.domain ? '; domain=' + options.domain : '',
|
33
|
+
options.secure ? '; secure' : ''
|
34
|
+
].join(''));
|
35
|
+
}
|
36
|
+
|
37
|
+
// key and possibly options given, get cookie...
|
38
|
+
options = value || {};
|
39
|
+
var decode = options.raw ? function(s) { return s; } : decodeURIComponent;
|
40
|
+
|
41
|
+
var pairs = document.cookie.split('; ');
|
42
|
+
for (var i = 0, pair; pair = pairs[i] && pairs[i].split('='); i++) {
|
43
|
+
if (decode(pair[0]) === key) return decode(pair[1] || ''); // IE saves cookies with empty string as "c; ", e.g. without "=" as opposed to EOMB, thus pair[1] may be undefined
|
44
|
+
}
|
45
|
+
return null;
|
46
|
+
};
|
47
|
+
})(jQuery);
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cacheable_flash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
5
|
-
prerelease:
|
4
|
+
version: 0.3.3
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Peter H. Boling
|
@@ -10,44 +9,39 @@ authors:
|
|
10
9
|
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date:
|
12
|
+
date: 2013-09-13 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: stackable_flash
|
17
16
|
requirement: !ruby/object:Gem::Requirement
|
18
|
-
none: false
|
19
17
|
requirements:
|
20
|
-
- -
|
18
|
+
- - '>='
|
21
19
|
- !ruby/object:Gem::Version
|
22
20
|
version: 0.0.7
|
23
21
|
type: :runtime
|
24
22
|
prerelease: false
|
25
23
|
version_requirements: !ruby/object:Gem::Requirement
|
26
|
-
none: false
|
27
24
|
requirements:
|
28
|
-
- -
|
25
|
+
- - '>='
|
29
26
|
- !ruby/object:Gem::Version
|
30
27
|
version: 0.0.7
|
31
28
|
- !ruby/object:Gem::Dependency
|
32
29
|
name: json
|
33
30
|
requirement: !ruby/object:Gem::Requirement
|
34
|
-
none: false
|
35
31
|
requirements:
|
36
|
-
- -
|
32
|
+
- - '>='
|
37
33
|
- !ruby/object:Gem::Version
|
38
34
|
version: '0'
|
39
35
|
type: :runtime
|
40
36
|
prerelease: false
|
41
37
|
version_requirements: !ruby/object:Gem::Requirement
|
42
|
-
none: false
|
43
38
|
requirements:
|
44
|
-
- -
|
39
|
+
- - '>='
|
45
40
|
- !ruby/object:Gem::Version
|
46
41
|
version: '0'
|
47
42
|
- !ruby/object:Gem::Dependency
|
48
43
|
name: rails
|
49
44
|
requirement: !ruby/object:Gem::Requirement
|
50
|
-
none: false
|
51
45
|
requirements:
|
52
46
|
- - ~>
|
53
47
|
- !ruby/object:Gem::Version
|
@@ -55,7 +49,6 @@ dependencies:
|
|
55
49
|
type: :development
|
56
50
|
prerelease: false
|
57
51
|
version_requirements: !ruby/object:Gem::Requirement
|
58
|
-
none: false
|
59
52
|
requirements:
|
60
53
|
- - ~>
|
61
54
|
- !ruby/object:Gem::Version
|
@@ -63,106 +56,92 @@ dependencies:
|
|
63
56
|
- !ruby/object:Gem::Dependency
|
64
57
|
name: jquery-rails
|
65
58
|
requirement: !ruby/object:Gem::Requirement
|
66
|
-
none: false
|
67
59
|
requirements:
|
68
|
-
- -
|
60
|
+
- - '>='
|
69
61
|
- !ruby/object:Gem::Version
|
70
62
|
version: '0'
|
71
63
|
type: :development
|
72
64
|
prerelease: false
|
73
65
|
version_requirements: !ruby/object:Gem::Requirement
|
74
|
-
none: false
|
75
66
|
requirements:
|
76
|
-
- -
|
67
|
+
- - '>='
|
77
68
|
- !ruby/object:Gem::Version
|
78
69
|
version: '0'
|
79
70
|
- !ruby/object:Gem::Dependency
|
80
71
|
name: rspec-rails
|
81
72
|
requirement: !ruby/object:Gem::Requirement
|
82
|
-
none: false
|
83
73
|
requirements:
|
84
|
-
- -
|
74
|
+
- - '>='
|
85
75
|
- !ruby/object:Gem::Version
|
86
76
|
version: 2.11.0
|
87
77
|
type: :development
|
88
78
|
prerelease: false
|
89
79
|
version_requirements: !ruby/object:Gem::Requirement
|
90
|
-
none: false
|
91
80
|
requirements:
|
92
|
-
- -
|
81
|
+
- - '>='
|
93
82
|
- !ruby/object:Gem::Version
|
94
83
|
version: 2.11.0
|
95
84
|
- !ruby/object:Gem::Dependency
|
96
85
|
name: rdoc
|
97
86
|
requirement: !ruby/object:Gem::Requirement
|
98
|
-
none: false
|
99
87
|
requirements:
|
100
|
-
- -
|
88
|
+
- - '>='
|
101
89
|
- !ruby/object:Gem::Version
|
102
90
|
version: '3.12'
|
103
91
|
type: :development
|
104
92
|
prerelease: false
|
105
93
|
version_requirements: !ruby/object:Gem::Requirement
|
106
|
-
none: false
|
107
94
|
requirements:
|
108
|
-
- -
|
95
|
+
- - '>='
|
109
96
|
- !ruby/object:Gem::Version
|
110
97
|
version: '3.12'
|
111
98
|
- !ruby/object:Gem::Dependency
|
112
99
|
name: reek
|
113
100
|
requirement: !ruby/object:Gem::Requirement
|
114
|
-
none: false
|
115
101
|
requirements:
|
116
|
-
- -
|
102
|
+
- - '>='
|
117
103
|
- !ruby/object:Gem::Version
|
118
104
|
version: 1.2.8
|
119
105
|
type: :development
|
120
106
|
prerelease: false
|
121
107
|
version_requirements: !ruby/object:Gem::Requirement
|
122
|
-
none: false
|
123
108
|
requirements:
|
124
|
-
- -
|
109
|
+
- - '>='
|
125
110
|
- !ruby/object:Gem::Version
|
126
111
|
version: 1.2.8
|
127
112
|
- !ruby/object:Gem::Dependency
|
128
113
|
name: roodi
|
129
114
|
requirement: !ruby/object:Gem::Requirement
|
130
|
-
none: false
|
131
115
|
requirements:
|
132
|
-
- -
|
116
|
+
- - '>='
|
133
117
|
- !ruby/object:Gem::Version
|
134
118
|
version: 2.1.0
|
135
119
|
type: :development
|
136
120
|
prerelease: false
|
137
121
|
version_requirements: !ruby/object:Gem::Requirement
|
138
|
-
none: false
|
139
122
|
requirements:
|
140
|
-
- -
|
123
|
+
- - '>='
|
141
124
|
- !ruby/object:Gem::Version
|
142
125
|
version: 2.1.0
|
143
126
|
- !ruby/object:Gem::Dependency
|
144
127
|
name: rake
|
145
128
|
requirement: !ruby/object:Gem::Requirement
|
146
|
-
none: false
|
147
129
|
requirements:
|
148
|
-
- -
|
130
|
+
- - '>='
|
149
131
|
- !ruby/object:Gem::Version
|
150
132
|
version: '0'
|
151
133
|
type: :development
|
152
134
|
prerelease: false
|
153
135
|
version_requirements: !ruby/object:Gem::Requirement
|
154
|
-
none: false
|
155
136
|
requirements:
|
156
|
-
- -
|
137
|
+
- - '>='
|
157
138
|
- !ruby/object:Gem::Version
|
158
139
|
version: '0'
|
159
|
-
description:
|
160
|
-
|
140
|
+
description: |-
|
141
|
+
Allows caching of pages with flash messages by rendering flash
|
161
142
|
messages from a cookie using JavaScript, instead of statically in your Rails
|
162
|
-
|
163
143
|
view template. Flash contents are converted to JSON and placed in
|
164
|
-
|
165
|
-
a cookie by an after_filter (default) or a Rack Middleware (option).'
|
144
|
+
a cookie by an after_filter (default) or a Rack Middleware (option).
|
166
145
|
email: peter.boling@gmail.com
|
167
146
|
executables: []
|
168
147
|
extensions: []
|
@@ -196,6 +175,7 @@ files:
|
|
196
175
|
- spec/cacheable_flash/install_spec.rb
|
197
176
|
- spec/cacheable_flash/test_helpers_spec.rb
|
198
177
|
- spec/controllers/comparison_cotroller_spec.rb
|
178
|
+
- spec/controllers/controller_test_using_test_unit_spec.rb
|
199
179
|
- spec/controllers/dummy_controller_spec.rb
|
200
180
|
- spec/dummy/Rakefile
|
201
181
|
- spec/dummy/app/assets/javascripts/application.js
|
@@ -238,32 +218,31 @@ files:
|
|
238
218
|
- spec/requests/integration_spec.rb
|
239
219
|
- spec/spec_helper.rb
|
240
220
|
- tasks/cacheable_flash_tasks.rake
|
241
|
-
- vendor/assets/javascripts/flash.js
|
221
|
+
- vendor/assets/javascripts/flash.js.erb
|
242
222
|
- vendor/assets/javascripts/jquery.cookie.js
|
243
223
|
homepage: http://github.com/pivotal/cacheable-flash
|
244
224
|
licenses:
|
245
225
|
- MIT
|
226
|
+
metadata: {}
|
246
227
|
post_install_message:
|
247
228
|
rdoc_options: []
|
248
229
|
require_paths:
|
249
230
|
- lib
|
250
231
|
required_ruby_version: !ruby/object:Gem::Requirement
|
251
|
-
none: false
|
252
232
|
requirements:
|
253
|
-
- -
|
233
|
+
- - '>='
|
254
234
|
- !ruby/object:Gem::Version
|
255
235
|
version: '0'
|
256
236
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
257
|
-
none: false
|
258
237
|
requirements:
|
259
|
-
- -
|
238
|
+
- - '>='
|
260
239
|
- !ruby/object:Gem::Version
|
261
240
|
version: '0'
|
262
241
|
requirements: []
|
263
242
|
rubyforge_project:
|
264
|
-
rubygems_version:
|
243
|
+
rubygems_version: 2.0.3
|
265
244
|
signing_key:
|
266
|
-
specification_version:
|
245
|
+
specification_version: 4
|
267
246
|
summary: Render flash messages from a cookie using JavaScript, instead of in your
|
268
247
|
Rails view template
|
269
248
|
test_files:
|
@@ -271,6 +250,7 @@ test_files:
|
|
271
250
|
- spec/cacheable_flash/install_spec.rb
|
272
251
|
- spec/cacheable_flash/test_helpers_spec.rb
|
273
252
|
- spec/controllers/comparison_cotroller_spec.rb
|
253
|
+
- spec/controllers/controller_test_using_test_unit_spec.rb
|
274
254
|
- spec/controllers/dummy_controller_spec.rb
|
275
255
|
- spec/dummy/Rakefile
|
276
256
|
- spec/dummy/app/assets/javascripts/application.js
|