show_message 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +28 -4
- data/app/views/show_message/_show_message.html.erb +1 -1
- data/lib/show_message/version.rb +1 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# ShowMessage
|
2
2
|
|
3
3
|
[![Build Status](https://travis-ci.org/jclusso/show_message.png?branch=master)](https://travis-ci.org/jclusso/show_message)
|
4
|
-
[![Code Climate](https://codeclimate.com/
|
4
|
+
[![Code Climate](https://codeclimate.com/github/jclusso/show_message.png)](https://codeclimate.com/github/jclusso/show_message)
|
5
5
|
|
6
6
|
## Installation
|
7
7
|
|
@@ -19,20 +19,24 @@ Or install it yourself as:
|
|
19
19
|
|
20
20
|
## Usage
|
21
21
|
|
22
|
-
Add this code where you want your
|
22
|
+
Add this code where you want your messages to be shown. You will need to create some styles for the message box.
|
23
|
+
See further down for the HTML this outputs so you know how to style it.
|
23
24
|
|
24
25
|
```erb
|
25
26
|
<%= show_message %>
|
26
27
|
```
|
27
28
|
|
28
|
-
|
29
|
+
Now, set a message in your controller. You can use :error, :success, :myCoolMessage or :whatever. You get the point.
|
29
30
|
The only thing you should not use is and "_". Read on to see why.
|
30
31
|
|
32
|
+
Also, it you can set a single message as a String or multiple as an Array
|
33
|
+
|
31
34
|
```ruby
|
32
35
|
class MyController
|
33
36
|
|
34
37
|
def test_function
|
35
|
-
flash[:
|
38
|
+
flash[:success] = "Some Success Message"
|
39
|
+
flash[:error] = ["Error Message 1", "Error Message 2"]
|
36
40
|
end
|
37
41
|
|
38
42
|
end
|
@@ -57,6 +61,26 @@ class MyController
|
|
57
61
|
end
|
58
62
|
```
|
59
63
|
|
64
|
+
Lastly, I found the need to insert a margin below the message sometimes.
|
65
|
+
|
66
|
+
```erb
|
67
|
+
<%= show_message(space: 10) %>
|
68
|
+
<!-- will insert a 10px margin below -->
|
69
|
+
```
|
70
|
+
|
71
|
+
## show_message - HTML Output
|
72
|
+
|
73
|
+
Below is HTML that show_message will output. You will need to create a few styles to make yours look nice.
|
74
|
+
I left it free of styles since I was using Zurb Foundation. I also figured most people would want to style their own anyway.
|
75
|
+
|
76
|
+
```html
|
77
|
+
<div class="alert-box [the flash symbol will be here to]">
|
78
|
+
<div class="message">
|
79
|
+
Message gets outputed here.
|
80
|
+
</div>
|
81
|
+
</div>
|
82
|
+
```
|
83
|
+
|
60
84
|
## Contributing
|
61
85
|
|
62
86
|
If anyone has any suggestions on a better way to do the "scoped" messages or anything for that matter,
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<% data.each do |m| %>
|
2
|
-
<div class="alert-box <%= m[:class] %>" style= "<%= (m != data.last) ? "margin-bottom:5px;" : "" %>">
|
2
|
+
<div class="alert-box <%= m[:class] %> <%= options[:class] %>" style= "<%= (m != data.last) ? "margin-bottom:5px;" : "" %>">
|
3
3
|
<div class="message">
|
4
4
|
<%= raw m[:message] %>
|
5
5
|
</div>
|
data/lib/show_message/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: show_message
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-08-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|