agilibox 1.0.0 → 1.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (135) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +321 -2
  3. data/Rakefile +4 -0
  4. data/app/assets/javascripts/agilibox/autocomplete.coffee +2 -0
  5. data/app/assets/javascripts/agilibox/checkboxes_dropdown.coffee +9 -0
  6. data/app/assets/javascripts/agilibox/modals.coffee +81 -55
  7. data/app/assets/stylesheets/agilibox/actions.sass +2 -0
  8. data/app/assets/stylesheets/agilibox/all.sass +5 -0
  9. data/app/assets/stylesheets/agilibox/buttons.sass +11 -0
  10. data/app/assets/stylesheets/agilibox/filters.sass +13 -3
  11. data/app/assets/stylesheets/agilibox/forms.sass +49 -0
  12. data/app/assets/stylesheets/agilibox/icons.sass +5 -0
  13. data/app/assets/stylesheets/agilibox/modals.sass +15 -7
  14. data/app/assets/stylesheets/agilibox/pagination.sass +7 -0
  15. data/app/assets/stylesheets/agilibox/print.sass +10 -0
  16. data/app/assets/stylesheets/agilibox/tables.sass +26 -0
  17. data/app/controllers/agilibox/application_controller.rb +2 -4
  18. data/app/controllers/agilibox/small_data/filters_controller.rb +8 -6
  19. data/app/controllers/concerns/agilibox/api_controller_concern.rb +69 -0
  20. data/app/controllers/concerns/agilibox/back_url_concern.rb +13 -5
  21. data/app/emails/agilibox/email.rb +113 -0
  22. data/app/filters/agilibox/small_data/filter.rb +19 -1
  23. data/app/filters/agilibox/small_data/filter_strategy.rb +1 -1
  24. data/app/filters/agilibox/small_data/filter_strategy_by_date_begin.rb +3 -2
  25. data/app/filters/agilibox/small_data/filter_strategy_by_date_end.rb +3 -2
  26. data/app/filters/agilibox/small_data/filter_strategy_by_date_or_datetime_period.rb +56 -0
  27. data/app/filters/agilibox/small_data/filter_strategy_by_date_period.rb +5 -0
  28. data/app/filters/agilibox/small_data/filter_strategy_by_datetime_period.rb +5 -0
  29. data/app/filters/agilibox/small_data/filter_strategy_by_key_value.rb +14 -3
  30. data/app/filters/agilibox/small_data/filter_strategy_by_key_values.rb +13 -0
  31. data/app/filters/agilibox/small_data/filter_strategy_by_tags.rb +1 -1
  32. data/app/forms/agilibox/mini_form_object.rb +29 -0
  33. data/app/helpers/agilibox/all_helpers.rb +2 -0
  34. data/app/helpers/agilibox/bootstrap_helper.rb +62 -3
  35. data/app/helpers/agilibox/button_helper.rb +22 -13
  36. data/app/helpers/agilibox/filters_helper.rb +7 -8
  37. data/app/helpers/agilibox/font_awesome_helper.rb +67 -0
  38. data/app/helpers/agilibox/form_helper.rb +37 -14
  39. data/app/helpers/agilibox/i18n_helper.rb +5 -0
  40. data/app/helpers/agilibox/link_helper.rb +1 -1
  41. data/app/helpers/agilibox/pagination_helper.rb +18 -2
  42. data/app/helpers/agilibox/routes_helper.rb +6 -2
  43. data/app/helpers/agilibox/sorting_helper.rb +9 -4
  44. data/app/helpers/agilibox/text_helper.rb +51 -26
  45. data/app/helpers/h.rb +3 -0
  46. data/app/jobs/concerns/agilibox/setup_job_concern.rb +35 -0
  47. data/app/libs/agilibox/collection_update.rb +32 -0
  48. data/app/libs/agilibox/fcm/notifier.rb +28 -0
  49. data/app/libs/agilibox/fcm/request.rb +48 -0
  50. data/app/libs/agilibox/initialize_with.rb +20 -0
  51. data/app/libs/agilibox/mini_model_serializer/serialize.rb +30 -0
  52. data/app/libs/agilibox/mini_model_serializer/serializer.rb +23 -0
  53. data/app/libs/agilibox/monkey.rb +39 -0
  54. data/app/libs/agilibox/phone_number_sanitizer.rb +15 -0
  55. data/app/libs/agilibox/sortable_uuid_generator.rb +1 -1
  56. data/app/libs/agilibox/token_generator.rb +37 -0
  57. data/app/mailers/agilibox/application_mailer.rb +2 -0
  58. data/app/mailers/agilibox/generic_mailer.rb +9 -0
  59. data/app/models/concerns/agilibox/active_record_uuid_concern.rb +4 -2
  60. data/app/models/concerns/agilibox/default_values_concern.rb +4 -3
  61. data/app/models/concerns/agilibox/model_i18n.rb +37 -6
  62. data/app/models/concerns/agilibox/pluck_distinct.rb +13 -0
  63. data/app/models/concerns/agilibox/pluck_to_hash.rb +9 -0
  64. data/app/models/concerns/agilibox/polymorphic_id.rb +5 -2
  65. data/app/models/concerns/agilibox/search.rb +11 -13
  66. data/app/models/concerns/agilibox/timestamp_helpers.rb +17 -0
  67. data/app/serializers/agilibox/serializers/base.rb +47 -1
  68. data/app/serializers/agilibox/serializers/xlsx.rb +25 -23
  69. data/app/services/agilibox/service.rb +17 -0
  70. data/app/sms/agilibox/sms/application_sms.rb +42 -0
  71. data/app/sms/agilibox/sms/message.rb +25 -0
  72. data/app/sms/agilibox/sms/strategies/amazon_sns.rb +48 -0
  73. data/app/sms/agilibox/sms/strategies/base.rb +15 -0
  74. data/app/sms/agilibox/sms/strategies/test.rb +10 -0
  75. data/app/sms/agilibox/sms.rb +35 -0
  76. data/app/sorters/agilibox/sorter.rb +26 -0
  77. data/app/views/agilibox/_flash.html.slim +9 -0
  78. data/app/views/agilibox/forms/_checkboxes_dropdown.html.slim +14 -0
  79. data/app/views/agilibox/search/_form.html.slim +1 -6
  80. data/app/views/agilibox/search/_form_bs3.html.slim +13 -0
  81. data/app/views/agilibox/search/_form_bs4.html.slim +9 -0
  82. data/app/views/agilibox/search/_form_bs5.html.slim +8 -0
  83. data/app/views/kaminari/bootstrap4/_first_page.html.slim +2 -0
  84. data/app/views/kaminari/bootstrap4/_gap.html.slim +2 -0
  85. data/app/views/kaminari/bootstrap4/_last_page.html.slim +2 -0
  86. data/app/views/kaminari/bootstrap4/_next_page.html.slim +2 -0
  87. data/app/views/kaminari/bootstrap4/_page.html.slim +6 -0
  88. data/app/views/kaminari/bootstrap4/_paginator.html.slim +12 -0
  89. data/app/views/kaminari/bootstrap4/_prev_page.html.slim +2 -0
  90. data/config/cucumber.yml +9 -0
  91. data/config/locales/actions.en.yml +76 -0
  92. data/config/locales/actions.fr.yml +76 -0
  93. data/config/locales/attributes.en.yml +108 -0
  94. data/config/locales/attributes.fr.yml +108 -0
  95. data/config/locales/common.en.yml +0 -160
  96. data/config/locales/common.fr.yml +0 -171
  97. data/config/locales/dates.fr.yml +8 -0
  98. data/config/locales/errors.en.yml +5 -0
  99. data/config/locales/errors.fr.yml +5 -0
  100. data/db/migrate/20000101000000_enable_agilibox_extensions.rb +7 -0
  101. data/lib/agilibox/active_model_custom_error_messages.rb +23 -0
  102. data/lib/agilibox/active_model_type_cast.rb +52 -0
  103. data/lib/agilibox/config.rb +19 -0
  104. data/lib/agilibox/core_and_rails_ext.rb +2 -1
  105. data/lib/agilibox/cucumber_config.rb +53 -0
  106. data/lib/agilibox/cucumber_helpers/agilibox.rb +2 -0
  107. data/lib/agilibox/cucumber_helpers/ajax.rb +18 -0
  108. data/lib/agilibox/cucumber_helpers/apparition.rb +18 -0
  109. data/lib/agilibox/cucumber_helpers/capybara.rb +12 -0
  110. data/lib/agilibox/cucumber_helpers/capybara_selectors.rb +7 -0
  111. data/lib/agilibox/cucumber_helpers/chrome_headless.rb +16 -0
  112. data/lib/agilibox/cucumber_helpers/common_steps.rb +139 -0
  113. data/lib/agilibox/cucumber_helpers/cuprite.rb +20 -0
  114. data/lib/agilibox/cucumber_helpers/database_cleaner.rb +8 -0
  115. data/lib/agilibox/cucumber_helpers/factory_bot.rb +1 -0
  116. data/lib/agilibox/cucumber_helpers/rails.rb +1 -0
  117. data/lib/agilibox/cucumber_helpers/rspec.rb +6 -0
  118. data/lib/agilibox/cucumber_helpers/screenshots.rb +3 -0
  119. data/lib/agilibox/cucumber_helpers/select2.rb +23 -0
  120. data/lib/agilibox/cucumber_helpers/sign_in.rb +17 -0
  121. data/lib/agilibox/cucumber_helpers/simplecov.rb +1 -0
  122. data/lib/agilibox/cucumber_helpers/timecop.rb +3 -0
  123. data/lib/agilibox/cucumber_helpers/turbolinks.rb +34 -0
  124. data/lib/agilibox/cucumber_helpers/zonebie.rb +4 -0
  125. data/lib/agilibox/engine.rb +15 -0
  126. data/lib/agilibox/engine_file.rb +10 -0
  127. data/lib/agilibox/errors_middleware.rb +50 -0
  128. data/lib/agilibox/form_back_url.rb +4 -4
  129. data/lib/agilibox/rspec.rb +29 -0
  130. data/lib/agilibox/test_helpers.rb +13 -0
  131. data/lib/agilibox/version.rb +1 -1
  132. data/lib/tasks/cucumber.rake +76 -0
  133. metadata +165 -9
  134. data/app/filters/agilibox/small_data/filter_strategy_by_time_period.rb +0 -37
  135. data/lib/agilibox/active_record_comma_type_cast.rb +0 -12
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.0.0
4
+ version: 1.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - agilidée
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-28 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
@@ -24,6 +24,76 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: awesome_print
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: pry-rails
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: nilify_blanks
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: tapenade
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
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'
27
97
  description: Agilibox
28
98
  email:
29
99
  - contact@agilidee.com
@@ -36,63 +106,150 @@ files:
36
106
  - Rakefile
37
107
  - app/assets/config/agilibox_manifest.js
38
108
  - app/assets/javascripts/agilibox/all.coffee
109
+ - app/assets/javascripts/agilibox/autocomplete.coffee
110
+ - app/assets/javascripts/agilibox/checkboxes_dropdown.coffee
39
111
  - app/assets/javascripts/agilibox/filters_date.coffee
40
112
  - app/assets/javascripts/agilibox/form_anchor_referer.coffee
41
113
  - app/assets/javascripts/agilibox/form_reset.coffee
42
114
  - app/assets/javascripts/agilibox/modals.coffee
115
+ - app/assets/stylesheets/agilibox/actions.sass
43
116
  - app/assets/stylesheets/agilibox/all.sass
117
+ - app/assets/stylesheets/agilibox/buttons.sass
44
118
  - app/assets/stylesheets/agilibox/filters.sass
45
119
  - app/assets/stylesheets/agilibox/flash.sass
120
+ - app/assets/stylesheets/agilibox/forms.sass
121
+ - app/assets/stylesheets/agilibox/icons.sass
46
122
  - app/assets/stylesheets/agilibox/modals.sass
47
123
  - app/assets/stylesheets/agilibox/pagination.sass
48
124
  - app/assets/stylesheets/agilibox/print.sass
125
+ - app/assets/stylesheets/agilibox/tables.sass
49
126
  - app/controllers/agilibox/application_controller.rb
50
127
  - app/controllers/agilibox/small_data/filters_controller.rb
128
+ - app/controllers/concerns/agilibox/api_controller_concern.rb
51
129
  - app/controllers/concerns/agilibox/back_url_concern.rb
130
+ - app/emails/agilibox/email.rb
52
131
  - app/filters/agilibox/small_data/filter.rb
53
132
  - app/filters/agilibox/small_data/filter_strategy.rb
54
133
  - app/filters/agilibox/small_data/filter_strategy_by_date.rb
55
134
  - app/filters/agilibox/small_data/filter_strategy_by_date_begin.rb
56
135
  - app/filters/agilibox/small_data/filter_strategy_by_date_end.rb
136
+ - app/filters/agilibox/small_data/filter_strategy_by_date_or_datetime_period.rb
137
+ - app/filters/agilibox/small_data/filter_strategy_by_date_period.rb
138
+ - app/filters/agilibox/small_data/filter_strategy_by_datetime_period.rb
57
139
  - app/filters/agilibox/small_data/filter_strategy_by_key_value.rb
