card-mod-bootstrap 0.11.2 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/db/migrate_core_cards/20170719163733_update_bootswatch_themes_to_4_beta.rb +1 -2
  3. data/db/migrate_core_cards/20170726111053_add_bootstrap_mixins.rb +2 -2
  4. data/db/migrate_core_cards/20170726145012_select2.rb +2 -2
  5. data/db/migrate_core_cards/20180423160231_migrate_customized_bootstrap_skin.rb +1 -0
  6. data/db/migrate_core_cards/20180423170283_add_type_bootswatch_skin.rb +1 -0
  7. data/db/migrate_core_cards/20180425174433_delete_deprecated_skin_cards.rb +1 -0
  8. data/db/migrate_core_cards/20181129140917_fix_skin_images.rb +0 -1
  9. data/db/migrate_core_cards/data/20181108181219_migrate_classic_skins_to_bootstrap.rb +1 -0
  10. data/db/migrate_core_cards/lib/skin.rb +1 -1
  11. data/lib/card/bootstrap.rb +17 -0
  12. data/lib/card/bootstrap/basic_tags.rb +26 -0
  13. data/lib/card/bootstrap/component.rb +110 -0
  14. data/lib/card/bootstrap/component/carousel.rb +78 -0
  15. data/lib/card/bootstrap/component/form.rb +67 -0
  16. data/lib/card/bootstrap/component/horizontal_form.rb +65 -0
  17. data/lib/card/bootstrap/component/layout.rb +107 -0
  18. data/lib/card/bootstrap/component/panel.rb +11 -0
  19. data/lib/card/bootstrap/component_klass.rb +37 -0
  20. data/lib/card/bootstrap/component_loader.rb +30 -0
  21. data/lib/card/bootstrap/content.rb +42 -0
  22. data/lib/card/bootstrap/delegate.rb +18 -0
  23. data/lib/card/bootstrap/old_component.rb +108 -0
  24. data/lib/card/bootstrap/tag_method.rb +56 -0
  25. data/lib/card/bootstrapper.rb +17 -0
  26. data/lib/card/tab.rb +8 -1
  27. data/set/abstract/bootstrap_code_file.rb +0 -1
  28. data/set/abstract/bootswatch_theme.rb +1 -0
  29. data/set/abstract/bs_badge/tab_badge.haml +1 -1
  30. data/set/all/bootstrap/dropdown.rb +12 -4
  31. data/set/all/bootstrap/helper.rb +18 -11
  32. data/set/all/bootstrap/icon.rb +3 -1
  33. data/set/all/bootstrap/table.rb +1 -0
  34. data/set/all/bootstrap/wrapper.rb +2 -4
  35. data/set/self/bootstrap_core.rb +7 -8
  36. data/set/type/customized_bootswatch_skin.rb +11 -7
  37. data/set/type_plus_right/customized_bootswatch_skin/colors.rb +3 -2
  38. metadata +28 -27
  39. data/lib/bootstrap.rb +0 -16
  40. data/lib/bootstrap/basic_tags.rb +0 -26
  41. data/lib/bootstrap/component.rb +0 -139
  42. data/lib/bootstrap/component/carousel.rb +0 -68
  43. data/lib/bootstrap/component/form.rb +0 -65
  44. data/lib/bootstrap/component/horizontal_form.rb +0 -63
  45. data/lib/bootstrap/component/layout.rb +0 -95
  46. data/lib/bootstrap/component/panel.rb +0 -9
  47. data/lib/bootstrap/component_loader.rb +0 -28
  48. data/lib/bootstrap/content.rb +0 -40
  49. data/lib/bootstrap/delegate.rb +0 -16
  50. data/lib/bootstrap/old_component.rb +0 -103
  51. data/lib/bootstrap/tag_method.rb +0 -54
  52. data/lib/bootstrapper.rb +0 -16
@@ -1,4 +1,3 @@
1
-
2
1
  def self.included host_class
3
2
  host_class.include_set Abstract::CodeFile
4
3
  host_class.include OverrideCodeFile
@@ -142,6 +142,7 @@ end
142
142
  def scss_from_theme_file file
