librails 0.0.3 → 0.0.4
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 +4 -4
- data/app/helpers/librails/application_helper.rb +27 -2
- data/lib/librails/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ed2c88999f831b9e63b2bd2ef1d063b3858aa0a
|
4
|
+
data.tar.gz: 76e81d2a2fa9e24793372699f392339aef746698
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc530fcb53c26f789115b4d66b4cd85fd6e600573452188c001b09bdc987af70a7d3f1cd8a2a5b1d69a5da959d4a4fee4615a697df763e545849b3ea93d656e7
|
7
|
+
data.tar.gz: 28bc49ff306e95ef9f512f2ee69f7122bf21cf3c65b1cf5f70721505219ccc091eaa3d38d37f6b725bf4698f2e023ad89eb6ee04e9823bfe82e675187c9ea3d1
|
@@ -1,7 +1,32 @@
|
|
1
|
+
# coding: utf-8
|
1
2
|
module Librails
|
2
3
|
module ApplicationHelper
|
3
|
-
def
|
4
|
-
"
|
4
|
+
def bootstrap_class_for(flash_type)
|
5
|
+
{ success: "alert-success", error: "alert-danger", alert: "alert-warning", notice: "alert-info" }[flash_type.to_sym] || flash_type.to_s
|
6
|
+
end
|
7
|
+
|
8
|
+
# noinspection RubyUnusedLocalVariable
|
9
|
+
def flash_messages(opts = {})
|
10
|
+
# https://github.com/plataformatec/devise/issues/1777
|
11
|
+
# deviseが:timeoutにtrueをぶちこんでくるのでそれを除外する
|
12
|
+
flash.each do |msg_type, message|
|
13
|
+
next if msg_type == :timedout
|
14
|
+
concat(content_tag(:div, message, class: "alert #{bootstrap_class_for(msg_type)} alert-dismissible", role: 'alert') do
|
15
|
+
concat(content_tag(:button, class: 'close', data: { dismiss: 'alert' }) do
|
16
|
+
concat content_tag(:span, '×'.html_safe, 'aria-hidden' => true)
|
17
|
+
concat content_tag(:span, 'Close', class: 'sr-only')
|
18
|
+
end)
|
19
|
+
concat message
|
20
|
+
end)
|
21
|
+
end
|
22
|
+
nil
|
23
|
+
end
|
24
|
+
|
25
|
+
def ransack_value(params, value_para, mquery_param = 'q')
|
26
|
+
q = params[query_param]
|
27
|
+
return nil unless q
|
28
|
+
return nil unless q.kind_of?(Hash)
|
29
|
+
q[value_param]
|
5
30
|
end
|
6
31
|
end
|
7
32
|
end
|
data/lib/librails/version.rb
CHANGED