140
+ - app/filters/agilibox/small_data/filter_strategy_by_key_values.rb
58
141
  - app/filters/agilibox/small_data/filter_strategy_by_tags.rb
59
- - app/filters/agilibox/small_data/filter_strategy_by_time_period.rb
142
+ - app/forms/agilibox/mini_form_object.rb
60
143
  - app/helpers/agilibox/all_helpers.rb
61
144
  - app/helpers/agilibox/bootstrap_helper.rb
62
145
  - app/helpers/agilibox/button_helper.rb
63
146
  - app/helpers/agilibox/filters_helper.rb
147
+ - app/helpers/agilibox/font_awesome_helper.rb
64
148
  - app/helpers/agilibox/form_helper.rb
149
+ - app/helpers/agilibox/i18n_helper.rb
65
150
  - app/helpers/agilibox/link_helper.rb
66
151
  - app/helpers/agilibox/pagination_helper.rb
67
152
  - app/helpers/agilibox/routes_helper.rb
68
153
  - app/helpers/agilibox/sorting_helper.rb
69
154
  - app/helpers/agilibox/text_helper.rb
155
+ - app/helpers/h.rb
156
+ - app/jobs/concerns/agilibox/setup_job_concern.rb
157
+ - app/libs/agilibox/collection_update.rb
158
+ - app/libs/agilibox/fcm/notifier.rb
159
+ - app/libs/agilibox/fcm/request.rb
160
+ - app/libs/agilibox/initialize_with.rb
161
+ - app/libs/agilibox/mini_model_serializer/serialize.rb
162
+ - app/libs/agilibox/mini_model_serializer/serializer.rb
163
+ - app/libs/agilibox/monkey.rb
164
+ - app/libs/agilibox/phone_number_sanitizer.rb
70
165
  - app/libs/agilibox/sortable_uuid_generator.rb
166
+ - app/libs/agilibox/token_generator.rb
167
+ - app/mailers/agilibox/application_mailer.rb
168
+ - app/mailers/agilibox/generic_mailer.rb
71
169
  - app/models/concerns/agilibox/active_record_uuid_concern.rb
72
170
  - app/models/concerns/agilibox/default_values_concern.rb
73
171
  - app/models/concerns/agilibox/model_i18n.rb
74
172
  - app/models/concerns/agilibox/model_to_s.rb
