ui_bibz 3.0.0.beta18 → 3.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +94 -90
  3. data/config/locales/en.yml +3 -0
  4. data/config/locales/fr.yml +3 -0
  5. data/lib/ui_bibz.rb +1 -1
  6. data/lib/ui_bibz/concerns/models/searchable.rb +26 -16
  7. data/lib/ui_bibz/infos.rb +2 -2
  8. data/lib/ui_bibz/inputs/ui_bibz_form/ui_bibz_form_builder.rb +1 -1
  9. data/lib/ui_bibz/ui/concerns/card_itemable_concern.rb +1 -1
  10. data/lib/ui_bibz/ui/concerns/html_concern.rb +1 -1
  11. data/lib/ui_bibz/ui/concerns/navigation_concern.rb +1 -1
  12. data/lib/ui_bibz/ui/concerns/notification_concern.rb +1 -1
  13. data/lib/ui_bibz/ui/core/boxes/components/card_body.rb +1 -1
  14. data/lib/ui_bibz/ui/core/boxes/components/card_col.rb +1 -1
  15. data/lib/ui_bibz/ui/core/component.rb +1 -1
  16. data/lib/ui_bibz/ui/core/forms/buttons/button.rb +4 -4
  17. data/lib/ui_bibz/ui/core/forms/buttons/button_link.rb +3 -3
  18. data/lib/ui_bibz/ui/core/forms/numbers/formula_field.rb +1 -1
  19. data/lib/ui_bibz/ui/core/forms/numbers/slider_header.rb +2 -2
  20. data/lib/ui_bibz/ui/core/forms/surrounds/surround_field.rb +1 -1
  21. data/lib/ui_bibz/ui/core/layouts/col.rb +1 -3
  22. data/lib/ui_bibz/ui/core/layouts/row.rb +1 -3
  23. data/lib/ui_bibz/ui/core/navigations/breadcrumb.rb +1 -1
  24. data/lib/ui_bibz/ui/core/navigations/components/breadcrumb_link.rb +1 -1
  25. data/lib/ui_bibz/ui/core/navigations/components/nav_link_link.rb +1 -1
  26. data/lib/ui_bibz/ui/core/navigations/components/navbar_form.rb +1 -1
  27. data/lib/ui_bibz/ui/core/navigations/link.rb +1 -1
  28. data/lib/ui_bibz/ui/core/navigations/navbar.rb +1 -1
  29. data/lib/ui_bibz/ui/core/notifications/components/bar.rb +1 -1
  30. data/lib/ui_bibz/ui/core/notifications/components/toast_header.rb +1 -1
  31. data/lib/ui_bibz/ui/core/notifications/toast.rb +1 -1
  32. data/lib/ui_bibz/ui/ux/tables/components/actions.rb +3 -3
  33. data/lib/ui_bibz/ui/ux/tables/components/store.rb +5 -1
  34. data/lib/ui_bibz/ui/ux/tables/extensions/paginable.rb +0 -1
  35. data/lib/ui_bibz/ui/ux/tables/table.rb +6 -2
  36. data/lib/ui_bibz/ui/ux/tables/table_pagination.rb +1 -1
  37. data/lib/ui_bibz/ui/ux/tables/table_pagination_per_page.rb +2 -2
  38. data/lib/ui_bibz/ui/ux/tables/table_search_field.rb +1 -5
  39. data/test/ui/ux/tables/table_test.rb +13 -6
  40. data/ui_bibz.gemspec +1 -1
  41. metadata +11 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 710b0c4a072a6505597eb6f7b2c92685eb6e545e470ba72bec6838b0f6acc4f6
4
- data.tar.gz: 1c3e4c48723812182a347d8cbe2ef85053fbc72c1f36c07853025212e16f0353
3
+ metadata.gz: d230136d48595c4f4300a001323a7d19ea58863dcca0486cfbfdaa9c1cb4e787
4
+ data.tar.gz: 82720943d66e77dffd6a566ca8992abc02e743c2ca1eb7a8595fa75b2747049a
5
5
  SHA512:
6
- metadata.gz: da63293c5b8bd94bd2a4797aef3d3b94ae360c2f796730f23bee60fc55c645dad59dd5ec09f22c9251a1ff2cce6c7ccc345e6e9ed82c5b63e7832cfb485fa446
7
- data.tar.gz: 0e7d6f80d5d85506c04c8123fd5b94143a6c96f58ba39a90feacb1ed3ec765330c846a7f810af7ea6a8917ec4c92cbb1a448e552ef29a1b638889b2bb126981a
6
+ metadata.gz: 0b2b7c559fcbe30355f716c6140fccdabbe0afbaa883753c257602de2d148ea2cf680da2566150d7a4bbc4438a6dc7f491cfc36cdc0b19b6fef8220f0a44976f
7
+ data.tar.gz: ecc26cc0be6fcf85b77a92fa35ed65888f17fcb73061d4655dabcca4ea26123828b0730ebdef3f3487e471210653f2d6d8bc17b275bc2f4f65b58592c8ed7937
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ui_bibz (3.0.0.beta18)
4
+ ui_bibz (3.0.2)
5
5
  will-paginate-i18n
6
6
  will_paginate (~> 3.3.0)
7
7
  will_paginate-bootstrap4
@@ -9,69 +9,73 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- actioncable (6.0.3.6)
13
- actionpack (= 6.0.3.6)
12
+ actioncable (6.1.4)
13
+ actionpack (= 6.1.4)
14
+ activesupport (= 6.1.4)
14
15
  nio4r (~> 2.0)
15
16
  websocket-driver (>= 0.6.1)
16
- actionmailbox (6.0.3.6)
17
- actionpack (= 6.0.3.6)
18
- activejob (= 6.0.3.6)
19
- activerecord (= 6.0.3.6)
20
- activestorage (= 6.0.3.6)
21
- activesupport (= 6.0.3.6)
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)
22
23
  mail (>= 2.7.1)
23
- actionmailer (6.0.3.6)
24
- actionpack (= 6.0.3.6)
25
- actionview (= 6.0.3.6)
26
- activejob (= 6.0.3.6)
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)
27
29
  mail (~> 2.5, >= 2.5.4)
28
30
  rails-dom-testing (~> 2.0)
29
- actionpack (6.0.3.6)
30
- actionview (= 6.0.3.6)
31
- activesupport (= 6.0.3.6)
32
- rack (~> 2.0, >= 2.0.8)
31
+ actionpack (6.1.4)
32
+ actionview (= 6.1.4)
33
+ activesupport (= 6.1.4)
34
+ rack (~> 2.0, >= 2.0.9)
33
35
  rack-test (>= 0.6.3)
34
36
  rails-dom-testing (~> 2.0)
35
37
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
36
- actiontext (6.0.3.6)
37
- actionpack (= 6.0.3.6)
38
- activerecord (= 6.0.3.6)
39
- activestorage (= 6.0.3.6)
40
- activesupport (= 6.0.3.6)
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)
41
43
  nokogiri (>= 1.8.5)
42
- actionview (6.0.3.6)
43
- activesupport (= 6.0.3.6)
44
+ actionview (6.1.4)
45
+ activesupport (= 6.1.4)
44
46
  builder (~> 3.1)
45
47
  erubi (~> 1.4)
46
48
  rails-dom-testing (~> 2.0)
