bootstrap_builders 0.0.19 → 0.0.20
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/lib/bootstrap_builders/panel.rb +15 -6
- data/lib/bootstrap_builders/table.rb +14 -3
- data/lib/bootstrap_builders/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 847d2098593ed2679fee822c22a826ad2ed066a7
|
4
|
+
data.tar.gz: 42246bb0049b56208d8e18a67c206df91c0c6489
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24660413fd2417d55a60c41b026270eb7d4a500f139199cb0da0d075392c27364e422b327eef8d80bdab6b58f3969cbc2e56efabd0212caecc1e14ed983315a4
|
7
|
+
data.tar.gz: 59ec4531ce4e1783fdd423ddcc3878b38cfd194472dc1097e9edd1de69045fe73df651b327fc9949e1ac3b3ebf61b1444eef83987fc762e093b383cccf23333f
|
@@ -37,11 +37,16 @@ class BootstrapBuilders::Panel
|
|
37
37
|
|
38
38
|
def html
|
39
39
|
@panel = HtmlGen::Element.new(:div, inden: " ", classes: container_classes, css: @css, data: @data)
|
40
|
-
|
40
|
+
|
41
|
+
if table?
|
42
|
+
@generated_body = @context.content_tag(:div, nil, class: ["table-responsive"], &@block)
|
43
|
+
else
|
44
|
+
@generated_body = @context.content_tag(:div, nil, class: ["panel-body"], &@block)
|
45
|
+
end
|
41
46
|
|
42
47
|
add_heading if heading?
|
43
48
|
|
44
|
-
if
|
49
|
+
if table?
|
45
50
|
add_table
|
46
51
|
else
|
47
52
|
add_body
|
@@ -89,22 +94,26 @@ private
|
|
89
94
|
@title.present? || controls?
|
90
95
|
end
|
91
96
|
|
92
|
-
def
|
93
|
-
|
97
|
+
def table?
|
98
|
+
@table.present?
|
99
|
+
end
|
94
100
|
|
101
|
+
def add_table
|
95
102
|
bs_classes = BootstrapBuilders.configuration.default_table_classes - [:bordered]
|
96
103
|
|
97
104
|
table_args = {
|
98
105
|
class: "bb-panel-table",
|
99
106
|
bs_classes: bs_classes,
|
100
107
|
context: @context,
|
101
|
-
|
108
|
+
content: @generated_body
|
102
109
|
}
|
103
110
|
|
104
111
|
table_args.merge!(@table) if @table.is_a?(Hash)
|
105
112
|
|
106
113
|
table = BootstrapBuilders::Table.new(table_args)
|
107
|
-
|
114
|
+
|
115
|
+
responsive = @panel.add_ele(:div, classes: ["table-responsive"])
|
116
|
+
responsive.add_html(table.html)
|
108
117
|
end
|
109
118
|
|
110
119
|
def add_body
|
@@ -1,12 +1,23 @@
|
|
1
1
|
class BootstrapBuilders::Table
|
2
2
|
def initialize(args)
|
3
3
|
@args = args
|
4
|
-
|
5
|
-
|
4
|
+
|
5
|
+
if args.key?(:blk)
|
6
|
+
@blk = args.fetch(:blk)
|
7
|
+
else
|
8
|
+
@content = args.fetch(:content)
|
9
|
+
end
|
10
|
+
|
11
|
+
@context = args.fetch(:context)
|
6
12
|
end
|
7
13
|
|
8
14
|
def html
|
9
|
-
|
15
|
+
if @blk
|
16
|
+
buffer = @context.content_tag(:table, attributes, &@blk)
|
17
|
+
else
|
18
|
+
buffer = @context.content_tag(:table, @content, attributes)
|
19
|
+
end
|
20
|
+
|
10
21
|
return buffer unless @args[:responsive]
|
11
22
|
|
12
23
|
@context.content_tag(:div, buffer, class: "table-responsive")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bootstrap_builders
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.20
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kaspernj
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09-
|
11
|
+
date: 2016-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|