ui_bibz 3.0.2 → 3.0.6

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: d230136d48595c4f4300a001323a7d19ea58863dcca0486cfbfdaa9c1cb4e787
4
- data.tar.gz: 82720943d66e77dffd6a566ca8992abc02e743c2ca1eb7a8595fa75b2747049a
3
+ metadata.gz: 13a1dd66cbd7e134c7defdad8c359d9c64beb21eb6196436a518cb17a83a8df2
4
+ data.tar.gz: a89c779194577142ace4a56e53089ed0dceb8b96988207f9f6c043f0d0354b9b
5
5
  SHA512:
6
- metadata.gz: 0b2b7c559fcbe30355f716c6140fccdabbe0afbaa883753c257602de2d148ea2cf680da2566150d7a4bbc4438a6dc7f491cfc36cdc0b19b6fef8220f0a44976f
7
- data.tar.gz: ecc26cc0be6fcf85b77a92fa35ed65888f17fcb73061d4655dabcca4ea26123828b0730ebdef3f3487e471210653f2d6d8bc17b275bc2f4f65b58592c8ed7937
6
+ metadata.gz: c39e166f3cda1b05035d734b652d44a50af2cbbb4b9a9bfbd78f1582a03b32bd2356eebe00d470e46b77bbf45a672226830b38cb1826d156997145e5b62453ac
7
+ data.tar.gz: 353ae7e27e66411c506bc984e8575263371117e3461f3de5cdf1f833790be324bec3ff75d6ff15ac98c7e60fcddc41dc68f5cf601e8dddfd0c809a0c8b93ff29
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ui_bibz (3.0.2)
4
+ ui_bibz (3.0.6)
5
5
  will-paginate-i18n
6
6
  will_paginate (~> 3.3.0)
7
7
  will_paginate-bootstrap4
@@ -9,60 +9,60 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- actioncable (6.1.4)
13
- actionpack (= 6.1.4)
14
- activesupport (= 6.1.4)
12
+ actioncable (6.1.4.1)
13
+ actionpack (= 6.1.4.1)
14
+ activesupport (= 6.1.4.1)
15
15
  nio4r (~> 2.0)
16
16
  websocket-driver (>= 0.6.1)
17
- actionmailbox (6.1.4)
18
- actionpack (= 6.1.4)
19
- activejob (= 6.1.4)
20
- activerecord (= 6.1.4)
21
- activestorage (= 6.1.4)
22
- activesupport (= 6.1.4)
17
+ actionmailbox (6.1.4.1)
18
+ actionpack (= 6.1.4.1)
19
+ activejob (= 6.1.4.1)
20
+ activerecord (= 6.1.4.1)
21
+ activestorage (= 6.1.4.1)
22
+ activesupport (= 6.1.4.1)
23
23
  mail (>= 2.7.1)
24
- actionmailer (6.1.4)
25
- actionpack (= 6.1.4)
26
- actionview (= 6.1.4)
27
- activejob (= 6.1.4)
28
- activesupport (= 6.1.4)
24
+ actionmailer (6.1.4.1)
25
+ actionpack (= 6.1.4.1)
26
+ actionview (= 6.1.4.1)
27
+ activejob (= 6.1.4.1)
28
+ activesupport (= 6.1.4.1)
29
29
  mail (~> 2.5, >= 2.5.4)
30
30
  rails-dom-testing (~> 2.0)
31
- actionpack (6.1.4)
32
- actionview (= 6.1.4)
33
- activesupport (= 6.1.4)
31
+ actionpack (6.1.4.1)
32
+ actionview (= 6.1.4.1)
33
+ activesupport (= 6.1.4.1)
34
34
  rack (~> 2.0, >= 2.0.9)
35
35
  rack-test (>= 0.6.3)
36
36
  rails-dom-testing (~> 2.0)
37
37
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
38
- actiontext (6.1.4)
39
- actionpack (= 6.1.4)
40
- activerecord (= 6.1.4)
41
- activestorage (= 6.1.4)
42
- activesupport (= 6.1.4)
38
+ actiontext (6.1.4.1)
39
+ actionpack (= 6.1.4.1)
40
+ activerecord (= 6.1.4.1)
41
+ activestorage (= 6.1.4.1)
42
+ activesupport (= 6.1.4.1)
43
43
  nokogiri (>= 1.8.5)