143
143
  return "" unless (path = ::File.join(source_dir, "_#{file}.scss")) &&
144
144
  ::File.exist?(path)
145
+
145
146
  ::File.read path
146
147
  end
147
148
 
@@ -1,5 +1,5 @@
1
1
  %div.tab-badge.count-number.clearfix{ class: klass }
2
2
  %span.badge.badge-secondary{ class: "badge-#{color}" }
3
- = count
3
+ = number_with_delimiter count
4
4
  %span.badge-label
5
5
  = label
@@ -57,19 +57,27 @@ format :html do
57
57
  return unless item
58
58
 
59
59
  if item.is_a? Array
60
- [dropdown_header(item.first), dropdown_array_list(item.second)]
60
+ formatted_dropdown_list_item item
61
61
  else
62
- "<li class='dropdown-item#{' active' if active_test == active}'>#{item}</li>"
62
+ simple_dropdown_list_item item, (active_test == active)
63
63
  end
64
64
  end
65
65
 
66
+ def formatted_dropdown_list_item item
67
+ [dropdown_header(item.first), dropdown_array_list(item.second)]
68
+ end
69
+
70
+ def simple_dropdown_list_item item, active
71
+ "<li class='dropdown-item#{' active' if active}'>#{item}</li>"
72
+ end
73
+
66
74
  def split_button_toggle
67
- wrap_with(:a,
75
+ wrap_with :a,
68
76
  href: "#",
69
77
  class: "nav-link pl-0 dropdown-toggle dropdown-toggle-split",
70
78
  "data-toggle" => "dropdown",
71
79
  "aria-haspopup" => "true",
72
- "aria-expanded" => "false") do
80
+ "aria-expanded" => "false" do
73
81
  '<span class="sr-only">Toggle Dropdown</span>'
74
82
  end
75
83
  end
@@ -23,21 +23,28 @@ format :html do
23
23
  add_class options[:items], "list-group-item"
24
24
  end
25
25
 
26
- def list_tag content_or_options=nil, options={}
27
- options = content_or_options if block_given?
28
- content = block_given? ? yield : content_or_options
29
- content = Array(content)
26
+ def list_tag content_or_options=nil, options={}, &block
27
+ content, options = list_tag_content_and_options content_or_options, options, &block
30
28
  default_item_options = options.delete(:items) || {}
31
- tag = options[:ordered] ? :ol : :ul
32
- wrap_with tag, options do
33
- content.map do |item|
34
- i_content, i_opts = item
35
- i_opts ||= default_item_options
36
- wrap_with :li, i_content, i_opts
37
- end
29
+ wrap_with (options[:ordered] ? :ol : :ul), options do
30
+ list_items content, default_item_options
31
+ end
32
+ end
33
+
34
+ def list_items content, default_item_options
35
+ content.map do |item|
36
+ i_content, i_opts = item
37
+ i_opts ||= default_item_options
38
+ wrap_with :li, i_content, i_opts
38
39
  end
39
40
  end
40
41
 
42
+ def list_tag_content_and_options content_or_options, options
43
+ options = content_or_options if block_given?
44
+ content = block_given? ? yield : content_or_options
45
+ [Array(content), options]
46
+ end
47
+
41
48
  def badge_tag content, options={}
42
49
  add_class options, "badge"
43
50
  wrap_with :span, content, options
@@ -96,7 +96,9 @@ format :html do
96
96
  end
97
97
 
98
98
  def font_awesome_icon_tag icon, opts={}
99
- prepend_class opts, "fa fa-#{icon_class(:font_awesome, icon)}"
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
 
@@ -17,6 +17,7 @@ format :html do
17
17
 
18
18
  def header
19
19
  return unless @header
20
+
20
21
  tag :thead do
21
22
  tag :tr do
22
23
  @header.map do |item|
@@ -1,6 +1,6 @@
1
1
  format :html do
2
2
  def frame
3
- class_up "d0-card-header" , "card-header"
3
+ class_up "d0-card-header", "card-header"
4
4
  class_up "d0-card-body", "card-body card-text"
5
5
  super
6
6
  end
@@ -14,7 +14,5 @@ format :html do
14
14
  super
15
15
  end
16
16
 
17
- def panel_state
18
- end
17
+ def panel_state; end
19
18
  end
20
-
@@ -3,13 +3,12 @@ include_set Abstract::BootstrapCodeFile
3
3
  def load_stylesheets
4
4
  add_bs_stylesheet "variables"
5
5
  add_bs_subdir "mixins"
6
- %w[ print reboot type images code grid tables forms buttons transitions dropdown
7
- button-group input-group custom-forms nav navbar card breadcrumb pagination badge
8
- jumbotron alert progress media list-group close modal tooltip popover carousel
9
- ].each do |name|
10
- add_bs_stylesheet name
11
- end
6
+ %w[
7
+ print reboot type images code grid tables forms buttons transitions dropdown
8
+ button-group input-group custom-forms nav navbar card breadcrumb pagination badge
9
+ jumbotron alert progress media list-group close modal tooltip popover carousel
10
+ ].each do |name|
11
+ add_bs_stylesheet name
12
+ end
12
13
  add_bs_subdir "utilities"
13
14
  end
14
-
15
-
@@ -37,13 +37,17 @@ def theme_codename
37
37
  end
38
38
 
39
39
  event :validate_theme_template, :validate, on: :create do
40
- if theme_name
41
- if Card.fetch_type_id(theme_card_name) != Card::BootswatchSkinID
42
- errors.add :abort, tr(:not_valid_theme, theme_name: theme_name)
43
- elsif !Dir.exist? source_dir
44
- puts method(:source_dir).source_location
45
- errors.add :abort, tr(:cannot_source_theme, theme_name: theme_name)
46
- end
40
+ return unless (tname = theme_name) && (etype = theme_error_type)
41
+
42
+ errors.add :abort, t("bootstrap_#{etype}", theme_name: tname)
43
+ end
44
+
45
+ def theme_error_type
46
+ if Card.fetch_type_id(theme_card_name) != Card::BootswatchSkinID
47
+ :not_valid_theme
48
+ elsif !Dir.exist? source_dir
49
+ # puts method(:source_dir).source_location
50
+ :cannot_source_theme
47
51
  end
48
52
  end
49
53
 
@@ -27,11 +27,12 @@ end
27
27
 
28
28
  def value_from_variables_card name
29
29
  return unless (var_card = left.variables_card) && var_card.content.present?
30
+
30
31
  value_from_scss name, var_card.content
31
32
  end
32
33
 
33
34
  def definition_regex name