47
49
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
48
- activejob (6.0.3.6)
49
- activesupport (= 6.0.3.6)
50
+ activejob (6.1.4)
51
+ activesupport (= 6.1.4)
50
52
  globalid (>= 0.3.6)
51
- activemodel (6.0.3.6)
52
- activesupport (= 6.0.3.6)
53
- activerecord (6.0.3.6)
54
- activemodel (= 6.0.3.6)
55
- activesupport (= 6.0.3.6)
56
- activestorage (6.0.3.6)
57
- actionpack (= 6.0.3.6)
58
- activejob (= 6.0.3.6)
59
- activerecord (= 6.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)
60
63
  marcel (~> 1.0.0)
61
- activesupport (6.0.3.6)
64
+ mini_mime (>= 1.1.0)
65
+ activesupport (6.1.4)
62
66
  concurrent-ruby (~> 1.0, >= 1.0.2)
63
- i18n (>= 0.7, < 2)
64
- minitest (~> 5.1)
65
- tzinfo (~> 1.1)
66
- zeitwerk (~> 2.2, >= 2.2.2)
67
+ i18n (>= 1.6, < 2)
68
+ minitest (>= 5.1)
69
+ tzinfo (~> 2.0)
70
+ zeitwerk (~> 2.3)
67
71
  ast (2.4.2)
68
72
  awesome_print (1.9.2)
69
73
  builder (3.2.4)
70
74
  byebug (11.1.3)
71
- childprocess (4.0.0)
72
- concurrent-ruby (1.1.8)
75
+ childprocess (4.1.0)
76
+ concurrent-ruby (1.1.9)
73
77
  crass (1.0.6)
74
- docile (1.3.5)
78
+ docile (1.4.0)
75
79
  erubi (1.10.0)
76
80
  erubis (2.7.0)
77
81
  factory_bot (4.11.1)
@@ -79,9 +83,9 @@ GEM
79
83
  factory_bot_rails (4.11.1)
80
84
  factory_bot (~> 4.11.1)
81
85
  railties (>= 3.0.0)
82
- globalid (0.4.2)
83
- activesupport (>= 4.2.0)
84
- haml (5.2.1)
86
+ globalid (0.5.2)
87
+ activesupport (>= 5.0)
88
+ haml (5.2.2)
85
89
  temple (>= 0.8.0)
86
90
  tilt
87
91
  haml-rails (2.0.1)
@@ -102,7 +106,7 @@ GEM
102
106
  rails-dom-testing (>= 1, < 3)
103
107
  railties (>= 4.2.0)
104
108
  thor (>= 0.14, < 2.0)
105
- loofah (2.9.1)
109
+ loofah (2.12.0)
106
110
  crass (~> 1.0.2)
107
111
  nokogiri (>= 1.5.9)
108
112
  mail (2.7.1)
@@ -110,76 +114,77 @@ GEM
110
114
  marcel (1.0.1)
111
115
  method_source (1.0.0)
112
116
  mini_mime (1.1.0)
113
- mini_portile2 (2.5.1)
117
+ mini_portile2 (2.6.1)
114
118
  minitest (5.14.4)
115
- nio4r (2.5.7)
116
- nokogiri (1.11.3)
117
- mini_portile2 (~> 2.5.0)
119
+ nio4r (2.5.8)
120
+ nokogiri (1.12.3)
121
+ mini_portile2 (~> 2.6.1)
118
122
  racc (~> 1.4)
119
- overcommit (0.57.0)
123
+ overcommit (0.58.0)
120
124
  childprocess (>= 0.6.3, < 5)
121
125
  iniparse (~> 1.4)
126
+ rexml (~> 3.2)
122
127
  parallel (1.20.1)
123
- parser (3.0.1.1)
128
+ parser (3.0.2.0)
124
129
  ast (~> 2.4.1)
125
130
  racc (1.5.2)
126
131
  rack (2.2.3)
127
132
  rack-test (1.1.0)
128
133
  rack (>= 1.0, < 3)
129
- rails (6.0.3.6)
130
- actioncable (= 6.0.3.6)
131
- actionmailbox (= 6.0.3.6)
132
- actionmailer (= 6.0.3.6)
133
- actionpack (= 6.0.3.6)
134
- actiontext (= 6.0.3.6)
135
- actionview (= 6.0.3.6)
136
- activejob (= 6.0.3.6)
137
- activemodel (= 6.0.3.6)
138
- activerecord (= 6.0.3.6)
139
- activestorage (= 6.0.3.6)
140
- activesupport (= 6.0.3.6)
141
- bundler (>= 1.3.0)
142
- railties (= 6.0.3.6)
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)
146
+ bundler (>= 1.15.0)
147
+ railties (= 6.1.4)
143
148
  sprockets-rails (>= 2.0.0)
144
149
  rails-dom-testing (2.0.3)
145
150
  activesupport (>= 4.2.0)
146
151
  nokogiri (>= 1.6)
147
152
  rails-html-sanitizer (1.3.0)
148
153
  loofah (~> 2.3)
149
- railties (6.0.3.6)
150
- actionpack (= 6.0.3.6)
151
- activesupport (= 6.0.3.6)
154
+ railties (6.1.4)
155
+ actionpack (= 6.1.4)
156
+ activesupport (= 6.1.4)
152
157
  method_source
153
- rake (>= 0.8.7)
154
- thor (>= 0.20.3, < 2.0)
158
+ rake (>= 0.13)
159
+ thor (~> 1.0)
155
160
  rainbow (3.0.0)
156
- rake (13.0.3)
161
+ rake (13.0.6)
157
162
  regexp_parser (2.1.1)
158
163
  rexml (3.2.5)
159
- rubocop (1.13.0)
164
+ rubocop (1.19.0)
160
165
  parallel (~> 1.10)
161
166
  parser (>= 3.0.0.0)
162
167
  rainbow (>= 2.2.2, < 4.0)
163
168
  regexp_parser (>= 1.8, < 3.0)
164
169
  rexml
165
- rubocop-ast (>= 1.2.0, < 2.0)
170
+ rubocop-ast (>= 1.9.1, < 2.0)
166
171
  ruby-progressbar (~> 1.7)
167
172
  unicode-display_width (>= 1.4.0, < 3.0)
168
- rubocop-ast (1.5.0)
173
+ rubocop-ast (1.10.0)
169
174
  parser (>= 3.0.1.1)
170
- rubocop-minitest (0.12.1)
175
+ rubocop-minitest (0.15.0)
171
176
  rubocop (>= 0.90, < 2.0)
172
- rubocop-performance (1.11.1)
177
+ rubocop-performance (1.11.5)
173
178
  rubocop (>= 1.7.0, < 2.0)
174
179
  rubocop-ast (>= 0.4.0)
175
- rubocop-rails (2.9.1)
180
+ rubocop-rails (2.11.3)
176
181
  activesupport (>= 4.2.0)
177
182
  rack (>= 1.1)
178
- rubocop (>= 0.90.0, < 2.0)
183
+ rubocop (>= 1.7.0, < 2.0)
179
184
  ruby-progressbar (1.11.0)
180
- ruby_parser (3.15.1)
181
- sexp_processor (~> 4.9)
182
- sexp_processor (4.15.2)
185
+ ruby_parser (3.17.0)
186
+ sexp_processor (~> 4.15, >= 4.15.1)
187
+ sexp_processor (4.15.3)
183
188
  simple_form (5.1.0)
184
189
  actionpack (>= 5.2)
