card-mod-bootstrap 0.11.7 → 0.13.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/{lib/javascript → assets/script}/bootstrap_modal_decko.js +0 -0
- data/assets/script/manifest.yml +18 -0
- data/assets/script/script_colorpicker.js.coffee +3 -0
- data/{lib/javascript → assets/script}/script_load_select2.js.coffee +0 -0
- data/assets/script/script_pointer_config.js.coffee +80 -0
- data/assets/script/script_pointer_list_editor.js.coffee +67 -0
- data/db/migrate_core_cards/20180423160231_migrate_customized_bootstrap_skin.rb +1 -1
- data/db/migrate_core_cards/20200809112346_add_mod_card.rb +7 -0
- data/db/migrate_core_cards/20201129140917_remove_script_cards.rb +9 -0
- data/file/mod_bootstrap_script_bootstrap_machine_output/file.js +25 -0
- data/file/mod_bootstrap_script_pointer_machine_output/file.js +223 -0
- data/lib/card/bootstrap.rb +17 -0
- data/lib/card/bootstrap/basic_tags.rb +26 -0
- data/lib/card/bootstrap/component.rb +110 -0
- data/lib/card/bootstrap/component/carousel.rb +78 -0
- data/lib/card/bootstrap/component/form.rb +67 -0
- data/lib/card/bootstrap/component/horizontal_form.rb +65 -0
- data/lib/card/bootstrap/component/layout.rb +107 -0
- data/lib/card/bootstrap/component/panel.rb +11 -0
- data/lib/{bootstrap/component/component_class.rb → card/bootstrap/component_klass.rb} +5 -4
- data/lib/card/bootstrap/component_loader.rb +30 -0
- data/lib/card/bootstrap/content.rb +42 -0
- data/lib/card/bootstrap/delegate.rb +18 -0
- data/lib/card/bootstrap/old_component.rb +108 -0
- data/lib/card/bootstrap/tag_method.rb +56 -0
- data/lib/card/bootstrapper.rb +17 -0
- data/lib/card/tab.rb +8 -1
- data/lib/stylesheets/font_awesome.css +6 -6
- data/lib/stylesheets/material_icons.css +4 -4
- data/locales/en.yml +3 -0
- data/public/{assets/fonts → fonts}/MaterialIcons-Regular.eot +0 -0
- data/public/{assets/fonts → fonts}/MaterialIcons-Regular.ijmap +0 -0
- data/public/{assets/fonts → fonts}/MaterialIcons-Regular.svg +0 -0
- data/public/{assets/fonts → fonts}/MaterialIcons-Regular.ttf +0 -0
- data/public/{assets/fonts → fonts}/MaterialIcons-Regular.woff +0 -0
- data/public/{assets/fonts → fonts}/MaterialIcons-Regular.woff2 +0 -0
- data/public/{assets/fonts → fonts}/fa-brands-400.eot +0 -0
- data/public/{assets/fonts → fonts}/fa-brands-400.svg +0 -0
- data/public/{assets/fonts → fonts}/fa-brands-400.ttf +0 -0
- data/public/{assets/fonts → fonts}/fa-brands-400.woff +0 -0
- data/public/{assets/fonts → fonts}/fa-brands-400.woff2 +0 -0
- data/public/{assets/fonts → fonts}/fa-regular-400.eot +0 -0
- data/public/{assets/fonts → fonts}/fa-regular-400.svg +0 -0
- data/public/{assets/fonts → fonts}/fa-regular-400.ttf +0 -0
- data/public/{assets/fonts → fonts}/fa-regular-400.woff +0 -0
- data/public/{assets/fonts → fonts}/fa-regular-400.woff2 +0 -0
- data/public/{assets/fonts → fonts}/fa-solid-900.eot +0 -0
- data/public/{assets/fonts → fonts}/fa-solid-900.svg +0 -0
- data/public/{assets/fonts → fonts}/fa-solid-900.ttf +0 -0
- data/public/{assets/fonts → fonts}/fa-solid-900.woff +0 -0
- data/public/{assets/fonts → fonts}/fa-solid-900.woff2 +0 -0
- data/public/{assets/fonts → fonts}/glyphicons-halflings-regular.eot +0 -0
- data/public/{assets/fonts → fonts}/glyphicons-halflings-regular.svg +0 -0
- data/public/{assets/fonts → fonts}/glyphicons-halflings-regular.ttf +0 -0
- data/public/{assets/fonts → fonts}/glyphicons-halflings-regular.woff +0 -0
- data/public/{assets/fonts → fonts}/glyphicons-halflings-regular.woff2 +0 -0
- data/set/abstract/bootswatch_theme.rb +2 -2
- data/set/all/bootstrap/icon.rb +3 -1
- metadata +78 -57
- data/lib/bootstrap.rb +0 -18
- data/lib/bootstrap/basic_tags.rb +0 -26
- data/lib/bootstrap/component.rb +0 -108
- data/lib/bootstrap/component/carousel.rb +0 -76
- data/lib/bootstrap/component/form.rb +0 -65
- data/lib/bootstrap/component/horizontal_form.rb +0 -63
- data/lib/bootstrap/component/layout.rb +0 -105
- data/lib/bootstrap/component/panel.rb +0 -9
- data/lib/bootstrap/component_loader.rb +0 -28
- data/lib/bootstrap/content.rb +0 -40
- data/lib/bootstrap/delegate.rb +0 -16
- data/lib/bootstrap/old_component.rb +0 -103
- data/lib/bootstrap/tag_method.rb +0 -54
- data/lib/bootstrapper.rb +0 -16
- data/set/self/script_bootstrap.rb +0 -12
- data/set/self/script_select2.rb +0 -12
@@ -1,7 +1,7 @@
|
|
1
|
-
class
|
2
|
-
class
|
1
|
+
class Card
|
2
|
+
class Bootstrap
|
3
3
|
# class methods for Bootstrap::Component
|
4
|
-
module
|
4
|
+
module ComponentKlass
|
5
5
|
def render format, *args, &block
|
6
6
|
new(format, *args, &block).render
|
7
7
|
end
|
@@ -26,7 +26,8 @@ class Bootstrap
|
|
26
26
|
def def_tag_method method_name, html_class, tag_opts={}, &tag_opts_block
|
27
27
|
tag = tag_opts.delete(:tag) || method_name
|
28
28
|
define_method method_name do |*args, &content_block|
|
29
|
-
@html.tag! tag,
|
29
|
+
@html.tag! tag,
|
30
|
+
tag_method_opts(args, html_class, tag_opts, &tag_opts_block) do
|
30
31
|
instance_exec(&content_block)
|
31
32
|
end
|
32
33
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
class Card
|
2
|
+
class Bootstrap
|
3
|
+
module ComponentLoader
|
4
|
+
def load_components
|
5
|
+
components.each do |component|
|
6
|
+
require_relative "component/#{component}"
|
7
|
+
include_component component
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def include_component component
|
12
|
+
component_class = to_const component.camelcase
|
13
|
+
define_method component do |*args, &block|
|
14
|
+
component_class.render self, *args, &block
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def components
|
19
|
+
path = File.expand_path "component/*.rb", __dir__
|
20
|
+
Dir.glob(path).map do |file|
|
21
|
+
File.basename file, ".rb"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def to_const name
|
26
|
+
self.class.const_get "::Card::Bootstrap::Component::#{name.camelcase}"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
class Card
|
2
|
+
class Bootstrap
|
3
|
+
# shared methods for OldComponent and TagMethod
|
4
|
+
module Content
|
5
|
+
private
|
6
|
+
|
7
|
+
def process_collected_content tag_name, opts
|
8
|
+
collected_content = @content.pop
|
9
|
+
tag_name = opts.delete(:tag) if tag_name == :yield
|
10
|
+
add_content content_tag(tag_name, collected_content, opts, false)
|
11
|
+
end
|
12
|
+
|
13
|
+
def process_content &content_block
|
14
|
+
content, opts = yield
|
15
|
+
wrappers = @wrap.pop
|
16
|
+
if wrappers.present?
|
17
|
+
process_wrappers wrappers, content, &content_block
|
18
|
+
else
|
19
|
+
add_content content
|
20
|
+
end
|
21
|
+
opts
|
22
|
+
end
|
23
|
+
|
24
|
+
def process_append
|
25
|
+
@append.pop.each do |block|
|
26
|
+
add_content instance_exec(&block)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def process_wrappers wrappers, content, &content_block
|
31
|
+
while wrappers.present?
|
32
|
+
wrapper = wrappers.shift
|
33
|
+
if wrapper.is_a? Symbol
|
34
|
+
send wrapper, &content_block
|
35
|
+
else
|
36
|
+
instance_exec content, &wrappers.shift
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class Card
|
2
|
+
class Bootstrap
|
3
|
+
module Delegate
|
4
|
+
def method_missing method_name, *args, &block
|
5
|
+
# return super unless @context.respond_to? method_name
|
6
|
+
if block_given?
|
7
|
+
@context.send(method_name, *args, &block)
|
8
|
+
else
|
9
|
+
@context.send(method_name, *args)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def respond_to_missing? method_name, _include_private=false
|
14
|
+
@context.respond_to? method_name
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,108 @@
|
|
1
|
+
class Card
|
2
|
+
class Bootstrap
|
3
|
+
# not-yet-obviated component handling
|
4
|
+
class OldComponent < Component
|
5
|
+
include Content
|
6
|
+
|
7
|
+
def initialize context, *args, &block
|
8
|
+
@context = context
|
9
|
+
@content = ["".html_safe]
|
10
|
+
@args = args
|
11
|
+
@child_args = []
|
12
|
+
@append = []
|
13
|
+
@wrap = []
|
14
|
+
@build_block = block
|
15
|
+
end
|
16
|
+
|
17
|
+
class << self
|
18
|
+
def render format, *args, &block
|
19
|
+
new(format, *args, &block).render
|
20
|
+
end
|
21
|
+
|
22
|
+
# Like add_tag_method but always generates a div tag
|
23
|
+
# The tag option is not available
|
24
|
+
def add_div_method name, html_class, opts={}, &tag_block
|
25
|
+
add_tag_method name, html_class, opts.merge(tag: :div), &tag_block
|
26
|
+
end
|
27
|
+
|
28
|
+
# Defines a method that generates a html tag
|
29
|
+
# @param name [Symbol, String] the name of the method. If no :tag option in
|
30
|
+
# tag_opts is defined then the name is also the name of the tag that the method
|
31
|
+
# generates
|
32
|
+
# @param html_class [String] a html class that is added to tag. Use nil if you
|
33
|
+
# don't want a html_class
|
34
|
+
# @param tag_opts [Hash] additional argument that will be added to the tag
|
35
|
+
# @option tag_opts [Symbol, String] tag the name of the tag
|
36
|
+
# @example
|
37
|
+
# add_tag_method :link, "known-link", tag: :a, id: "uniq-link"
|
38
|
+
# link # => <a class="known-link" id="uniq-link"></a>
|
39
|
+
def add_tag_method name, html_class, tag_opts={}, &tag_block
|
40
|
+
define_method name do |*args, &block|
|
41
|
+
process_tag tag_opts[:tag] || name do
|
42
|
+
content, opts, new_child_args = standardize_args args, &tag_block
|
43
|
+
add_classes opts, html_class, tag_opts.delete(:optional_classes)
|
44
|
+
if (attributes = tag_opts.delete(:attributes))
|
45
|
+
opts.merge! attributes
|
46
|
+
end
|
47
|
+
|
48
|
+
content = with_child_args new_child_args do
|
49
|
+
generate_content content,
|
50
|
+
tag_opts[:content_processor],
|
51
|
+
&block
|
52
|
+
end
|
53
|
+
|
54
|
+
[content, opts]
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
alias_method :def_div_method, :add_div_method
|
60
|
+
alias_method :def_tag_method, :add_tag_method
|
61
|
+
end
|
62
|
+
|
63
|
+
def render
|
64
|
+
@rendered = begin
|
65
|
+
render_content
|
66
|
+
@content[-1]
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
private
|
71
|
+
|
72
|
+
def process_tag tag_name, &content_block
|
73
|
+
@content.push "".html_safe
|
74
|
+
@append << []
|
75
|
+
@wrap << []
|
76
|
+
|
77
|
+
opts = process_content(&content_block)
|
78
|
+
process_collected_content tag_name, opts
|
79
|
+
process_append
|
80
|
+
""
|
81
|
+
end
|
82
|
+
|
83
|
+
# include BasicTags
|
84
|
+
def html content
|
85
|
+
add_content String(content).html_safe
|
86
|
+
""
|
87
|
+
end
|
88
|
+
|
89
|
+
add_div_method :div, nil do |opts, extra_args|
|
90
|
+
prepend_class opts, extra_args.first if extra_args.present?
|
91
|
+
opts
|
92
|
+
end
|
93
|
+
|
94
|
+
add_div_method :span, nil do |opts, extra_args|
|
95
|
+
prepend_class opts, extra_args.first if extra_args.present?
|
96
|
+
opts
|
97
|
+
end
|
98
|
+
|
99
|
+
add_tag_method :tag, nil, tag: :yield do |opts, extra_args|
|
100
|
+
prepend_class opts, extra_args[1] if extra_args[1].present?
|
101
|
+
opts[:tag] = extra_args[0]
|
102
|
+
opts
|
103
|
+
end
|
104
|
+
|
105
|
+
include Delegate
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
class Card
|
2
|
+
class Bootstrap
|
3
|
+
# support html tag generation
|
4
|
+
class TagMethod
|
5
|
+
include Content
|
6
|
+
|
7
|
+
def initialize component, name, html_class, tag_opts={}, &tag_block
|
8
|
+
@component = component
|
9
|
+
@name = name
|
10
|
+
@html_class = html_class
|
11
|
+
@tag_opts = tag_opts
|
12
|
+
@tag_block = tag_block
|
13
|
+
@append = []
|
14
|
+
@wrap = []
|
15
|
+
@xm = Builder::XmlMarkup.new
|
16
|
+
end
|
17
|
+
|
18
|
+
def call *_args, &content_block
|
19
|
+
component.content.push "".html_safe
|
20
|
+
|
21
|
+
opts = process_content(&content_block)
|
22
|
+
process_collected_content tag_name, opts
|
23
|
+
process_append
|
24
|
+
""
|
25
|
+
end
|
26
|
+
|
27
|
+
def method_missing method, *args, &block
|
28
|
+
return super unless respond_to_missing? method
|
29
|
+
|
30
|
+
@component.send method, *args, &block
|
31
|
+
end
|
32
|
+
|
33
|
+
def respond_to_missing? method, _include_private=false
|
34
|
+
@component.respond_to? method
|
35
|
+
end
|
36
|
+
|
37
|
+
def prepend &block
|
38
|
+
tmp = @content.pop
|
39
|
+
instance_exec(&block)
|
40
|
+
@content << tmp
|
41
|
+
end
|
42
|
+
|
43
|
+
def wrap &block
|
44
|
+
instance_exec(&block)
|
45
|
+
end
|
46
|
+
|
47
|
+
def append &block
|
48
|
+
@append[-1] << block
|
49
|
+
end
|
50
|
+
|
51
|
+
def wrapInner tag=nil, &block
|
52
|
+
@wrap[-1] << (block_given? ? block : tag)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class Card
|
2
|
+
module Bootstrapper
|
3
|
+
extend Bootstrap::ComponentLoader
|
4
|
+
|
5
|
+
def bootstrap
|
6
|
+
@bootstrap ||= Bootstrap.new(self)
|
7
|
+
end
|
8
|
+
|
9
|
+
def bs *args, &block
|
10
|
+
bootstrap.render(*args, &block)
|
11
|
+
end
|
12
|
+
|
13
|
+
components.each do |component|
|
14
|
+
delegate component, to: :bootstrap, prefix: :bs
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/card/tab.rb
CHANGED
@@ -5,11 +5,18 @@ class Card
|
|
5
5
|
class << self
|
6
6
|
def tab_objects format, tab_hash, active_name, klass=nil
|
7
7
|
klass ||= Card::Tab
|
8
|
-
active_name
|
8
|
+
active_name = active active_name, tab_hash.keys
|
9
9
|
tab_hash.map do |name, config|
|
10
10
|
klass.new format, name, active_name, config
|
11
11
|
end
|
12
12
|
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def active requested, keys
|
17
|
+
r = requested.to_name
|
18
|
+
r && keys.find { |k| k.to_name == r } || keys.first
|
19
|
+
end
|
13
20
|
end
|
14
21
|
|
15
22
|
delegate :add_class, :wrap_with, :unique_id, :link_to, to: :format
|
@@ -4588,8 +4588,8 @@ readers do not read off random characters that represent icons */
|
|
4588
4588
|
font-style: normal;
|
4589
4589
|
font-weight: 400;
|
4590
4590
|
font-display: block;
|
4591
|
-
src: url([[/
|
4592
|
-
src: url([[/
|
4591
|
+
src: url([[/mod/bootstrap/fonts/fa-brands-400.eot]]);
|
4592
|
+
src: url([[/mod/bootstrap/fonts/fa-brands-400.eot?#iefix]]) format("embedded-opentype"), url([[/mod/bootstrap/fonts/fa-brands-400.woff2]]) format("woff2"), url([[/mod/bootstrap/fonts/fa-brands-400.woff]]) format("woff"), url([[/mod/bootstrap/fonts/fa-brands-400.ttf]]) format("truetype"), url([[/mod/bootstrap/fonts/fa-brands-400.svg#fontawesome]]) format("svg"); }
|
4593
4593
|
|
4594
4594
|
.fab {
|
4595
4595
|
font-family: 'Font Awesome 5 Brands';
|
@@ -4599,8 +4599,8 @@ readers do not read off random characters that represent icons */
|
|
4599
4599
|
font-style: normal;
|
4600
4600
|
font-weight: 400;
|
4601
4601
|
font-display: block;
|
4602
|
-
src: url([[/
|
4603
|
-
src: url([[/
|
4602
|
+
src: url([[/mod/bootstrap/fonts/fa-regular-400.eot]]);
|
4603
|
+
src: url([[/mod/bootstrap/fonts/fa-regular-400.eot?#iefix]]) format("embedded-opentype"), url([[/mod/bootstrap/fonts/fa-regular-400.woff2]]) format("woff2"), url([[/mod/bootstrap/fonts/fa-regular-400.woff]]) format("woff"), url([[/mod/bootstrap/fonts/fa-regular-400.ttf]]) format("truetype"), url([[/mod/bootstrap/fonts/fa-regular-400.svg#fontawesome]]) format("svg"); }
|
4604
4604
|
|
4605
4605
|
.far {
|
4606
4606
|
font-family: 'FontAwesome';
|
@@ -4610,8 +4610,8 @@ readers do not read off random characters that represent icons */
|
|
4610
4610
|
font-style: normal;
|
4611
4611
|
font-weight: 900;
|
4612
4612
|
font-display: block;
|
4613
|
-
src: url([[/
|
4614
|
-
src: url([[/
|
4613
|
+
src: url([[/mod/bootstrap/fonts/fa-solid-900.eot]]);
|
4614
|
+
src: url([[/mod/bootstrap/fonts/fa-solid-900.eot?#iefix]]) format("embedded-opentype"), url([[/mod/bootstrap/fonts/fa-solid-900.woff2]]) format("woff2"), url([[/mod/bootstrap/fonts/fa-solid-900.woff]]) format("woff"), url([[/mod/bootstrap/fonts/fa-solid-900.ttf]]) format("truetype"), url([[/mod/bootstrap/fonts/fa-solid-900.svg#fontawesome]]) format("svg"); }
|
4615
4615
|
|
4616
4616
|
.fa,
|
4617
4617
|
.fas {
|
@@ -2,12 +2,12 @@
|
|
2
2
|
font-family: 'Material Icons';
|
3
3
|
font-style: normal;
|
4
4
|
font-weight: 400;
|
5
|
-
src: url([[/
|
5
|
+
src: url([[/mod/bootstrap/fonts/MaterialIcons-Regular.eot]]); /* For IE6-8 */
|
6
6
|
src: local('Material Icons'),
|
7
7
|
local('MaterialIcons-Regular'),
|
8
|
-
url([[/
|
9
|
-
url([[/
|
10
|
-
url([[/
|
8
|
+
url([[/mod/bootstrap/fonts/MaterialIcons-Regular.woff2]]) format('woff2'),
|
9
|
+
url([[/mod/bootstrap/fonts/MaterialIcons-Regular.woff]]) format('woff'),
|
10
|
+
url([[/mod/bootstrap/fonts/MaterialIcons-Regular.ttf]]) format('truetype');
|
11
11
|
}
|
12
12
|
|
13
13
|
.material-icons {
|
data/locales/en.yml
ADDED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|