agilibox 1.11.0 → 2.0.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: 73e2e45e1fed7a2e0cec02d337dc0afa3bf0112e4b26ec3168d8b62e0f64c961
4
- data.tar.gz: 9a79efe0583a84370cc71d57468e6083b77032053c59ae702c9c557a3cac3dd4
3
+ metadata.gz: ed05b27ec31b31ad6010e9c9977889712896676653142fb5258260b9b1ecebb2
4
+ data.tar.gz: a35841da1a137938d7bd7433d6c7de752a1d13c8d2448c65799cf288b8f3804c
5
5
  SHA512:
6
- metadata.gz: 80764451b386701e1e0033ed885589c1e95bff2bd973cc022dc706ce828fc86f1ac8c947c8bbe5b6f394e395fa5c1e9f933b45fb0173fe03d7ef3c088bc2eed2
7
- data.tar.gz: 727f23e415b4aa280e2d96bc91d3016636e2e8f76a8a197218b9a8ef93797e638fb9637f880603293476c0ad6960fcd6d1974f74a1669184f20624f4b8169222
6
+ metadata.gz: 1d32717f5f9d83fbb0438018c746e1f21ad55d197bb5bdd1aa78b257fbec3b576c907006c46c94b39faf03f0de7d7bdfaef5465d6b3889c7b66144be71ceb712
7
+ data.tar.gz: ea1322427b7fa25716e060ccd10999b052a87226aaf07b889c7f01f9ee8a970ae49b38f1b1d6d757e5c16a6ba3b37f5a6167354b8025885b7f0de5dc70ff7839
data/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  ## Next version
4
4
 
5
+ ## v2.0.0
6
+ - Ruby 3.1 required
7
+ - Rails 7.0
8
+ - Zeitwerk compatibility
9
+
5
10
  ## v1.11.0
6
11
  - Add ActionDispatch::Http::MimeNegotiation::InvalidType to errors middleware
7
12
  - Fix inverted forbidden/unauthorized
@@ -4,12 +4,12 @@ module Agilibox::ApiControllerConcern
4
4
  private
5
5
 
6
6
  def render_json(json = {}, options = {})
7
- json.reverse_merge!(current_user: current_user)
8
- options.reverse_merge!(current_user: current_user)
7
+ json.reverse_merge!(current_user:)
8
+ options.reverse_merge!(current_user:)
9
9
 
10
10
  json = Agilibox::MiniModelSerializer::Serialize.call(json, options)
11
11
 
12
- render options.merge(json: json)
12
+ render options.merge(json:)
13
13
  end
14
14
 
15
15
  def render_json_error(any_object, options = {})
@@ -44,7 +44,7 @@ class Agilibox::SmallData::Filter
44
44
  end
45
45
  end
46
46
 
47
- def respond_to_missing?(method, *)
47
+ def respond_to_missing?(method, include_private = false)
48
48
  super || strategies.key?(method.to_s) || strategies.key?(method.to_s.chomp("="))
49
49
  end
50
50
 
@@ -29,7 +29,7 @@ module Agilibox::FiltersHelper
29
29
  filter_reset_button + filter_submit_button
30
30
  end
31
31
 
32
- def filters_form(options = {}, &block)
32
+ def filters_form(options = {}, &)
33
33
  if options.key?(:buttons)
34
34
  buttons = options.delete(:buttons)
35
35
  else
@@ -41,7 +41,7 @@ module Agilibox::FiltersHelper
41
41
  :wrapper => :inline_form,
42
42
  }.merge(options)
43
43
 
44
- html = simple_form_for(:filters, options, &block)
44
+ html = simple_form_for(:filters, options, &)
45
45
 
46
46
  if buttons
47
47
  html = html.gsub("</form>", "#{form_hidden_submit + filter_buttons}</form>").html_safe
@@ -3,7 +3,7 @@ module Agilibox::FormHelper
3
3
 
4
4
  # Hidden submit to be the default triggered on <enter> keypress on a form
5
5
  def form_hidden_submit
6
- tag(:input, type: "submit", class: "hidden-submit")
6
+ tag.input(type: "submit", class: "hidden-submit")
7
7
  end
8
8
 
9
9
  def form_buttons(opts = {})
@@ -36,7 +36,7 @@ module Agilibox::FormHelper
36
36
  end
37
37
  end
38
38
 
39
- def horizontal_form_for(obj, opts = {}, &block)
39
+ def horizontal_form_for(obj, opts = {}, &)
40
40
  opts = {
41
41
  :wrapper => "horizontal_form",
42
42
  :html => {
@@ -44,11 +44,11 @@ module Agilibox::FormHelper
44
44
  },
45
45
  }.deep_merge(opts)
46
46
 
