unobtrusive_flash 0.0.1 → 0.0.2
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.
- data/generators/unobtrusive_flash/unobtrusive_flash_generator.rb +1 -1
- data/init.rb +2 -0
- data/rails/init.rb +1 -1
- metadata +8 -48
@@ -8,7 +8,7 @@ class UnobtrusiveFlashGenerator < Rails::Generator::Base
|
|
8
8
|
m.template 'unobtrusive_flash.css', File.join('public', 'stylesheets', 'unobtrusive_flash.css')
|
9
9
|
|
10
10
|
m.directory File.join('public', 'javascripts')
|
11
|
-
m.template 'unobtrusive_flash.js', File.join('public', '
|
11
|
+
m.template 'unobtrusive_flash.js', File.join('public', 'javascripts', 'unobtrusive_flash.js')
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
data/init.rb
ADDED
data/rails/init.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
require File.expand_path(File.join(File.dirname(__FILE__), "..", "init"))
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), "..", "init.rb"))
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unobtrusive_flash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Leonid Shevtsov
|
@@ -20,50 +20,9 @@ default_executable:
|
|
20
20
|
dependencies: []
|
21
21
|
|
22
22
|
description: |
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
Ever got tired of writing custom code to handle flash messages passed in AJAX responses?
|
28
|
-
|
29
|
-
Here comes the solution.
|
30
|
-
|
31
|
-
`unobtrusive_flash` takes your flash messages for the backend and automagically passes them to the frontend via
|
32
|
-
HTTP cookies. This works with both regular page loads and AJAX requests, does not tamper with the page body and requires
|
33
|
-
about 3 extra lines of code in your app - how's that for unobtrusive?
|
34
|
-
|
35
|
-
You can pass up to 4K of text into flash this way, and you don't need to worry about cookie size since they are
|
36
|
-
cleared immediately upon rendering.
|
37
|
-
|
38
|
-
Tested and fully functional in:
|
39
|
-
|
40
|
-
* Internet Explorer 8
|
41
|
-
* Firefox 4b7
|
42
|
-
* Chrome 7
|
43
|
-
* Safari 5
|
44
|
-
* Opera 10.6
|
45
|
-
* *please let me know if it works in firefox 3 and ie 6, 7*
|
46
|
-
|
47
|
-
## Requirements
|
48
|
-
|
49
|
-
* Rails 2.3 or 3
|
50
|
-
* jQuery (maybe I'll make it agnostic in the future)
|
51
|
-
|
52
|
-
## Usage
|
53
|
-
|
54
|
-
1. Add the gem to your Rails app.
|
55
|
-
2. Run `script/generate unobtrusive_flash` or `rails g unobtrusive_flash:install`
|
56
|
-
3. Add the following to the controllers that generate flash messages (or better, to the `ApplicationController`):
|
57
|
-
|
58
|
-
after_filter :prepare_unobtrusive_flash
|
59
|
-
|
60
|
-
4. Include `unobtrusive_flash.css` and `unobtrusive_flash.js` in your layouts. No custom markup is needed.
|
61
|
-
5. Remove existing flash rendering code from your layouts.
|
62
|
-
6. That's all! You can also edit the generated CSS/JS to your liking.
|
63
|
-
|
64
|
-
* * *
|
65
|
-
|
66
|
-
© 2010 Leonid Shevtsov, released under the MIT license
|
23
|
+
unobtrusive_flash takes your flash messages for the backend and automagically passes them to the frontend via HTTP cookies.
|
24
|
+
This works with both regular page loads and AJAX requests, does not tamper with the page body and requires about 3 extra
|
25
|
+
lines of code in your app - how's that for unobtrusive?
|
67
26
|
|
68
27
|
email: leonid@shevtsov.me
|
69
28
|
executables: []
|
@@ -80,6 +39,7 @@ files:
|
|
80
39
|
- lib/unobtrusive_flash/railtie.rb
|
81
40
|
- generators/unobtrusive_flash/unobtrusive_flash_generator.rb
|
82
41
|
- rails/init.rb
|
42
|
+
- init.rb
|
83
43
|
- README.markdown
|
84
44
|
has_rdoc: true
|
85
45
|
homepage: http://github.com/leonid-shevtsov/unobtrusive_flash
|
@@ -114,6 +74,6 @@ rubyforge_project:
|
|
114
74
|
rubygems_version: 1.3.7
|
115
75
|
signing_key:
|
116
76
|
specification_version: 3
|
117
|
-
summary: Unobtrusive flash messages for
|
77
|
+
summary: Unobtrusive flash messages for Rails
|
118
78
|
test_files: []
|
119
79
|
|