librails 0.0.3 → 0.0.4

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: 8ebfc03ac1f2aa9c344261dc06f3c2e8cb2809ca
4
- data.tar.gz: 039b314f73b710f28700073a8a2c68db9aff34ab
3
+ metadata.gz: 1ed2c88999f831b9e63b2bd2ef1d063b3858aa0a
4
+ data.tar.gz: 76e81d2a2fa9e24793372699f392339aef746698
5
5
  SHA512:
6
- metadata.gz: b116912e382f7adb3a0a27cb5de3732d960aba2a4dcea63a042eed5abb2e25baac325e1ba0980b28467c8f30bb9b9cfb25aaa9bc2d125d42f6708bbc8f1148d5
7
- data.tar.gz: fdc48329a657500b01274c7850a9d193fdfce26873917b2271b5ee6217a13af972a28bfcfc1f0a950e3b32f3882e0760c6dd2ce8fb70d0afa555abf1b1a35b4e
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 hello3
4
- "Hello3"
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
@@ -1,3 +1,3 @@
1
1
  module Librails
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: librails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - src