bootstrap_builders 0.0.16 → 0.0.17
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/README.md +7 -1
- data/lib/bootstrap_builders/panel.rb +15 -7
- 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: 86af43be2744904728e7bcf4695eafcb4c735674
|
4
|
+
data.tar.gz: ec12f0941810f4f603d11299d87e2e857e8caafc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74b8839a01f9b473c6296a366e4e4677b68d82a4b82ea31187d18b55ff7e7bfe1252a8a28735b741b540c641cec18f6ae17ce84bfb45d4b36b77ec71d93b3e7e
|
7
|
+
data.tar.gz: 34cb7316f6a42ee7a591cedfcdf229fd7b1b82b98b0210264b687481586eaf4b77defa25cf2ff9e02e2132ccd7d3f8cd374d7534d805842891114af37626d4a8
|
data/README.md
CHANGED
@@ -33,7 +33,13 @@ Then add to your `application.css`:
|
|
33
33
|
3. Table if `:table` argument is given
|
34
34
|
|
35
35
|
```haml
|
36
|
-
= bb_panel "Title of panel",
|
36
|
+
= bb_panel "Title of panel", controls: button_content do
|
37
|
+
Content of panel
|
38
|
+
```
|
39
|
+
|
40
|
+
```haml
|
41
|
+
= bb_panel "Title of panel", controls: button_content do |panel|
|
42
|
+
- panel.controls << bb_btn("#", "Another button", :mini)
|
37
43
|
Content of panel
|
38
44
|
```
|
39
45
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
class BootstrapBuilders::Panel
|
2
|
-
attr_accessor :context
|
2
|
+
attr_accessor :context, :controls
|
3
3
|
|
4
4
|
def self.with_parsed_args(*opts, &blk)
|
5
5
|
title = opts.shift unless opts.first.is_a?(Hash)
|
@@ -19,15 +19,20 @@ class BootstrapBuilders::Panel
|
|
19
19
|
|
20
20
|
def initialize(args)
|
21
21
|
@title = args.fetch(:title)
|
22
|
-
@controls = args[:controls]
|
23
22
|
@table = args[:table]
|
24
|
-
@block = args.fetch(:block)
|
25
23
|
@context = args[:context]
|
26
24
|
@class = args[:class]
|
27
25
|
@data = args[:data]
|
28
26
|
|
27
|
+
@controls = args[:controls]
|
28
|
+
@controls = [@controls] unless @controls.is_a?(Array)
|
29
|
+
|
29
30
|
@css = {}
|
30
31
|
@css[:width] = args.fetch(:width) if args[:width]
|
32
|
+
|
33
|
+
@block = proc do
|
34
|
+
args.fetch(:block).call(self)
|
35
|
+
end
|
31
36
|
end
|
32
37
|
|
33
38
|
def html
|
@@ -41,6 +46,7 @@ class BootstrapBuilders::Panel
|
|
41
46
|
add_body
|
42
47
|
end
|
43
48
|
|
49
|
+
add_heading_controls
|
44
50
|
html = @panel.html
|
45
51
|
|
46
52
|
if html.respond_to?(:html_safe)
|
@@ -53,15 +59,17 @@ class BootstrapBuilders::Panel
|
|
53
59
|
private
|
54
60
|
|
55
61
|
def add_heading
|
56
|
-
heading = @panel.add_ele(:div, classes: ["panel-heading", "clearfix"])
|
62
|
+
@heading = @panel.add_ele(:div, classes: ["panel-heading", "clearfix"])
|
57
63
|
|
58
64
|
if !@title || @title.to_s.strip.empty?
|
59
|
-
heading.add_ele(:div, classes: ["panel-title", "pull-left"], str_html: " ") if @controls
|
65
|
+
@heading.add_ele(:div, classes: ["panel-title", "pull-left"], str_html: " ") if @controls
|
60
66
|
else
|
61
|
-
heading.add_ele(:div, classes: ["panel-title", "pull-left"], str: @title)
|
67
|
+
@heading.add_ele(:div, classes: ["panel-title", "pull-left"], str: @title)
|
62
68
|
end
|
69
|
+
end
|
63
70
|
|
64
|
-
|
71
|
+
def add_heading_controls
|
72
|
+
@heading.add_ele(:div, classes: ["pull-right"], str_html: controls_content) if @controls
|
65
73
|
end
|
66
74
|
|
67
75
|
def controls_content
|
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.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kaspernj
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-09-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|