44
- actionview (6.1.4)
45
- activesupport (= 6.1.4)
44
+ actionview (6.1.4.1)
45
+ activesupport (= 6.1.4.1)
46
46
  builder (~> 3.1)
47
47
  erubi (~> 1.4)
48
48
  rails-dom-testing (~> 2.0)
49
49
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
50
- activejob (6.1.4)
51
- activesupport (= 6.1.4)
50
+ activejob (6.1.4.1)
51
+ activesupport (= 6.1.4.1)
52
52
  globalid (>= 0.3.6)
53
- activemodel (6.1.4)
54
- activesupport (= 6.1.4)
55
- activerecord (6.1.4)
56
- activemodel (= 6.1.4)
57
- activesupport (= 6.1.4)
58
- activestorage (6.1.4)
59
- actionpack (= 6.1.4)
60
- activejob (= 6.1.4)
61
- activerecord (= 6.1.4)
62
- activesupport (= 6.1.4)
53
+ activemodel (6.1.4.1)
54
+ activesupport (= 6.1.4.1)
55
+ activerecord (6.1.4.1)
56
+ activemodel (= 6.1.4.1)
57
+ activesupport (= 6.1.4.1)
58
+ activestorage (6.1.4.1)
59
+ actionpack (= 6.1.4.1)
60
+ activejob (= 6.1.4.1)
61
+ activerecord (= 6.1.4.1)
62
+ activesupport (= 6.1.4.1)
63
63
  marcel (~> 1.0.0)
64
64
  mini_mime (>= 1.1.0)
65
- activesupport (6.1.4)
65
+ activesupport (6.1.4.1)
66
66
  concurrent-ruby (~> 1.0, >= 1.0.2)
67
67
  i18n (>= 1.6, < 2)
68
68
  minitest (>= 5.1)
@@ -111,49 +111,49 @@ GEM
111
111
  nokogiri (>= 1.5.9)
112
112
  mail (2.7.1)
113
113
  mini_mime (>= 0.1.1)
114
- marcel (1.0.1)
114
+ marcel (1.0.2)
115
115
  method_source (1.0.0)
116
- mini_mime (1.1.0)
116
+ mini_mime (1.1.1)
117
117
  mini_portile2 (2.6.1)
118
118
  minitest (5.14.4)
119
119
  nio4r (2.5.8)
120
- nokogiri (1.12.3)
120
+ nokogiri (1.12.5)
121
121
  mini_portile2 (~> 2.6.1)
122
122
  racc (~> 1.4)
123
123
  overcommit (0.58.0)
124
124
  childprocess (>= 0.6.3, < 5)
125
125
  iniparse (~> 1.4)
126
126
  rexml (~> 3.2)
127
- parallel (1.20.1)
127
+ parallel (1.21.0)
128
128
  parser (3.0.2.0)
129
129
  ast (~> 2.4.1)
130
130
  racc (1.5.2)
131
131
  rack (2.2.3)
132
132
  rack-test (1.1.0)
133
133
  rack (>= 1.0, < 3)
134
- rails (6.1.4)
135
- actioncable (= 6.1.4)
136
- actionmailbox (= 6.1.4)
137
- actionmailer (= 6.1.4)
138
- actionpack (= 6.1.4)
139
- actiontext (= 6.1.4)
140
- actionview (= 6.1.4)
141
- activejob (= 6.1.4)
142
- activemodel (= 6.1.4)
143
- activerecord (= 6.1.4)
144
- activestorage (= 6.1.4)
145
- activesupport (= 6.1.4)
134
+ rails (6.1.4.1)
135
+ actioncable (= 6.1.4.1)
136
+ actionmailbox (= 6.1.4.1)
137
+ actionmailer (= 6.1.4.1)
138
+ actionpack (= 6.1.4.1)
139
+ actiontext (= 6.1.4.1)
140
+ actionview (= 6.1.4.1)
141
+ activejob (= 6.1.4.1)
142
+ activemodel (= 6.1.4.1)
143
+ activerecord (= 6.1.4.1)
144
+ activestorage (= 6.1.4.1)
145
+ activesupport (= 6.1.4.1)
146
146
  bundler (>= 1.15.0)
