ui_bibz 3.0.0.beta15 → 3.0.0.beta16

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a24ee2f7f963d13b2f79652d8e02c196072e3d674c1f528a92b121598f6ccd08
4
- data.tar.gz: 9dd65d798d69e14c08de9c5e2fd6c198e0df7def2fe06e22341124f1a96e2d05
3
+ metadata.gz: ffa18823b220fe50b0aab6b3b25e06d184bc514266edaf8a24e47345e8816001
4
+ data.tar.gz: c189f21d3f6ad9943f8fc9ce303eb9578d1159366a7fc3340d9a5fed8205d9ad
5
5
  SHA512:
6
- metadata.gz: f634662ead3cda0d2d6898352f9634666c3282d3e066a18eed7c76e3dd03b955b7cc465955584140d81a3d73e38f443fd537756f684d9d01e1831d6dc6cc90e0
7
- data.tar.gz: 2d7b682c66482d611ec5ac47751027529caa59b5672bab233e9c413b0e3c45e82ec69c471330aae1a05002ea41aa353fd35de33e5677aa41b8ff3e70bf91e42b
6
+ metadata.gz: 53ef82ec6ccc0bd9f4036887402fef838f6e206d2ce59282fd3b9571eaa1b960767607e99286bb515e95d801c8c8a4c4f7750c219096bed99b49ccd55cabc37c
7
+ data.tar.gz: 7e4f7f43e3fb0e1830eafc73b35c6901184586973db3d5964b06de5e27503edbee78d945f8203104effc617c3a4b0263a8903fd5d7cc0193a83a4e6c626b22ea
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ui_bibz (3.0.0.beta15)
4
+ ui_bibz (3.0.0.beta16)
5
5
  will-paginate-i18n
6
6
  will_paginate (~> 3.3.0)
7
7
  will_paginate-bootstrap4
@@ -65,7 +65,7 @@ GEM
65
65
  tzinfo (~> 1.1)
66
66
  zeitwerk (~> 2.2, >= 2.2.2)
67
67
  ast (2.4.2)
68
- awesome_print (1.8.0)
68
+ awesome_print (1.9.2)
69
69
  builder (3.2.4)
70
70
  byebug (11.1.3)
71
71
  childprocess (4.0.0)
@@ -113,8 +113,8 @@ GEM
113
113
  mimemagic (0.3.5)
114
114
  mini_mime (1.0.2)
115
115
  mini_portile2 (2.5.0)
116
- minitest (5.14.3)
117
- nio4r (2.5.5)
116
+ minitest (5.14.4)
117
+ nio4r (2.5.7)
118
118
  nokogiri (1.11.1)
119
119
  mini_portile2 (~> 2.5.0)
120
120
  racc (~> 1.4)
@@ -156,9 +156,9 @@ GEM
156
156
  thor (>= 0.20.3, < 2.0)
157
157
  rainbow (3.0.0)
158
158
  rake (13.0.3)
159
- regexp_parser (2.0.3)
159
+ regexp_parser (2.1.1)
160
160
  rexml (3.2.4)
161
- rubocop (1.9.1)
161
+ rubocop (1.11.0)
162
162
  parallel (~> 1.10)
163
163
  parser (>= 3.0.0.0)
164
164
  rainbow (>= 2.2.2, < 4.0)
@@ -171,7 +171,7 @@ GEM
171
171
  parser (>= 2.7.1.5)
172
172
  rubocop-minitest (0.10.3)
173
173
  rubocop (>= 0.87, < 2.0)
174
- rubocop-performance (1.9.2)
174
+ rubocop-performance (1.10.1)
175
175
  rubocop (>= 0.90.0, < 2.0)
176
176
  rubocop-ast (>= 0.4.0)
177
177
  rubocop-rails (2.9.1)
@@ -213,6 +213,7 @@ GEM
213
213
  will_paginate (3.3.0)
214
214
  will_paginate-bootstrap4 (0.2.2)
215
215
  will_paginate (~> 3.0, >= 3.0.0)
216
+ yard (0.9.26)
216
217
  zeitwerk (2.4.2)
217
218
 
218
219
  PLATFORMS
@@ -236,6 +237,7 @@ DEPENDENCIES
236
237
  simplecov
237
238
  sqlite3
238
239
  ui_bibz!
240
+ yard
239
241
 
240
242
  BUNDLED WITH
241
243
  2.1.4
@@ -120,18 +120,18 @@ module UiBibz::Concerns::Models::Searchable
120
120
  if attribute == :as
121
121
  attribute.each_value do |value|
122
122
  sql_subquery << "lower(#{value}) LIKE :#{value}_#{i}"
123
- sql_attributes = sql_attributes.merge(Hash["#{value}_#{i}".to_sym, "%#{pattern}%"])
123
+ sql_attributes = sql_attributes.merge({ "#{value}_#{i}".to_sym => "%#{pattern}%" })
124
124
  end
125
125
  else
126
126
  key_name = attribute.keys.first.to_s.pluralize
127
127
  attribute.each_value do |value|
128
128
  sql_subquery << "lower(#{key_name}.#{value}) LIKE :#{key_name}_#{value}_#{i}"
129
- sql_attributes = sql_attributes.merge(Hash["#{key_name}_#{value}_#{i}".to_sym, "%#{pattern}%"])
129
+ sql_attributes = sql_attributes.merge({ "#{key_name}_#{value}_#{i}".to_sym => "%#{pattern}%" })
130
130
  end
131
131
  end
132
132
  else
133
133
  sql_subquery << "lower(#{to_s.underscore.pluralize.split('/').last}.#{attribute}) LIKE :#{attribute}_#{i}"
134
- sql_attributes = sql_attributes.merge(Hash["#{attribute}_#{i}".to_sym, "%#{pattern}%"])
134
+ sql_attributes = sql_attributes.merge({ "#{attribute}_#{i}".to_sym => "%#{pattern}%" })
135
135
  end
136
136
  end
137
137
  sql_query << "(#{sql_subquery.join(' OR ')})"
data/lib/ui_bibz/infos.rb CHANGED
@@ -12,6 +12,6 @@ module UiBibz
12
12
  REPO = 'git+https://github.com/thooams/ui_bibz.git'
13
13
  EMAIL = 'thomas@hummel.link'
14
14
  AUTHOR = 'Thooams [Thomas HUMMEL]'
15
- VERSION = '3.0.0.beta15'
15
+ VERSION = '3.0.0.beta16'
16
16
  AUTHORS = ['Thooams'].freeze
17
17
  end
@@ -17,7 +17,7 @@ module UiBibzForm
17
17
  wrapper_html = (options[:input_html] || {}).merge({ class: input_classes })
18
18
  surround_field = UiBibz::Ui::Core::Forms::Surrounds::SurroundField.new(content, opts, html_options).tap(&block)
19
19
  errors_text = surround_field.errors.flatten.to_sentence
20
- required = surround_field.required_fields.any? { |u| u == true }
20
+ required = surround_field.required_fields.any?(true)
21
21
  wrapper_classes = UiBibz::Utils::Screwdriver.join_classes(('has-error' if errors_text.present?), wrapper_html.try(:[], :class))
22
22
  label_classes = UiBibz::Utils::Screwdriver.join_classes(('required' if required), 'control-label')
23
23
  abbr_html = content_tag('abbr', I18n.t(:"simple_form.required.mark", default: '*'), title: I18n.t(:"simple_form.required.text", default: 'required')) if required
@@ -90,7 +90,7 @@ module UiBibz::Ui::Core::Boxes
90
90
  class Card < UiBibz::Ui::Core::Component
91
91
  include UiBibz::Ui::Concerns::CardItemableConcern
92
92
 
93
- # See UiBibz::Ui::Core::Component.initialize
93
+ # (see UiBibz::Ui::Core::Component#initialize)
94
94
  def initialize(content = nil, options = nil, html_options = nil, &block)
95
95
  super
96
96
  @items = @content.nil? ? [] : [UiBibz::Ui::Core::Boxes::Components::CardBody.new(@content).render]
@@ -149,7 +149,7 @@ module UiBibz::Ui::Core
149
149
  def add_html_data(name, value: true)
150
150
  html_options[:data] = {} if html_options[:data].nil?
151
151
  value = value.is_a?(String) ? value.strip : value
152
- html_options[:data].update(Hash[name, value])
152
+ html_options[:data].update({ name => value })
153
153
  end
154
154
 
155
155
  def disabled?
@@ -25,6 +25,7 @@ module UiBibz::Ui::Core::Forms::Selects
25
25
  # * +searchable+ - Boolean
26
26
  # * +select_all_option+ - Boolean
27
27
  # * +append+ - String, Html
28
+ # * +non_selected_text+ - String
28
29
  # * +open+ - Boolean
29
30
  # * +theme+ - Symbol, defaut: +:dark+
30
31
  # * +prepend+ - String, Html
@@ -83,10 +84,12 @@ module UiBibz::Ui::Core::Forms::Selects
83
84
  clickable_opt_group
84
85
  collapsible_opt_group
