show_message 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -25,7 +25,8 @@ Add this code where you want your error messages to be shown.
25
25
  <%= show_message %>
26
26
  ```
27
27
 
28
- Set a message in your controller.
28
+ Set a message in your controller. You can use :error, :success, :myCoolMessage or :whatever. You get the point.
29
+ The only thing you should not use is and "_". Read on to see why.
29
30
 
30
31
  ```ruby
31
32
  class MyController
@@ -37,8 +38,30 @@ class MyController
37
38
  end
38
39
  ```
39
40
 
41
+ Now, when using remote forms I came across the issue where I would have multiple show_message helpers on the same page.
42
+ This led to some issues so I added the ability to set an id on show_message
43
+
44
+ ```erb
45
+ <%= show_message(id: :create_object) %>
46
+ ```
47
+
48
+ There is a slight twist to setting the flash now. I use an "_" to find what I call "scoped" messages.
49
+
50
+ ```ruby
51
+ class MyController
52
+
53
+ def test_function
54
+ flash[:error_create_object] = "Some Error Message"
55
+ end
56
+
57
+ end
58
+ ```
59
+
40
60
  ## Contributing
41
61
 
62
+ If anyone has any suggestions on a better way to do the "scoped" messages or anything for that matter,
63
+ feel free to submit a pull request.
64
+
42
65
  1. Fork it
43
66
  2. Create your feature branch (`git checkout -b my-new-feature`)
44
67
  3. Commit your changes (`git commit -am 'Add some feature'`)
@@ -5,4 +5,4 @@
5
5
  </div>
6
6
  </div>
7
7
  <% end %>
8
- <div style="margin-top:#{options[:space]}px;"></div>
8
+ <div style="margin-top:<%= options[:space] %>px;"></div>
@@ -1,3 +1,3 @@
1
1
  module ShowMessage
2
- VERSION = [0, 0, 2].join "."
2
+ VERSION = [0, 0, 3].join "."
3
3
  end
@@ -5,7 +5,6 @@ module ShowMessage
5
5
 
6
6
  scope = options[:id]
7
7
 
8
-
9
8
  if scope.present?
10
9
  flash_is_empty = false
11
10
  flash.keys.each do |k|
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.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: