agilibox 1.9.15 → 1.9.20

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: c2ac38c7ce2b93922b8caeb2c8d90301c44836149b1a646426a6966f24772352
4
- data.tar.gz: e80e585846ab6380434509048d4d9b88c673c8b307e47b1ac4d7530b77176336
3
+ metadata.gz: 8e10ef85cda205b913421360ffdd960056fcc37df3e8ffa92e130cb0c09f3310
4
+ data.tar.gz: d3a4c1af561aa8bc1b4cfb80bf8e3b6202b3a98d73b80b18df0e7c91fdf88825
5
5
  SHA512:
6
- metadata.gz: a8c2c2b1836986a3f10100a46bccd85982f2bc2dd10ac0361b0aecb16fccf58b6dfc15e811616cdfcdd162cf48407116b3980c79ca88833d1fb5dbc13c362543
7
- data.tar.gz: 187ff2cbd4cd530ed94c7f37780b0556ca86db37cce67c959fc6a441e1fbf96ffd60d0653286656bfe9163a04a1dea7c62c4f04a017f49d19d02f0a876fc2f06
6
+ metadata.gz: ef482cd542ee089625a500352c6808e8638990f6acd5d3f8bf3d46dd92e9df723838d3a1d9b714352b43a742969730b4d866028fcd3e97691e01a5cec3e95b94
7
+ data.tar.gz: fade774279ccc5f30a67d0b158b7913c153daa8da702932eeba74e8450c4147cef300566a8ee42aeb14eeb068c0c4fe0bdf82e8133e633ffef71a1a5fe5dc54c
data/CHANGELOG.md CHANGED
@@ -2,6 +2,21 @@
2
2
 
3
3
  ## Next version
4
4
 
5
+ ## v1.9.20
6
+ - Add bootstrap 5 search form
7
+
8
+ ## v1.9.19
9
+ - Add bootstrap 4/5 pagination support
10
+
11
+ ## v1.9.18
12
+ - Rails 6.1 compatibility
13
+
14
+ ## v1.9.17
15
+ - Fix capybara selector
16
+
17
+ ## v1.9.16
18
+ - Fix Rails 6.1 warnings
19
+
5
20
  ## v1.9.15
6
21
  - Add `modal:before-close` event
7
22
 
@@ -31,7 +31,8 @@ module Agilibox::ApiControllerConcern
31
31
 
32
32
  def json_errors_hash_for_model(object)
33
33
  object.errors
34
- .map { |a, m| [a, message: m, full_message: object.errors.full_message(a, m)] }
34
+ .to_hash
35
+ .map { |a, m| [a, message: m.first, full_message: object.errors.full_message(a, m.first)] }
35
36
  .uniq(&:first)
36
37
  .to_h
37
38
  end
@@ -1,6 +1,14 @@
1
1
  module Agilibox::PaginationHelper
2
+ class << self
3
+ attr_writer :theme
4
+
5
+ def theme
6
+ @theme ||= "twitter-bootstrap-3"
7
+ end
8
+ end
9
+
2
10
  def paginate(objects, options = {})
3
- options = {theme: "twitter-bootstrap-3"}.merge(options)
11
+ options = {theme: Agilibox::PaginationHelper.theme}.merge(options)
4
12
  super(objects, **options).gsub(/>(\s+)</, "><").html_safe
5
13
  end
6
14
 
@@ -12,6 +12,8 @@ module Agilibox::Search
12
12
  words = q.to_s.parameterize.split("-")
13
13
  fields = default_search_fields if fields.empty?
14
14
 