85
86
  searchable
87
+ non_selected_text
86
88
  select_all_options
87
89
  number_displayed
88
90
  dropdown_menu_classes
89
91
  dropdown_classes
92
+ n_selected_text
90
93
  end
91
94
 
92
95
  def clickable_opt_group
@@ -101,6 +104,10 @@ module UiBibz::Ui::Core::Forms::Selects
101
104
  add_html_data('enable_filtering') if options[:searchable]
102
105
  end
103
106
 
107
+ def n_selected_text
108
+ add_html_data('n_selected_text', value: options[:n_selected_text]) if options[:n_selected_text]
109
+ end
110
+
104
111
  def number_displayed
105
112
  add_html_data('number_displayed') if options[:number_displayed]
106
113
  end
@@ -109,6 +116,10 @@ module UiBibz::Ui::Core::Forms::Selects
109
116
  add_html_data('include_select_all_option') if options[:select_all_options]
110
117
  end
111
118
 
119
+ def non_selected_text
120
+ add_html_data('non_selected_text', value: options[:non_selected_text]) if options[:non_selected_text]
121
+ end
122
+
112
123
  def dropdown_menu_classes
113
124
  classes = join_classes(theme, alignment, open)
114
125
  add_html_data('dropdown_menu_classes', value: classes.nil? ? nil : classes.join(' '))
@@ -23,4 +23,11 @@ class CheckboxFieldTest < ActionView::TestCase
23
23
 
24
24
  assert_equal expected, actual
25
25
  end
26
+
27
+ test 'checkbox_field with html_options' do
28
+ actual = UiBibz::Ui::Core::Forms::Choices::CheckboxField.new('John', { checked: true }, { data: { name: 'check' } }).render
29
+ expected = "<div class=\"form-check\"><input type=\"checkbox\" name=\"John\" id=\"John\" value=\"1\" data-name=\"check\" class=\"form-check-input\" checked=\"checked\" /><label class=\"form-check-label\" for=\"John\">John</label></div>"
30
+
31
+ assert_equal expected, actual
32
+ end
26
33
  end
@@ -3,7 +3,7 @@
3
3
  require 'test_helper'
4
4
 
5
5
  class DropdownSelectFieldTest < ActionView::TestCase
6
- test 'Multi Select Field' do
6
+ test 'Dropdown Select Field' do
7
7
  options = options_for_select(Array.new(2) { |i| "option #{i}" })
8
8
  actual = UiBibz::Ui::Core::Forms::Selects::DropdownSelectField.new('example', multiple: true, option_tags: options).render
9
9
  expected = "<select name=\"example[]\" id=\"example\" data-dropdown-classes=\"dropdown\" class=\"btn-secondary multi-select-field\" multiple=\"multiple\"><option value=\"option 0\">option 0</option>
@@ -12,10 +12,10 @@ class DropdownSelectFieldTest < ActionView::TestCase
12
12
  assert_equal expected, actual
13
13
  end
14
14
 
15
- test 'Multi Select Field data html options' do
15
+ test 'Dropdown Select Field data html options' do
16
16
  grouped_options = { 'North America' => [['United statuss', 'US'], 'Canada'], 'Europe' => %w[Denmark Germany France] }
17
- actual = UiBibz::Ui::Core::Forms::Selects::DropdownSelectField.new('example', { multiple: true, option_tags: grouped_options_for_select(grouped_options), clickable_opt_group: true, collapsible_opt_group: true, searchable: true, select_all_options: true, number_displayed: 2, status: :danger }).render
18
- expected = "<select name=\"example[]\" id=\"example\" data-enable-clickable-opt-groups=\"true\" data-enable-collapsible-opt-groups=\"true\" data-enable-filtering=\"true\" data-include-select-all-option=\"true\" data-number-displayed=\"true\" data-dropdown-classes=\"dropdown\" class=\"btn-danger multi-select-field\" multiple=\"multiple\"><optgroup label=\"North America\"><option value=\"US\">United statuss</option>
17
+ actual = UiBibz::Ui::Core::Forms::Selects::DropdownSelectField.new('example', { multiple: true, option_tags: grouped_options_for_select(grouped_options), clickable_opt_group: true, collapsible_opt_group: true, searchable: true, non_selected_text: 'test', select_all_options: true, number_displayed: 2, status: :danger, n_selected_text: "items selected" }).render
18
+ expected = "<select name=\"example[]\" id=\"example\" data-enable-clickable-opt-groups=\"true\" data-enable-collapsible-opt-groups=\"true\" data-enable-filtering=\"true\" data-non-selected-text=\"test\" data-include-select-all-option=\"true\" data-number-displayed=\"true\" data-dropdown-classes=\"dropdown\" data-n-selected-text=\"items selected\" class=\"btn-danger multi-select-field\" multiple=\"multiple\"><optgroup label=\"North America\"><option value=\"US\">United statuss</option>
19
19
  <option value=\"Canada\">Canada</option></optgroup><optgroup label=\"Europe\"><option value=\"Denmark\">Denmark</option>