173
+ - app/models/concerns/agilibox/pluck_distinct.rb
174
+ - app/models/concerns/agilibox/pluck_to_hash.rb
75
175
  - app/models/concerns/agilibox/polymorphic_id.rb
76
176
  - app/models/concerns/agilibox/search.rb
177
+ - app/models/concerns/agilibox/timestamp_helpers.rb
77
178
  - app/serializers/agilibox/serializers.rb
78
179
  - app/serializers/agilibox/serializers/base.rb
79
180
  - app/serializers/agilibox/serializers/xlsx.rb
181
+ - app/services/agilibox/service.rb
182
+ - app/sms/agilibox/sms.rb
183
+ - app/sms/agilibox/sms/application_sms.rb
184
+ - app/sms/agilibox/sms/message.rb
185
+ - app/sms/agilibox/sms/strategies/amazon_sns.rb
186
+ - app/sms/agilibox/sms/strategies/base.rb
187
+ - app/sms/agilibox/sms/strategies/test.rb
188
+ - app/sorters/agilibox/sorter.rb
189
+ - app/views/agilibox/_flash.html.slim
190
+ - app/views/agilibox/forms/_checkboxes_dropdown.html.slim
80
191
  - app/views/agilibox/search/_form.html.slim
192
+ - app/views/agilibox/search/_form_bs3.html.slim
193
+ - app/views/agilibox/search/_form_bs4.html.slim
194
+ - app/views/agilibox/search/_form_bs5.html.slim
195
+ - app/views/kaminari/bootstrap4/_first_page.html.slim
196
+ - app/views/kaminari/bootstrap4/_gap.html.slim
197
+ - app/views/kaminari/bootstrap4/_last_page.html.slim
198
+ - app/views/kaminari/bootstrap4/_next_page.html.slim
199
+ - app/views/kaminari/bootstrap4/_page.html.slim
200
+ - app/views/kaminari/bootstrap4/_paginator.html.slim
201
+ - app/views/kaminari/bootstrap4/_prev_page.html.slim
202
+ - config/cucumber.yml
203
+ - config/locales/actions.en.yml
204
+ - config/locales/actions.fr.yml
205
+ - config/locales/attributes.en.yml
206
+ - config/locales/attributes.fr.yml
81
207
  - config/locales/common.en.yml
82
208
  - config/locales/common.fr.yml
209
+ - config/locales/dates.fr.yml
210
+ - config/locales/errors.en.yml
211
+ - config/locales/errors.fr.yml
83
212
  - config/routes.rb
213
+ - db/migrate/20000101000000_enable_agilibox_extensions.rb
84
214
  - lib/agilibox.rb
85
- - lib/agilibox/active_record_comma_type_cast.rb
215
+ - lib/agilibox/active_model_custom_error_messages.rb
216
+ - lib/agilibox/active_model_type_cast.rb
217
+ - lib/agilibox/config.rb
86
218
  - lib/agilibox/core_and_rails_ext.rb
219
+ - lib/agilibox/cucumber_config.rb
220
+ - lib/agilibox/cucumber_helpers/agilibox.rb
221
+ - lib/agilibox/cucumber_helpers/ajax.rb
222
+ - lib/agilibox/cucumber_helpers/apparition.rb
223
+ - lib/agilibox/cucumber_helpers/capybara.rb
224
+ - lib/agilibox/cucumber_helpers/capybara_selectors.rb
225
+ - lib/agilibox/cucumber_helpers/chrome_headless.rb
226
+ - lib/agilibox/cucumber_helpers/common_steps.rb
227
+ - lib/agilibox/cucumber_helpers/cuprite.rb
228
+ - lib/agilibox/cucumber_helpers/database_cleaner.rb
229
+ - lib/agilibox/cucumber_helpers/factory_bot.rb
230
+ - lib/agilibox/cucumber_helpers/rails.rb
231
+ - lib/agilibox/cucumber_helpers/rspec.rb
232
+ - lib/agilibox/cucumber_helpers/screenshots.rb
233
+ - lib/agilibox/cucumber_helpers/select2.rb
234
+ - lib/agilibox/cucumber_helpers/sign_in.rb
235
+ - lib/agilibox/cucumber_helpers/simplecov.rb
236
+ - lib/agilibox/cucumber_helpers/timecop.rb
237
+ - lib/agilibox/cucumber_helpers/turbolinks.rb
238
+ - lib/agilibox/cucumber_helpers/zonebie.rb
87
239
  - lib/agilibox/engine.rb
