effective_resources 2.7.9 → 2.7.11

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 31e09d4567b7c51be34c376f25ef74abd17969a9fd193dae5cddca70b9513455
4
- data.tar.gz: b518f302ee57740c70ff98033ecd71890032b85f675731c9ee860d9f57fec222
3
+ metadata.gz: d337f18fe69722ae972a31d8027af508b555b6542496e626d7793dacec6f2a17
4
+ data.tar.gz: 44cb8d6fce0394a2dee68cd4731e3aea349d9edf2a8eed46026afe26e76838a0
5
5
  SHA512:
6
- metadata.gz: 1721954e1ed150209853308b56f3e0f29b2f4a98bf4f9327bf17ec005cc65a9033debde9c78db025947c86bbaeb5f89941b63c63089dfd281ff3893d01a3c4bc
7
- data.tar.gz: 7134665aee289d98d4e158c63f40ac67e006b14920b26de1f43e150f956ab300c232a7b91da6b77a72ba08c5ff1e5862f7e35c190900ffa0c1971bfd3620addc
6
+ metadata.gz: 45c1f94eba3ba91769fb8b6e356333405e2dd826e6ab14657abe7feaeec9635ce05f75554929ac140ad295d3759180dd04aa208adfe67bae6fcb8d70ee5a489c
7
+ data.tar.gz: a324bf7e82198921d34b19f341c8e36bb72ff4225dd7b9bbd6b94d4e30cf6d8aa131fc69700c6da6fc4d2ceb45efd784e9bcf50d64f2d095d526c6c672591416
@@ -206,7 +206,7 @@ module EffectiveResourcesHelper
206
206
  end
207
207
  alias_method :render_resource, :render_resource_partial
208
208
 
209
- def render_if_exists(partial, atts = {})
209
+ def render_partial_exists?(partial, atts = {})
210
210
  raise('expected a path') unless partial.kind_of?(String)
211
211
  raise('path should not include spaces') if partial.include?(' ')
212
212
 
@@ -215,12 +215,11 @@ module EffectiveResourcesHelper
215
215
  file = pieces.last
216
216
  path = pieces[0..-2].join('/')
217
217
 
218
- if lookup_context.exists?(file, [path], :partial)
219
- render(partial, atts)
220
- else
221
- Rails.logger.info "Skipped Render (effective_resources) render_if_exists: #{partial}"
222
- nil
223
- end
218
+ lookup_context.exists?(file, [path], :partial)
219
+ end
220
+
221
+ def render_if_exists(partial, atts = {})
222
+ render(partial, atts) if render_partial_exists?(partial, atts)
224
223
  end
225
224
 
226
225
  # Tableize attributes
@@ -350,6 +350,13 @@ module Effective
350
350
  when :gteq then relation.where(attribute.gteq(term))
351
351
  when :lt then relation.where(attribute.lt(term))
352
352
  when :lteq then relation.where(attribute.lteq(term))
353
+ when :days_ago_eq
354
+ date = (Time.zone.now - (term.to_i).days)
355
+ relation.where("#{sql_column} >= ? AND #{sql_column} <= ?", date.beginning_of_day, date.end_of_day)
356
+ when :days_ago_lteq # 30 days or less ago.
357
+ relation.where("#{sql_column} >= ?", Time.zone.now - (term.to_i).days)
358
+ when :days_ago_gteq # 30 days or more ago
359
+ relation.where("#{sql_column} <= ?", Time.zone.now - (term.to_i).days)
353
360
  else raise("Unexpected operation: #{operation}")
354
361
  end
355
362
  end
@@ -1,3 +1,11 @@
1
1
  = wizard_card(resource) do
2
- = effective_table_with(resource) do |f|
3
- = render(template: "#{resource.render_path}/#{resource.render_step}", f: f)
2
+ - partial = "#{resource.render_path}/#{resource.render_step}_fields"
3
+
4
+ - if render_partial_exists?(partial)
5
+ = effective_table_with(resource) { |f| render(partial, f: f) }
6
+
7
+ - elsif Rails.env.development? || Rails.env.test?
8
+ - names = partial.split('/')
9
+ - name = names[0...-1].join('/') + '/_' + names.last + '.html.haml'
10
+
11
+ %div.alert.alert-warning Unable to find partial: #{name}
@@ -1,3 +1,3 @@
1
1
  module EffectiveResources
2
- VERSION = '2.7.9'.freeze
2
+ VERSION = '2.7.11'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_resources
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.9
4
+ version: 2.7.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-08 00:00:00.000000000 Z
11
+ date: 2023-05-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails