agilibox 1.9.18 → 1.10.1
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 +13 -0
- 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/helpers/agilibox/pagination_helper.rb +9 -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/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/cucumber_helpers/capybara.rb +2 -1
- data/lib/agilibox/errors_middleware.rb +1 -0
- data/lib/agilibox/version.rb +1 -1
- metadata +10 -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: ff2d34b73ea33a219f3d265b935bdea4036bfc6ec4341fd2276e30027faabcc0
|
4
|
+
data.tar.gz: a045b91aea19b7e91086e76b719b331ad7e1c91a968dcc98ab0ee2c751bd73f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4fee52d85871c82503de1c260a47e8c21a67632ed46ab225d3b62d67d2c800097581134777fdf8dbd00f7dee1a8325f6645f5c5c32357afb76ff3a0c824d3ce8
|
7
|
+
data.tar.gz: b5015ff7177e0d632fd3426db3eb1c784a624458a9d55c6c70e614a75a43dfb0d3f53c39ca734072f7bea305065997f49e63fd8e303437f7d69f8d2c5fcee249
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,19 @@
|
|
2
2
|
|
3
3
|
## Next version
|
4
4
|
|
5
|
+
## v1.10.1
|
6
|
+
- Fix date filters
|
7
|
+
|
8
|
+
## v1.10.0
|
9
|
+
- Add date support to XLSX serializer
|
10
|
+
- Remove AXLSX serializer
|
11
|
+
|
12
|
+
## v1.9.20
|
13
|
+
- Add bootstrap 5 search form
|
14
|
+
|
15
|
+
## v1.9.19
|
16
|
+
- Add bootstrap 4/5 pagination support
|
17
|
+
|
5
18
|
## v1.9.18
|
6
19
|
- Rails 6.1 compatibility
|
7
20
|
|
@@ -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
|
@@ -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
|
|
@@ -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)
|
@@ -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,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.1
|
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,14 @@ 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
|
181
|
+
- app/views/kaminari/bootstrap4/_first_page.html.slim
|
182
|
+
- app/views/kaminari/bootstrap4/_gap.html.slim
|
183
|
+
- app/views/kaminari/bootstrap4/_last_page.html.slim
|
184
|
+
- app/views/kaminari/bootstrap4/_next_page.html.slim
|
185
|
+
- app/views/kaminari/bootstrap4/_page.html.slim
|
186
|
+
- app/views/kaminari/bootstrap4/_paginator.html.slim
|
187
|
+
- app/views/kaminari/bootstrap4/_prev_page.html.slim
|
182
188
|
- config/cucumber.yml
|
183
189
|
- config/locales/actions.en.yml
|
184
190
|
- config/locales/actions.fr.yml
|
@@ -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
|