ui_bibz 3.0.0.beta9 → 3.0.0.beta10

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: c8d466ecd1eb2df599e88385a30722ff0c1431632835d9b857f1281fa65a588d
4
- data.tar.gz: 8db65e1c63a6c60460c7514226c29a42eb4b7664a68764356375464ac3532623
3
+ metadata.gz: b0b4963785be829c23f3f560fdc03346b3ee8beba96998a95b7ecf15ba20d7bf
4
+ data.tar.gz: 0e37bab962b5fb777493fbe861cf21efd0acb2c6072cda35c8c0c24686ecee77
5
5
  SHA512:
6
- metadata.gz: 5964c0dfe3a5302d8a5bcb5554da38ee0d7bfc59672b83a72b2ecef238e14c384a627f784c06d237a36a8067f4f63246eb772d367f26259a11af53071949b7f7
7
- data.tar.gz: dc8f4393860f273950ed96efcdcb5bc57d38c3053636da293d2087323e9a57cafeecbaaaf80c8db32c1682b89b339f544191faed9bc67e459ec38ffb49f29d79
6
+ metadata.gz: d5a557c7bd724918100d60570f86fdd9a49b0862bc2735f11a450a524dc97569929fbc1753cbc69a71c864df51aeb5eaae67f02daff2a712cadb088d10e5961d
7
+ data.tar.gz: a892279deea5157f18bb6f37fb6eed213ab979890e652d35058da21696e0d000c9ce8305bd48433fcb56f8fcb571840ee4a850e78b240c935dc5a5a98b952bb7
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ui_bibz (3.0.0.beta9)
4
+ ui_bibz (3.0.0.beta10)
5
5
  will-paginate-i18n
6
6
  will_paginate (~> 3.3.0)
7
7
  will_paginate-bootstrap4
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.beta9'
15
+ VERSION = '3.0.0.beta10'
16
16
  AUTHORS = ['Thooams'].freeze
17
17
  end
@@ -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, { position: :right, size: :sm, glyph: actions_glyph }, { class: 'dropdown-action' }).tap do |d|
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
- # * +reflow+ - Boolean
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, responsive, reflow]
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
@@ -32,7 +32,8 @@ module UiBibz::Ui::Ux::Tables
32
32
  # * +size+
33
33
  # (+sm+)
34
34
  # * +responsive+ - Boolean
35
- # * +reflow+ - Boolean
35
+ # * +breakpoint+
36
+ # (+:sm+, +:md+, +:lg+, +:xl+, +:xxl+)
36
37
  #
37
38
  #
38
39
  # ==== Signatures
@@ -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 = UiBibz::Ui::Ux::Tables::Table.new(store: @users, striped: true, status: :inverse, responsive: true, bordered: true, size: :sm, hoverable: true, reflow: true).render
199
- actual = Nokogiri::HTML(table).xpath('//table')[0].attributes['class'].value
200
- expected = 'table-inverse table table-striped table-bordered table-hoverable table-sm table-responsive table-reflow'
201
-
202
- assert_equal expected, actual
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.beta9
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