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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 46cbbbe48bc7958f15aded22f185be127b0b88ea
|
4
|
+
data.tar.gz: 85b1020570c215a6f4bde307c13c98428da51259
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
8
|
-
|
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
|
-
#
|
17
|
-
|
18
|
-
|
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("×",
|
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
|
data/lib/poodle/version.rb
CHANGED