147
- railties (= 6.1.4)
147
+ railties (= 6.1.4.1)
148
148
  sprockets-rails (>= 2.0.0)
149
149
  rails-dom-testing (2.0.3)
150
150
  activesupport (>= 4.2.0)
151
151
  nokogiri (>= 1.6)
152
- rails-html-sanitizer (1.3.0)
152
+ rails-html-sanitizer (1.4.2)
153
153
  loofah (~> 2.3)
154
- railties (6.1.4)
155
- actionpack (= 6.1.4)
156
- activesupport (= 6.1.4)
154
+ railties (6.1.4.1)
155
+ actionpack (= 6.1.4.1)
156
+ activesupport (= 6.1.4.1)
157
157
  method_source
158
158
  rake (>= 0.13)
159
159
  thor (~> 1.0)
@@ -161,23 +161,23 @@ GEM
161
161
  rake (13.0.6)
162
162
  regexp_parser (2.1.1)
163
163
  rexml (3.2.5)
164
- rubocop (1.19.0)
164
+ rubocop (1.22.1)
165
165
  parallel (~> 1.10)
166
166
  parser (>= 3.0.0.0)
167
167
  rainbow (>= 2.2.2, < 4.0)
168
168
  regexp_parser (>= 1.8, < 3.0)
169
169
  rexml
170
- rubocop-ast (>= 1.9.1, < 2.0)
170
+ rubocop-ast (>= 1.12.0, < 2.0)
171
171
  ruby-progressbar (~> 1.7)
172
172
  unicode-display_width (>= 1.4.0, < 3.0)
173
- rubocop-ast (1.10.0)
173
+ rubocop-ast (1.12.0)
174
174
  parser (>= 3.0.1.1)
175
- rubocop-minitest (0.15.0)
175
+ rubocop-minitest (0.15.1)
176
176
  rubocop (>= 0.90, < 2.0)
177
177
  rubocop-performance (1.11.5)
178
178
  rubocop (>= 1.7.0, < 2.0)
179
179
  rubocop-ast (>= 0.4.0)
180
- rubocop-rails (2.11.3)
180
+ rubocop-rails (2.12.3)
181
181
  activesupport (>= 4.2.0)
182
182
  rack (>= 1.1)
183
183
  rubocop (>= 1.7.0, < 2.0)
@@ -207,7 +207,7 @@ GEM
207
207
  tilt (2.0.10)
208
208
  tzinfo (2.0.4)
209
209
  concurrent-ruby (~> 1.0)
210
- unicode-display_width (2.0.0)
210
+ unicode-display_width (2.1.0)
211
211
  websocket-driver (0.7.5)
212
212
  websocket-extensions (>= 0.1.0)
213
213
  websocket-extensions (0.1.5)
@@ -72,12 +72,12 @@ module WillPaginate
72
72
  end
73
73
 
74
74
  def previous_page
75
- num = @collection.current_page > 1 && @collection.current_page - 1
75
+ num = @collection.current_page > 1 && (@collection.current_page - 1)
76
76
  previous_or_next_page num, @options[:previous_label], 'previous'
77
77
  end
78
78
 
79
79
  def next_page
80
- num = @collection.current_page < @collection.total_pages && @collection.current_page + 1
80
+ num = @collection.current_page < @collection.total_pages && (@collection.current_page + 1)
81
81
  previous_or_next_page num, @options[:next_label], 'next'
82
82
  end
83
83
  end
@@ -33,7 +33,7 @@ module UiBibz::Concerns::Models::Searchable
33
33
  end
34
34
 
35
35
  def self.store_id
36
- @arguments[:store_id] || @arguments[:controller] || @params[:controller]
36
+ @arguments[:store_id] || @params[:controller]
37
37
  end
38
38
 
39
39
  def self.create_model
@@ -139,7 +139,7 @@ module UiBibz::Concerns::Models::Searchable
139
139
  end
140
140
  end
141
141
  else
