bootstrap_builders 0.0.15 → 0.0.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/bootstrap_builders.scss +2 -1
- data/app/assets/stylesheets/bootstrap_builders/bb-progress-bar.scss +10 -0
- data/app/helpers/bootstrap_builders/application_helper.rb +6 -12
- data/lib/bootstrap_builders.rb +1 -0
- data/lib/bootstrap_builders/attribute_rows.rb +1 -1
- data/lib/bootstrap_builders/panel.rb +19 -1
- data/lib/bootstrap_builders/progress_bar.rb +35 -0
- data/lib/bootstrap_builders/tabs.rb +1 -1
- data/lib/bootstrap_builders/version.rb +1 -1
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4cea9f9ce171e693d5b8b7abec3af1487f690940
|
4
|
+
data.tar.gz: 401cf5ce394a7ca92a5bbceafb14acee0c41586b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e21fcde535f048f3f1c4fac6b60b2c03739baa405099396fd8e18531e5b63fa98ffe97e357befdfebf4c38338076e5e68eb491c53acb6dabd458634a7f344105
|
7
|
+
data.tar.gz: f7758ca1c4f2c095fafffafb838f0c6ccf306ded35f32ed171a06aaafc917f726047c3c90915b6d5410ec10af6f4e1ad98603dcbaae4c7940d1c2555a71228d7
|
@@ -1 +1,2 @@
|
|
1
|
-
|
1
|
+
@import "bootstrap_builders/bb-btn-responsive";
|
2
|
+
@import "bootstrap_builders/bb-progress-bar";
|
@@ -4,19 +4,13 @@ module BootstrapBuilders::ApplicationHelper
|
|
4
4
|
end
|
5
5
|
|
6
6
|
def bb_panel(*opts, &blk)
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
args = opts.first
|
12
|
-
title = args.fetch(:title) if args.key?(:title)
|
13
|
-
width = args[:width] if args.key?(:width)
|
14
|
-
right = args[:right] if args.key?(:right)
|
15
|
-
else
|
16
|
-
args = {}
|
17
|
-
end
|
7
|
+
panel = BootstrapBuilders::Panel.with_parsed_args(*opts, &blk)
|
8
|
+
panel.context = self
|
9
|
+
panel.html
|
10
|
+
end
|
18
11
|
|
19
|
-
|
12
|
+
def bb_progress_bar(*opts)
|
13
|
+
BootstrapBuilders::ProgressBar.with_parsed_args(*opts)
|
20
14
|
end
|
21
15
|
|
22
16
|
def bb_btn(*args)
|
data/lib/bootstrap_builders.rb
CHANGED
@@ -9,7 +9,7 @@ class BootstrapBuilders::AttributeRows
|
|
9
9
|
elements = []
|
10
10
|
|
11
11
|
@attributes.each do |attribute|
|
12
|
-
tr = HtmlGen::Element.new(:tr,
|
12
|
+
tr = HtmlGen::Element.new(:tr, classes: ["bb-attributes-row", "bb-attributes-row-#{attribute}"])
|
13
13
|
tr.add_ele(:th, classes: ["bb-attributes-row-title"], str: @model.class.human_attribute_name(attribute))
|
14
14
|
|
15
15
|
if column_type(attribute) == :boolean
|
@@ -1,10 +1,28 @@
|
|
1
1
|
class BootstrapBuilders::Panel
|
2
|
+
attr_accessor :context
|
3
|
+
|
4
|
+
def self.with_parsed_args(*opts, &blk)
|
5
|
+
title = opts.shift unless opts.first.is_a?(Hash)
|
6
|
+
width = opts.shift unless opts.first.is_a?(Hash)
|
7
|
+
|
8
|
+
if opts.length == 1 && opts.first.is_a?(Hash)
|
9
|
+
args = opts.first
|
10
|
+
title = args.fetch(:title) if args.key?(:title)
|
11
|
+
width = args[:width] if args.key?(:width)
|
12
|
+
right = args[:right] if args.key?(:right)
|
13
|
+
else
|
14
|
+
args = {}
|
15
|
+
end
|
16
|
+
|
17
|
+
BootstrapBuilders::Panel.new(args.merge(title: title, width: width, right: right, block: blk))
|
18
|
+
end
|
19
|
+
|
2
20
|
def initialize(args)
|
3
21
|
@title = args.fetch(:title)
|
4
22
|
@controls = args[:controls]
|
5
23
|
@table = args[:table]
|
6
24
|
@block = args.fetch(:block)
|
7
|
-
@context = args
|
25
|
+
@context = args[:context]
|
8
26
|
@class = args[:class]
|
9
27
|
@data = args[:data]
|
10
28
|
|
@@ -0,0 +1,35 @@
|
|
1
|
+
class BootstrapBuilders::ProgressBar
|
2
|
+
def self.with_parsed_args(*opts)
|
3
|
+
percent = opts.shift if opts.first.is_a?(Integer) || opts.first.is_a?(Float) || opts.first.is_a?(Fixnum)
|
4
|
+
|
5
|
+
args_parser = BootstrapBuilders::ArgumentsParser.new(
|
6
|
+
arguments: opts,
|
7
|
+
short_true_arguments: []
|
8
|
+
)
|
9
|
+
|
10
|
+
BootstrapBuilders::ProgressBar.new({percent: percent}.merge(args_parser.arguments_hash)).html
|
11
|
+
end
|
12
|
+
|
13
|
+
def initialize(args)
|
14
|
+
@percent = args.fetch(:percent)
|
15
|
+
end
|
16
|
+
|
17
|
+
def html
|
18
|
+
progress = HtmlGen::Element.new(:div, classes: ["bb-progress-bar", "progress"])
|
19
|
+
|
20
|
+
progress.add_ele(
|
21
|
+
:div,
|
22
|
+
classes: ["progress-bar"],
|
23
|
+
attr: {
|
24
|
+
"aria-valuenow" => @percent.to_i,
|
25
|
+
"aria-valuemin" => 0,
|
26
|
+
"aria-valuemax" => 100,
|
27
|
+
role: "progressbar",
|
28
|
+
style: "width: #{@percent}%;"
|
29
|
+
}
|
30
|
+
)
|
31
|
+
|
32
|
+
progress.add_ele(:div, classes: ["bb-progress-bar-label"], str: "#{@percent.to_i}%")
|
33
|
+
progress.html
|
34
|
+
end
|
35
|
+
end
|
@@ -21,7 +21,7 @@ class BootstrapBuilders::Tabs
|
|
21
21
|
def to_html
|
22
22
|
set_default_first_active
|
23
23
|
|
24
|
-
container = HtmlGen::Element.new(:div,
|
24
|
+
container = HtmlGen::Element.new(:div, classes: ["bb-tabs-container"])
|
25
25
|
ul = container.add_ele(:ul, classes: nav_classes)
|
26
26
|
container.add_ele(:div, classes: ["clearfix"])
|
27
27
|
|
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.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kaspernj
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.0.
|
33
|
+
version: 0.0.13
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.0.
|
40
|
+
version: 0.0.13
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: devise
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -238,6 +238,7 @@ files:
|
|
238
238
|
- app/assets/javascripts/bootstrap_builders/view-port-detection.coffee
|
239
239
|
- app/assets/stylesheets/bootstrap_builders.scss
|
240
240
|
- app/assets/stylesheets/bootstrap_builders/bb-btn-responsive.scss
|
241
|
+
- app/assets/stylesheets/bootstrap_builders/bb-progress-bar.scss
|
241
242
|
- app/controllers/bootstrap_builders/application_controller.rb
|
242
243
|
- app/helpers/bootstrap_builders/application_helper.rb
|
243
244
|
- app/views/layouts/bootstrap_builders/application.html.erb
|
@@ -253,6 +254,7 @@ files:
|
|
253
254
|
- lib/bootstrap_builders/flash.rb
|
254
255
|
- lib/bootstrap_builders/is_a_checker.rb
|
255
256
|
- lib/bootstrap_builders/panel.rb
|
257
|
+
- lib/bootstrap_builders/progress_bar.rb
|
256
258
|
- lib/bootstrap_builders/tab.rb
|
257
259
|
- lib/bootstrap_builders/table.rb
|
258
260
|
- lib/bootstrap_builders/tabs.rb
|