boot_wheel 0.0.1 → 0.0.2
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/examples/demo.rb +13 -0
- data/examples/index.html +33 -0
- data/lib/boot_wheel/internals/action_pack.rb +17 -0
- data/lib/boot_wheel/internals/component.rb +11 -0
- data/lib/boot_wheel/internals/renderer.rb +57 -0
- data/lib/boot_wheel/offroad.rb +4 -0
- data/lib/boot_wheel/page.rb +13 -0
- data/lib/boot_wheel/rugged.rb +7 -0
- data/lib/boot_wheel/table.rb +36 -0
- data/lib/boot_wheel.rb +12 -0
- metadata +19 -10
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: aaa8efe1573e9573c9b712808db9797d6e554844ef60927172493cc2262674bc
|
|
4
|
+
data.tar.gz: 46c33af21bd55892eac2d0212407a763bd4424497e6e5d13b865f741d30be218
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cf4c5157d8022f23e34a30871ace2e361ba3bb40abd7fce4e477f9d0398f263c893a5672d7cde325bebbf9d32fe2ed9734507be1174b6c29ed415d0fc33748a1
|
|
7
|
+
data.tar.gz: c7609522dc4ff12e012c9f6ae8e4bcb9626efc8451a0eac4108ef1208492f305a56512119f7d913375d769262a6ca39d6f1f0c69906360b612e8bba15412c1cb
|
data/examples/demo.rb
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
require_relative "../lib/boot_wheel/rugged"
|
|
2
|
+
|
|
3
|
+
TEMPLATE = <<~ERB
|
|
4
|
+
<%= BootWheel.page do %>
|
|
5
|
+
<%= BootWheel.table(
|
|
6
|
+
fields: [ { label: "AAA", key: :a }, { label: "BBB", key: :b } ],
|
|
7
|
+
items: [{ :a => 1, :b => 2}, { :c => 3, :d => 4}],
|
|
8
|
+
table_class: ["w-50"]
|
|
9
|
+
) %>
|
|
10
|
+
<% end %>
|
|
11
|
+
ERB
|
|
12
|
+
|
|
13
|
+
puts BootWheel.renderer.render(:inline => TEMPLATE)
|
data/examples/index.html
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
+
<title>Bootstrap demo</title>
|
|
7
|
+
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div class="container">
|
|
11
|
+
<table class="table w-50">
|
|
12
|
+
<thead>
|
|
13
|
+
<tr>
|
|
14
|
+
<th scope="col">AAA</th>
|
|
15
|
+
<th scope="col">BBB</th>
|
|
16
|
+
</tr>
|
|
17
|
+
</thead>
|
|
18
|
+
<tbody>
|
|
19
|
+
<tr>
|
|
20
|
+
<td>1</td>
|
|
21
|
+
<td>2</td>
|
|
22
|
+
</tr>
|
|
23
|
+
<tr>
|
|
24
|
+
<td>3</td>
|
|
25
|
+
<td>4</td>
|
|
26
|
+
</tr>
|
|
27
|
+
</tbody>
|
|
28
|
+
</table>
|
|
29
|
+
|
|
30
|
+
</div>
|
|
31
|
+
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
|
|
32
|
+
</body>
|
|
33
|
+
</html>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
require "erb"
|
|
2
|
+
|
|
3
|
+
module BootWheel
|
|
4
|
+
def self.renderer
|
|
5
|
+
BootWheel::Internals::Renderer
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def self.helpers
|
|
9
|
+
BootWheel::Internals::Renderer::HelpersStub
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
module Internals
|
|
13
|
+
# TEMPORARY COMPATIBILITY SHIM - NOT INTENDED FOR REAL USE
|
|
14
|
+
# Might want to extract something "Official" into Little Wheels
|
|
15
|
+
# for testing outside a Rails app.
|
|
16
|
+
class Component
|
|
17
|
+
def renderer
|
|
18
|
+
BootWheel.renderer
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def helpers
|
|
22
|
+
BootWheel.helpers
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def x
|
|
26
|
+
TagStub
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
class TagStub; end
|
|
30
|
+
|
|
31
|
+
def to_html
|
|
32
|
+
to_s
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
class Renderer
|
|
37
|
+
# TEMPORARY COMPATIBILITY SHIM - NOT INTENDED FOR REAL USE
|
|
38
|
+
# Might want to extract something "Official" into Little Wheels
|
|
39
|
+
# for testing outside a Rails app.
|
|
40
|
+
def self.render(template=nil,inline: nil, layout: nil, locals: {})
|
|
41
|
+
raise NotImplementedError unless template.nil?
|
|
42
|
+
|
|
43
|
+
ERB.new(inline, trim_mode: "-<>").result_with_hash(locals)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
class HelpersStub
|
|
47
|
+
def self.capture
|
|
48
|
+
yield
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def self.class_names(list)
|
|
52
|
+
list.join(" ")
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
require_relative "internals/component"
|
|
2
|
+
|
|
3
|
+
module BootWheel
|
|
4
|
+
class Table < BootWheel::Internals::Component
|
|
5
|
+
TEMPLATE = t("table.erb")
|
|
6
|
+
|
|
7
|
+
def initialize(items:, style_props: [], fields: items.first.keys, **params)
|
|
8
|
+
@items = items
|
|
9
|
+
@style_props = style_props
|
|
10
|
+
@fields = normalize_fields(fields)
|
|
11
|
+
@params = params
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
attr_reader :items, :fields, :params
|
|
15
|
+
|
|
16
|
+
def applied_classes
|
|
17
|
+
helpers.class_names(["table"] + @style_props.map { |e| "table-#{e}"} + (params[:table_class] || []))
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def normalize_fields(fields)
|
|
21
|
+
item_keys = @items.first.keys
|
|
22
|
+
|
|
23
|
+
fields.map.with_index do |e,i|
|
|
24
|
+
Hash === e ? e : { key: item_keys[i], label: e }
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def field_with_key(key)
|
|
29
|
+
@fields.find { |e| e[:key] == key }
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def self.table(*a,**o,&b)
|
|
34
|
+
BootWheel::Table.new(*a,**o,&b)
|
|
35
|
+
end
|
|
36
|
+
end
|
data/lib/boot_wheel.rb
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
require "little_wheels"
|
|
2
|
+
require_relative "boot_wheel/table"
|
|
3
|
+
require_relative "boot_wheel/page"
|
|
4
|
+
|
|
1
5
|
module BootWheel
|
|
2
6
|
VERSION = "0.0.1"
|
|
7
|
+
|
|
8
|
+
def self.renderer
|
|
9
|
+
LittleWheels.renderer
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def self.helpers
|
|
13
|
+
LittleWheels.helpers
|
|
14
|
+
end
|
|
3
15
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: boot_wheel
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Gregory Brown
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2024-12-
|
|
11
|
+
date: 2024-12-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: little_wheels
|
|
@@ -16,14 +16,14 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - '='
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: 0.0.
|
|
19
|
+
version: 0.0.9
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - '='
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: 0.0.
|
|
26
|
+
version: 0.0.9
|
|
27
27
|
description: Experimental component library built on top of Little Wheels, inspired
|
|
28
28
|
by BootstrapVue
|
|
29
29
|
email: gregory@practicingdeveloper.com
|
|
@@ -32,12 +32,21 @@ extensions: []
|
|
|
32
32
|
extra_rdoc_files: []
|
|
33
33
|
files:
|
|
34
34
|
- LICENSE.md
|
|
35
|
+
- examples/demo.rb
|
|
36
|
+
- examples/index.html
|
|
35
37
|
- lib/boot_wheel.rb
|
|
36
|
-
|
|
38
|
+
- lib/boot_wheel/internals/action_pack.rb
|
|
39
|
+
- lib/boot_wheel/internals/component.rb
|
|
40
|
+
- lib/boot_wheel/internals/renderer.rb
|
|
41
|
+
- lib/boot_wheel/offroad.rb
|
|
42
|
+
- lib/boot_wheel/page.rb
|
|
43
|
+
- lib/boot_wheel/rugged.rb
|
|
44
|
+
- lib/boot_wheel/table.rb
|
|
45
|
+
homepage:
|
|
37
46
|
licenses:
|
|
38
|
-
-
|
|
47
|
+
- AGPLv3
|
|
39
48
|
metadata: {}
|
|
40
|
-
post_install_message:
|
|
49
|
+
post_install_message:
|
|
41
50
|
rdoc_options: []
|
|
42
51
|
require_paths:
|
|
43
52
|
- lib
|
|
@@ -52,8 +61,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
52
61
|
- !ruby/object:Gem::Version
|
|
53
62
|
version: '0'
|
|
54
63
|
requirements: []
|
|
55
|
-
rubygems_version: 3.
|
|
56
|
-
signing_key:
|
|
64
|
+
rubygems_version: 3.5.9
|
|
65
|
+
signing_key:
|
|
57
66
|
specification_version: 4
|
|
58
67
|
summary: BootWheel
|
|
59
68
|
test_files: []
|