alert_message 1.1.5 → 1.1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +29 -21
- data/alert_message.gemspec +2 -2
- data/lib/alert_message.rb +0 -1
- data/lib/version/version.rb +1 -1
- data/spec/alert_message/alert_message_spec.rb +2 -2
- data/spec/alert_message/version_spec.rb +1 -1
- data/vendor/assets/javascripts/alert_message.coffee +10 -0
- data/vendor/assets/stylesheets/{alert_message.css → alert_message.scss} +0 -0
- metadata +6 -4
- data/vendor/assets/javascripts/alert_message.js +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c8edd001c11ba01273126f11e1db9557db5f975
|
4
|
+
data.tar.gz: 91f82a0a254ce3ed46b9d73f559c705b59a2158d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 016c13f939971f41cfc29b03f4f82efe000cad69f73ba3849d5e03e6e5b821f1c05f9fc6e0753f8a58bb2673e3011055a2a2e70b9084df78ea113fea0700e9d9
|
7
|
+
data.tar.gz: 954a0b5a0aa11e8b15d1f8aa6888bb8fd77c5ec3e696c91810665e11c8144372d8d38e7c9051aa02f44de0dc413a55a0828ce9781464f8c6327d30f821d4230f
|
data/README.md
CHANGED
@@ -8,7 +8,9 @@ This is a simple gem for [alerts messages](http://rubygems.org/gems/alert_messag
|
|
8
8
|
|
9
9
|
Add to your Gemfile:
|
10
10
|
|
11
|
-
|
11
|
+
```ruby
|
12
|
+
gem 'alert_message'
|
13
|
+
```
|
12
14
|
|
13
15
|
Then run:
|
14
16
|
|
@@ -35,17 +37,21 @@ Add in app/views/layouts/application.html.erb
|
|
35
37
|
|
36
38
|
To show your alerts, use:
|
37
39
|
|
38
|
-
|
39
|
-
|
40
|
-
|
40
|
+
```ruby
|
41
|
+
flash[:error] = "YOUR MESSAGE"
|
42
|
+
flash[:notice] = "YOUR MESSAGE"
|
43
|
+
flash[:success] = "YOUR MESSAGE"
|
44
|
+
```
|
41
45
|
|
42
46
|
#### Example
|
43
47
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
48
|
+
```ruby
|
49
|
+
class HomeController < ApplicationController
|
50
|
+
def index
|
51
|
+
flash[:error] = "YOUR MESSAGE"
|
52
|
+
end
|
53
|
+
end
|
54
|
+
```
|
49
55
|
|
50
56
|
## Custom message to Devise
|
51
57
|
|
@@ -57,18 +63,20 @@ Add in your app/views/layouts/_alerts.html.erb
|
|
57
63
|
|
58
64
|
Create helper alert_message_helper.rb
|
59
65
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
66
|
+
```ruby
|
67
|
+
module AlertMessageHelper
|
68
|
+
def show_messages
|
69
|
+
return "" if resource.errors.empty?
|
70
|
+
messages = resource.errors.full_messages
|
71
|
+
html = <<-HTML
|
72
|
+
<div class="alert alert-danger">
|
73
|
+
#{messages.first}
|
74
|
+
</div>
|
75
|
+
HTML
|
76
|
+
html.html_safe
|
77
|
+
end
|
78
|
+
end
|
79
|
+
```
|
72
80
|
|
73
81
|
## Demo
|
74
82
|
|
data/alert_message.gemspec
CHANGED
@@ -8,8 +8,8 @@ require 'version/version'
|
|
8
8
|
Gem::Specification.new do |s|
|
9
9
|
s.name = "alert_message"
|
10
10
|
s.version = AlertMessage::Version::VERSION
|
11
|
-
s.authors = ["Luiz Picolo"]
|
12
|
-
s.email = ["luizpicolo@gmail.com"]
|
11
|
+
s.authors = ["Luiz Picolo", "Gabriel Medina"]
|
12
|
+
s.email = ["luizpicolo@gmail.com", "gmedina.santos@gmail.com"]
|
13
13
|
s.summary = "Alert Message"
|
14
14
|
s.description = "Simple gem for alerts messages"
|
15
15
|
s.homepage = "https://github.com/luizpicolo/alert_message"
|
data/lib/alert_message.rb
CHANGED
data/lib/version/version.rb
CHANGED
@@ -2,9 +2,9 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe AlertMessage do
|
4
4
|
|
5
|
-
path = '
|
5
|
+
path = 'lib/generators/alert_message/templates/'
|
6
6
|
|
7
7
|
it 'should return true if template exist' do
|
8
|
-
expect(File.exist?("#{path}_alerts.html.erb")).to
|
8
|
+
expect(File.exist?("#{path}_alerts.html.erb")).to be_truthy
|
9
9
|
end
|
10
10
|
end
|
File without changes
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alert_message
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.5
|
4
|
+
version: 1.1.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luiz Picolo
|
8
|
+
- Gabriel Medina
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2016-03-24 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: bundler
|
@@ -61,6 +62,7 @@ dependencies:
|
|
61
62
|
description: Simple gem for alerts messages
|
62
63
|
email:
|
63
64
|
- luizpicolo@gmail.com
|
65
|
+
- gmedina.santos@gmail.com
|
64
66
|
executables: []
|
65
67
|
extensions: []
|
66
68
|
extra_rdoc_files: []
|
@@ -80,8 +82,8 @@ files:
|
|
80
82
|
- spec/alert_message/alert_message_spec.rb
|
81
83
|
- spec/alert_message/version_spec.rb
|
82
84
|
- spec/spec_helper.rb
|
83
|
-
- vendor/assets/javascripts/alert_message.
|
84
|
-
- vendor/assets/stylesheets/alert_message.
|
85
|
+
- vendor/assets/javascripts/alert_message.coffee
|
86
|
+
- vendor/assets/stylesheets/alert_message.scss
|
85
87
|
homepage: https://github.com/luizpicolo/alert_message
|
86
88
|
licenses:
|
87
89
|
- MIT
|