agilibox 1.10.0 → 1.11.0

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: b79eff8bab58fe3ca456bb0f4ed5eb18de97fd7a82dc247751a094a4fb91a961
4
- data.tar.gz: b13ee9bd49da7ceccee0f20737706ab1a9a3d4762688902bc773be94950af6cd
3
+ metadata.gz: 73e2e45e1fed7a2e0cec02d337dc0afa3bf0112e4b26ec3168d8b62e0f64c961
4
+ data.tar.gz: 9a79efe0583a84370cc71d57468e6083b77032053c59ae702c9c557a3cac3dd4
5
5
  SHA512:
6
- metadata.gz: 599316ad810f15843e060a9cc5034cc76b505cde1bda4066deccd8bad1470986ad5bf3fecaa1e4712ede494904a06851a5df1a8852beeb0a087e5677bf118bb8
7
- data.tar.gz: 92a2e1834215bfd50c322163cb59dfa22ea025aa4e52ee345815b5cebadb4cc3f45f376d8205e934e8aba4c8cf7cfe71813e367d4dd06e53cbbe1cf6cf329c3f
6
+ metadata.gz: 80764451b386701e1e0033ed885589c1e95bff2bd973cc022dc706ce828fc86f1ac8c947c8bbe5b6f394e395fa5c1e9f933b45fb0173fe03d7ef3c088bc2eed2
7
+ data.tar.gz: 727f23e415b4aa280e2d96bc91d3016636e2e8f76a8a197218b9a8ef93797e638fb9637f880603293476c0ad6960fcd6d1974f74a1669184f20624f4b8169222
data/CHANGELOG.md CHANGED
@@ -2,6 +2,25 @@
2
2
 
3
3
  ## Next version
4
4
 
5
+ ## v1.11.0
6
+ - Add ActionDispatch::Http::MimeNegotiation::InvalidType to errors middleware
7
+ - Fix inverted forbidden/unauthorized
8
+
9
+ ## v1.10.5
10
+ - Fix hidden_inputs_for_get_form again
11
+
12
+ ## v1.10.4
13
+ - Fix hidden_inputs_for_get_form
14
+
15
+ ## v1.10.3
16
+ - Fix search forms to preserve GET params
17
+
18
+ ## v1.10.2
19
+ - Filters improvements
20
+
21
+ ## v1.10.1
22
+ - Fix date filters
23
+
5
24
  ## v1.10.0
6
25
  - Add date support to XLSX serializer
7
26
  - Remove AXLSX serializer
@@ -54,7 +54,7 @@ module Agilibox::ApiControllerConcern
54
54
  end
55
55
 
56
56
  def render_forbidden_or_unauthorized
57
- current_user ? render_unauthorized : render_forbidden
57
+ current_user ? render_forbidden : render_unauthorized
58
58
  end
59
59
 
60
60
  included do |controller|
@@ -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
- read.select { |k, v| strategies.key?(k.to_s) && v.present? }.any?
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 = Time.zone.parse(value).beginning_of_day
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 = Time.zone.parse(value).end_of_day
3
+ value = Date.parse(value)
4
4
  column = column_for(query)
5
5
  query.where("#{column} <= ?", value)
6
6
  end
@@ -59,4 +59,14 @@ module Agilibox::FormHelper
59
59
  :label => label,
60
60
  )
61
61
  end
62
+
63
+ def hidden_inputs_for_get_form(url, except: [])
64
+ query_values = Addressable::URI.parse(url).query_values.to_h
65
+ .with_indifferent_access
66
+ .except(*except)
67
+
68
+ return if query_values.empty?
69
+
70
+ query_values.sum { |k, v| tag.input(type: "hidden", name: k, value: v) }
71
+ end
62
72
  end
@@ -1,4 +1,5 @@
1
1
  form.search.bs3 method="get" action=action
2
+ = hidden_inputs_for_get_form(action, except: [:q])
2
3
  = form_hidden_submit
3
4
 
4
5
  p.input-group.search
@@ -1,4 +1,5 @@
1
1
  form.search.bs4 method="get" action=action
2
+ = hidden_inputs_for_get_form(action, except: [:q])
2
3
  = form_hidden_submit
3
4
 
4
5
  .input-group.search
@@ -1,4 +1,5 @@
1
1
  form.search.bs5.mb-3 method="get" action=action
2
+ = hidden_inputs_for_get_form(action, except: [:q])
2
3
  = form_hidden_submit
3
4
 
4
5
  .input-group.search
@@ -1,5 +1,6 @@
1
1
  Capybara.register_driver :agilibox_no_driver do |_app|
2
- raise "You need to add Agilibox::CucumberConfig.require_cuprite! or "\
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,8 @@ class Agilibox::ErrorsMiddleware
9
9
  "ActionController::BadRequest",
10
10
  "ActionController::UnknownFormat",
11
11
  "ActionController::UnknownHttpMethod",
12
+ "ActionDispatch::Cookies::CookieOverflow",
13
+ "ActionDispatch::Http::MimeNegotiation::InvalidType",
12
14
  "ActionView::MissingTemplate",
13
15
  "Mime::Type::InvalidMimeType",
14
16
  ]
@@ -1,3 +1,3 @@
1
1
  module Agilibox
2
- VERSION = "1.10.0"
2
+ VERSION = "1.11.0"
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.10.0
4
+ version: 1.11.0
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-08-24 00:00:00.000000000 Z
11
+ date: 2021-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails-i18n
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: addressable
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
83
97
  description: Agilibox
84
98
  email:
85
99
  - contact@agilidee.com
@@ -125,7 +139,6 @@ files:
125
139
  - app/filters/agilibox/small_data/filter_strategy_by_key_value.rb
126
140
  - app/filters/agilibox/small_data/filter_strategy_by_key_values.rb
127
141
  - app/filters/agilibox/small_data/filter_strategy_by_tags.rb
128
- - app/filters/agilibox/small_data/filter_strategy_by_time_period.rb
129
142
  - app/forms/agilibox/mini_form_object.rb
130
143
  - app/helpers/agilibox/all_helpers.rb
131
144
  - app/helpers/agilibox/bootstrap_helper.rb
@@ -1,6 +0,0 @@
1
- class Agilibox::SmallData::FilterStrategyByTimePeriod
2
- def initialize(*)
3
- raise "FilterStrategyByTimePeriod is deprecated, please use " \
4
- "FilterStrategyByDatePeriod or FilterStrategyByDatetimePeriod"
5
- end
6
- end