142
- sql_subquery << "lower(CAST(#{to_s.underscore.pluralize.split('/').last}.#{attribute} AS TEXT)) LIKE :#{attribute}_#{i}"
142
+ sql_subquery << "lower(CAST(#{table_name}.#{attribute} AS TEXT)) LIKE :#{attribute}_#{i}"
143
143
  sql_attributes = sql_attributes.merge({ "#{attribute}_#{i}".to_sym => "%#{pattern}%" })
144
144
  end
145
145
  end
data/lib/ui_bibz/infos.rb CHANGED
@@ -4,14 +4,14 @@ module UiBibz
4
4
  NAME = 'Ui Bibz'
5
5
  SLUG = 'ui_bibz'
6
6
  BOOTSTRAP_VERSION = '5.0.2'
7
- DESCRIPTION = "A Rails Interface Framework using Bootstrap #{BOOTSTRAP_VERSION}."
8
- SUMMARY = "Ui Bibz is an Ui Framework that allows you to build an interface very quickly and simply using Bootstrap #{BOOTSTRAP_VERSION}."
7
+ DESCRIPTION = "A Rails Interface Framework using Bootstrap #{BOOTSTRAP_VERSION}.".freeze
8
+ SUMMARY = "Ui Bibz is an Ui Framework that allows you to build an interface very quickly and simply using Bootstrap #{BOOTSTRAP_VERSION}.".freeze
9
9
  LICENSE = 'MIT'
10
10
  FONTAWESOME_VERSION = '5.15.3'
11
11
  HOMEPAGE = 'https://hummel.link/ui-bibz/'
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.2'
15
+ VERSION = '3.0.6'
16
16
  AUTHORS = ['Thooams'].freeze
17
17
  end
@@ -7,5 +7,9 @@ module UiBibzInputs
7
7
  def input(_wrapper_options)
8
8
  UiBibz::Ui::Core::Forms::Files::FileField.new(input_attribute_name, options, input_html_options).render
9
9
  end
10
+
11
+ def input_attribute_name
12
+ options[:multiple] ? "#{super}[]" : super
13
+ end
10
14
  end
11
15
  end
@@ -26,6 +26,7 @@ module UiBibz::Ui::Core::Boxes
26
26
  # * text - Hash (+:size+, +:position+)
27
27
  # (+:left+, +:right+, +:center+)
28
28
  # * block - Boolean
29
+ # * tabbed - Boolean to use tab card
29
30
  # * type - Symbol
30
31
  # (+:inverse+)
31
32
  #
@@ -108,7 +109,7 @@ module UiBibz::Ui::Core::Boxes
108
109
  end
109
110
 
110
111
  def component_html_classes
111
- ['card', text, type, tab_pane, outline]
112
+ ['card', text, type, tab_pane, outline, tabbed]
112
113
  end
113
114
 
114
115
  def status
@@ -135,6 +136,10 @@ module UiBibz::Ui::Core::Boxes
135
136
  'tab-pane' if @options[:tab]
136
137
  end
137
138
 
139
+ def tabbed
140
+ 'tab-content' if @options[:tabbed]
141
+ end
142
+
138
143
  def outline
139
144
  'bg-transparent' if @options[:outline]
140
145
  end
@@ -81,7 +81,11 @@ module UiBibz::Ui::Core::Boxes::Components
81
81
  private
82
82
 
83
83
  def component_html_classes
84
- ['card-body', outline]
84
+ ['card-body', outline, tab_pane]
85
+ end
86
+
87
+ def component_html_options
88
+ @options[:tab_pane].nil? ? {} : { id: @options[:tab_pane] }
85
89
  end
86
90
 
87
91
  def outline
@@ -91,5 +95,9 @@ module UiBibz::Ui::Core::Boxes::Components
91
95
  def show
92
96
  'show' if @options[:show]
93
97
  end
98
+
99
+ def tab_pane
100
+ 'tab-pane' if options[:tab_pane]
101
+ end
94
102
  end
95
103
  end
@@ -59,10 +59,13 @@ module UiBibz::Ui::Core::Forms::Files
59
59
  end
60
60
 
61
61
  def format_value(value)
62
- if value.is_a? ActiveStorage::Attached::One
62
+ case value
63
+ when ActiveStorage::Attached::One
63
64
  return '' unless value.attached?
64
65
 
65
66
  return value.attachment.blob.filename
67
+ when ActiveStorage::Attached::Many
68
+ return ''
66
69
  end
