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.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/{lib/javascript → assets/script}/bootstrap_modal_decko.js +0 -0
  3. data/assets/script/manifest.yml +18 -0
  4. data/assets/script/script_colorpicker.js.coffee +3 -0
  5. data/{lib/javascript → assets/script}/script_load_select2.js.coffee +0 -0
  6. data/assets/script/script_pointer_config.js.coffee +80 -0
  7. data/assets/script/script_pointer_list_editor.js.coffee +67 -0
  8. data/db/migrate_core_cards/20180423160231_migrate_customized_bootstrap_skin.rb +1 -1
  9. data/db/migrate_core_cards/20200809112346_add_mod_card.rb +7 -0
  10. data/db/migrate_core_cards/20201129140917_remove_script_cards.rb +9 -0
  11. data/file/mod_bootstrap_script_bootstrap_machine_output/file.js +25 -0
  12. data/file/mod_bootstrap_script_pointer_machine_output/file.js +223 -0
  13. data/lib/card/bootstrap.rb +17 -0
  14. data/lib/card/bootstrap/basic_tags.rb +26 -0
  15. data/lib/card/bootstrap/component.rb +110 -0
  16. data/lib/card/bootstrap/component/carousel.rb +78 -0
  17. data/lib/card/bootstrap/component/form.rb +67 -0
  18. data/lib/card/bootstrap/component/horizontal_form.rb +65 -0
  19. data/lib/card/bootstrap/component/layout.rb +107 -0
  20. data/lib/card/bootstrap/component/panel.rb +11 -0
  21. data/lib/{bootstrap/component/component_class.rb → card/bootstrap/component_klass.rb} +5 -4
  22. data/lib/card/bootstrap/component_loader.rb +30 -0
  23. data/lib/card/bootstrap/content.rb +42 -0
  24. data/lib/card/bootstrap/delegate.rb +18 -0
  25. data/lib/card/bootstrap/old_component.rb +108 -0
  26. data/lib/card/bootstrap/tag_method.rb +56 -0
  27. data/lib/card/bootstrapper.rb +17 -0
  28. data/lib/card/tab.rb +8 -1
  29. data/lib/stylesheets/font_awesome.css +6 -6
  30. data/lib/stylesheets/material_icons.css +4 -4
  31. data/locales/en.yml +3 -0
  32. data/public/{assets/fonts → fonts}/MaterialIcons-Regular.eot +0 -0
  33. data/public/{assets/fonts → fonts}/MaterialIcons-Regular.ijmap +0 -0
  34. data/public/{assets/fonts → fonts}/MaterialIcons-Regular.svg +0 -0
  35. data/public/{assets/fonts → fonts}/MaterialIcons-Regular.ttf +0 -0
  36. data/public/{assets/fonts → fonts}/MaterialIcons-Regular.woff +0 -0
  37. data/public/{assets/fonts → fonts}/MaterialIcons-Regular.woff2 +0 -0
  38. data/public/{assets/fonts → fonts}/fa-brands-400.eot +0 -0
  39. data/public/{assets/fonts → fonts}/fa-brands-400.svg +0 -0
  40. data/public/{assets/fonts → fonts}/fa-brands-400.ttf +0 -0
  41. data/public/{assets/fonts → fonts}/fa-brands-400.woff +0 -0
  42. data/public/{assets/fonts → fonts}/fa-brands-400.woff2 +0 -0
  43. data/public/{assets/fonts → fonts}/fa-regular-400.eot +0 -0
  44. data/public/{assets/fonts → fonts}/fa-regular-400.svg +0 -0
  45. data/public/{assets/fonts → fonts}/fa-regular-400.ttf +0 -0
  46. data/public/{assets/fonts → fonts}/fa-regular-400.woff +0 -0
  47. data/public/{assets/fonts → fonts}/fa-regular-400.woff2 +0 -0
  48. data/public/{assets/fonts → fonts}/fa-solid-900.eot +0 -0
  49. data/public/{assets/fonts → fonts}/fa-solid-900.svg +0 -0
  50. data/public/{assets/fonts → fonts}/fa-solid-900.ttf +0 -0
  51. data/public/{assets/fonts → fonts}/fa-solid-900.woff +0 -0
  52. data/public/{assets/fonts → fonts}/fa-solid-900.woff2 +0 -0
  53. data/public/{assets/fonts → fonts}/glyphicons-halflings-regular.eot +0 -0
  54. data/public/{assets/fonts → fonts}/glyphicons-halflings-regular.svg +0 -0
  55. data/public/{assets/fonts → fonts}/glyphicons-halflings-regular.ttf +0 -0
  56. data/public/{assets/fonts → fonts}/glyphicons-halflings-regular.woff +0 -0
  57. data/public/{assets/fonts → fonts}/glyphicons-halflings-regular.woff2 +0 -0
  58. data/set/abstract/bootswatch_theme.rb +2 -2
  59. data/set/all/bootstrap/icon.rb +3 -1
  60. metadata +78 -57
  61. data/lib/bootstrap.rb +0 -18
  62. data/lib/bootstrap/basic_tags.rb +0 -26
  63. data/lib/bootstrap/component.rb +0 -108
  64. data/lib/bootstrap/component/carousel.rb +0 -76
  65. data/lib/bootstrap/component/form.rb +0 -65
  66. data/lib/bootstrap/component/horizontal_form.rb +0 -63
  67. data/lib/bootstrap/component/layout.rb +0 -105
  68. data/lib/bootstrap/component/panel.rb +0 -9
  69. data/lib/bootstrap/component_loader.rb +0 -28
  70. data/lib/bootstrap/content.rb +0 -40
  71. data/lib/bootstrap/delegate.rb +0 -16
  72. data/lib/bootstrap/old_component.rb +0 -103
  73. data/lib/bootstrap/tag_method.rb +0 -54
  74. data/lib/bootstrapper.rb +0 -16
  75. data/set/self/script_bootstrap.rb +0 -12
  76. data/set/self/script_select2.rb +0 -12
