card-mod-bootstrap 0.11.7 → 0.13.2
Sign up to get free protection for your applications and to get access to all the features.
- 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
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -77,14 +77,14 @@ def after_engine output
|
|
77
77
|
Card::Auth.as_bot { update! db_content: output }
|
78
78
|
end
|
79
79
|
|
80
|
-
# needed to make the
|
80
|
+
# needed to make the refresh_assets method work with these cards
|
81
81
|
def source_files
|
82
82
|
extended_input_cards.map do |i_card|
|
83
83
|
i_card.try(:source_files)
|
84
84
|
end.flatten.compact
|
85
85
|
end
|
86
86
|
|
87
|
-
# needed to make the
|
87
|
+
# needed to make the refresh_assets method work with these cards
|
88
88
|
def existing_source_paths
|
89
89
|
extended_input_cards.map do |i_card|
|
90
90
|
i_card.try(:existing_source_paths)
|
data/set/all/bootstrap/icon.rb
CHANGED
@@ -96,7 +96,9 @@ format :html do
|
|
96
96
|
end
|
97
97
|
|
98
98
|
def font_awesome_icon_tag icon, opts={}
|
99
|
-
|
99
|
+
|
100
|
+
prepend_class opts,
|
101
|
+
"fa#{'b' if opts.delete :brand} fa-#{icon_class(:font_awesome, icon)}"
|
100
102
|
wrap_with :i, "", opts
|
101
103
|
end
|
102
104
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: card-mod-bootstrap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.13.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ethan McCutchen
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2021-08-
|
13
|
+
date: 2021-08-06 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: card
|
@@ -18,70 +18,84 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 1.
|
21
|
+
version: 1.103.2
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
26
|
- - '='
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version: 1.
|
28
|
+
version: 1.103.2
|
29
|
+
- !ruby/object:Gem::Dependency
|
30
|
+
name: card-mod-assets
|
31
|
+
requirement: !ruby/object:Gem::Requirement
|
32
|
+
requirements:
|
33
|
+
- - '='
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: 0.13.2
|
36
|
+
type: :runtime
|
37
|
+
prerelease: false
|
38
|
+
version_requirements: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - '='
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 0.13.2
|
29
43
|
- !ruby/object:Gem::Dependency
|
30
44
|
name: card-mod-edit
|
31
45
|
requirement: !ruby/object:Gem::Requirement
|
32
46
|
requirements:
|
33
47
|
- - '='
|
34
48
|
- !ruby/object:Gem::Version
|
35
|
-
version: 0.
|
49
|
+
version: 0.13.2
|
36
50
|
type: :runtime
|
37
51
|
prerelease: false
|
38
52
|
version_requirements: !ruby/object:Gem::Requirement
|
39
53
|
requirements:
|
40
54
|
- - '='
|
41
55
|
- !ruby/object:Gem::Version
|
42
|
-
version: 0.
|
56
|
+
version: 0.13.2
|
43
57
|
- !ruby/object:Gem::Dependency
|
44
58
|
name: card-mod-bar_and_box
|
45
59
|
requirement: !ruby/object:Gem::Requirement
|
46
60
|
requirements:
|
47
61
|
- - '='
|
48
62
|
- !ruby/object:Gem::Version
|
49
|
-
version: 0.
|
63
|
+
version: 0.13.2
|
50
64
|
type: :runtime
|
51
65
|
prerelease: false
|
52
66
|
version_requirements: !ruby/object:Gem::Requirement
|
53
67
|
requirements:
|
54
68
|
- - '='
|
55
69
|
- !ruby/object:Gem::Version
|
56
|
-
version: 0.
|
70
|
+
version: 0.13.2
|
57
71
|
- !ruby/object:Gem::Dependency
|
58
72
|
name: card-mod-style
|
59
73
|
requirement: !ruby/object:Gem::Requirement
|
60
74
|
requirements:
|
61
75
|
- - '='
|
62
76
|
- !ruby/object:Gem::Version
|
63
|
-
version: 0.
|
77
|
+
version: 0.13.2
|
64
78
|
type: :runtime
|
65
79
|
prerelease: false
|
66
80
|
version_requirements: !ruby/object:Gem::Requirement
|
67
81
|
requirements:
|
68
82
|
- - '='
|
69
83
|
- !ruby/object:Gem::Version
|
70
|
-
version: 0.
|
84
|
+
version: 0.13.2
|
71
85
|
- !ruby/object:Gem::Dependency
|
72
86
|
name: card-mod-script
|
73
87
|
requirement: !ruby/object:Gem::Requirement
|
74
88
|
requirements:
|
75
89
|
- - '='
|
76
90
|
- !ruby/object:Gem::Version
|
77
|
-
version: 0.
|
91
|
+
version: 0.13.2
|
78
92
|
type: :runtime
|
79
93
|
prerelease: false
|
80
94
|
version_requirements: !ruby/object:Gem::Requirement
|
81
95
|
requirements:
|
82
96
|
- - '='
|
83
97
|
- !ruby/object:Gem::Version
|
84
|
-
version: 0.
|
98
|
+
version: 0.13.2
|
85
99
|
description: ''
|
86
100
|
email:
|
87
101
|
- info@decko.org
|
@@ -89,6 +103,12 @@ executables: []
|
|
89
103
|
extensions: []
|
90
104
|
extra_rdoc_files: []
|
91
105
|
files:
|
106
|
+
- assets/script/bootstrap_modal_decko.js
|
107
|
+
- assets/script/manifest.yml
|
108
|
+
- assets/script/script_colorpicker.js.coffee
|
109
|
+
- assets/script/script_load_select2.js.coffee
|
110
|
+
- assets/script/script_pointer_config.js.coffee
|
111
|
+
- assets/script/script_pointer_list_editor.js.coffee
|
92
112
|
- db/migrate_core_cards/20170719163733_update_bootswatch_themes_to_4_beta.rb
|
93
113
|
- db/migrate_core_cards/20170726111053_add_bootstrap_mixins.rb
|
94
114
|
- db/migrate_core_cards/20170726145012_select2.rb
|
@@ -103,6 +123,8 @@ files:
|
|
103
123
|
- db/migrate_core_cards/20180516153037_add_style_select2_card.rb
|
104
124
|
- db/migrate_core_cards/20180601133753_migrate_skins.rb
|
105
125
|
- db/migrate_core_cards/20181129140917_fix_skin_images.rb
|
126
|
+
- db/migrate_core_cards/20200809112346_add_mod_card.rb
|
127
|
+
- db/migrate_core_cards/20201129140917_remove_script_cards.rb
|
106
128
|
- db/migrate_core_cards/data/20181108181219_migrate_classic_skins_to_bootstrap.rb
|
107
129
|
- db/migrate_core_cards/data/custom_theme/cards.scss
|
108
130
|
- db/migrate_core_cards/data/custom_theme/colors.scss
|
@@ -166,6 +188,8 @@ files:
|
|
166
188
|
- file/minty_skin_image/image-medium.png
|
167
189
|
- file/minty_skin_image/image-original.png
|
168
190
|
- file/minty_skin_image/image-small.png
|
191
|
+
- file/mod_bootstrap_script_bootstrap_machine_output/file.js
|
192
|
+
- file/mod_bootstrap_script_pointer_machine_output/file.js
|
169
193
|
- file/paper_skin_image/image-icon.png
|
170
194
|
- file/paper_skin_image/image-large.png
|
171
195
|
- file/paper_skin_image/image-medium.png
|
@@ -226,57 +250,56 @@ files:
|
|
226
250
|
- file/yeti_skin_image/image-medium.png
|
227
251
|
- file/yeti_skin_image/image-original.png
|
228
252
|
- file/yeti_skin_image/image-small.png
|
229
|
-
- lib/bootstrap.rb
|
230
|
-
- lib/bootstrap/basic_tags.rb
|
231
|
-
- lib/bootstrap/component.rb
|
232
|
-
- lib/bootstrap/component/carousel.rb
|
233
|
-
- lib/bootstrap/component/
|
234
|
-
- lib/bootstrap/component/
|
235
|
-
- lib/bootstrap/component/
|
236
|
-
- lib/bootstrap/component/
|
237
|
-
- lib/bootstrap/
|
238
|
-
- lib/bootstrap/component_loader.rb
|
239
|
-
- lib/bootstrap/content.rb
|
240
|
-
- lib/bootstrap/delegate.rb
|
241
|
-
- lib/bootstrap/old_component.rb
|
242
|
-
- lib/bootstrap/tag_method.rb
|
243
|
-
- lib/bootstrapper.rb
|
253
|
+
- lib/card/bootstrap.rb
|
254
|
+
- lib/card/bootstrap/basic_tags.rb
|
255
|
+
- lib/card/bootstrap/component.rb
|
256
|
+
- lib/card/bootstrap/component/carousel.rb
|
257
|
+
- lib/card/bootstrap/component/form.rb
|
258
|
+
- lib/card/bootstrap/component/horizontal_form.rb
|
259
|
+
- lib/card/bootstrap/component/layout.rb
|
260
|
+
- lib/card/bootstrap/component/panel.rb
|
261
|
+
- lib/card/bootstrap/component_klass.rb
|
262
|
+
- lib/card/bootstrap/component_loader.rb
|
263
|
+
- lib/card/bootstrap/content.rb
|
264
|
+
- lib/card/bootstrap/delegate.rb
|
265
|
+
- lib/card/bootstrap/old_component.rb
|
266
|
+
- lib/card/bootstrap/tag_method.rb
|
267
|
+
- lib/card/bootstrapper.rb
|
244
268
|
- lib/card/lazy_tab.rb
|
245
269
|
- lib/card/tab.rb
|
246
|
-
- lib/javascript/bootstrap_modal_decko.js
|
247
|
-
- lib/javascript/script_load_select2.js.coffee
|
248
270
|
- lib/javascript/smartmenu.js
|
249
271
|
- lib/stylesheets/font_awesome.css
|
250
272
|
- lib/stylesheets/material_icons.css
|
251
273
|
- lib/stylesheets/smartmenu.css
|
252
274
|
- lib/stylesheets/style_bootstrap_cards.scss
|
253
275
|
- lib/stylesheets/style_select2_bootstrap.scss
|
254
|
-
-
|
255
|
-
- public/
|
256
|
-
- public/
|
257
|
-
- public/
|
258
|
-
- public/
|
259
|
-
- public/
|
260
|
-
- public/
|
261
|
-
- public/
|
262
|
-
- public/
|
263
|
-
- public/
|
264
|
-
- public/
|
265
|
-
- public/
|
266
|
-
- public/
|
267
|
-
- public/
|
268
|
-
- public/
|
269
|
-
- public/
|
270
|
-
- public/
|
271
|
-
- public/
|
272
|
-
- public/
|
273
|
-
- public/
|
274
|
-
- public/
|
275
|
-
- public/
|
276
|
-
- public/
|
277
|
-
- public/
|
278
|
-
- public/
|
279
|
-
- public/
|
276
|
+
- locales/en.yml
|
277
|
+
- public/fonts/MaterialIcons-Regular.eot
|
278
|
+
- public/fonts/MaterialIcons-Regular.ijmap
|
279
|
+
- public/fonts/MaterialIcons-Regular.svg
|
280
|
+
- public/fonts/MaterialIcons-Regular.ttf
|
281
|
+
- public/fonts/MaterialIcons-Regular.woff
|
282
|
+
- public/fonts/MaterialIcons-Regular.woff2
|
283
|
+
- public/fonts/fa-brands-400.eot
|
284
|
+
- public/fonts/fa-brands-400.svg
|
285
|
+
- public/fonts/fa-brands-400.ttf
|
286
|
+
- public/fonts/fa-brands-400.woff
|
287
|
+
- public/fonts/fa-brands-400.woff2
|
288
|
+
- public/fonts/fa-regular-400.eot
|
289
|
+
- public/fonts/fa-regular-400.svg
|
290
|
+
- public/fonts/fa-regular-400.ttf
|
291
|
+
- public/fonts/fa-regular-400.woff
|
292
|
+
- public/fonts/fa-regular-400.woff2
|
293
|
+
- public/fonts/fa-solid-900.eot
|
294
|
+
- public/fonts/fa-solid-900.svg
|
295
|
+
- public/fonts/fa-solid-900.ttf
|
296
|
+
- public/fonts/fa-solid-900.woff
|
297
|
+
- public/fonts/fa-solid-900.woff2
|
298
|
+
- public/fonts/glyphicons-halflings-regular.eot
|
299
|
+
- public/fonts/glyphicons-halflings-regular.svg
|
300
|
+
- public/fonts/glyphicons-halflings-regular.ttf
|
301
|
+
- public/fonts/glyphicons-halflings-regular.woff
|
302
|
+
- public/fonts/glyphicons-halflings-regular.woff2
|
280
303
|
- set/abstract/bootstrap_code_file.rb
|
281
304
|
- set/abstract/bootswatch_theme.rb
|
282
305
|
- set/abstract/bootswatch_theme/html_views.rb
|
@@ -301,9 +324,7 @@ files:
|
|
301
324
|
- set/self/bootstrap_functions.rb
|
302
325
|
- set/self/font_awesome.rb
|
303
326
|
- set/self/material_icons.rb
|
304
|
-
- set/self/script_bootstrap.rb
|
305
327
|
- set/self/script_load_select2.rb
|
306
|
-
- set/self/script_select2.rb
|
307
328
|
- set/self/smartmenu_css.rb
|
308
329
|
- set/self/smartmenu_js.rb
|
309
330
|
- set/self/style_bootstrap_cards.rb
|
data/lib/bootstrap.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
require "bootstrap/component_loader"
|
2
|
-
require "bootstrap/component"
|
3
|
-
|
4
|
-
class Bootstrap
|
5
|
-
include Delegate
|
6
|
-
extend ComponentLoader
|
7
|
-
load_components
|
8
|
-
|
9
|
-
attr_reader :context
|
10
|
-
|
11
|
-
def initialize context=nil
|
12
|
-
@context = context
|
13
|
-
end
|
14
|
-
|
15
|
-
def render *args, &block
|
16
|
-
instance_exec(*args, &block)
|
17
|
-
end
|
18
|
-
end
|
data/lib/bootstrap/basic_tags.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
# require 'component'
|
2
|
-
|
3
|
-
class Bootstrap
|
4
|
-
module BasicTags
|
5
|
-
def html content
|
6
|
-
add_content String(content).html_safe
|
7
|
-
""
|
8
|
-
end
|
9
|
-
|
10
|
-
Component.def_div_method :div, nil do |opts, extra_args|
|
11
|
-
prepend_class opts, extra_args.first if extra_args.present?
|
12
|
-
opts
|
13
|
-
end
|
14
|
-
|
15
|
-
Component.def_div_method :span, nil do |opts, extra_args|
|
16
|
-
prepend_class opts, extra_args.first if extra_args.present?
|
17
|
-
opts
|
18
|
-
end
|
19
|
-
|
20
|
-
Component.def_tag_method :tag, nil, tag: :yield do |opts, extra_args|
|
21
|
-
prepend_class opts, extra_args[1] if extra_args[1].present?
|
22
|
-
opts[:tag] = extra_args[0]
|
23
|
-
opts
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
data/lib/bootstrap/component.rb
DELETED
@@ -1,108 +0,0 @@
|
|
1
|
-
class Bootstrap
|
2
|
-
# render components of bootstrap library
|
3
|
-
class Component
|
4
|
-
extend ComponentClass
|
5
|
-
|
6
|
-
def initialize context, *args, &block
|
7
|
-
@context = context
|
8
|
-
@content = ["".html_safe]
|
9
|
-
@args = args
|
10
|
-
@child_args = []
|
11
|
-
@append = []
|
12
|
-
@wrap = []
|
13
|
-
@build_block = block
|
14
|
-
@html = Builder::XmlMarkup.new
|
15
|
-
end
|
16
|
-
|
17
|
-
def render
|
18
|
-
@rendered = render_content
|
19
|
-
end
|
20
|
-
|
21
|
-
def prepend &block
|
22
|
-
tmp = @content.pop
|
23
|
-
instance_exec(&block)
|
24
|
-
@content << tmp
|
25
|
-
end
|
26
|
-
|
27
|
-
def insert &block
|
28
|
-
instance_exec(&block)
|
29
|
-
end
|
30
|
-
|
31
|
-
def append &block
|
32
|
-
@append[-1] << block
|
33
|
-
end
|
34
|
-
|
35
|
-
def wrap tag=nil, &block
|
36
|
-
@wrap[-1] << (block_given? ? block : tag)
|
37
|
-
end
|
38
|
-
|
39
|
-
def card
|
40
|
-
@context.context.card
|
41
|
-
end
|
42
|
-
|
43
|
-
private
|
44
|
-
|
45
|
-
def tag_method_opts args, html_class, tag_opts, &tag_opts_block
|
46
|
-
opts = {}
|
47
|
-
_blah, opts, _blah = standardize_args args, &tag_opts_block if block_given?
|
48
|
-
add_classes opts, html_class, tag_opts.delete(:optional_classes)
|
49
|
-
opts
|
50
|
-
end
|
51
|
-
|
52
|
-
def render_content
|
53
|
-
# if @build_block.arity > 0
|
54
|
-
instance_exec(*@args, &@build_block)
|
55
|
-
end
|
56
|
-
|
57
|
-
def generate_content content, processor, &block
|
58
|
-
content = instance_exec(&block) if block.present?
|
59
|
-
return content if !processor || !content.is_a?(Array)
|
60
|
-
|
61
|
-
content.each { |item| send processor, item }
|
62
|
-
""
|
63
|
-
end
|
64
|
-
|
65
|
-
def with_child_args args
|
66
|
-
@child_args << args if args.present?
|
67
|
-
yield.tap { @child_args.pop if args.present? }
|
68
|
-
end
|
69
|
-
|
70
|
-
def add_content content
|
71
|
-
@content[-1] << "\n#{content}".html_safe if content.present?
|
72
|
-
end
|
73
|
-
|
74
|
-
def standardize_args args, &block
|
75
|
-
opts = standardize_opts args
|
76
|
-
items = items_from_args args
|
77
|
-
opts, args = standardize_block_args opts, args, &block if block.present?
|
78
|
-
|
79
|
-
[items, opts, args]
|
80
|
-
end
|
81
|
-
|
82
|
-
def standardize_opts args
|
83
|
-
args.last.is_a?(Hash) ? args.pop : {}
|
84
|
-
end
|
85
|
-
|
86
|
-
def items_from_args args
|
87
|
-
((args.one? && args.last.is_a?(String)) || args.last.is_a?(Array)) && args.pop
|
88
|
-
end
|
89
|
-
|
90
|
-
def standardize_block_args opts, args, &block
|
91
|
-
instance_exec(opts, args, &block).tap do |s_opts, _s_args|
|
92
|
-
unless s_opts.is_a? Hash
|
93
|
-
raise Card::Error, "first return value of a tag block has to be a hash"
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
def add_classes opts, html_class, optional_classes
|
99
|
-
prepend_class opts, html_class if html_class
|
100
|
-
Array.wrap(optional_classes).each do |k, v|
|
101
|
-
prepend_class opts, v if opts.delete k
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
include BasicTags
|
106
|
-
include Delegate
|
107
|
-
end
|
108
|
-
end
|
@@ -1,76 +0,0 @@
|
|
1
|
-
class Bootstrap
|
2
|
-
class Component
|
3
|
-
class Carousel < Component
|
4
|
-
def render_content
|
5
|
-
carousel(*@args, &@build_block)
|
6
|
-
end
|
7
|
-
|
8
|
-
def carousel id, active_index, &block
|
9
|
-
@id = id
|
10
|
-
@active_item_index = active_index
|
11
|
-
@items = []
|
12
|
-
instance_exec(&block)
|
13
|
-
|
14
|
-
@html.div class: "carousel slide", id: id, "data-ride" => "carousel" do
|
15
|
-
indicators
|
16
|
-
items
|
17
|
-
control_prev
|
18
|
-
control_next
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def item content=nil, &block
|
23
|
-
@items << (content || block)
|
24
|
-
end
|
25
|
-
|
26
|
-
def items
|
27
|
-
@html.div class: "carousel-inner", role: "listbox" do
|
28
|
-
@items.each_with_index do |item, index|
|
29
|
-
carousel_item item, carousel_item_opts(index)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
def carousel_item_opts index
|
35
|
-
{ class: "carousel-item" }.tap do |opts|
|
36
|
-
add_class opts, "active" if index == @active_item_index
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
def carousel_item item, html_opts
|
41
|
-
@html.div html_opts do
|
42
|
-
item = item.call if item.respond_to?(:call)
|
43
|
-
@html << item if item.is_a?(String)
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
def control_prev
|
48
|
-
@html.a class: "carousel-control-prev", href: "##{@id}", role: "button",
|
49
|
-
"data-slide" => "prev" do
|
50
|
-
@html.span class: "carousel-control-prev-icon", "aria-hidden" => "true"
|
51
|
-
@html.span "Previous", class: "sr-only"
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
def control_next
|
56
|
-
@html.a class: "carousel-control-next", href: "##{@id}", role: "button",
|
57
|
-
"data-slide": "next" do
|
58
|
-
@html.span class: "carousel-control-next-icon", "aria-hidden" => "true"
|
59
|
-
@html.span "Next", class: "sr-only"
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
def indicators
|
64
|
-
@html.ol class: "carousel-indicators" do
|
65
|
-
@items.size.times { |i| indicator i }
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
def indicator index
|
70
|
-
html_opts = { "data-slide-to" => index, "data-target": "##{@id}" }
|
71
|
-
add_class html_opts, "active" if index == @active_item_index
|
72
|
-
@html.li html_opts
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|