240
+ - lib/agilibox/engine_file.rb
241
+ - lib/agilibox/errors_middleware.rb
88
242
  - lib/agilibox/form_back_url.rb
243
+ - lib/agilibox/rspec.rb
244
+ - lib/agilibox/test_helpers.rb
89
245
  - lib/agilibox/version.rb
90
246
  - lib/tasks/agilibox_tasks.rake
247
+ - lib/tasks/cucumber.rake
91
248
  homepage: https://github.com/agilidee/agilibox
92
249
  licenses:
93
250
  - MIT
94
251
  metadata: {}
95
- post_install_message:
252
+ post_install_message:
96
253
  rdoc_options: []
97
254
  require_paths:
98
255
  - lib
@@ -107,9 +264,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
264
  - !ruby/object:Gem::Version
108
265
  version: '0'
109
266
  requirements: []
110
- rubyforge_project:
111
- rubygems_version: 2.5.1
112
- signing_key:
267
+ rubygems_version: 3.1.6
268
+ signing_key:
113
269
  specification_version: 4
114
270
  summary: Agilibox
115
271
  test_files: []
@@ -1,37 +0,0 @@
1
- class Agilibox::SmallData::FilterStrategyByTimePeriod < ::Agilibox::SmallData::FilterStrategyByKeyValue
2
- def apply(query, value)
3
- if value == "today"
4
- a = Time.zone.now.beginning_of_day
5
- b = Time.zone.now.end_of_day
6
- elsif value == "yesterday"
7
- a = (Time.zone.now - 1.day).beginning_of_day
8
- b = (Time.zone.now - 1.day).end_of_day
9
- elsif value == "this_week"
10
- a = Time.zone.now.beginning_of_week
11
- b = Time.zone.now.end_of_week
12
- elsif value == "this_month"
13
- a = Time.zone.now.beginning_of_month
14
- b = Time.zone.now.end_of_month
15
- elsif value == "this_year"
16
- a = Time.zone.now.beginning_of_year
17
- b = Time.zone.now.end_of_year
18
- elsif value == "last_week"
19
- a = (Time.zone.now - 1.week).beginning_of_week
20
- b = (Time.zone.now - 1.week).end_of_week
21
- elsif value == "last_month"
22
- a = (Time.zone.now - 1.month).beginning_of_month
23
- b = (Time.zone.now - 1.month).end_of_month
24
- elsif value == "last_year"
25
- a = (Time.zone.now - 1.year).beginning_of_year
26
- b = (Time.zone.now - 1.year).end_of_year
27
- else
28
- return query
29
- end
30
-
31
- criteria = "#{query.model.table_name}.#{key}"
32
-
33
- query
34
- .where("#{criteria} >= ?", a.to_date)
35
- .where("#{criteria} <= ?", b.to_date)
36
- end
37
- end
@@ -1,12 +0,0 @@
1
- module Agilibox::ActiveRecordCommaTypeCast
2
- def cast_value(value)
3
- if value.is_a?(String)
4
- super value.gsub(",", ".").gsub(/[^-0-9\.]/, "")
5
- else
6
- super value
7
- end
8
- end
9
- end
10
-
11
- ActiveRecord::Type::Decimal.send(:prepend, Agilibox::ActiveRecordCommaTypeCast)
12
- ActiveRecord::Type::Float.send(:prepend, Agilibox::ActiveRecordCommaTypeCast)