34
- /^(?<before>\s*\$#{name}\:\s*)(?<value>.+?)(?<after> !default;)$/
35
+ /^(?<before>\s*\$#{name}:\s*)(?<value>.+?)(?<after> !default;)$/
35
36
  end
36
37
 
37
38
  def default_value_from_bootstrap name
@@ -109,5 +110,5 @@ def replace_values group, prefix=""
109
110
  end
110
111
 
111
112
  def variable_values_from_params group
112
- Env.params.dig(group)&.slice(*VARIABLE_NAMES[group]) || {}
113
+ Env.params[group]&.slice(*VARIABLE_NAMES[group]) || {}
113
114
  end
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.11.2
4
+ version: 0.12.0
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-03-15 00:00:00.000000000 Z
13
+ date: 2021-07-05 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: card
@@ -18,70 +18,70 @@ dependencies:
18
18
  requirements:
19
19
  - - '='
20
20
  - !ruby/object:Gem::Version
21
- version: 1.101.2
21
+ version: 1.102.0
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.101.2
28
+ version: 1.102.0
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: card-mod-edit
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
33
  - - '='
34
34
  - !ruby/object:Gem::Version
35
- version: 0.11.2
35
+ version: 0.12.0
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - '='
41
41
  - !ruby/object:Gem::Version
42
- version: 0.11.2
42
+ version: 0.12.0
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: card-mod-bar_and_box
45
45
  requirement: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - '='
48
48
  - !ruby/object:Gem::Version
49
- version: 0.11.2
49
+ version: 0.12.0
50
50
  type: :runtime
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
54
  - - '='
55
55
  - !ruby/object:Gem::Version
56
- version: 0.11.2
56
+ version: 0.12.0
57
57
  - !ruby/object:Gem::Dependency
58
58
  name: card-mod-style
59
59
  requirement: !ruby/object:Gem::Requirement
60
60
  requirements:
61
61
  - - '='
62
62
  - !ruby/object:Gem::Version
63
- version: 0.11.2
63
+ version: 0.12.0
64
64
  type: :runtime
65
65
  prerelease: false
66
66
  version_requirements: !ruby/object:Gem::Requirement
67
67
  requirements:
68
68
  - - '='
69
69
  - !ruby/object:Gem::Version
70
- version: 0.11.2
70
+ version: 0.12.0
71
71
  - !ruby/object:Gem::Dependency
72
72
  name: card-mod-script
73
73
  requirement: !ruby/object:Gem::Requirement
74
74
  requirements:
75
75
  - - '='
76
76
  - !ruby/object:Gem::Version
77
- version: 0.11.2
77
+ version: 0.12.0
78
78
  type: :runtime
79
79
  prerelease: false
80
80
  version_requirements: !ruby/object:Gem::Requirement
81
81
  requirements:
82
82
  - - '='
83
83
  - !ruby/object:Gem::Version
84
- version: 0.11.2
84
+ version: 0.12.0
85
85
  description: ''
86
86
  email:
87
87
  - info@decko.org
@@ -226,20 +226,21 @@ files:
226
226
  - file/yeti_skin_image/image-medium.png
227
227
  - file/yeti_skin_image/image-original.png
228
228
  - 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/form.rb
234
- - lib/bootstrap/component/horizontal_form.rb
235
- - lib/bootstrap/component/layout.rb
236
- - lib/bootstrap/component/panel.rb
237
- - lib/bootstrap/component_loader.rb
238
- - lib/bootstrap/content.rb
239
- - lib/bootstrap/delegate.rb
240
- - lib/bootstrap/old_component.rb
241
- - lib/bootstrap/tag_method.rb
242
- - lib/bootstrapper.rb
229
+ - lib/card/bootstrap.rb
230
+ - lib/card/bootstrap/basic_tags.rb
231
+ - lib/card/bootstrap/component.rb
232
+ - lib/card/bootstrap/component/carousel.rb
233
+ - lib/card/bootstrap/component/form.rb
234
+ - lib/card/bootstrap/component/horizontal_form.rb
235
+ - lib/card/bootstrap/component/layout.rb
236
+ - lib/card/bootstrap/component/panel.rb
237
+ - lib/card/bootstrap/component_klass.rb
238
+ - lib/card/bootstrap/component_loader.rb
239
+ - lib/card/bootstrap/content.rb
240
+ - lib/card/bootstrap/delegate.rb
241
+ - lib/card/bootstrap/old_component.rb
242
+ - lib/card/bootstrap/tag_method.rb
243
+ - lib/card/bootstrapper.rb
243
244
  - lib/card/lazy_tab.rb
244
245
  - lib/card/tab.rb
245
246
  - lib/javascript/bootstrap_modal_decko.js
@@ -2993,7 +2994,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
2993
2994
  - !ruby/object:Gem::Version
2994
2995
  version: '0'
2995
2996
  requirements: []
2996
- rubygems_version: 3.0.3
2997
+ rubygems_version: 3.2.15
2997
2998
  signing_key:
2998
2999
  specification_version: 4
2999
3000
  summary: Bootstrap
data/lib/bootstrap.rb DELETED
@@ -1,16 +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
- def initialize context=nil
10
- @context = context
11
- end
12
-
13
- def render *args, &block
14
- instance_exec *args, &block
15
- end
16
- end
@@ -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
@@ -1,139 +0,0 @@
1
- class Bootstrap
2
- # render components of bootstrap library
3
- class Component
4
- def initialize context, *args, &block
5
- @context = context
6
- @content = ["".html_safe]
7
- @args = args
8
- @child_args = []
9
- @append = []
10
- @wrap = []
11
- @build_block = block
12
- @html = Builder::XmlMarkup.new
13
- end
14
-
15
- class << self
16
- def render format, *args, &block
17
- new(format, *args, &block).render
18
- end
19
-
20
- # Like def_tag_method but always generates a div tag
21
- # The tag option is not available
22
- def def_div_method name, html_class, opts={}, &tag_block
23
- def_tag_method name, html_class, opts.merge(tag: :div), &tag_block
24
- end
25
-
26
- # Defines a method that generates a html tag
27
- # @param method_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
28
- # @param html_class [String] a html class that is added to tag. Use nil if you don't want a html_class
29
- # @param tag_opts [Hash] additional argument that will be added to the tag
30
- # @option tag_opts [Symbol, String] tag the name of the tag
31
- # @example
32
- # def_tag_method :link, "known-link", tag: :a, id: "uniq-link"
33
- # link # => <a class="known-link" id="uniq-link"></a>
34
- def def_tag_method method_name, html_class, tag_opts={}, &tag_opts_block
35
- tag = tag_opts.delete(:tag) || method_name
36
- return def_simple_tag_method method_name, tag, html_class, tag_opts unless block_given?
37
-
38
- define_method method_name do |*args, &content_block|
39
- content, opts, new_child_args = standardize_args args, &tag_opts_block
40
- add_classes opts, html_class, tag_opts.delete(:optional_classes)
41
-
42
- @html.tag! tag, opts do
43
- instance_exec(&content_block)
44
- end
45
- end
46
- end
47
-
48
- def def_simple_tag_method method_name, tag, html_class, tag_opts={}
49
- define_method method_name do |*args, &content_block|
50
- @html.tag! tag, class: html_class do
51
- instance_exec &content_block
52
- end
53
- end
54
- end
55
- end
56
-
57
- def render
58
- @rendered = begin
59
- render_content
60
- # @content[-1]
61
- end
62
- end
63
-
64
- def prepend &block
65
- tmp = @content.pop
66
- instance_exec(&block)
67
- @content << tmp
68
- end
69
-
70
- def insert &block
71
- instance_exec(&block)
72
- end
73
-
74
- def append &block
75
- @append[-1] << block
76
- end
77
-
78
- def wrap tag=nil, &block
79
- @wrap[-1] << (block_given? ? block : tag)
80
- end
81
-
82
- private
83
-
84
- def render_content
85
- # if @build_block.arity > 0
86
- instance_exec *@args, &@build_block
87
- end
88
-
89
- def generate_content content, processor, &block
90
- content = instance_exec &block if block.present?
91
- return content if !processor || !content.is_a?(Array)
92
- content.each {|item| send processor, item}
93
- ""
94
- end
95
-
96
- def with_child_args args
97
- @child_args << args if args.present?
98
- yield.tap { @child_args.pop if args.present? }
99
- end
100
-
101
- def add_content content
102
- @content[-1] << "\n#{content}".html_safe if content.present?
103
- end
104
-
105
- def standardize_args args, &block
106
- opts = standardize_opts args
107
- items = items_from_args args
108
- opts, args = standardize_block_args opts, args, &block if block.present?
109
-
110
- [items, opts, args]
111
- end
112
-
113
- def standardize_opts args
114
- args.last.is_a?(Hash) ? args.pop : {}
115
- end
116
-
117
- def items_from_args args
118
- ((args.one? && args.last.is_a?(String)) || args.last.is_a?(Array)) && args.pop
119
- end
120
-
121
- def standardize_block_args opts, args, &block
122
- instance_exec(opts, args, &block).tap do |s_opts, _s_args|
123
- unless s_opts.is_a? Hash
124
- raise Card::Error, "first return value of a tag block has to be a hash"
125
- end
126
- end
127
- end
128
-
129
- def add_classes opts, html_class, optional_classes
130
- prepend_class opts, html_class if html_class
131
- Array.wrap(optional_classes).each do |k, v|
132
- prepend_class opts, v if opts.delete k
133
- end
134
- end
135
-
136
- include BasicTags
137
- include Delegate
138
- end
139
- end