185
190
  activemodel (>= 5.2)
@@ -199,16 +204,15 @@ GEM
199
204
  sqlite3 (1.4.2)
200
205
  temple (0.8.2)
201
206
  thor (1.1.0)
202
- thread_safe (0.3.6)
203
207
  tilt (2.0.10)
204
- tzinfo (1.2.9)
205
- thread_safe (~> 0.1)
208
+ tzinfo (2.0.4)
209
+ concurrent-ruby (~> 1.0)
206
210
  unicode-display_width (2.0.0)
207
- websocket-driver (0.7.3)
211
+ websocket-driver (0.7.5)
208
212
  websocket-extensions (>= 0.1.0)
209
213
  websocket-extensions (0.1.5)
210
214
  will-paginate-i18n (0.1.15)
211
- will_paginate (3.3.0)
215
+ will_paginate (3.3.1)
212
216
  will_paginate-bootstrap4 (0.2.2)
213
217
  will_paginate (~> 3.0, >= 3.0.0)
214
218
  yard (0.9.26)
@@ -225,7 +229,7 @@ DEPENDENCIES
225
229
  jquery-rails (>= 3.1.0)
226
230
  minitest
227
231
  overcommit
228
- rails (~> 6.0.3, >= 6.0.3.2)
232
+ rails (~> 6.1.3, >= 6.1.3.2)
229
233
  rubocop
230
234
  rubocop-ast
231
235
  rubocop-minitest
@@ -238,4 +242,4 @@ DEPENDENCIES
238
242
  yard
239
243
 
240
244
  BUNDLED WITH
241
- 2.2.15
245
+ 2.2.21
@@ -1,5 +1,8 @@
1
1
  en:
2
2
  ui_bibz:
3
+ table:
4
+ pagination:
5
+ per_page: 'Per page: '
3
6
  grid:
4
7
  pagination:
5
8
  per_page: 'Per page: '
@@ -1,5 +1,8 @@
1
1
  fr:
2
2
  ui_bibz:
3
+ table:
4
+ pagination:
5
+ per_page: 'Par page : '
3
6
  grid:
4
7
  pagination:
5
8
  per_page: 'Par page : '
data/lib/ui_bibz.rb CHANGED
@@ -43,7 +43,7 @@ module UiBibz
43
43
  attr_accessor :configuration
44
44
  end
45
45
 
46
- def self.configured? #:nodoc:
46
+ def self.configured? # :nodoc:
47
47
  @@configured
48
48
  end
49
49
 
@@ -17,37 +17,44 @@ module UiBibz::Concerns::Models::Searchable
17
17
  def self.generate_parameters
18
18
  {
19
19
  controller: @params[:controller],
20
+ actions_controller: @arguments[:actions_controller] || @params[:controller],
20
21
  param_id: @params[:id],
21
22
  params: @params,
22
- direction: @params[:direction],
23
- search: @params[:search],
24
- sort: @params[:sort],
23
+ direction: @tmp_params[:direction],
24
+ search: @tmp_params[:search],
25
+ sort: @tmp_params[:sort],
25
26
  action: @params[:action],
26
27
  column_id: @params[:column_id],
27
- id: @arguments[:store_id],
28
+ id: store_id,
28
29
  records: search_sort_paginate,
29
30
  searchable_attributes: @searchable_attributes,
30
31
  model: create_model
31
32
  }
32
33
  end
33
34
 
35
+ def self.store_id
36
+ @arguments[:store_id] || @arguments[:controller] || @params[:controller]
37
+ end
38
+
34
39
  def self.create_model
35
40
  @arguments[:model].nil? ? self : @arguments[:model].to_s.camelize.classify.constantize
36
41
  end
37
42
 
38
43
  # If there is more one table in html page
39
44
  def self.initialize_params
40
- @tmp_params = { per_page: @arguments[:per_page] }
45
+ @tmp_params = (session_store || { 'per_page' => @arguments[:per_page] || 30 }).with_indifferent_access
41
46
 
42
47
  return unless good_store_id?
43
48
 
44
49
  @tmp_params = {
45
- search: @params[:search],
46
- per_page: @params[:per_page] || @arguments[:per_page],
47
- page: new_search? ? nil : @params[:page],
48
- sort: @params[:sort],
49
- direction: @params[:direction]
50
- }
50
+ 'search' => @params[:search] || @tmp_params['search'],
51
+ 'per_page' => @params[:per_page] || @tmp_params['per_page'] || @arguments[:per_page],
52
+ 'page' => @params[:page],
53
+ 'sort' => @params[:sort] || @tmp_params['sort'],
54
+ 'direction' => @params[:direction] || @tmp_params['direction']
55
+ }.with_indifferent_access
56
+
57
+ @session[store_id] = @tmp_params
51
58
  end
52
59
 
53
60
  def self.search
@@ -75,15 +82,15 @@ module UiBibz::Concerns::Models::Searchable
75
82
 
76
83
  def self.generate_default_sql(sql)
77
84
  if sorting?
78
- sql.paginate(page: @tmp_params[:page], per_page: @session[:per_page])
85
+ sql.paginate(page: @tmp_params[:page], per_page: @tmp_params[:per_page])
79
86
  else
80
- sql.reorder(order_sql).paginate(page: @tmp_params[:page], per_page: @session[:per_page])
87
+ sql.reorder(order_sql).paginate(page: @tmp_params[:page], per_page: @tmp_params[:per_page])
81
88
  end
82
89
  end
83
90
 
84
91
  def self.generate_count_sql(sql)
85
92
  sq = "SELECT * FROM (#{sql.group("#{table_name}.id").to_sql}) countable ORDER BY countable.count #{@tmp_params[:direction] || asc}"
86
- paginate_by_sql(sq, page: @tmp_params[:page], per_page: @session[:per_page])
93
+ paginate_by_sql(sq, page: @tmp_params[:page], per_page: @tmp_params[:per_page])
87
94
  end
88
95
 
89
96
  def self.generate_select_count_sort_query(sql, column_args)
@@ -147,13 +154,16 @@ module UiBibz::Concerns::Models::Searchable
147
154
  end
148
155
 
149
156
  def self.search_sort_paginate
150
- @session[:per_page] = @tmp_params[:per_page] unless @tmp_params[:per_page].nil?
151
157
  search
152
158
  end
153
159
 
160
+ def self.session_store
161
+ @session[store_id]
162
+ end
163
+
154
164
  # If there's several table in the same page
155
165
  def self.good_store_id?
156
- @arguments[:store_id] == @params[:store_id]
166
+ @params[:store_id].nil? ? true : store_id == @params[:store_id]
157
167
  end
158
168
 
159
169
  def self.new_search?
data/lib/ui_bibz/infos.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  module UiBibz
4
4
  NAME = 'Ui Bibz'
5
5
  SLUG = 'ui_bibz'
6
- BOOTSTRAP_VERSION = '5.0.0.beta3'
6
+ BOOTSTRAP_VERSION = '5.0.2'
7
7
  DESCRIPTION = "A Rails Interface Framework using Bootstrap #{BOOTSTRAP_VERSION}."
8
8
  SUMMARY = "Ui Bibz is an Ui Framework that allows you to build an interface very quickly and simply using Bootstrap #{BOOTSTRAP_VERSION}."
9
9
  LICENSE = 'MIT'
@@ -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.beta18'
15
+ VERSION = '3.0.2'
16
16
  AUTHORS = ['Thooams'].freeze