@@ -1,65 +0,0 @@
1
- class Bootstrap
2
- class Component
3
- class Form < Component
4
- def render_content *args
5
- form(*args, &@build_block)
6
- end
7
-
8
- #
9
- # def_tag_method :form, nil, optional_classes: {
10
- # horizontal: "form-horizontal",
11
- # inline: "form-inline"
12
- # }
13
- # def_div_method :group, "form-group"
14
- # def_tag_method :label, nil
15
- # def_tag_method :input, "form-control" do |opts, extra_args|
16
- # type, label = extra_args
17
- # prepend { label label, for: opts[:id] } if label
18
- # opts[:type] = type
19
- # opts
20
- # end
21
-
22
- def form opts={}, &block
23
- add_class opts, "form-horizontal" if opts.delete(:horizontal)
24
- add_class opts, "form-inline" if opts.delete(:inline)
25
- @html.form opts do
26
- instance_exec(&block)
27
- end
28
- end
29
-
30
- def group text=nil, &block
31
- @html.div text, class: "form-group" do
32
- instance_exec(&block)
33
- end
34
- end
35
-
36
- def label text=nil, &block
37
- @html.label text, &block
38
- end
39
-
40
- def input type, text: nil, label: nil, id: nil
41
- @html.input id: id, class: "form-control", type: type do
42
- @html.label label, for: id if label
43
- @html << text if text
44
- end
45
- end
46
-
47
- %i[text password datetime datetime-local date month time
48
- week number email url search tel color].each do |tag|
49
- # def_tag_method tag, "form-control", attributes: { type: tag },
50
- # tag: :input do |opts, extra_args|
51
- # label, = extra_args
52
- # prepend { label label, for: opts[:id] } if label
53
- # opts
54
- # end
55
-
56
- define_method tag do |id:, label:, text: nil|
57
- @html.input id: id, class: "form-control", type: tag do
58
- @html.label label, for: id if label
59
- @html << text
60
- end
61
- end
62
- end
63
- end
64
- end
65
- end
@@ -1,63 +0,0 @@
1
- class Bootstrap
2
- class Component
3
- class HorizontalForm < Form
4
- def left_col_width
5
- @child_args.last && @child_args.last[0] || 2
6
- end
7
-
8
- def right_col_width
9
- @child_args.last && @child_args.last[1] || 10
10
- end
11
-
12
- def_tag_method :form, "form-horizontal"
13
-
14
- def_tag_method :label, "control-label" do |opts, _extra_args|
15
- prepend_class opts, "col-sm-#{left_col_width}"
16
- opts
17
- end
18
-
19
- # def_div_method :input, nil do |opts, extra_args, &block|
20
- # type, label = extra_args
21
- # prepend { tag(:label, nil, for: opts[:id]) { label } } if label
22
- # insert { inner_input opts.merge(type: type) }
23
- # { class: "col-sm-#{right_col_width}" }
24
- # end
25
-
26
- def label_col label, id:
27
- @html.label label, for: id, class: "col-sm-#{left_col_width} control-label"
28
- end
29
-
30
- def input type, label:, id:
31
- label_col label, id: id
32
- @html.div class: "col-sm-#{right_col_width}" do
33
- @html.input type: type, id: id, class: "form-control"
34
- end
35
- # block.call class: "col-sm-#{right_col_width}" do
36
- # inner_input opts.merge(type: type)
37
- # end
38
- end
39
-
40
- def_tag_method :inner_input, "form-control", tag: :input
41
- def_div_method :inner_checkbox, "checkbox"
42
-
43
- def_div_method :checkbox, nil do |opts, extra_args|
44
- inner_checkbox do
45
- label do
46
- inner_input "checkbox", extra_args.first, opts
47
- end
48
- end
49
- { class: "col-sm-offset-#{left_col_width} col-sm-#{right_col_width}" }
50
- end
51
-
52
- def checkbox _text, _extra_args
53
- @html.div class: "col-sm-offset-#{left_col_width} col-sm-#{right_col_width}" do
54
- @html.div class: "checkbox" do
55
- label_cllabel do
56
- inner_input "checkbox"
57
- end
58
- end
59
- end
60
- end
61
- end
62
- end
63
- end
@@ -1,105 +0,0 @@
1
- class Bootstrap
2
- class Component
3
- # generate bootstrap column layout
4
- # @example
5
- # layout container: true, fluid: true, class: "hidden" do
6
- # row 6, 6, class: "unicorn" do
7
- # column "horn",
8
- # column "rainbow", class: "colorful"
9
- # end
10
- # end
11
- # @example
12
- # layout do
13
- # row 3, 3, 4, 2, class: "unicorn" do
14
- # [ "horn", "body", "tail", "rainbow"]
15
- # end
16
- # add_html "<span> some extra html</span>"
17
- # row 6, 6, ["unicorn", "rainbow"], class: "horn"
18
- # end
19
- class Layout < OldComponent
20
- def render
21
- @rendered = begin
22
- render_content
23
- @content[-1]
24
- end
25
- end
26
-
27
- def render_content
28
- content = instance_exec(*@args, &@build_block)
29
- add_content content
30
- opts = @args.first
31
- return unless opts&.delete(:container)
32
-
33
- content = @content.pop
34
- @content = ["".html_safe]
35
- container content, opts
36
- end
37
-
38
- add_div_method :container, nil do |opts, _extra_args|
39
- prepend_class opts, opts.delete(:fluid) ? "container-fluid" : "container"
40
- opts
41
- end
42
-
43
- # @param args column widths, column content and html attributes
44
- # @example
45
- # row 6, 6, ["col one", "col two"], class: "count", id: "count"
46
- # @example
47
- # row md: 12, xs: 8, "single column content"
48
- # @example
49
- # row md: [1, 11], xs: [2, 10] do
50
- # col "A"
51
- # col "B"
52
- # end
53
- add_div_method :row, "row", content_processor: :column do |opts, extra_args|
54
- cols_content = extra_args.pop if extra_args.last.is_a? Array
55
- [opts, col_widths(extra_args, opts), cols_content].compact
56
- end
57
-
58
- # default column width type is for medium devices (col-md-)
59
- add_div_method :column, nil do |opts, _extra_args|
60
- @child_args.last.each do |medium, size|
61
- if medium == :xs
62
- prepend_class opts, "col-#{size.shift}"
63
- else
64
- prepend_class opts, "col-#{medium}-#{size.shift}"
65
- end
66
- end
67
- opts
68
- end
69
-
70
- alias_method :col, :column
71
-
72
- private
73
-
74
- def standardize_row_args args
75
- opts = args.last.is_a?(Hash) ? args.pop : {}
76
- cols = (args.last.is_a?(Array) || args.last.is_a?(String)) &&
77
- Array.wrap(args.pop)
78
- [cols, opts, col_widths(args, opts)]
79
- end
80
-
81
- def col_widths args, opts
82
- opts = args.pop if args.one? && args.last.is_a?(Hash)
83
- if args.present?
84
- col_widths_from_args args
85
- else
86
- col_widths_from_opts opts
87
- end
88
- end
89
-
90
- def col_widths_from_args args
91
- raise Error, "bad argument" unless args.all? { |a| a.is_a? Integer }
92
-
93
- { md: Array.wrap(args) }
94
- end
95
-
96
- def col_widths_from_opts opts
97
- %i[lg xs sm md].each_with_object({}) do |k, cols_w|
98
- next unless (widths = opts.delete(k))
99
-
100
- cols_w[k] = Array.wrap widths
101
- end
102
- end
103
- end
104
- end
105
- end
@@ -1,9 +0,0 @@
1
- class Bootstrap
2
- class Component
3
- class Panel < OldComponent
4
- def_div_method :panel, "card"
5
- def_div_method :heading, "card-header"
6
- def_div_method :body, "card-body"
7
- end
8
- end
9
- end
@@ -1,28 +0,0 @@
1
- class Bootstrap
2
- module ComponentLoader
3
- def load_components
4
- components.each do |component|
5
- require_relative "component/#{component}"
6
- include_component component
7
- end
8
- end
9
-
10
- def include_component component
11
- component_class = to_const component.camelcase
12
- define_method component do |*args, &block|
13
- component_class.render self, *args, &block
14
- end
15
- end
16
-
17
- def components
18
- path = File.expand_path "component/*.rb", __dir__
19
- Dir.glob(path).map do |file|
20
- File.basename file, ".rb"
21
- end
22
- end
23
-
24
- def to_const name
25
- self.class.const_get "::Bootstrap::Component::#{name.camelcase}"
26
- end
27
- end
28
- end
@@ -1,40 +0,0 @@
1
- class Bootstrap
2
- # shared methods for OldComponent and TagMethod
3
- module Content
4
- private
5
-
6
- def process_collected_content tag_name, opts
7
- collected_content = @content.pop
8
- tag_name = opts.delete(:tag) if tag_name == :yield
9
- add_content content_tag(tag_name, collected_content, opts, false)
10
- end
11
-
12
- def process_content &content_block
13
- content, opts = yield
14
- wrappers = @wrap.pop
15
- if wrappers.present?
16
- process_wrappers wrappers, content, &content_block
17
- else
18
- add_content content
19
- end
20
- opts
21
- end
22
-
23
- def process_append
24
- @append.pop.each do |block|
25
- add_content instance_exec(&block)
26
- end
27
- end
28
-
29
- def process_wrappers wrappers, content, &content_block
30
- while wrappers.present?
31
- wrapper = wrappers.shift
32
- if wrapper.is_a? Symbol
33
- send wrapper, &content_block
34
- else
35
- instance_exec content, &wrappers.shift
36
- end
37
- end
38
- end
39
- end
40
- end
@@ -1,16 +0,0 @@
1
- class Bootstrap
2
- module Delegate
3
- def method_missing method_name, *args, &block
4
- # return super unless @context.respond_to? method_name
5
- if block_given?
6
- @context.send(method_name, *args, &block)
7
- else
8
- @context.send(method_name, *args)
9
- end
10
- end
11
-
12
- def respond_to_missing? method_name, _include_private=false
13
- @context.respond_to? method_name
14
- end
15
- end
16
- end
@@ -1,103 +0,0 @@
1
- class Bootstrap
2
- # not-yet-obviated component handling
3
- class OldComponent < Component
4
- include Content
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
- end
15
-
16
- class << self
17
- def render format, *args, &block
18
- new(format, *args, &block).render
19
- end
20
-
21
- # Like add_tag_method but always generates a div tag
22
- # The tag option is not available
23
- def add_div_method name, html_class, opts={}, &tag_block
24
- add_tag_method name, html_class, opts.merge(tag: :div), &tag_block
25
- end
26
-
27
- # Defines a method that generates a html tag
28
- # @param name [Symbol, String] the name of the method. If no :tag option in tag_opts is defined then the name is also the name of the tag that the method generates
29
- # @param html_class [String] a html class that is added to tag. Use nil if you don't want a html_class
30
- # @param tag_opts [Hash] additional argument that will be added to the tag
31
- # @option tag_opts [Symbol, String] tag the name of the tag
32
- # @example
33
- # add_tag_method :link, "known-link", tag: :a, id: "uniq-link"
34
- # link # => <a class="known-link" id="uniq-link"></a>
35
- def add_tag_method name, html_class, tag_opts={}, &tag_block
36
- define_method name do |*args, &block|
37
- process_tag tag_opts[:tag] || name do
38
- content, opts, new_child_args = standardize_args args, &tag_block
39
- add_classes opts, html_class, tag_opts.delete(:optional_classes)
40
- if (attributes = tag_opts.delete(:attributes))
41
- opts.merge! attributes
42
- end
43
-
44
- content = with_child_args new_child_args do
45
- generate_content content,
46
- tag_opts[:content_processor],
47
- &block
48
- end
49
-
50
- [content, opts]
51
- end
52
- end
53
- end
54
-
55
- alias_method :def_div_method, :add_div_method
56
- alias_method :def_tag_method, :add_tag_method
57
- end
58
-
59
- def render
60
- @rendered = begin
61
- render_content
62
- @content[-1]
63
- end
64
- end
65
-
66
- private
67
-
68
- def process_tag tag_name, &content_block
69
- @content.push "".html_safe
70
- @append << []
71
- @wrap << []
72
-
73
- opts = process_content(&content_block)
74
- process_collected_content tag_name, opts
75
- process_append
76
- ""
77
- end
78
-
79
- # include BasicTags
80
- def html content
81
- add_content String(content).html_safe
82
- ""
83
- end
84
-
85
- add_div_method :div, nil do |opts, extra_args|
86
- prepend_class opts, extra_args.first if extra_args.present?
87
- opts
88
- end
89
-
90
- add_div_method :span, nil do |opts, extra_args|
91
- prepend_class opts, extra_args.first if extra_args.present?
92
- opts
93
- end
94
-
95
- add_tag_method :tag, nil, tag: :yield do |opts, extra_args|
96
- prepend_class opts, extra_args[1] if extra_args[1].present?
97
- opts[:tag] = extra_args[0]
98
- opts
99
- end
100
-
101
- include Delegate
102
- end
103
- end
@@ -1,54 +0,0 @@
1
- class Bootstrap
2
- # support html tag generation
3
- class TagMethod
4
- include Content
5
-
6
- def initialize component, name, html_class, tag_opts={}, &tag_block
7
- @component = component
8
- @name = name
9
- @html_class = html_class
10
- @tag_opts = tag_opts
11
- @tag_block = tag_block
12
- @append = []
13
- @wrap = []
14
- @xm = Builder::XmlMarkup.new
15
- end
16
-
17
- def call *_args, &content_block
18
- component.content.push "".html_safe
19
-
20
- opts = process_content(&content_block)
21
- process_collected_content tag_name, opts
22
- process_append
23
- ""
24
- end
25
-
26
- def method_missing method, *args, &block
27
- return super unless respond_to_missing? method
28
-
29
- @component.send method, *args, &block
30
- end
31
-
32
- def respond_to_missing? method, _include_private=false
33
- @component.respond_to? method
34
- end
35
-
36
- def prepend &block
37
- tmp = @content.pop
38
- instance_exec(&block)
39
- @content << tmp
40
- end
41
-
42
- def wrap &block
43
- instance_exec(&block)
44
- end
45
-
46
- def append &block
47
- @append[-1] << block
48
- end
49
-
50
- def wrapInner tag=nil, &block
51
- @wrap[-1] << (block_given? ? block : tag)
52
- end
53
- end
54
- end