67
70
 
68
71
  value.to_s
@@ -78,7 +78,7 @@ module UiBibz::Ui::Core::Forms::Numbers
78
78
  end
79
79
 
80
80
  def not_on_hundred_percent?
81
- options[:max].present? && options[:max] != 100 || options[:min].present? && options[:min] != 0
81
+ (options[:max].present? && options[:max] != 100) || (options[:min].present? && options[:min] != 0)
82
82
  end
83
83
 
84
84
  def absolute_total
@@ -102,6 +102,7 @@ module UiBibz::Ui::Core::Forms::Selects
102
102
 
103
103
  def searchable
104
104
  add_html_data('enable_filtering') if options[:searchable]
105
+ add_html_data('fuzzy_search') if options[:searchable] == :fuzzy
105
106
  end
106
107
 
107
108
  def n_selected_text
@@ -78,7 +78,7 @@ module UiBibz::Ui::Ux::Tables
78
78
  end
79
79
 
80
80
  def from_current_results
81
- store.limit_value * store.current_page - store.limit_value + 1
81
+ (store.limit_value * store.current_page) - store.limit_value + 1
82
82
  end
83
83
 
84
84
  def to_current_results
@@ -136,16 +136,18 @@ class CardTest < ActionView::TestCase
136
136
  assert_equal expected, actual
137
137
  end
138
138
 
139
- test 'card header tab group' do
140
- actual = ui_card do |c|
139
+ test 'card tab' do
140
+ actual = ui_card tabbed: true do |c|
141
141
  c.header do |h|
142
142
  h.tab_group do |cg|
143
143
  cg.tab 'link1', url: '#link1'
144
144
  cg.tab 'link2', url: '#link2'
145
145
  end
146
146
  end
147
+ c.body tab_pan: "link1", state: :active
148
+ c.body tab_pan: "link2"
147
149
  end
148
- expected = "<div class=\"card\"><div class=\"card-header\"><ul class=\"nav nav-tabs card-header-tabs\" role=\"tablist\"><li class=\"nav-item\"><a href=\"#link1\" class=\"nav-link\" data-bs-toggle=\"tab\" role=\"tab\">link1</a></li><li class=\"nav-item\"><a href=\"#link2\" class=\"nav-link\" data-bs-toggle=\"tab\" role=\"tab\">link2</a></li></ul></div></div>"
150
+ expected = "<div class=\"card tab-content\"><div class=\"card-header\"><ul class=\"nav nav-tabs card-header-tabs\" role=\"tablist\"><li class=\"nav-item\"><a href=\"#link1\" class=\"nav-link\" data-bs-toggle=\"tab\" role=\"tab\">link1</a></li><li class=\"nav-item\"><a href=\"#link2\" class=\"nav-link\" data-bs-toggle=\"tab\" role=\"tab\">link2</a></li></ul></div><div class=\"active card-body\"></div><div class=\"card-body\"></div></div>"
149
151
 
150
152
  assert_equal expected, actual
151
153
  end
@@ -12,6 +12,15 @@ class DropdownSelectFieldTest < ActionView::TestCase
12
12
  assert_equal expected, actual
13
13
  end
14
14
 
15
+ test 'Dropdown Select Field with fuzzy search' do
16
+ options = options_for_select(Array.new(2) { |i| "option #{i}" })
17
+ actual = UiBibz::Ui::Core::Forms::Selects::DropdownSelectField.new('example', option_tags: options, searchable: :fuzzy).render
18
+ expected = "<select name=\"example\" id=\"example\" data-enable-filtering=\"true\" data-fuzzy-search=\"true\" data-dropdown-classes=\"dropdown\" class=\"btn-secondary multi-select-field\"><option value=\"option 0\">option 0</option>
19
+ <option value=\"option 1\">option 1</option></select>"
20
+
21
+ assert_equal expected, actual
22
+ end
23
+
15
24
  test 'Dropdown Select Field data html options' do
16
25
  grouped_options = { 'North America' => [['United statuss', 'US'], 'Canada'], 'Europe' => %w[Denmark Germany France] }
17
26
  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
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.2
4
+ version: 3.0.6
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-08-18 00:00:00.000000000 Z
11
+ date: 2021-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails