agilibox 1.9.14 → 1.9.19

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: 39ba603c31035133392e8960223805f62875d2c073bab3c92c740ee64587cc6f
4
- data.tar.gz: 9f029239b10af613e1cb62c0f11a2c1e17037bb4f2178a81a9c3c7f4afebad1c
3
+ metadata.gz: 6ec9c151ffb8cfeac78339974ae35f77124730d8e5a0f4103489c65c03738cff
4
+ data.tar.gz: cf1862277f5a5fefff00dc06b356902d05ecb1b6e8b9b1bad12e973f4cbfe8fb
5
5
  SHA512:
6
- metadata.gz: aafbd06be7c481159a1f86060f7712b6f0d82dd9f3e4d28dc66b7fa5c08200649c9ff3029c8975c76f1bd40159988b92186e01e10b67429a11687e8e796e4874
7
- data.tar.gz: c3f1221380f43921074b6b4ba2eb4c4f70681636c0fbba4784f3553f3f0a3b595286f38db1cf6ba3161c03f14b814eecf2e86bf61e29dca3c4bd62abfc8cf131
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
 
@@ -34,6 +34,7 @@ window.modal =
34
34
 
35
35
  close: (event) ->
36
36
  event.preventDefault() if event
37
+ $(document).trigger("modal:before-close")
37
38
  $("body").removeClass("modal-open")
38
39
  $("#modal").remove()
39
40
  $(document).trigger("modal:close")
@@ -31,7 +31,8 @@ module Agilibox::ApiControllerConcern
31
31
 
32
32
  def json_errors_hash_for_model(object)
33
33
  object.errors
34
- .map { |a, m| [a, message: m, full_message: object.errors.full_message(a, m)] }
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 self.class == Agilibox::SmallData::FilterStrategyByDateOrDatetimePeriod
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(" ") if value.is_a?(String)
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(" ")).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
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") {} + " " + ta(submit_action)
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") {} + " " + ta(:cancel)
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: "twitter-bootstrap-3"}.merge(options)
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,2 @@
1
+ li.page-item
2
+ = link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, remote: remote, class: 'page-link'
@@ -0,0 +1,2 @@
1
+ li.page-item.disabled
2
+ = link_to raw(t 'views.pagination.truncate'), '#', class: 'page-link'
@@ -0,0 +1,2 @@
1
+ li.page-item
2
+ = link_to_unless current_page.last?, raw(t 'views.pagination.last'), url, remote: remote, class: 'page-link'
@@ -0,0 +1,2 @@
1
+ li.page-item
2
+ = link_to_unless current_page.last?, raw(t 'views.pagination.next'), url, rel: 'next', remote: remote, class: 'page-link'
@@ -0,0 +1,6 @@
1
+ - if page.current?
2
+ li.page-item.active
3
+ = content_tag :a, page, data: { remote: remote }, rel: page.rel, class: 'page-link'
4
+ - else
5
+ li.page-item
6
+ = link_to page, url, remote: remote, rel: page.rel, class: 'page-link'
@@ -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?
@@ -0,0 +1,2 @@
1
+ li.page-item
2
+ = link_to_unless current_page.first?, raw(t 'views.pagination.previous'), url, rel: 'prev', remote: remote, class: 'page-link'
@@ -1,8 +1,23 @@
1
1
  module Agilibox::ActiveModelCustomErrorMessages
2
- def full_message(attribute, message)
3
- return message[1..] if message[0] == "^"
4
- super(attribute, message)
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
- ActiveModel::Errors.prepend(Agilibox::ActiveModelCustomErrorMessages)
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
- self.class.all
4
- .values_at(:link, :button, :label)
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
@@ -1,3 +1,3 @@
1
1
  module Agilibox
2
- VERSION = "1.9.14"
2
+ VERSION = "1.9.19"
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.9.14
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: 2020-12-08 00:00:00.000000000 Z
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.4
254
+ rubygems_version: 3.1.6
248
255
  signing_key:
249
256
  specification_version: 4
250
257
  summary: Agilibox