flash-messenger 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +5 -1
- data/app/assets/javascripts/flash-messenger.js +0 -11
- data/lib/flash-messenger/helper.rb +3 -1
- data/lib/flash-messenger/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bcfd920b84f707bce9d2d51578983cebcf15c210
|
4
|
+
data.tar.gz: f0b39dd188271b89bade6d08d333b3efce49e5e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94bb6c964708591831ec07ecd49f57fb09237136d0b4cd742db199c9fca98c5df2ead173a132d58f9ea9c81c1ec83c42f03ba4bc8e6f396e7945349175197876
|
7
|
+
data.tar.gz: 49f4ed67bbbc73fe46bbae8d9eb3a2aef66c68b565dfc6d9b10d94ce52fd26579480300573b6489222c1a570175b770d56f56118aa981912ae93f0a8f3886b5e
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -32,7 +32,9 @@ Add the following to /app/assets/javascripts/application.js:
|
|
32
32
|
### Require CSS
|
33
33
|
Add the following to /app/assets/stylesheets/application.css:
|
34
34
|
```
|
35
|
+
/*
|
35
36
|
*= require flash-messenger
|
37
|
+
*/
|
36
38
|
```
|
37
39
|
|
38
40
|
### Render
|
@@ -59,7 +61,7 @@ flash_error('Error!')
|
|
59
61
|
```
|
60
62
|
You can also use it to show model errors:
|
61
63
|
```ruby
|
62
|
-
flash_model_error(
|
64
|
+
flash_model_error(model)
|
63
65
|
```
|
64
66
|
|
65
67
|
### Bootstrap
|
@@ -69,7 +71,9 @@ If you want to use bootstrap style, add the following to js file:
|
|
69
71
|
```
|
70
72
|
Add the following to css file:
|
71
73
|
```
|
74
|
+
/*
|
72
75
|
*= require flash-messenger-bootstrap
|
76
|
+
*/
|
73
77
|
```
|
74
78
|
|
75
79
|
### Turboboost
|
@@ -15,15 +15,4 @@
|
|
15
15
|
};
|
16
16
|
$(document).on('ready page:load', show);
|
17
17
|
};
|
18
|
-
|
19
|
-
window.flash.modelError = function (errors, options) {
|
20
|
-
options = options || {};
|
21
|
-
options.type = 'error';
|
22
|
-
for (var key in errors) {
|
23
|
-
var messages = errors[key];
|
24
|
-
messages.forEach(function (message) {
|
25
|
-
flash(key + ' ' + message, options);
|
26
|
-
});
|
27
|
-
}
|
28
|
-
};
|
29
18
|
})(jQuery);
|
@@ -20,7 +20,9 @@ module FlashMessenger
|
|
20
20
|
|
21
21
|
def flash_model_error(errors, options = nil)
|
22
22
|
errors = errors.errors if errors.is_a? ActiveRecord::Base
|
23
|
-
|
23
|
+
errors.full_messages.to_a.each do |message|
|
24
|
+
push_flash(message, options, 'error')
|
25
|
+
end
|
24
26
|
end
|
25
27
|
|
26
28
|
def flash_messenger
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flash-messenger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chen, Yi-Cyuan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: request_store
|