17
17
  end
@@ -20,7 +20,7 @@ module UiBibzForm
20
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
- abbr_html = content_tag('abbr', I18n.t(:"simple_form.required.mark", default: '*'), title: I18n.t(:"simple_form.required.text", default: 'required')) if required
23
+ abbr_html = content_tag('abbr', I18n.t(:'simple_form.required.mark', default: '*'), title: I18n.t(:'simple_form.required.text', default: 'required')) if required
24
24
 
25
25
  wrapper_html[:class] = wrapper_classes
26
26
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module UiBibz::Ui::Concerns::CardItemableConcern #:nodoc:
3
+ module UiBibz::Ui::Concerns::CardItemableConcern # :nodoc:
4
4
  extend ActiveSupport::Concern
5
5
  include UiBibz::Ui::Concerns::HtmlConcern
6
6
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module UiBibz::Ui::Concerns::HtmlConcern #:nodoc:
3
+ module UiBibz::Ui::Concerns::HtmlConcern # :nodoc:
4
4
  extend ActiveSupport::Concern
5
5
 
6
6
  included do
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module UiBibz::Ui::Concerns::NavigationConcern #:nodoc:
3
+ module UiBibz::Ui::Concerns::NavigationConcern # :nodoc:
4
4
  extend ActiveSupport::Concern
5
5
 
6
6
  included do
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module UiBibz::Ui::Concerns::NotificationConcern #:nodoc:
3
+ module UiBibz::Ui::Concerns::NotificationConcern # :nodoc:
4
4
  extend ActiveSupport::Concern
5
5
 
6
6
  included do
@@ -46,7 +46,7 @@ module UiBibz::Ui::Core::Boxes::Components
46
46
  # Render html tag
47
47
  def pre_render
48
48
  if options[:collapse]
49
- content_tag :div, class: join_classes('collapse', show), id: options[:collapse], "data-bs-parent": "##{options[:parent_collapse]}" do
49
+ content_tag :div, class: join_classes('collapse', show), id: options[:collapse], 'data-bs-parent': "##{options[:parent_collapse]}" do
50
50
  content_tag :div, @items.join.html_safe, html_options
51
51
  end
52
52
  else
@@ -47,7 +47,7 @@ module UiBibz::Ui::Core::Boxes::Components
47
47
 
48
48
  # See UiBibz::Ui::Core::Component.initialize
49
49
  def initialize(content = nil, options = nil, html_options = nil, &block)
50
- content = content.is_a?(Integer) ? { num: content } : content
50
+ content = { num: content } if content.is_a?(Integer)
51
51
  super
52
52
  @items = [@content]
53
53
  end
@@ -148,7 +148,7 @@ module UiBibz::Ui::Core
148
148
  # Add html data arguments
149
149
  def add_html_data(name, value: true)
150
150
  html_options[:data] = {} if html_options[:data].nil?
151
- value = value.is_a?(String) ? value.strip : value
151
+ value = value.strip if value.is_a?(String)
152
152
  html_options[:data].update({ name => value })
153
153
  end
154
154
 
@@ -83,10 +83,10 @@ module UiBibz::Ui::Core::Forms::Buttons
83
83
  def collapse
84
84
  # Must be flat hash not deep hash
85
85
  {
86
- "data-bs-toggle": :collapse,
87
- "data-bs-target": "##{options[:collapse]}",
88
- "aria-controls": options[:collapse],
89
- "aria-expanded": options[:expand_collapse].nil? ? false : options[:expand_collapse]
86
+ 'data-bs-toggle': :collapse,
87
+ 'data-bs-target': "##{options[:collapse]}",
88
+ 'aria-controls': options[:collapse],
89
+ 'aria-expanded': options[:expand_collapse].nil? ? false : options[:expand_collapse]
90
90
  }
91
91
  end
92
92
 
@@ -78,9 +78,9 @@ module UiBibz::Ui::Core::Forms::Buttons
78
78
  def collapse
79
79
  # Must be flat hash not deep hash
80
80
  {
81
- "data-bs-toggle": :collapse,
82
- "aria-controls": options[:collapse],
83
- "aria-expanded": options[:expand_collaspe].nil? ? false : options[:expand_collaspe]
81
+ 'data-bs-toggle': :collapse,
82
+ 'aria-controls': options[:collapse],
83
+ 'aria-expanded': options[:expand_collaspe].nil? ? false : options[:expand_collaspe]
84
84
  }
85
85
  end
86
86
  end
@@ -53,7 +53,7 @@ module UiBibz::Ui::Core::Forms::Numbers
53
53
  sf.text_field formula_field_name, nil, text_field_formula_html_options
54
54
  sf.addon '=', class: 'formula-field-sign'
55
55
  sf.text_field content, nil, text_field_input_html_options
56
- sf.addon formula_field_alert_glyph, { class: 'formula-field-alert' }, { data: { "bs-toggle": 'tooltip' } }
56
+ sf.addon formula_field_alert_glyph, { class: 'formula-field-alert' }, { data: { 'bs-toggle': 'tooltip' } }
57
57
  sf.addon @options[:prepend] unless @options[:prepend].nil?
58
58
  end.render
59
59
  end
@@ -53,14 +53,14 @@ module UiBibz::Ui::Core::Forms::Numbers
53
53
  def header_min
54
54
  content_tag :div, class: 'slider-header-min' do
55
55
  concat content_tag :label, options[:label_min] || 'Min: ', for: options[:label_for_min]
56
- concat content_tag :span, options[:thumb_min], "data-unit": options[:unit] || options[:unit_min]
56
+ concat content_tag :span, options[:thumb_min], 'data-unit': options[:unit] || options[:unit_min]
57
57
  end
58
58
  end
59
59
 
60
60
  def header_max
61
61
  content_tag :div, class: 'slider-header-max' do
62
62
  concat content_tag :label, options[:label_max] || 'Max: ', for: options[:label_for_max]
63
- concat content_tag :span, options[:thumb_max], "data-unit": options[:unit] || options[:unit_max]
63
+ concat content_tag :span, options[:thumb_max], 'data-unit': options[:unit] || options[:unit_max]
64
64
  end
65
65
  end
66
66
 
@@ -116,7 +116,7 @@ module UiBibz::Ui::Core::Forms::Surrounds
116
116
  end
117
117
 
118
118
  def dropdown_select_field(content = nil, options = nil, html_options = nil, &block)
119
- html_options = (html_options || {}).merge("data-wrapper-classes": 'input-group-btn')
119
+ html_options = (html_options || {}).merge('data-wrapper-classes': 'input-group-btn')
120
120
  @items << UiBibz::Ui::Core::Forms::Selects::DropdownSelectField.new(content, options, html_options, &block).render
121
121
  end
122
122
 
@@ -52,9 +52,7 @@ module UiBibz::Ui::Core::Layouts
52
52
  class Col < UiBibz::Ui::Core::Component
53
53
  # See UiBibz::Ui::Core::Component.initialize
54
54
  def initialize(content = nil, options = nil, html_options = nil, &block)
55
- unless block.nil?
56
- content = content.is_a?(Integer) ? { num: content } : content
57
- end
55
+ content = { num: content } if !block.nil? && content.is_a?(Integer)
58
56
  super
59
57
  end
60
58
 
@@ -50,9 +50,7 @@ module UiBibz::Ui::Core::Layouts
50
50
 