20
20
  <option value=\"Germany\">Germany</option>
21
21
  <option value=\"France\">France</option></optgroup></select>"
@@ -23,7 +23,7 @@ class DropdownSelectFieldTest < ActionView::TestCase
23
23
  assert_equal expected, actual
24
24
  end
25
25
 
26
- test 'Multi select Field refresh option' do
26
+ test 'Dropdown Select Field refresh option' do
27
27
  actual = UiBibz::Ui::Core::Forms::Selects::DropdownSelectField.new('test', { multiple: true, refresh: { target: { url: '/' } } }).render
28
28
  expected = "<div class=\"field-refresh input-group ui_surround_field\"><select name=\"test[]\" id=\"test\" data-dropdown-classes=\"dropdown\" class=\"btn-secondary multi-select-field\" multiple=\"multiple\"></select><span data-connect=\"{&quot;events&quot;:&quot;click&quot;,&quot;mode&quot;:&quot;remote&quot;,&quot;target&quot;:{&quot;selector&quot;:&quot;#test&quot;,&quot;url&quot;:&quot;/&quot;,&quot;data&quot;:[]}}\" class=\"btn-secondary ui-bibz-connect btn input-refresh-button\"><i class=\"glyph fas fa-sync-alt\"></i></span></div>"
29
29
 
data/ui_bibz.gemspec CHANGED
@@ -47,4 +47,5 @@ Gem::Specification.new do |s|
47
47
  s.add_development_dependency 'simplecov'
48
48
  s.add_development_dependency 'simple_form'
49
49
  s.add_development_dependency 'sqlite3'
50
+ s.add_development_dependency 'yard'
50
51
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ui_bibz
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0.beta15
4
+ version: 3.0.0.beta16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thooams [Thomas HUMMEL]
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-15 00:00:00.000000000 Z
11
+ date: 2021-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -240,6 +240,20 @@ dependencies:
240
240
  - - ">="
241
241
  - !ruby/object:Gem::Version
242
242
  version: '0'
243
+ - !ruby/object:Gem::Dependency
244
+ name: yard
245
+ requirement: !ruby/object:Gem::Requirement
246
+ requirements:
247
+ - - ">="
248
+ - !ruby/object:Gem::Version
249
+ version: '0'
250
+ type: :development
251
+ prerelease: false
252
+ version_requirements: !ruby/object:Gem::Requirement
253
+ requirements:
254
+ - - ">="
255
+ - !ruby/object:Gem::Version
256
+ version: '0'
243
257
  description: A Rails Interface Framework using Bootstrap 5.0.0.beta2.
244
258
  email: thomas@hummel.link
245
259
  executables:
@@ -546,8 +560,8 @@ files:
546
560
  - test/ui/core/forms/numbers/number_field_test.rb
547
561
  - test/ui/core/forms/numbers/range_field_test.rb
548
562
  - test/ui/core/forms/numbers/slider_field_test.rb
563
+ - test/ui/core/forms/selects/dropdown_select_field_test.rb
549
564
  - test/ui/core/forms/selects/multi_column_field_test.rb
550
- - test/ui/core/forms/selects/multi_select_field_test.rb
551
565
  - test/ui/core/forms/selects/select_field_test.rb
552
566
  - test/ui/core/forms/surrounds/surround_field_test.rb
553
567
  - test/ui/core/forms/textareas/markdown_editor_field_test.rb
@@ -759,8 +773,8 @@ test_files:
759
773
  - test/ui/core/forms/numbers/number_field_test.rb
760
774
  - test/ui/core/forms/numbers/range_field_test.rb
761
775
  - test/ui/core/forms/numbers/slider_field_test.rb
776
+ - test/ui/core/forms/selects/dropdown_select_field_test.rb
762
777
  - test/ui/core/forms/selects/multi_column_field_test.rb
763
- - test/ui/core/forms/selects/multi_select_field_test.rb
764
778
  - test/ui/core/forms/selects/select_field_test.rb
765
779
  - test/ui/core/forms/surrounds/surround_field_test.rb
766
780
  - test/ui/core/forms/textareas/markdown_editor_field_test.rb