ui_bibz 3.0.0.beta9 → 3.0.0.beta10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/ui_bibz/infos.rb +1 -1
- data/lib/ui_bibz/ui/ux/tables/extensions/actionable.rb +1 -1
- data/lib/ui_bibz/ui/ux/tables/table.rb +5 -8
- data/lib/ui_bibz/ui/ux/tables/table_card.rb +2 -1
- data/test/ui/ux/tables/table_card_test.rb +37 -0
- data/test/ui/ux/tables/table_test.rb +8 -5
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b0b4963785be829c23f3f560fdc03346b3ee8beba96998a95b7ecf15ba20d7bf
|
4
|
+
data.tar.gz: 0e37bab962b5fb777493fbe861cf21efd0acb2c6072cda35c8c0c24686ecee77
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5a557c7bd724918100d60570f86fdd9a49b0862bc2735f11a450a524dc97569929fbc1753cbc69a71c864df51aeb5eaae67f02daff2a712cadb088d10e5961d
|
7
|
+
data.tar.gz: a892279deea5157f18bb6f37fb6eed213ab979890e652d35058da21696e0d000c9ce8305bd48433fcb56f8fcb571840ee4a850e78b240c935dc5a5a98b952bb7
|
data/Gemfile.lock
CHANGED
data/lib/ui_bibz/infos.rb
CHANGED
@@ -35,7 +35,7 @@ module UiBibz::Ui::Ux::Tables
|
|
35
35
|
|
36
36
|
return if default_actions? != true && @actions.raw_list.empty?
|
37
37
|
|
38
|
-
UiBibz::Ui::Core::Forms::Dropdowns::Dropdown.new(dropdown_action_name, {
|
38
|
+
UiBibz::Ui::Core::Forms::Dropdowns::Dropdown.new(dropdown_action_name, { size: :sm, glyph: actions_glyph }, { class: 'dropdown-action' }).tap do |d|
|
39
39
|
actions_links(record).each do |l|
|
40
40
|
d.html l.to_s.html_safe
|
41
41
|
end
|
@@ -42,7 +42,8 @@ module UiBibz::Ui::Ux::Tables
|
|
42
42
|
# * +size+
|
43
43
|
# (+:sm+)
|
44
44
|
# * +responsive+ - Boolean
|
45
|
-
# * +
|
45
|
+
# * +breakpoint+
|
46
|
+
# (+:sm+, +:md+, +:lg+, +:xl+, +:xxl+)
|
46
47
|
#
|
47
48
|
# ==== Signatures
|
48
49
|
#
|
@@ -118,7 +119,7 @@ module UiBibz::Ui::Ux::Tables
|
|
118
119
|
|
119
120
|
# Render html tag
|
120
121
|
def pre_render
|
121
|
-
table_html
|
122
|
+
options[:responsive] ? content_tag(:div, table_html, class: responsive) : table_html
|
122
123
|
end
|
123
124
|
|
124
125
|
# Store must be generated by *table_search_pagination* method
|
@@ -184,7 +185,7 @@ module UiBibz::Ui::Ux::Tables
|
|
184
185
|
private
|
185
186
|
|
186
187
|
def component_html_classes
|
187
|
-
['table', striped, bordered, hoverable, size
|
188
|
+
['table', striped, bordered, hoverable, size]
|
188
189
|
end
|
189
190
|
|
190
191
|
def status
|
@@ -208,11 +209,7 @@ module UiBibz::Ui::Ux::Tables
|
|
208
209
|
end
|
209
210
|
|
210
211
|
def responsive
|
211
|
-
'table-responsive' unless @options[:responsive].nil?
|
212
|
-
end
|
213
|
-
|
214
|
-
def reflow
|
215
|
-
'table-reflow' unless @options[:reflow].nil?
|
212
|
+
['table-responsive', @options[:breakpoint]].compact.join('-') unless @options[:responsive].nil?
|
216
213
|
end
|
217
214
|
end
|
218
215
|
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'test_helper'
|
4
|
+
require 'ui_bibz/ui/ux/tables/components/store'
|
5
|
+
require 'ui_bibz/ui/ux/tables/extensions/paginable'
|
6
|
+
require 'ui_bibz/ui/ux/tables/extensions/searchable'
|
7
|
+
require 'ui_bibz/ui/ux/tables/extensions/sortable'
|
8
|
+
require 'ui_bibz/ui/ux/tables/extensions/actionable'
|
9
|
+
|
10
|
+
class TableCardTest < ActionView::TestCase
|
11
|
+
setup do
|
12
|
+
create_list(:user, 25)
|
13
|
+
params = ActionController::Parameters.new({
|
14
|
+
controller: 'users',
|
15
|
+
action: 'index',
|
16
|
+
sort: 'users.name_fr',
|
17
|
+
direction: 'asc',
|
18
|
+
search: 'Name fr',
|
19
|
+
per_page: 2,
|
20
|
+
page: 1,
|
21
|
+
only_path: true
|
22
|
+
})
|
23
|
+
@users = User.table_search_pagination(params, session)
|
24
|
+
@store = UiBibz::Ui::Ux::Tables::Store.new @users
|
25
|
+
end
|
26
|
+
|
27
|
+
test 'table card visual options' do
|
28
|
+
table_card = UiBibz::Ui::Ux::Tables::TableCard.new(store: @users, table_options: { striped: true, status: :inverse, responsive: true, bordered: true, size: :sm, hoverable: true, breakpoint: :sm }).render
|
29
|
+
actual_table_classes = Nokogiri::HTML(table_card).xpath('//table')[0].attributes['class'].value
|
30
|
+
div_classes = Nokogiri::HTML(table_card).xpath('//div').css('.table-responsive-sm')[0].attributes['class'].value
|
31
|
+
table_classes = 'table-inverse table table-striped table-bordered table-hoverable table-sm'
|
32
|
+
actual_div_classes = 'table-responsive-sm'
|
33
|
+
|
34
|
+
assert_equal table_classes, actual_table_classes
|
35
|
+
assert_equal div_classes, actual_div_classes
|
36
|
+
end
|
37
|
+
end
|
@@ -195,11 +195,14 @@ class TableTest < ActionView::TestCase
|
|
195
195
|
end
|
196
196
|
|
197
197
|
test 'table visual options' do
|
198
|
-
table
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
198
|
+
table = UiBibz::Ui::Ux::Tables::Table.new(store: @users, striped: true, status: :inverse, responsive: true, bordered: true, size: :sm, hoverable: true, breakpoint: :sm).render
|
199
|
+
div_classes = Nokogiri::HTML(table).xpath('//div')[0].attributes['class'].value
|
200
|
+
actual_table_classes = Nokogiri::HTML(table).xpath('//table')[0].attributes['class'].value
|
201
|
+
table_classes = 'table-inverse table table-striped table-bordered table-hoverable table-sm'
|
202
|
+
actual_div_classes = 'table-responsive-sm'
|
203
|
+
|
204
|
+
assert_equal table_classes, actual_table_classes
|
205
|
+
assert_equal div_classes, actual_div_classes
|
203
206
|
end
|
204
207
|
|
205
208
|
test 'table thead visual options' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ui_bibz
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.0.
|
4
|
+
version: 3.0.0.beta10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thooams [Thomas HUMMEL]
|
@@ -574,6 +574,7 @@ files:
|
|
574
574
|
- test/ui/core/windows/modal_test.rb
|
575
575
|
- test/ui/utils/breakdown_class_name_generator_test.rb
|
576
576
|
- test/ui/ux/containers/panel_test.rb
|
577
|
+
- test/ui/ux/tables/table_card_test.rb
|
577
578
|
- test/ui/ux/tables/table_test.rb
|
578
579
|
- test/ui_bibz_test.rb
|
579
580
|
- ui_bibz.gemspec
|
@@ -786,5 +787,6 @@ test_files:
|
|
786
787
|
- test/ui/core/windows/modal_test.rb
|
787
788
|
- test/ui/utils/breakdown_class_name_generator_test.rb
|
788
789
|
- test/ui/ux/containers/panel_test.rb
|
790
|
+
- test/ui/ux/tables/table_card_test.rb
|
789
791
|
- test/ui/ux/tables/table_test.rb
|
790
792
|
- test/ui_bibz_test.rb
|