47
- simple_form_for(obj, opts, &block)
47
+ simple_form_for(obj, opts, &)
48
48
  end
49
49
 
50
50
  def search_form(action: request.fullpath)
51
- render "agilibox/search/form", action: action
51
+ render "agilibox/search/form", action:
52
52
  end
53
53
 
54
54
  def checkboxes_dropdown(f, input, collection, label = t("actions.select"))
@@ -67,6 +67,6 @@ module Agilibox::FormHelper
67
67
 
68
68
  return if query_values.empty?
69
69
 
70
- query_values.sum { |k, v| tag.input(type: "hidden", name: k, value: v) }
70
+ query_values.sum("".html_safe) { |k, v| tag.input(type: "hidden", name: k, value: v) }
71
71
  end
72
72
  end
@@ -9,9 +9,9 @@ module Agilibox::LinkHelper
9
9
  end
10
10
  end
11
11
 
12
- def icon_link_to(icon, name, options = nil, html_options = nil, &block)
12
+ def icon_link_to(icon, name, options = nil, html_options = nil, &)
13
13
  name = "#{icon(icon)} #{name}".html_safe
14
- link_to(name, options, html_options, &block)
14
+ link_to(name, options, html_options, &)
15
15
  end
16
16
 
17
17
  def web_link(text, opts = {})
@@ -8,7 +8,7 @@ class Agilibox::MiniModelSerializer::Serialize
8
8
 
9
9
  def call
10
10
  if object.is_a?(Hash)
11
- object.map { |k, v| [k.to_s, serialize(v)] }.to_h
11
+ object.map.to_h { |k, v| [k.to_s, serialize(v)] }
12
12
  elsif object.is_a?(Enumerable)
13
13
  object.map { |e| serialize(e) }
14
14
  elsif (serializer = "#{object.class}Serializer".safe_constantize)
@@ -4,20 +4,20 @@ class Agilibox::MiniModelSerializer::Serializer < Agilibox::MiniModelSerializer:
4
4
  end
5
5
 
6
6
  def call
7
- serialize attributes.map { |k| [k, send(k)] }.to_h
7
+ serialize(attributes.index_with { |k| send(k) })
8
8
  end
9
9
 
10
10
  private
11
11
 
12
- def method_missing(m, *args)
12
+ def method_missing(m, ...)
13
13
  if respond_to_missing?(m)
14
- object.send(m, *args)
14
+ object.send(m, ...)
15
15
  else
16
16
  super
17
17
  end
18
18
  end
19
19
 
20
- def respond_to_missing?(m, *)
20
+ def respond_to_missing?(m, include_private = false)
21
21
  super || object.respond_to?(m, true)
22
22
  end
23
23
  end
@@ -2,29 +2,29 @@ module Agilibox::Monkey
2
2
  extend ActiveSupport::Concern
3
3
 
4
4
  class_methods do
5
- def prepend_instances(&block)
6
- m = Module.new(&block)
5
+ def prepend_instances(&)
6
+ m = Module.new(&)
7
7
  send(:prepend, m)
8
8
  end
9
9
 
10
- def prepend_class(&block)
11
- m = Module.new(&block)
10
+ def prepend_class(&)
11
+ m = Module.new(&)
12
12
  singleton_class.send(:prepend, m)
13
13
  end
14
14
 
15
- def prepend_instance_method(name, &block)
15
+ def prepend_instance_method(name, &)
16
16
  check_instance_method_exist!(name)
17
17
 
18
18
  m = Module.new
19
- m.send(:define_method, name, &block)
19
+ m.send(:define_method, name, &)
20
20
  send(:prepend, m)
21
21
  end
22
22
 
23
- def prepend_class_method(name, &block)
23
+ def prepend_class_method(name, &)
24
24
  check_class_method_exist!(name)
25
25
 
26
26
  m = Module.new
27
- m.send(:define_method, name, &block)
27
+ m.send(:define_method, name, &)
28
28
  singleton_class.send(:prepend, m)
29
29
  end
30
30
 
@@ -3,17 +3,15 @@ class Agilibox::Serializers::XLSX < Agilibox::Serializers::Base
3
3
  headers, *data = formatted_data
4
4
 
5
5
  SpreadsheetArchitect.to_xlsx(
6
- headers: headers,
7
- data: data,
6
+ headers:,
7
+ data:,
8
8
  freeze_headers: true,
9
9
  range_styles: range_styles(data[0]),
10
10
  )
11
11
  end
12
12
 
13
13
  def render_file(file_path)
14
- File.open(file_path, "w+b") do |f|
15
- f.write(render_inline)
16
- end
14
+ File.binwrite(file_path, render_inline)
17
15
  end
18
16
 
19
17
  private
