poodle-rb 0.0.5 → 0.0.6

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 148d0f4cd6fb2c57e9b8e00fa0f2fecc475f333a
4
- data.tar.gz: 29df628f0d01994f956cd73ea4a58b6c9394d418
3
+ metadata.gz: 46cbbbe48bc7958f15aded22f185be127b0b88ea
4
+ data.tar.gz: 85b1020570c215a6f4bde307c13c98428da51259
5
5
  SHA512:
6
- metadata.gz: 805334ef3bc567ec4fe2f93eef62df67a08af93f29f781955c247aaf5a6da2306db769a4d6bf2feca18bdd57d39ed22b1817a7ca1bad971518d96e7197217e98
7
- data.tar.gz: e29766968915d98137d0717eb2b1631e20aa720a1bf0af1e23f4dfec78b26720a01bd7eaeb5b14b7666faca189761c1ac525d9b2abab86e89336b5e7456cf990
6
+ metadata.gz: 7d43379cf0c3b58bb4ecdefdf146920be834818dd6d95324bf773f74cc0a3e1b736ba3a264177da456791d104c267ae859cc368b7a0a1e3b22b38999a9ab552e
7
+ data.tar.gz: f9c86b081919b448fba2c8d77fcdca2bb03e2ee1bc2506a9033809eee599a44b16ffd8124141c2f417e6c3aad21231ef5395d1e98d93f6fb89f3aa699912f5b8
@@ -2,10 +2,13 @@ module Poodle
2
2
  module FlashHelper
3
3
  # This function will set a flash message depending up on the request type (ajax - xml http or direct http)
4
4
  # Example
5
- # set_flash_message("The message has been sent successfully", :success)
5
+ # set_flash_message("The message has been sent successfully", :success, false)
6
6
  # set_flash_message("Permission denied", :error)
7
- def set_flash_message(message, type)
8
- if request.xhr?
7
+ #
8
+ # Difference between flash and flash.now
9
+ # http://trace.adityalesmana.com/2010/10/difference-between-flash-and-flash-now-in-ruby/
10
+ def set_flash_message(message, type, now=true)
11
+ if now
9
12
  flash.now[type] = message
10
13
  else
11
14
  flash[type] = message
@@ -13,9 +16,10 @@ module Poodle
13
16
  end
14
17
 
15
18
  # Example
16
- # message = get_flash_message()
17
- def get_flash_message
18
- if request.xhr?
19
+ # ajax_notice = get_flash_message(true)
20
+ # notice = get_flash_message(false)
21
+ def get_flash_message(now=true)
22
+ if now
19
23
  message = flash.now[:success] || flash.now[:notice] || flash.now[:alert] || flash.now[:error]
20
24
  else
21
25
  message = flash[:success] || flash[:notice] || flash[:alert] || flash[:error]
@@ -27,8 +31,8 @@ module Poodle
27
31
  # <div id="div_flash_message">
28
32
  # <%= flash_message() -%>
29
33
  # </div>
30
- def flash_message
31
- message = get_flash_message
34
+ def flash_message(now=true)
35
+ message = get_flash_message(now)
32
36
  cls_name = "alert-info"
33
37
  cls_name = 'alert-success' if flash.now[:success] || flash[:success]
34
38
  cls_name = 'alert-warning' if flash.now[:alert] || flash[:alert]
@@ -37,7 +41,7 @@ module Poodle
37
41
  message = message.strip if message
38
42
 
39
43
  content_tag(:div, class: "alert #{cls_name} fade in mb-10", "data-alert" => "alert") do
40
- raw(link_to("×",nil, class: "close", "data-dismiss" => "alert") + content_tag(:p, message))
44
+ raw(link_to("×", "#", class: "close", "data-dismiss" => "alert") + content_tag(:p, message))
41
45
  end unless message.blank?
42
46
  end
43
47
  end
@@ -26,7 +26,7 @@
26
26
 
27
27
  <%#* Show flash messages if controller has set any. -%>
28
28
  <div id="div_flash_message">
29
- <%= flash_message() -%>
29
+ <%= flash_message(false) -%>
30
30
  </div>
31
31
 
32
32
  <%#* Page Content Starts here -%>
@@ -20,7 +20,7 @@
20
20
 
21
21
  <%#* Show flash messages if controller has set any. -%>
22
22
  <div id="div_flash_message">
23
- <%= flash_message() -%>
23
+ <%= flash_message(false) -%>
24
24
  </div>
25
25
 
26
26
  <%#* Page Content Starts here -%>
@@ -1,3 +1,3 @@
1
1
  module Poodle
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: poodle-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Krishnaprasad Varma