51
51
  # See UiBibz::Ui::Core::Component.initialize
52
52
  def initialize(content = nil, options = nil, html_options = nil, &block)
53
- unless block.nil?
54
- content = content.is_a?(Integer) ? { num: content } : content
55
- end
53
+ content = { num: content } if !block.nil? && content.is_a?(Integer)
56
54
  super
57
55
  @items = [@content]
58
56
  end
@@ -93,7 +93,7 @@ module UiBibz::Ui::Core::Navigations
93
93
  private
94
94
 
95
95
  def component_html_options
96
- super.merge({ "arial-label": 'breadcrumb' })
96
+ super.merge({ 'arial-label': 'breadcrumb' })
97
97
  end
98
98
 
99
99
  def model_name
@@ -50,7 +50,7 @@ module UiBibz::Ui::Core::Navigations::Components
50
50
  private
51
51
 
52
52
  def component_html_options
53
- super.merge(options[:current] ? { "aria-current": 'page' } : {})
53
+ super.merge(options[:current] ? { 'aria-current': 'page' } : {})
54
54
  end
55
55
 
56
56
  def component_html_classes
@@ -45,7 +45,7 @@ module UiBibz::Ui::Core::Navigations
45
45
  when 'nav-tabs'
46
46
  html_tag_base
47
47
  when 'list-group'
48
- html_tag_base.merge("aria-controls": sanitize_text(content).parameterize)
48
+ html_tag_base.merge('aria-controls': sanitize_text(content).parameterize)
49
49
  else
50
50
  {}
51
51
  end.merge(options[:a_html] || {})
@@ -44,7 +44,7 @@ module UiBibz::Ui::Core::Navigations
44
44
  include Haml::Helpers
45
45
  include SimpleForm::ActionViewExtensions::FormHelper if defined?(SimpleForm)
46
46
  include UiBibz::Helpers::UtilsHelper
47
- include ActionView::Helpers #::FormHelper
47
+ include ActionView::Helpers # ::FormHelper
48
48
 
49
49
  attr_accessor :html_options
50
50
 
@@ -58,7 +58,7 @@ module UiBibz::Ui::Core::Navigations
58
58
  def collapse
