kadmin 1.2.1 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/helpers/kadmin/bootstrap_helper.rb +22 -15
- data/lib/kadmin/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f006debe357b9b00018578ed59b5f70abd7062c47aa69ec3fbfb488d6b74bc98
|
4
|
+
data.tar.gz: 8ccabc5103f421e655c5d38a3b4cb8fe8975a515d14d3849c4799ddffe329934
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f16f761cc7292f9206ed15cc3277b9ceda44a733f67fff832f5d06333f90d34af257e569856acb6d7b804092c2d7c55aaff05c209f946671fe1f4ff41a30c9a
|
7
|
+
data.tar.gz: cfa6a82c8999d89b3056a818a55977afd970f4a1e609041f1abbe28cbd86ae849b458408d9dc6b4260b4119458b3be330c4cc5168a32e5f786c3d4a6adfba4bf
|
@@ -44,33 +44,40 @@ module Kadmin
|
|
44
44
|
end
|
45
45
|
|
46
46
|
# Custom label generator using bootstrap i.e. * for mendatory feilds, help icon and popover for help
|
47
|
-
# @param [String]
|
48
|
-
# @param [
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
47
|
+
# @param [String] key identifier for the help label / input field
|
48
|
+
# @param [Hash] options options for the help label
|
49
|
+
def create_custom_label(key, options = {})
|
50
|
+
defaults = {
|
51
|
+
label_for: "#{key}",
|
52
|
+
required: false,
|
53
|
+
display_help: true,
|
54
|
+
title: ".#{key}.title",
|
55
|
+
message: ".#{key}.message",
|
56
|
+
label_class: 'control-label',
|
57
|
+
data_placement: 'top'
|
58
|
+
}
|
59
|
+
options = defaults.merge(options)
|
60
|
+
|
61
|
+
label = t(".#{key}.label")
|
56
62
|
label = label.html_safe
|
57
63
|
|
58
|
-
require_html = required ? '<span class="required-field"><span>' : ''
|
64
|
+
require_html = options[:required] ? '<span class="required-field"><span>' : ''
|
59
65
|
icon_html = "<i class='fa fa-question-circle' style='color:green'></i>"
|
60
66
|
|
61
67
|
display_message = ''
|
62
|
-
if display_help
|
63
|
-
message = t(message)
|
68
|
+
if options[:display_help]
|
69
|
+
message = t(options[:message])
|
64
70
|
message = message.gsub('"', '\"')
|
65
71
|
message = message.gsub("'", "\'")
|
66
72
|
html_message = message.html_safe
|
67
73
|
|
68
|
-
title = t(title)
|
74
|
+
title = t(options[:title])
|
69
75
|
title = title.html_safe
|
70
|
-
|
76
|
+
|
77
|
+
display_message = "<span data-toggle='popover' title='#{title}' data-placement='#{options[:data_placement]}' data-trigger='hover' data-content='#{html_message}'>#{icon_html}</span>"
|
71
78
|
end
|
72
79
|
|
73
|
-
return "<label for='#{label_for}' class='#{label_class}'
|
80
|
+
return "<label for='#{options[:label_for]}' class='#{options[:label_class]}'>#{require_html}#{label} #{display_message}</label>".html_safe
|
74
81
|
end
|
75
82
|
end
|
76
83
|
end
|
data/lib/kadmin/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kadmin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nicolas Pepin-Perreault
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2020-02-28 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|