agilibox 1.9.14 → 1.9.19
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/CHANGELOG.md +15 -0
- data/app/assets/javascripts/agilibox/modals.coffee +1 -0
- data/app/controllers/concerns/agilibox/api_controller_concern.rb +2 -1
- data/app/filters/agilibox/small_data/filter_strategy_by_date_or_datetime_period.rb +1 -1
- data/app/filters/agilibox/small_data/filter_strategy_by_key_values.rb +1 -1
- data/app/helpers/agilibox/bootstrap_helper.rb +4 -4
- data/app/helpers/agilibox/font_awesome_helper.rb +2 -2
- data/app/helpers/agilibox/form_helper.rb +2 -2
- data/app/helpers/agilibox/pagination_helper.rb +9 -1
- data/app/models/concerns/agilibox/search.rb +2 -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 +10 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ec9c151ffb8cfeac78339974ae35f77124730d8e5a0f4103489c65c03738cff
|
4
|
+
data.tar.gz: cf1862277f5a5fefff00dc06b356902d05ecb1b6e8b9b1bad12e973f4cbfe8fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df5df7fe6e3016d1740a684f8dbdcb44a85c37d299f02cabb2b056137a3745f6ef968f0f5f018d7f540286e9a51ef0a78f518aeaf824063dea2897e81c858db2
|
7
|
+
data.tar.gz: 10a96821c98427c56b24d16e90b904038e7d2a4b60a38c495946ae3ff3d0c81adab668280103e68925e57124d072cc78a085d13c32f58351c97055aae1035098
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,21 @@
|
|
2
2
|
|
3
3
|
## Next version
|
4
4
|
|
5
|
+
## v1.9.19
|
6
|
+
- Add bootstrap 4/5 pagination support
|
7
|
+
|
8
|
+
## v1.9.18
|
9
|
+
- Rails 6.1 compatibility
|
10
|
+
|
11
|
+
## v1.9.17
|
12
|
+
- Fix capybara selector
|
13
|
+
|
14
|
+
## v1.9.16
|
15
|
+
- Fix Rails 6.1 warnings
|
16
|
+
|
17
|
+
## v1.9.15
|
18
|
+
- Add `modal:before-close` event
|
19
|
+
|
5
20
|
## v1.9.14
|
6
21
|
- Fix syntax error on Ruby < 2.7
|
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,6 @@
|
|
1
1
|
class Agilibox::SmallData::FilterStrategyByDateOrDatetimePeriod < ::Agilibox::SmallData::FilterStrategyByKeyValue
|
2
2
|
def initialize(*)
|
3
|
-
if
|
3
|
+
if instance_of?(Agilibox::SmallData::FilterStrategyByDateOrDatetimePeriod)
|
4
4
|
raise "please use FilterStrategyByDatePeriod or FilterStrategyByDatetimePeriod"
|
5
5
|
end
|
6
6
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class Agilibox::SmallData::FilterStrategyByKeyValues < ::Agilibox::SmallData::FilterStrategyByKeyValue
|
2
2
|
def apply(query, value)
|
3
|
-
value = value.split
|
3
|
+
value = value.split if value.is_a?(String)
|
4
4
|
value = value.select(&:present?)
|
5
5
|
column = column_for(query)
|
6
6
|
|
@@ -35,10 +35,10 @@ module Agilibox::BootstrapHelper
|
|
35
35
|
&block
|
36
36
|
)
|
37
37
|
global_classes = Agilibox::BootstrapHelper.card_classes
|
38
|
-
card_classes = ([global_classes[:card]] + card_class.to_s.split
|
39
|
-
header_classes = ([global_classes[:header]] + header_class.to_s.split
|
40
|
-
body_classes = ([global_classes[:body]] + body_class.to_s.split
|
41
|
-
footer_classes = ([global_classes[:footer]] + footer_class.to_s.split
|
38
|
+
card_classes = ([global_classes[:card]] + card_class.to_s.split).compact.sort
|
39
|
+
header_classes = ([global_classes[:header]] + header_class.to_s.split).compact.sort
|
40
|
+
body_classes = ([global_classes[:body]] + body_class.to_s.split).compact.sort
|
41
|
+
footer_classes = ([global_classes[:footer]] + footer_class.to_s.split).compact.sort
|
42
42
|
|
43
43
|
if header
|
44
44
|
header_html = content_tag(header_tag, class: header_classes) { header }
|
@@ -6,7 +6,7 @@ module Agilibox::FontAwesomeHelper
|
|
6
6
|
fa_style = Agilibox::FontAwesomeHelper.default_fa_style_for_id(id)
|
7
7
|
end
|
8
8
|
|
9
|
-
css_classes = options.delete(:class).to_s.split
|
9
|
+
css_classes = options.delete(:class).to_s.split
|
10
10
|
css_classes << "icon"
|
11
11
|
css_classes << "fa-#{id}"
|
12
12
|
css_classes << "fa#{fa_style.to_s[0]}"
|
@@ -15,7 +15,7 @@ module Agilibox::FontAwesomeHelper
|
|
15
15
|
|
16
16
|
attributes = options.merge(class: css_classes.sort.join(" ")).sort.to_h
|
17
17
|
|
18
|
-
tag.span(**attributes)
|
18
|
+
tag.span(**attributes)
|
19
19
|
end
|
20
20
|
|
21
21
|
class << self
|
@@ -23,11 +23,11 @@ module Agilibox::FormHelper
|
|
23
23
|
|
24
24
|
tag.div(class: "actions form-actions") do
|
25
25
|
submit = tag.button(type: :submit, class: "btn btn-sm btn-success form-submit") do
|
26
|
-
tag.span(class: "fa fa-save")
|
26
|
+
tag.span(class: "fa fa-save") + " " + ta(submit_action)
|
27
27
|
end
|
28
28
|
|
29
29
|
cancel = tag.a(href: back_url, class: "btn btn-primary btn-sm form-cancel") do
|
30
|
-
tag.span(class: "fa fa-times")
|
30
|
+
tag.span(class: "fa fa-times") + " " + ta(:cancel)
|
31
31
|
end
|
32
32
|
|
33
33
|
cancel = "" if back_url == false
|
@@ -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,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.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- agilidée
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-05-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails-i18n
|
@@ -179,6 +179,13 @@ 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/kaminari/bootstrap4/_first_page.html.slim
|
183
|
+
- app/views/kaminari/bootstrap4/_gap.html.slim
|
184
|
+
- app/views/kaminari/bootstrap4/_last_page.html.slim
|
185
|
+
- app/views/kaminari/bootstrap4/_next_page.html.slim
|
186
|
+
- app/views/kaminari/bootstrap4/_page.html.slim
|
187
|
+
- app/views/kaminari/bootstrap4/_paginator.html.slim
|
188
|
+
- app/views/kaminari/bootstrap4/_prev_page.html.slim
|
182
189
|
- config/cucumber.yml
|
183
190
|
- config/locales/actions.en.yml
|
184
191
|
- config/locales/actions.fr.yml
|
@@ -244,7 +251,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
244
251
|
- !ruby/object:Gem::Version
|
245
252
|
version: '0'
|
246
253
|
requirements: []
|
247
|
-
rubygems_version: 3.1.
|
254
|
+
rubygems_version: 3.1.6
|
248
255
|
signing_key:
|
249
256
|
specification_version: 4
|
250
257
|
summary: Agilibox
|