59
59
  {
60
60
  role: 'button',
61
- data: { "bs-toggle": :collapse },
61
+ data: { 'bs-toggle': :collapse },
62
62
  aria: {
63
63
  controls: options[:collapse],
64
64
  expanded: options[:active_collapse].nil? ? false : options[:active_collapse]
@@ -159,7 +159,7 @@ module UiBibz::Ui::Core::Navigations
159
159
  end
160
160
 
161
161
  def navbar_toggle_button_html
162
- content_tag :button, '☰', class: 'navbar-toggler hidden-sm-up', type: :button, data: { "bs-toggle": 'collapse', "bs-target": "##{id}" }
162
+ content_tag :button, '☰', class: 'navbar-toggler hidden-sm-up', type: :button, data: { 'bs-toggle': 'collapse', 'bs-target': "##{id}" }
163
163
  end
164
164
 
165
165
  def expand_size
@@ -56,7 +56,7 @@ module UiBibz::Ui::Core::Notifications::Components
56
56
  end
57
57
 
58
58
  def component_html_options
59
- { "aria-valuenow": value, "aria-valuemin": min, "aria-valuemax": max, style: "width: #{value}%", role: 'progressbar' }
59
+ { 'aria-valuenow': value, 'aria-valuemin': min, 'aria-valuemax': max, style: "width: #{value}%", role: 'progressbar' }
60
60
  end
61
61
 
62
62
  def striped
@@ -60,7 +60,7 @@ module UiBibz::Ui::Core::Notifications::Components
60
60
  end
61
61
 
62
62
  def close_button
63
- content_tag :button, '', class: 'ml-2 mb-1 btn-close', "data-bs-dismiss": 'toast', "aria-label": 'Close'
63
+ content_tag :button, '', class: 'ml-2 mb-1 btn-close', 'data-bs-dismiss': 'toast', 'aria-label': 'Close'
64
64
  end
65
65
 
66
66
  def component_html_classes
@@ -102,7 +102,7 @@ module UiBibz::Ui::Core::Notifications
102
102
  end
103
103
 
104
104
  def component_html_options
105
- { role: 'alert', "aria-live": 'assertive', "aria-atomic": true }
105
+ { role: 'alert', 'aria-live': 'assertive', 'aria-atomic': true }
106
106
  end
107
107
 
108
108
  def component_html_data
@@ -51,9 +51,9 @@ module UiBibz::Ui::Ux::Tables
51
51
 
52
52
  def defaults_actions
53
53
  [
54
- UiBibz::Ui::Core::Forms::Dropdowns::Components::DropdownLink.new(show_name, url: { controller: @store.controller, action: 'show', id: :id }, glyph: 'eye').render,
55
- UiBibz::Ui::Core::Forms::Dropdowns::Components::DropdownLink.new(edit_name, url: { controller: @store.controller, action: 'edit', id: :id }, glyph: 'edit').render,
56
- UiBibz::Ui::Core::Forms::Dropdowns::Components::DropdownLink.new(delete_name, { glyph: 'trash', url: { controller: @store.controller, action: 'destroy', id: :id }, link_html_options: { data: { confirm: 'Are you sure?', method: :delete } } }).render
54
+ UiBibz::Ui::Core::Forms::Dropdowns::Components::DropdownLink.new(show_name, url: { controller: @store.actions_controller, action: 'show', id: :id }, glyph: 'eye').render,
55
+ UiBibz::Ui::Core::Forms::Dropdowns::Components::DropdownLink.new(edit_name, url: { controller: @store.actions_controller, action: 'edit', id: :id }, glyph: 'edit').render,
56
+ UiBibz::Ui::Core::Forms::Dropdowns::Components::DropdownLink.new(delete_name, { glyph: 'trash', url: { controller: @store.actions_controller, action: 'destroy', id: :id }, link_html_options: { data: { confirm: 'Are you sure?', method: :delete } } }).render
57
57
  ]
58
58
  end
59
59
 
@@ -57,7 +57,7 @@ module UiBibz::Ui::Ux::Tables
57
57
  end
58
58
 
59
59
  def columns
60
- @columns ||= Columns.new(model.new.attributes.keys.map { |record| Column.new(record, { name: record.humanize }) })
60
+ @columns ||= Columns.new(model.attribute_names.map { |attribute_name| Column.new(attribute_name, { name: attribute_name.humanize }) })
61
61
  end
62
62
 
63
63
  attr_reader :model
@@ -70,6 +70,10 @@ module UiBibz::Ui::Ux::Tables
70
70
  @store.controller
71
71
  end
72
72
 
73
+ def actions_controller
74
+ @store.actions_controller
75
+ end
76
+
73
77
  def params
74
78
  @store.params || {}
75
79
  end
@@ -15,7 +15,6 @@ module UiBibz::Ui::Ux::Tables
15
15
  content_tag :div, @html_options do
16
16
  concat UiBibz::Ui::Ux::Tables::TablePagination.new(store: @store, wrap_form: @options[:wrap_form]).render
17
17
  concat UiBibz::Ui::Ux::Tables::TablePaginationPerPage.new(store: @store, wrap_form: @options[:wrap_form]).render
18
- concat tag(:br, class: 'ui-bibz-clear')
19
18
  end
20
19
  end
21
20
 
@@ -172,12 +172,16 @@ module UiBibz::Ui::Ux::Tables
172
172
 
173
173
  # Maybe create a class for td_content
174
174
  def td_content(record, col)
175
- content = col.count ? record.send(col.data_index).count : record.send(col.data_index)
175
+ begin
176
+ content = col.count ? record.send(col.data_index).count : record.send(col.data_index)
177
+ rescue StandardError
178
+ content = nil
179
+ end
176
180
  unless content.nil?
177
181
  content = content.strftime(col.date_format) unless col.date_format.nil?
178
182
  content = link_to content, action.inject_url(col.link, record) unless col.link.nil?
179
- content = col.format.call(@store.records, record) unless col.format.nil?
180
183
  end
184
+ content = col.format.call(@store.records, record) unless col.format.nil?
181
185
  content = As.new(col, record, content, @options).render unless col.as.nil?
182
186
  content
183
187
  end
@@ -39,8 +39,8 @@ module UiBibz::Ui::Ux::Tables
39
39
  # Render html tag with boostrap pagination theme
40
40
  def render
41
41
  paginate_parameters = { controller: store.controller }
42
- paginate_parameters = paginate_parameters.merge({ store_id: store.id }) unless store.id.nil?
43
42
  paginate_parameters = paginate_parameters.merge(store.parameters)
43
+ paginate_parameters = paginate_parameters.merge({ store_id: store.id }) unless store.id.nil?
44
44
  paginate_parameters = paginate_parameters.merge({ link_type: 'pagination' })
45
45
  will_paginate(store.records, params: paginate_parameters.with_indifferent_access.reject { |k, v| default_parameters?(k) || v.blank? }, renderer: WillPaginate::ActionView::BootstrapLinkRenderer)
46
46
  end
@@ -57,7 +57,7 @@ module UiBibz::Ui::Ux::Tables
57
57
  content_tag :div, class: 'table-pagination-per-page' do
58
58
  concat results_count_html
59
59
  concat UiBibz::Utils::Internationalization.new('ui_bibz.table.pagination.per_page', default: 'Per page: ').translate
60
- concat select_tag('per_page', options_for_select([5, 10, 20, 30, 50, 100, 200, 500], store.per_page), class: 'form-control')
60
+ concat select_tag('per_page', options_for_select([5, 10, 20, 30, 50, 100, 200, 500], store.per_page), class: 'form-select')
61
61
  end
62
62
  end
63
63
 
@@ -68,7 +68,7 @@ module UiBibz::Ui::Ux::Tables
68
68
  store.parameters.with_indifferent_access.reject { |k, v| default_parameters?(k) || v.blank? }.each do |k, v|
69
69
  concat tag(:input, type: 'hidden', name: k, value: v)
70
70
  end
71
- concat select_tag('per_page', options_for_select([5, 10, 20, 30, 50, 100, 200, 500], store.per_page), class: 'form-control')
71
+ concat select_tag('per_page', options_for_select([5, 10, 20, 30, 50, 100, 200, 500], store.per_page), class: 'form-select')
72
72
  concat tag(:input, type: 'hidden', name: 'store_id', value: store.id) unless store.id.nil? # If there is more 1 table in html page
73
73
  end
74
74
  end
@@ -62,11 +62,7 @@ module UiBibz::Ui::Ux::Tables
62
62
  end
63
63
 
64
64
  def search_content
65
- if store.id.nil?
66
- store.search
67
- else
68
- store.id == store.params[:store_id] ? store.search : ''
69
- end
65
+ store.search
70
66
  end
71
67
 
72
68
  def clear_button
@@ -26,14 +26,14 @@ class TableTest < ActionView::TestCase
26
26
 
27
27
  test 'table search field' do
28
28
  actual = UiBibz::Ui::Ux::Tables::TableSearchField.new({ store: @users }).render
29
- expected = "<form class=\"form-table-search-field\" action=\"/users?direction=asc&amp;page=1&amp;per_page=2&amp;search=Name+fr&amp;sort=users.name_fr\" accept-charset=\"UTF-8\" method=\"get\"><div class=\"input-group input-group-sm table-search-field\"><span class=\"input-group-text\"><i class=\"glyph fas fa-search\"></i></span><input type=\"hidden\" name=\"sort\" value=\"users.name_fr\" /><input type=\"hidden\" name=\"direction\" value=\"asc\" /><input type=\"hidden\" name=\"per_page\" value=\"2\" /><input type=\"hidden\" name=\"page\" value=\"1\" /><input type=\"hidden\" name=\"only_path\" value=\"true\" /><input type=\"hidden\" name=\"link_type\" value=\"search\" /><input type=\"search\" value=\"Name fr\" name=\"search\" class=\"form-control\" placeholder=\"Search by Name fr and Name en...\" /><button type=\"button\" class=\"btn btn-secondary input-group-btn clear-search-btn\"><i class=\"glyph fas fa-times-circle\"></i> <span class=\"visually-hidden\">Clear Search</span></button></div></form>"
29
+ expected = "<form class=\"form-table-search-field\" action=\"/users?direction=asc&amp;page=1&amp;per_page=2&amp;search=Name+fr&amp;sort=users.name_fr\" accept-charset=\"UTF-8\" method=\"get\"><div class=\"input-group input-group-sm table-search-field\"><span class=\"input-group-text\"><i class=\"glyph fas fa-search\"></i></span><input type=\"hidden\" name=\"sort\" value=\"users.name_fr\" /><input type=\"hidden\" name=\"direction\" value=\"asc\" /><input type=\"hidden\" name=\"per_page\" value=\"2\" /><input type=\"hidden\" name=\"page\" value=\"1\" /><input type=\"hidden\" name=\"only_path\" value=\"true\" /><input type=\"hidden\" name=\"store_id\" value=\"users\" /><input type=\"hidden\" name=\"link_type\" value=\"search\" /><input type=\"search\" value=\"Name fr\" name=\"search\" class=\"form-control\" placeholder=\"Search by Name fr and Name en...\" /><button type=\"button\" class=\"btn btn-secondary input-group-btn clear-search-btn\"><i class=\"glyph fas fa-times-circle\"></i> <span class=\"visually-hidden\">Clear Search</span></button></div></form>"
30
30
 
31
31
  assert_equal expected, actual
32
32
  end
33
33
 
34
34
  test 'table pagination' do
35
35
  actual = UiBibz::Ui::Ux::Tables::TablePagination.new({ store: @users }).render
36
- expected = "<nav class=\"pagination\"><ul class=\"pagination\" role=\"group\"><li class=\"previous page-item disabled\"><span class=\"page-link\">&laquo;</span></li> <li class=\"page-item active\"><span class=\"page-link\">1</span></li> <li class=\"page-item\"><a class=\"page-link\" rel=\"next\" href=\"/users?direction=asc&amp;page=2&amp;search=Name+fr&amp;sort=users.name_fr\">2</a></li> <li class=\"page-item\"><a class=\"page-link\" href=\"/users?direction=asc&amp;page=3&amp;search=Name+fr&amp;sort=users.name_fr\">3</a></li> <li class=\"page-item\"><a class=\"page-link\" href=\"/users?direction=asc&amp;page=4&amp;search=Name+fr&amp;sort=users.name_fr\">4</a></li> <li class=\"page-item\"><a class=\"page-link\" href=\"/users?direction=asc&amp;page=5&amp;search=Name+fr&amp;sort=users.name_fr\">5</a></li> <li class=\"page-item disabled\"><i class=\"page-link\">&hellip;</i></li> <li class=\"page-item\"><a class=\"page-link\" href=\"/users?direction=asc&amp;page=12&amp;search=Name+fr&amp;sort=users.name_fr\">12</a></li> <li class=\"page-item\"><a class=\"page-link\" href=\"/users?direction=asc&amp;page=13&amp;search=Name+fr&amp;sort=users.name_fr\">13</a></li> <li class=\"next page-item\"><a class=\"page-link\" rel=\"next\" href=\"/users?direction=asc&amp;page=2&amp;search=Name+fr&amp;sort=users.name_fr\">&raquo;</a></li></ul></nav>"
36
+ expected = "<nav class=\"pagination\"><ul class=\"pagination\" role=\"group\"><li class=\"previous page-item disabled\"><span class=\"page-link\">&laquo;</span></li> <li class=\"page-item active\"><span class=\"page-link\">1</span></li> <li class=\"page-item\"><a class=\"page-link\" rel=\"next\" href=\"/users?direction=asc&amp;page=2&amp;search=Name+fr&amp;sort=users.name_fr&amp;store_id=users\">2</a></li> <li class=\"page-item\"><a class=\"page-link\" href=\"/users?direction=asc&amp;page=3&amp;search=Name+fr&amp;sort=users.name_fr&amp;store_id=users\">3</a></li> <li class=\"page-item\"><a class=\"page-link\" href=\"/users?direction=asc&amp;page=4&amp;search=Name+fr&amp;sort=users.name_fr&amp;store_id=users\">4</a></li> <li class=\"page-item\"><a class=\"page-link\" href=\"/users?direction=asc&amp;page=5&amp;search=Name+fr&amp;sort=users.name_fr&amp;store_id=users\">5</a></li> <li class=\"page-item disabled\"><i class=\"page-link\">&hellip;</i></li> <li class=\"page-item\"><a class=\"page-link\" href=\"/users?direction=asc&amp;page=12&amp;search=Name+fr&amp;sort=users.name_fr&amp;store_id=users\">12</a></li> <li class=\"page-item\"><a class=\"page-link\" href=\"/users?direction=asc&amp;page=13&amp;search=Name+fr&amp;sort=users.name_fr&amp;store_id=users\">13</a></li> <li class=\"next page-item\"><a class=\"page-link\" rel=\"next\" href=\"/users?direction=asc&amp;page=2&amp;search=Name+fr&amp;sort=users.name_fr&amp;store_id=users\">&raquo;</a></li></ul></nav>"
37
37
 
38
38
  assert_equal expected, actual
39
39
  end
@@ -49,7 +49,7 @@ class TableTest < ActionView::TestCase
49
49
  test 'table sortable' do
50
50
  options = { sortable: true }
51
51
  actual = UiBibz::Ui::Ux::Tables::Sortable.new(@store, options).header(@store.columns.list.first)
52
- expected = '<a class="dropup" href="/users?column_id=id&amp;direction=asc&amp;link_type=column&amp;search=Name+fr&amp;sort=users.id">Id</a>'
52
+ expected = '<a class="dropup" href="/users?column_id=id&amp;direction=asc&amp;link_type=column&amp;search=Name+fr&amp;sort=users.id&amp;store_id=users">Id</a>'
53
53
 
54
54
  assert_equal expected, actual
55
55
  end
@@ -66,14 +66,14 @@ class TableTest < ActionView::TestCase
66
66
  options = { paginable: true }
67
67
  pagination = UiBibz::Ui::Ux::Tables::Paginable.new(@store, options)
68
68
  actual = pagination.render if pagination.paginable?
69
- expected = "<div><nav class=\"pagination\"><ul class=\"pagination\" role=\"group\"><li class=\"previous page-item disabled\"><span class=\"page-link\">&laquo;</span></li> <li class=\"page-item active\"><span class=\"page-link\">1</span></li> <li class=\"page-item\"><a class=\"page-link\" rel=\"next\" href=\"/users?direction=asc&amp;page=2&amp;search=Name+fr&amp;sort=users.name_fr\">2</a></li> <li class=\"page-item\"><a class=\"page-link\" href=\"/users?direction=asc&amp;page=3&amp;search=Name+fr&amp;sort=users.name_fr\">3</a></li> <li class=\"page-item\"><a class=\"page-link\" href=\"/users?direction=asc&amp;page=4&amp;search=Name+fr&amp;sort=users.name_fr\">4</a></li> <li class=\"page-item\"><a class=\"page-link\" href=\"/users?direction=asc&amp;page=5&amp;search=Name+fr&amp;sort=users.name_fr\">5</a></li> <li class=\"page-item disabled\"><i class=\"page-link\">&hellip;</i></li> <li class=\"page-item\"><a class=\"page-link\" href=\"/users?direction=asc&amp;page=12&amp;search=Name+fr&amp;sort=users.name_fr\">12</a></li> <li class=\"page-item\"><a class=\"page-link\" href=\"/users?direction=asc&amp;page=13&amp;search=Name+fr&amp;sort=users.name_fr\">13</a></li> <li class=\"next page-item\"><a class=\"page-link\" rel=\"next\" href=\"/users?direction=asc&amp;page=2&amp;search=Name+fr&amp;sort=users.name_fr\">&raquo;</a></li></ul></nav><form action=\"/users\" accept-charset=\"UTF-8\" method=\"get\"><div class=\"table-pagination-per-page\">Displaying User <b>1&nbsp;-&nbsp;2</b> of <b>25</b> in total | Per page: <input type=\"hidden\" name=\"sort\" value=\"users.name_fr\" /><input type=\"hidden\" name=\"direction\" value=\"asc\" /><input type=\"hidden\" name=\"per_page\" value=\"2\" /><input type=\"hidden\" name=\"only_path\" value=\"true\" /><select name=\"per_page\" id=\"per_page\" class=\"form-control\"><option value=\"5\">5</option>
69
+ expected = "<div><nav class=\"pagination\"><ul class=\"pagination\" role=\"group\"><li class=\"previous page-item disabled\"><span class=\"page-link\">&laquo;</span></li> <li class=\"page-item active\"><span class=\"page-link\">1</span></li> <li class=\"page-item\"><a class=\"page-link\" rel=\"next\" href=\"/users?direction=asc&amp;page=2&amp;search=Name+fr&amp;sort=users.name_fr&amp;store_id=users\">2</a></li> <li class=\"page-item\"><a class=\"page-link\" href=\"/users?direction=asc&amp;page=3&amp;search=Name+fr&amp;sort=users.name_fr&amp;store_id=users\">3</a></li> <li class=\"page-item\"><a class=\"page-link\" href=\"/users?direction=asc&amp;page=4&amp;search=Name+fr&amp;sort=users.name_fr&amp;store_id=users\">4</a></li> <li class=\"page-item\"><a class=\"page-link\" href=\"/users?direction=asc&amp;page=5&amp;search=Name+fr&amp;sort=users.name_fr&amp;store_id=users\">5</a></li> <li class=\"page-item disabled\"><i class=\"page-link\">&hellip;</i></li> <li class=\"page-item\"><a class=\"page-link\" href=\"/users?direction=asc&amp;page=12&amp;search=Name+fr&amp;sort=users.name_fr&amp;store_id=users\">12</a></li> <li class=\"page-item\"><a class=\"page-link\" href=\"/users?direction=asc&amp;page=13&amp;search=Name+fr&amp;sort=users.name_fr&amp;store_id=users\">13</a></li> <li class=\"next page-item\"><a class=\"page-link\" rel=\"next\" href=\"/users?direction=asc&amp;page=2&amp;search=Name+fr&amp;sort=users.name_fr&amp;store_id=users\">&raquo;</a></li></ul></nav><form action=\"/users\" accept-charset=\"UTF-8\" method=\"get\"><div class=\"table-pagination-per-page\">Displaying User <b>1&nbsp;-&nbsp;2</b> of <b>25</b> in total | Per page: <input type=\"hidden\" name=\"sort\" value=\"users.name_fr\" /><input type=\"hidden\" name=\"direction\" value=\"asc\" /><input type=\"hidden\" name=\"per_page\" value=\"2\" /><input type=\"hidden\" name=\"only_path\" value=\"true\" /><select name=\"per_page\" id=\"per_page\" class=\"form-select\"><option value=\"5\">5</option>
70
70
  <option value=\"10\">10</option>
71
71
  <option value=\"20\">20</option>
72
72
  <option value=\"30\">30</option>
73
73
  <option value=\"50\">50</option>
74
74
  <option value=\"100\">100</option>
75
75
  <option value=\"200\">200</option>
76
- <option value=\"500\">500</option></select></div></form><br class=\"ui-bibz-clear\" /></div>"
76
+ <option value=\"500\">500</option></select><input type=\"hidden\" name=\"store_id\" value=\"users\" /></div></form></div>"
77
77
 
78
78
  assert_equal expected, actual
79
79
  end
@@ -97,7 +97,7 @@ class TableTest < ActionView::TestCase
97
97
  test 'table searchable' do
98
98
  options = { searchable: true }
99
99
  actual = UiBibz::Ui::Ux::Tables::Searchable.new(@store, options).render
100
- expected = "<div><div class=\"title\">Users list</div><form class=\"form-table-search-field\" action=\"/users?direction=asc&amp;page=1&amp;per_page=2&amp;search=Name+fr&amp;sort=users.name_fr\" accept-charset=\"UTF-8\" method=\"get\"><div class=\"input-group input-group-sm table-search-field\"><span class=\"input-group-text\"><i class=\"glyph fas fa-search\"></i></span><input type=\"hidden\" name=\"sort\" value=\"users.name_fr\" /><input type=\"hidden\" name=\"direction\" value=\"asc\" /><input type=\"hidden\" name=\"per_page\" value=\"2\" /><input type=\"hidden\" name=\"page\" value=\"1\" /><input type=\"hidden\" name=\"only_path\" value=\"true\" /><input type=\"hidden\" name=\"link_type\" value=\"search\" /><input type=\"search\" value=\"Name fr\" name=\"search\" class=\"form-control\" placeholder=\"Search by Name fr and Name en...\" /><button type=\"button\" class=\"btn btn-secondary input-group-btn clear-search-btn\"><i class=\"glyph fas fa-times-circle\"></i> <span class=\"visually-hidden\">Clear Search</span></button></div></form><br class=\"ui-bibz-clear\" /></div>"
100
+ expected = "<div><div class=\"title\">Users list</div><form class=\"form-table-search-field\" action=\"/users?direction=asc&amp;page=1&amp;per_page=2&amp;search=Name+fr&amp;sort=users.name_fr\" accept-charset=\"UTF-8\" method=\"get\"><div class=\"input-group input-group-sm table-search-field\"><span class=\"input-group-text\"><i class=\"glyph fas fa-search\"></i></span><input type=\"hidden\" name=\"sort\" value=\"users.name_fr\" /><input type=\"hidden\" name=\"direction\" value=\"asc\" /><input type=\"hidden\" name=\"per_page\" value=\"2\" /><input type=\"hidden\" name=\"page\" value=\"1\" /><input type=\"hidden\" name=\"only_path\" value=\"true\" /><input type=\"hidden\" name=\"store_id\" value=\"users\" /><input type=\"hidden\" name=\"link_type\" value=\"search\" /><input type=\"search\" value=\"Name fr\" name=\"search\" class=\"form-control\" placeholder=\"Search by Name fr and Name en...\" /><button type=\"button\" class=\"btn btn-secondary input-group-btn clear-search-btn\"><i class=\"glyph fas fa-times-circle\"></i> <span class=\"visually-hidden\">Clear Search</span></button></div></form><br class=\"ui-bibz-clear\" /></div>"
101
101
 
102
102
  assert_equal expected, actual
103
103
  end
@@ -129,6 +129,13 @@ class TableTest < ActionView::TestCase
129
129
  assert_equal expected, actual
130
130
  end
131
131
 
132
+ test 'table actionable with antoher controller' do
133
+ @users = User.table_search_pagination(params, session, { actions_controller: "areas" })
134
+ @store = UiBibz::Ui::Ux::Tables::Store.new @users
135
+
136
+ assert_equal("areas", @store.actions_controller)
137
+ end
138
+
132
139
  test 'table non actionable header' do
133
140
  options = { actionable: false }
134
141
  action = UiBibz::Ui::Ux::Tables::Actionable.new(@store, options)
data/ui_bibz.gemspec CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |s|
27
27
  s.require_paths = %w[lib vendor]
28
28
 
29
29
  # Rails gems
30
- s.add_development_dependency 'rails', '~> 6.0.3', '>= 6.0.3.2'
30
+ s.add_development_dependency 'rails', '~> 6.1.3', '>= 6.1.3.2'
31
31
 
32
32
  # Remove these dependencies after
33
33
  s.add_dependency 'will_paginate', '~> 3.3.0'
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.beta18
4
+ version: 3.0.2
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-05-04 00:00:00.000000000 Z
11
+ date: 2021-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,20 +16,20 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 6.0.3
19
+ version: 6.1.3
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 6.0.3.2
22
+ version: 6.1.3.2
23
23
  type: :development
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - "~>"
28
28
  - !ruby/object:Gem::Version
29
- version: 6.0.3
29
+ version: 6.1.3
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 6.0.3.2
32
+ version: 6.1.3.2
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: will_paginate
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -254,7 +254,7 @@ dependencies:
254
254
  - - ">="
255
255
  - !ruby/object:Gem::Version
256
256
  version: '0'
257
- description: A Rails Interface Framework using Bootstrap 5.0.0.beta3.
257
+ description: A Rails Interface Framework using Bootstrap 5.0.2.
258
258
  email: thomas@hummel.link
259
259
  executables:
260
260
  - test
@@ -674,15 +674,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
674
674
  version: 3.0.0
675
675
  required_rubygems_version: !ruby/object:Gem::Requirement
676
676
  requirements:
677
- - - ">"
677
+ - - ">="
678
678
  - !ruby/object:Gem::Version
679
- version: 1.3.1
679
+ version: '0'
680
680
  requirements: []
681
- rubygems_version: 3.2.15
681
+ rubygems_version: 3.2.21
682
682
  signing_key:
683
683
  specification_version: 4
684
684
  summary: Ui Bibz is an Ui Framework that allows you to build an interface very quickly
685
- and simply using Bootstrap 5.0.0.beta3.
685
+ and simply using Bootstrap 5.0.2.
686
686
  test_files:
687
687
  - test/dummy/README.rdoc
688
688
  - test/dummy/Rakefile