agilibox 1.9.19 → 1.10.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/app/filters/agilibox/small_data/filter.rb +7 -1
- data/app/filters/agilibox/small_data/filter_strategy_by_date_begin.rb +1 -1
- data/app/filters/agilibox/small_data/filter_strategy_by_date_end.rb +1 -1
- data/app/serializers/agilibox/serializers/base.rb +6 -6
- data/app/serializers/agilibox/serializers/xlsx.rb +27 -1
- data/app/views/agilibox/search/_form_bs5.html.slim +7 -0
- data/lib/agilibox/cucumber_helpers/capybara.rb +2 -1
- data/lib/agilibox/errors_middleware.rb +1 -0
- data/lib/agilibox/version.rb +1 -1
- metadata +3 -4
- data/app/filters/agilibox/small_data/filter_strategy_by_time_period.rb +0 -6
- data/app/serializers/agilibox/serializers/axlsx.rb +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c957ea49c90e282829586fcc2e643e29f0cafdf6de7addd6867e7c7ccb84b208
|
4
|
+
data.tar.gz: 7a03a0ccea759d460a7c67deb95f44e9e06f09ae89ddf9e8038e23f8112749a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b458a4602f68758275b70049a33def1d27658af96e4d6941251702b0d2957b5968c3cd2cf7bb682338f4c3a931233e054636629e9539053ef5700ad9102c847b
|
7
|
+
data.tar.gz: f64d11c96a644d6f2871820a25f1ba000904dbecf50037fa07b69cfe37c1f87aab16041a9188f0fb78c9ff9d988597408ba8f3dac9d78682c755c3a5d1badc36
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,19 @@
|
|
2
2
|
|
3
3
|
## Next version
|
4
4
|
|
5
|
+
## v1.10.2
|
6
|
+
- Filters improvements
|
7
|
+
|
8
|
+
## v1.10.1
|
9
|
+
- Fix date filters
|
10
|
+
|
11
|
+
## v1.10.0
|
12
|
+
- Add date support to XLSX serializer
|
13
|
+
- Remove AXLSX serializer
|
14
|
+
|
15
|
+
## v1.9.20
|
16
|
+
- Add bootstrap 5 search form
|
17
|
+
|
5
18
|
## v1.9.19
|
6
19
|
- Add bootstrap 4/5 pagination support
|
7
20
|
|
@@ -1,4 +1,6 @@
|
|
1
1
|
class Agilibox::SmallData::Filter
|
2
|
+
include ActiveModel::Model
|
3
|
+
|
2
4
|
STRATEGIES = {}
|
3
5
|
|
4
6
|
attr_reader :jar
|
@@ -60,8 +62,12 @@ class Agilibox::SmallData::Filter
|
|
60
62
|
write read.merge(new_filters)
|
61
63
|
end
|
62
64
|
|
65
|
+
def actives_count
|
66
|
+
read.count { |k, v| strategies.key?(k.to_s) && v.present? }
|
67
|
+
end
|
68
|
+
|
63
69
|
def any?
|
64
|
-
|
70
|
+
actives_count.positive?
|
65
71
|
end
|
66
72
|
|
67
73
|
def empty?
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class Agilibox::SmallData::FilterStrategyByDateBegin < ::Agilibox::SmallData::FilterStrategyByKeyValue
|
2
2
|
def apply(query, value)
|
3
|
-
value =
|
3
|
+
value = Date.parse(value)
|
4
4
|
column = column_for(query)
|
5
5
|
query.where("#{column} >= ?", value)
|
6
6
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class Agilibox::SmallData::FilterStrategyByDateEnd < ::Agilibox::SmallData::FilterStrategyByKeyValue
|
2
2
|
def apply(query, value)
|
3
|
-
value =
|
3
|
+
value = Date.parse(value)
|
4
4
|
column = column_for(query)
|
5
5
|
query.where("#{column} <= ?", value)
|
6
6
|
end
|
@@ -39,8 +39,8 @@ class Agilibox::Serializers::Base
|
|
39
39
|
I18n.t(value.to_s)
|
40
40
|
end
|
41
41
|
|
42
|
-
def
|
43
|
-
|
42
|
+
def format_date_or_time(value)
|
43
|
+
value
|
44
44
|
end
|
45
45
|
|
46
46
|
def format_default(value)
|
@@ -48,10 +48,10 @@ class Agilibox::Serializers::Base
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def formatter_for(value)
|
51
|
-
return :integer
|
52
|
-
return :decimal
|
53
|
-
return :boolean
|
54
|
-
return :
|
51
|
+
return :integer if value.is_a?(Integer)
|
52
|
+
return :decimal if value.is_a?(Numeric)
|
53
|
+
return :boolean if value.is_a?(TrueClass) || value.is_a?(FalseClass)
|
54
|
+
return :date_or_time if value.is_a?(Date) || value.is_a?(Time)
|
55
55
|
return :default
|
56
56
|
end
|
57
57
|
|
@@ -1,7 +1,13 @@
|
|
1
1
|
class Agilibox::Serializers::XLSX < Agilibox::Serializers::Base
|
2
2
|
def render_inline
|
3
3
|
headers, *data = formatted_data
|
4
|
-
|
4
|
+
|
5
|
+
SpreadsheetArchitect.to_xlsx(
|
6
|
+
headers: headers,
|
7
|
+
data: data,
|
8
|
+
freeze_headers: true,
|
9
|
+
range_styles: range_styles(data[0]),
|
10
|
+
)
|
5
11
|
end
|
6
12
|
|
7
13
|
def render_file(file_path)
|
@@ -9,4 +15,24 @@ class Agilibox::Serializers::XLSX < Agilibox::Serializers::Base
|
|
9
15
|
f.write(render_inline)
|
10
16
|
end
|
11
17
|
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def range_styles(row)
|
22
|
+
return [] if row.nil?
|
23
|
+
|
24
|
+
date_range_styles(row) + time_range_styles(row)
|
25
|
+
end
|
26
|
+
|
27
|
+
def date_range_styles(row)
|
28
|
+
row.each_index.select { row[_1].is_a?(Date) }.map do
|
29
|
+
{range: {rows: :all, columns: _1}, styles: {format_code: "dd/mm/yyyy"}}
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def time_range_styles(row)
|
34
|
+
row.each_index.select { row[_1].is_a?(Time) }.map do
|
35
|
+
{range: {rows: :all, columns: _1}, styles: {format_code: "dd/mm/yyyy hh:mm:ss"}}
|
36
|
+
end
|
37
|
+
end
|
12
38
|
end
|
@@ -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)
|
@@ -1,5 +1,6 @@
|
|
1
1
|
Capybara.register_driver :agilibox_no_driver do |_app|
|
2
|
-
raise
|
2
|
+
raise \
|
3
|
+
"You need to add Agilibox::CucumberConfig.require_cuprite! or " \
|
3
4
|
"Agilibox::CucumberConfig.require_chrome_headless! " \
|
4
5
|
"to your features/support/env.rb"
|
5
6
|
end
|
@@ -9,6 +9,7 @@ class Agilibox::ErrorsMiddleware
|
|
9
9
|
"ActionController::BadRequest",
|
10
10
|
"ActionController::UnknownFormat",
|
11
11
|
"ActionController::UnknownHttpMethod",
|
12
|
+
"ActionDispatch::Cookies::CookieOverflow",
|
12
13
|
"ActionView::MissingTemplate",
|
13
14
|
"Mime::Type::InvalidMimeType",
|
14
15
|
]
|
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.
|
4
|
+
version: 1.10.2
|
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-09-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails-i18n
|
@@ -125,7 +125,6 @@ files:
|
|
125
125
|
- app/filters/agilibox/small_data/filter_strategy_by_key_value.rb
|
126
126
|
- app/filters/agilibox/small_data/filter_strategy_by_key_values.rb
|
127
127
|
- app/filters/agilibox/small_data/filter_strategy_by_tags.rb
|
128
|
-
- app/filters/agilibox/small_data/filter_strategy_by_time_period.rb
|
129
128
|
- app/forms/agilibox/mini_form_object.rb
|
130
129
|
- app/helpers/agilibox/all_helpers.rb
|
131
130
|
- app/helpers/agilibox/bootstrap_helper.rb
|
@@ -163,7 +162,6 @@ files:
|
|
163
162
|
- app/models/concerns/agilibox/search.rb
|
164
163
|
- app/models/concerns/agilibox/timestamp_helpers.rb
|
165
164
|
- app/serializers/agilibox/serializers.rb
|
166
|
-
- app/serializers/agilibox/serializers/axlsx.rb
|
167
165
|
- app/serializers/agilibox/serializers/base.rb
|
168
166
|
- app/serializers/agilibox/serializers/xlsx.rb
|
169
167
|
- app/services/agilibox/service.rb
|
@@ -179,6 +177,7 @@ files:
|
|
179
177
|
- app/views/agilibox/search/_form.html.slim
|
180
178
|
- app/views/agilibox/search/_form_bs3.html.slim
|
181
179
|
- app/views/agilibox/search/_form_bs4.html.slim
|
180
|
+
- app/views/agilibox/search/_form_bs5.html.slim
|
182
181
|
- app/views/kaminari/bootstrap4/_first_page.html.slim
|
183
182
|
- app/views/kaminari/bootstrap4/_gap.html.slim
|
184
183
|
- app/views/kaminari/bootstrap4/_last_page.html.slim
|
@@ -1,21 +0,0 @@
|
|
1
|
-
class Agilibox::Serializers::AXLSX < Agilibox::Serializers::Base
|
2
|
-
def render_inline
|
3
|
-
xlsx.to_stream.read.force_encoding("BINARY")
|
4
|
-
end
|
5
|
-
|
6
|
-
def render_file(file_path)
|
7
|
-
xlsx.serialize(file_path)
|
8
|
-
end
|
9
|
-
|
10
|
-
def xlsx
|
11
|
-
@xlsx ||= Axlsx::Package.new do |p|
|
12
|
-
p.workbook.add_worksheet do |sheet|
|
13
|
-
formatted_data.each do |line|
|
14
|
-
sheet.add_row(line)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
p.use_shared_strings = true
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|