15
+ return all if words.empty?
16
+
15
17
  sql_query = words.map.with_index { |_word, index|
16
18
  fields.map { |field|
17
19
  "(UNACCENT(CAST(#{field} AS TEXT)) ILIKE :w#{index})"
@@ -0,0 +1,7 @@
1
+ form.search.bs5.mb-3 method="get" action=action
2
+ = form_hidden_submit
3
+
4
+ .input-group.search
5
+ input.form-control.form-control-sm type="text" name="q" placeholder=ta(:search) value=params[:q]
6
+ button.btn.btn-sm.bg-light.border.search-reset.reset type="submit" = icon(:times)
7
+ button.btn.btn-sm.bg-light.border.search-submit type="submit" = icon(:search)
@@ -0,0 +1,2 @@
1
+ li.page-item
2
+ = link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, remote: remote, class: 'page-link'
@@ -0,0 +1,2 @@
1
+ li.page-item.disabled
2
+ = link_to raw(t 'views.pagination.truncate'), '#', class: 'page-link'
@@ -0,0 +1,2 @@
1
+ li.page-item
2
+ = link_to_unless current_page.last?, raw(t 'views.pagination.last'), url, remote: remote, class: 'page-link'
@@ -0,0 +1,2 @@
1
+ li.page-item
2
+ = link_to_unless current_page.last?, raw(t 'views.pagination.next'), url, rel: 'next', remote: remote, class: 'page-link'
@@ -0,0 +1,6 @@
1
+ - if page.current?
2
+ li.page-item.active
3
+ = content_tag :a, page, data: { remote: remote }, rel: page.rel, class: 'page-link'
4
+ - else
5
+ li.page-item
6
+ = link_to page, url, remote: remote, rel: page.rel, class: 'page-link'
@@ -0,0 +1,12 @@
1
+ = paginator.render do
2
+ nav
3
+ ul.pagination
4
+ == first_page_tag unless current_page.first?
5
+ == prev_page_tag unless current_page.first?
6
+ - each_page do |page|
7
+ - if page.left_outer? || page.right_outer? || page.inside_window?
8
+ == page_tag page
9
+ - elsif !page.was_truncated?
10
+ == gap_tag
11
+ == next_page_tag unless current_page.last?
12
+ == last_page_tag unless current_page.last?
@@ -0,0 +1,2 @@
1
+ li.page-item
2
+ = link_to_unless current_page.first?, raw(t 'views.pagination.previous'), url, rel: 'prev', remote: remote, class: 'page-link'
@@ -1,8 +1,23 @@
1
1
  module Agilibox::ActiveModelCustomErrorMessages
2
- def full_message(attribute, message)
3
- return message[1..] if message[0] == "^"
4
- super(attribute, message)
2
+ # Rails <= 6.0
3
+ module ForErrors
4
+ def full_message(attribute, message)
5
+ return message[1..] if message[0] == "^"
6
+ super
7
+ end
8
+ end
9
+
10
+ ActiveModel::Errors.prepend(ForErrors)
11
+
12
+ # Rails >= 6.1
13
+ module ForError
14
+ def full_message
15
+ return message[1..] if message[0] == "^"
16
+ super
17
+ end
5
18
  end
6
- end
7
19
 
8
- ActiveModel::Errors.prepend(Agilibox::ActiveModelCustomErrorMessages)
20
+ if Module.const_defined?("ActiveModel::Error")
21
+ ActiveModel::Error.prepend(ForError)
22
+ end
23
+ end
@@ -1,8 +1,7 @@
1
1
  Capybara.add_selector(:agilibox_clickable) do
2
2
  xpath do |locator, **options|
3
- self.class.all
4
- .values_at(:link, :button, :label)
5
- .map { |selector| instance_exec(locator, **options, &selector.xpath) }
3
+ %i(link button label)
4
+ .map { |selector| expression_for(selector, locator, **options) }
6
5
  .reduce(:union)
7
6
  end
8
7
  end
@@ -1,3 +1,3 @@
1
1
  module Agilibox
2
- VERSION = "1.9.15"
2
+ VERSION = "1.9.20"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: agilibox
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.15
4
+ version: 1.9.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - agilidée
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-27 00:00:00.000000000 Z
11
+ date: 2021-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails-i18n
@@ -179,6 +179,14 @@ files:
179
179
  - app/views/agilibox/search/_form.html.slim
180
180
  - app/views/agilibox/search/_form_bs3.html.slim
181
181
  - app/views/agilibox/search/_form_bs4.html.slim
182
+ - app/views/agilibox/search/_form_bs5.html.slim
183
+ - app/views/kaminari/bootstrap4/_first_page.html.slim
184
+ - app/views/kaminari/bootstrap4/_gap.html.slim
185
+ - app/views/kaminari/bootstrap4/_last_page.html.slim
186
+ - app/views/kaminari/bootstrap4/_next_page.html.slim
187
+ - app/views/kaminari/bootstrap4/_page.html.slim
188
+ - app/views/kaminari/bootstrap4/_paginator.html.slim
189
+ - app/views/kaminari/bootstrap4/_prev_page.html.slim
182
190
  - config/cucumber.yml
183
191
  - config/locales/actions.en.yml
184
192
  - config/locales/actions.fr.yml
@@ -244,7 +252,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
244
252
  - !ruby/object:Gem::Version
245
253
  version: '0'
246
254
  requirements: []
247
- rubygems_version: 3.1.4
255
+ rubygems_version: 3.1.6
248
256
  signing_key:
249
257
  specification_version: 4
250
258
  summary: Agilibox