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 +4 -4
- data/CHANGELOG.md +15 -0
- data/app/controllers/concerns/agilibox/api_controller_concern.rb +2 -1
- data/app/helpers/agilibox/pagination_helper.rb +9 -1
- data/app/models/concerns/agilibox/search.rb +2 -0
- data/app/views/agilibox/search/_form_bs5.html.slim +7 -0
- data/app/views/kaminari/bootstrap4/_first_page.html.slim +2 -0
- data/app/views/kaminari/bootstrap4/_gap.html.slim +2 -0
- data/app/views/kaminari/bootstrap4/_last_page.html.slim +2 -0
- data/app/views/kaminari/bootstrap4/_next_page.html.slim +2 -0
- data/app/views/kaminari/bootstrap4/_page.html.slim +6 -0
- data/app/views/kaminari/bootstrap4/_paginator.html.slim +12 -0
- data/app/views/kaminari/bootstrap4/_prev_page.html.slim +2 -0
- data/lib/agilibox/active_model_custom_error_messages.rb +20 -5
- data/lib/agilibox/cucumber_helpers/capybara_selectors.rb +2 -3
- data/lib/agilibox/version.rb +1 -1
- metadata +11 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e10ef85cda205b913421360ffdd960056fcc37df3e8ffa92e130cb0c09f3310
|
4
|
+
data.tar.gz: d3a4c1af561aa8bc1b4cfb80bf8e3b6202b3a98d73b80b18df0e7c91fdf88825
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
.
|
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:
|
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,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?
|
@@ -1,8 +1,23 @@
|
|
1
1
|
module Agilibox::ActiveModelCustomErrorMessages
|
2
|
-
|
3
|
-
|
4
|
-
|
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
|
-
|
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
|
-
|
4
|
-
.
|
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
|
data/lib/agilibox/version.rb
CHANGED
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.
|
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-
|
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.
|
255
|
+
rubygems_version: 3.1.6
|
248
256
|
signing_key:
|
249
257
|
specification_version: 4
|
250
258
|
summary: Agilibox
|