@@ -25,14 +23,14 @@ class Agilibox::Serializers::XLSX < Agilibox::Serializers::Base
25
23
  end
26
24
 
27
25
  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"}}
26
+ row.each_index.select { row[_1].is_a?(Date) }.map do |c|
27
+ {range: {rows: :all, columns: c}, styles: {format_code: "dd/mm/yyyy"}}
30
28
  end
31
29
  end
32
30
 
33
31
  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"}}
32
+ row.each_index.select { row[_1].is_a?(Time) }.map do |c|
33
+ {range: {rows: :all, columns: c}, styles: {format_code: "dd/mm/yyyy hh:mm:ss"}}
36
34
  end
37
35
  end
38
36
  end
@@ -27,15 +27,15 @@ class Agilibox::SMS::ApplicationSMS
27
27
  class << self
28
28
  private :new
29
29
 
30
- def method_missing(m, *args)
30
+ def method_missing(m, ...)
31
31
  if respond_to_missing?(m)
32
- new(action_name: m).public_send(m, *args)
32
+ new(action_name: m).public_send(m, ...)
33
33
  else
34
34
  super
35
35
  end
36
36
  end
37
37
 
38
- def respond_to_missing?(m, *)
38
+ def respond_to_missing?(m, include_private = false)
39
39
  super || public_instance_methods.include?(m)
40
40
  end
41
41
  end # class << self
@@ -5,7 +5,7 @@ class << Agilibox
5
5
  @parent_controller ||= [
6
6
  "ApplicationController",
7
7
  "ActionController::Base",
8
- ].map(&:safe_constantize).compact.first
8
+ ].filter_map(&:safe_constantize).first
9
9
  end
10
10
 
11
11
  attr_writer :parent_mailer
@@ -14,6 +14,6 @@ class << Agilibox
14
14
  @parent_mailer ||= [
15
15
  "ApplicationMailer",
16
16
  "ActionMailer::Base",
17
- ].map(&:safe_constantize).compact.first
17
+ ].filter_map(&:safe_constantize).first
18
18
  end
19
19
  end
@@ -63,7 +63,7 @@ Then("I do not see {string} element") do |selector|
63
63
  end
64
64
 
65
65
  Then("I see {int} times {string} element") do |count, selector|
66
- expect(page).to have_selector(selector, count: count)
66
+ expect(page).to have_selector(selector, count:)
67
67
  end
68
68
 
69
69
  Then("I see {string} in modal") do |text|
@@ -95,7 +95,7 @@ When("I select {string}") do |value|
95
95
  end
96
96
 
97
97
  When("I select {string} from {string}") do |value, from|
98
- select value, from: from
98
+ select value, from:
99
99
  end
100
100
 
101
101
  When(/^I select2 "([^"]*)" from "([^"]*)"$/) do |value, selector|
@@ -8,6 +8,16 @@ module Agilibox
8
8
  class Engine < ::Rails::Engine
9
9
  isolate_namespace Agilibox
10
10
 
11
+ initializer "inflections" do
12
+ ActiveSupport::Inflector.inflections(:en) do |inflect|
13
+ inflect.acronym "FCM"
14
+ inflect.acronym "SMS"
15
+ inflect.acronym "SNS"
16
+ inflect.acronym "UUID"
17
+ inflect.acronym "XLSX"
18
+ end
19
+ end
20
+
11
21
  initializer "agilibox_mime_types" do
12
22
  Mime::Type.register "application/vnd.ms-excel", :xls
13
23
  Mime::Type.register "application/vnd.ms-excel", :xlsx
@@ -1,7 +1,6 @@
1
1
  module Agilibox::FormBackUrl
2
2
  def back_url_tag
3
- tag(:input,
4
- :type => "hidden",
3
+ tag.input(:type => "hidden",
5
4
  :name => "back_url",
6
5
  :value => (params[:back_url].presence || request.referer),
7
6
  )
@@ -1,3 +1,3 @@
1
1
  module Agilibox
2
- VERSION = "1.11.0"
2
+ VERSION = "2.0.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.11.0
4
+ version: 2.0.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-10-21 00:00:00.000000000 Z
11
+ date: 2022-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails-i18n
@@ -257,14 +257,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
257
257
  requirements:
258
258
  - - ">="
259
259
  - !ruby/object:Gem::Version
260
- version: '0'
260
+ version: 3.1.0
261
261
  required_rubygems_version: !ruby/object:Gem::Requirement
262
262
  requirements:
263
263
  - - ">="
264
264
  - !ruby/object:Gem::Version
265
265
  version: '0'
266
266
  requirements: []
267
- rubygems_version: 3.1.6
267
+ rubygems_version: 3.3.7
268
268
  signing_key:
269
269
  specification_version: 4
270
270
  summary: Agilibox