ui_bibz 3.0.4 → 3.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +14 -14
- data/config/initializers/will_paginate.rb +2 -2
- data/lib/ui_bibz/concerns/models/searchable.rb +1 -1
- data/lib/ui_bibz/infos.rb +3 -3
- data/lib/ui_bibz/inputs/ui_bibz_inputs/ui_file_field_input.rb +4 -0
- data/lib/ui_bibz/ui/core/forms/dropdowns/split_dropdown.rb +18 -2
- data/lib/ui_bibz/ui/core/forms/files/file_field.rb +4 -1
- data/lib/ui_bibz/ui/core/forms/numbers/slider_field.rb +1 -1
- data/lib/ui_bibz/ui/ux/tables/components/column.rb +4 -1
- data/lib/ui_bibz/ui/ux/tables/extensions/sortable.rb +7 -1
- data/lib/ui_bibz/ui/ux/tables/table_pagination_per_page.rb +1 -1
- data/test/ui/core/forms/dropdowns/dropdown_test.rb +0 -9
- data/test/ui/core/forms/dropdowns/split_dropdown_test.rb +24 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ccf1bc46f32031ce0698125631f8e1589410cee6db4a999a255b3cafdb9fc11
|
4
|
+
data.tar.gz: c960f216e67352be73ba19062695c4cb9ce3bbd20a7db4fc1527d664b870ab0a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 284c08b51b94b618f8d9f79c0ac6697249ede82fa2c2e2caff141ab5cb01ca35c1b621ac6b24904e0b61a7d9b4927ff30d529d9525d7951fcc3d436631dc6c79
|
7
|
+
data.tar.gz: b96dccac0028df0ae9d02b35cfe070f62d8b8020e2780a4de181c4d6205816a5bbdf19e3a3b7832624bb0b3603ba0c3442c38e8e721a5c056e62eeca81ce4941
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ui_bibz (3.0.
|
4
|
+
ui_bibz (3.0.8)
|
5
5
|
will-paginate-i18n
|
6
6
|
will_paginate (~> 3.3.0)
|
7
7
|
will_paginate-bootstrap4
|
@@ -111,23 +111,23 @@ GEM
|
|
111
111
|
nokogiri (>= 1.5.9)
|
112
112
|
mail (2.7.1)
|
113
113
|
mini_mime (>= 0.1.1)
|
114
|
-
marcel (1.0.
|
114
|
+
marcel (1.0.2)
|
115
115
|
method_source (1.0.0)
|
116
|
-
mini_mime (1.1.
|
116
|
+
mini_mime (1.1.2)
|
117
117
|
mini_portile2 (2.6.1)
|
118
118
|
minitest (5.14.4)
|
119
119
|
nio4r (2.5.8)
|
120
|
-
nokogiri (1.12.
|
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.
|
127
|
+
parallel (1.21.0)
|
128
128
|
parser (3.0.2.0)
|
129
129
|
ast (~> 2.4.1)
|
130
|
-
racc (1.
|
130
|
+
racc (1.6.0)
|
131
131
|
rack (2.2.3)
|
132
132
|
rack-test (1.1.0)
|
133
133
|
rack (>= 1.0, < 3)
|
@@ -149,7 +149,7 @@ GEM
|
|
149
149
|
rails-dom-testing (2.0.3)
|
150
150
|
activesupport (>= 4.2.0)
|
151
151
|
nokogiri (>= 1.6)
|
152
|
-
rails-html-sanitizer (1.4.
|
152
|
+
rails-html-sanitizer (1.4.2)
|
153
153
|
loofah (~> 2.3)
|
154
154
|
railties (6.1.4.1)
|
155
155
|
actionpack (= 6.1.4.1)
|
@@ -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.
|
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.
|
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.
|
173
|
+
rubocop-ast (1.12.0)
|
174
174
|
parser (>= 3.0.1.1)
|
175
|
-
rubocop-minitest (0.15.
|
175
|
+
rubocop-minitest (0.15.2)
|
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.
|
180
|
+
rubocop-rails (2.12.4)
|
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.
|
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)
|
@@ -216,7 +216,7 @@ GEM
|
|
216
216
|
will_paginate-bootstrap4 (0.2.2)
|
217
217
|
will_paginate (~> 3.0, >= 3.0.0)
|
218
218
|
yard (0.9.26)
|
219
|
-
zeitwerk (2.
|
219
|
+
zeitwerk (2.5.1)
|
220
220
|
|
221
221
|
PLATFORMS
|
222
222
|
ruby
|
@@ -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
|
@@ -139,7 +139,7 @@ module UiBibz::Concerns::Models::Searchable
|
|
139
139
|
end
|
140
140
|
end
|
141
141
|
else
|
142
|
-
sql_subquery << "lower(CAST(#{
|
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.
|
15
|
+
VERSION = '3.0.8'
|
16
16
|
AUTHORS = ['Thooams'].freeze
|
17
17
|
end
|
@@ -73,7 +73,7 @@ module UiBibz::Ui::Core::Forms::Dropdowns
|
|
73
73
|
end
|
74
74
|
|
75
75
|
def button_html
|
76
|
-
content_tag
|
76
|
+
content_tag dropdown_tag, button_content, dropdown_html_options
|
77
77
|
end
|
78
78
|
|
79
79
|
def split_html
|
@@ -86,11 +86,27 @@ module UiBibz::Ui::Core::Forms::Dropdowns
|
|
86
86
|
end
|
87
87
|
|
88
88
|
def split_classes
|
89
|
-
join_classes('btn', button_status, size, 'dropdown-toggle', 'dropdown-toggle-split', options[:split_html].try(:[], :class))
|
89
|
+
join_classes('btn', button_status, size, state, 'dropdown-toggle', 'dropdown-toggle-split', options[:split_html].try(:[], :class))
|
90
90
|
end
|
91
91
|
|
92
92
|
def src_only
|
93
93
|
content_tag :span, 'Toggle Dropdown', class: 'sr-only'
|
94
94
|
end
|
95
|
+
|
96
|
+
def dropdown_html_options
|
97
|
+
opts = (options[:html_button] || {})
|
98
|
+
opts = opts.merge(href: options[:url]) if options[:tag] == :a
|
99
|
+
opts.merge(class: join_classes('btn', button_status, state, size, options[:html_button].try(:[], :class)))
|
100
|
+
end
|
101
|
+
|
102
|
+
def split_dropdown_html_option
|
103
|
+
(options[:html_split] || {}).merge({
|
104
|
+
class: split_classes,
|
105
|
+
type: 'button',
|
106
|
+
'data-bs-toggle' => 'dropdown',
|
107
|
+
'aria-haspopup' => true,
|
108
|
+
'aria-expanded' => false
|
109
|
+
})
|
110
|
+
end
|
95
111
|
end
|
96
112
|
end
|
@@ -59,10 +59,13 @@ module UiBibz::Ui::Core::Forms::Files
|
|
59
59
|
end
|
60
60
|
|
61
61
|
def format_value(value)
|
62
|
-
|
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
|
@@ -2,7 +2,9 @@
|
|
2
2
|
|
3
3
|
module UiBibz::Ui::Ux::Tables
|
4
4
|
class Column < UiBibz::Ui::Core::Component
|
5
|
-
attr_accessor :hidden, :link, :name, :input_options, :class, :as, :data_index,
|
5
|
+
attr_accessor :hidden, :link, :name, :input_options, :class, :as, :data_index,
|
6
|
+
:date_format, :sort, :format, :count, :custom_sort, :parent, :id, :progress_options,
|
7
|
+
:sortable
|
6
8
|
|
7
9
|
def initialize(content = nil, options = nil, html_options = nil, &block)
|
8
10
|
super
|
@@ -20,6 +22,7 @@ module UiBibz::Ui::Ux::Tables
|
|
20
22
|
@format = @options[:format]
|
21
23
|
@class = @options[:class]
|
22
24
|
@hidden = @options[:hidden]
|
25
|
+
@sortable = @options[:sortable]
|
23
26
|
@input_options = @options[:input_options]
|
24
27
|
@progress_options = @options[:progress_options] || {}
|
25
28
|
end
|
@@ -75,7 +75,13 @@ module UiBibz::Ui::Ux::Tables
|
|
75
75
|
end
|
76
76
|
|
77
77
|
def sortable?
|
78
|
-
|
78
|
+
if !@column.sortable.nil?
|
79
|
+
@column.sortable
|
80
|
+
elsif !@options[:sortable].nil?
|
81
|
+
@options[:sortable]
|
82
|
+
else
|
83
|
+
true
|
84
|
+
end
|
79
85
|
end
|
80
86
|
|
81
87
|
def title
|
@@ -43,13 +43,4 @@ class DropdownTest < ActionView::TestCase
|
|
43
43
|
|
44
44
|
assert_equal expected, actual.render
|
45
45
|
end
|
46
|
-
|
47
|
-
test 'Split Dropdown' do
|
48
|
-
actual = UiBibz::Ui::Core::Forms::Dropdowns::Dropdown.new('Split Dropdown').tap do |d|
|
49
|
-
d.link 'state'
|
50
|
-
end
|
51
|
-
expected = "<div class=\"dropdown\"><button class=\"btn btn-secondary dropdown-toggle\" type=\"button\" data-bs-toggle=\"dropdown\" aria-expanded=\"false\" id=\"#{actual.id}\">Split Dropdown</button><div class=\"dropdown-menu\" arial-labelledby=\"#{actual.id}\"><a class=\"dropdown-item\" href=\"#\">state</a></div></div>"
|
52
|
-
|
53
|
-
assert_equal expected, actual.render
|
54
|
-
end
|
55
46
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'test_helper'
|
4
|
+
class SplitDropdownTest < ActionView::TestCase
|
5
|
+
include UiBibz::Helpers::Ui::CoreHelper
|
6
|
+
|
7
|
+
test 'Split Dropdown' do
|
8
|
+
actual = UiBibz::Ui::Core::Forms::Dropdowns::Dropdown.new('Split Dropdown').tap do |d|
|
9
|
+
d.link 'state'
|
10
|
+
end
|
11
|
+
expected = "<div class=\"dropdown\"><button class=\"btn btn-secondary dropdown-toggle\" type=\"button\" data-bs-toggle=\"dropdown\" aria-expanded=\"false\" id=\"#{actual.id}\">Split Dropdown</button><div class=\"dropdown-menu\" arial-labelledby=\"#{actual.id}\"><a class=\"dropdown-item\" href=\"#\">state</a></div></div>"
|
12
|
+
|
13
|
+
assert_equal expected, actual.render
|
14
|
+
end
|
15
|
+
|
16
|
+
test 'Split Dropdown with link' do
|
17
|
+
actual = UiBibz::Ui::Core::Forms::Dropdowns::Dropdown.new('Split Dropdown', tag: :a, url: "#test").tap do |d|
|
18
|
+
d.link 'state'
|
19
|
+
end
|
20
|
+
expected = "<div class=\"dropdown\"><a class=\"btn btn-secondary dropdown-toggle\" role=\"button\" data-bs-toggle=\"dropdown\" aria-expanded=\"false\" id=\"#{actual.id}\">Split Dropdown</a><div class=\"dropdown-menu\" arial-labelledby=\"#{actual.id}\"><a class=\"dropdown-item\" href=\"#\">state</a></div></div>"
|
21
|
+
|
22
|
+
assert_equal expected, actual.render
|
23
|
+
end
|
24
|
+
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.
|
4
|
+
version: 3.0.8
|
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-
|
11
|
+
date: 2021-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -555,6 +555,7 @@ files:
|
|
555
555
|
- test/ui/core/forms/choices/radio_field_test.rb
|
556
556
|
- test/ui/core/forms/dates/date_picker_field_test.rb
|
557
557
|
- test/ui/core/forms/dropdowns/dropdown_test.rb
|
558
|
+
- test/ui/core/forms/dropdowns/split_dropdown_test.rb
|
558
559
|
- test/ui/core/forms/files/file_field_test.rb
|
559
560
|
- test/ui/core/forms/numbers/formula_field_test.rb
|
560
561
|
- test/ui/core/forms/numbers/number_field_test.rb
|
@@ -768,6 +769,7 @@ test_files:
|
|
768
769
|
- test/ui/core/forms/choices/radio_field_test.rb
|
769
770
|
- test/ui/core/forms/dates/date_picker_field_test.rb
|
770
771
|
- test/ui/core/forms/dropdowns/dropdown_test.rb
|
772
|
+
- test/ui/core/forms/dropdowns/split_dropdown_test.rb
|
771
773
|
- test/ui/core/forms/files/file_field_test.rb
|
772
774
|
- test/ui/core/forms/numbers/formula_field_test.rb
|
773
775
|
- test/ui/core/forms/numbers/number_field_test.rb
|