bootstrap_2_helpers 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc4938e203f45de7b2525fe72cf2f42554db7397
|
4
|
+
data.tar.gz: ee20eb6cdb7af95604a6520b7d267b7ebe156912
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dab565ead0e62ae0e6fed97368509db826e530823007ab4986c6a8c17e278e653859ade93a1b134a7184736b4fd00301a2fc18c64a748c4760d0930054b079db
|
7
|
+
data.tar.gz: dcc203c98183b826313e1232fd952afaea02283c8645e263db10709f0c072ae6d94e4c8c571fb3a715aa36f2807901684cb39bdf7385c5c8e7a6bd596c501618
|
@@ -1,15 +1,16 @@
|
|
1
|
-
module BootstrapFlashHelper
|
1
|
+
module BootstrapFlashHelper
|
2
|
+
AVALIABLE_TYPES = %i(info success warning danger)
|
2
3
|
def bootstrap_flash
|
3
4
|
flash_messages = []
|
4
5
|
flash.each do |type, message|
|
5
6
|
# Skip Devise :timeout and :timedout flags
|
6
7
|
next if type == :timeout
|
7
8
|
next if type == :timedout
|
8
|
-
type = :
|
9
|
-
|
9
|
+
type = :error if type == :danger
|
10
|
+
use_type = AVALIABLE_TYPES.include?(type) ? type : :info
|
10
11
|
text = content_tag(:div,
|
11
12
|
content_tag(:button, raw("×"), :class => "close", "data-dismiss" => "alert") +
|
12
|
-
message, :class => "alert fade in alert-#{
|
13
|
+
message, :class => "alert fade in alert-#{use_type}")
|
13
14
|
flash_messages << text if message
|
14
15
|
end
|
15
16
|
flash_messages.join("\n").html_safe
|
@@ -1,5 +1,4 @@
|
|
1
1
|
module FlashBlockHelper
|
2
|
-
AVAIABLE_TYPES = %w[info success warning danger]
|
3
2
|
def flash_block
|
4
3
|
output = ''
|
5
4
|
flash.each do |type, message|
|
@@ -10,7 +9,6 @@ module FlashBlockHelper
|
|
10
9
|
end
|
11
10
|
|
12
11
|
def flash_container(type, message)
|
13
|
-
use_type = AVAIABLE_TYPES.include?(type.to_s) ? type : 'info'
|
14
12
|
raw(content_tag(:div, :class => "alert alert-#{use_type}") do
|
15
13
|
content_tag(:a, raw("×"),:class => 'close', :data => {:dismiss => 'alert'}) +
|
16
14
|
message
|