noventius 1.0.0 → 2.0.0

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.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/{nuntius → noventius}/application.js +10 -10
  3. data/app/assets/javascripts/noventius/columns.js +61 -0
  4. data/app/assets/javascripts/{nuntius → noventius}/filters.js +1 -4
  5. data/app/assets/javascripts/noventius/filters/select.js +92 -0
  6. data/app/assets/javascripts/noventius/forms.js +39 -0
  7. data/app/assets/javascripts/noventius/nested.js +29 -0
  8. data/app/assets/javascripts/{nuntius → noventius}/reports.js +4 -4
  9. data/app/assets/stylesheets/{nuntius → noventius}/application.css +6 -5
  10. data/app/assets/stylesheets/{nuntius → noventius}/nested.css +0 -0
  11. data/app/assets/stylesheets/{nuntius → noventius}/reports.css +1 -1
  12. data/app/controllers/concerns/{nuntius → noventius}/filter_params.rb +1 -1
  13. data/app/controllers/{nuntius → noventius}/application_controller.rb +2 -2
  14. data/app/controllers/{nuntius → noventius}/reports_controller.rb +2 -2
  15. data/app/helpers/concerns/{nuntius → noventius}/filter_wrappers.rb +1 -1
  16. data/app/helpers/{nuntius → noventius}/alerts_helper.rb +1 -1
  17. data/app/helpers/{nuntius → noventius}/application_helper.rb +2 -2
  18. data/app/helpers/{nuntius → noventius}/cells_helper.rb +1 -1
  19. data/app/helpers/{nuntius → noventius}/columns_helper.rb +1 -1
  20. data/app/helpers/{nuntius → noventius}/filters_helper.rb +3 -3
  21. data/app/helpers/{nuntius → noventius}/forms_helper.rb +1 -1
  22. data/app/helpers/{nuntius → noventius}/rows_helper.rb +1 -1
  23. data/app/views/layouts/{nuntius → noventius}/application.html.erb +4 -4
  24. data/app/views/{nuntius → noventius}/reports/_filter.erb +0 -0
  25. data/app/views/{nuntius → noventius}/reports/_form.erb +0 -0
  26. data/app/views/{nuntius → noventius}/reports/_table.erb +0 -0
  27. data/app/views/{nuntius → noventius}/reports/index.erb +0 -0
  28. data/app/views/{nuntius → noventius}/reports/nested.erb +0 -0
  29. data/app/views/{nuntius → noventius}/reports/show.erb +0 -0
  30. data/app/views/shared/{nuntius → noventius}/_header.erb +0 -0
  31. data/config/locales/en.bootstrap.yml +23 -0
  32. data/config/routes.rb +1 -1
  33. data/lib/noventius.rb +13 -0
  34. data/lib/noventius/assets.rb +7 -0
  35. data/lib/{nuntius → noventius}/column.rb +1 -1
  36. data/lib/{nuntius → noventius}/columns_group.rb +1 -1
  37. data/lib/{nuntius → noventius}/engine.rb +2 -2
  38. data/lib/{nuntius → noventius}/extensions/date_query.rb +2 -2
  39. data/lib/{nuntius → noventius}/filter.rb +1 -1
  40. data/lib/{nuntius → noventius}/post_processors/date_ranges.rb +23 -8
  41. data/lib/{nuntius → noventius}/report.rb +13 -1
  42. data/lib/{nuntius → noventius}/report/dsl.rb +1 -1
  43. data/lib/{nuntius → noventius}/report/dsl/columns.rb +2 -2
  44. data/lib/{nuntius → noventius}/report/dsl/filters.rb +1 -1
  45. data/lib/{nuntius → noventius}/report/dsl/nested.rb +1 -1
  46. data/lib/{nuntius → noventius}/report/dsl/post_processors.rb +1 -1
  47. data/lib/{nuntius → noventius}/report/dsl/validations.rb +1 -1
  48. data/lib/{nuntius → noventius}/report/interpolator.rb +1 -1
  49. data/lib/{nuntius → noventius}/serializers/csv.rb +2 -2
  50. data/lib/{nuntius → noventius}/validation.rb +1 -1
  51. data/lib/noventius/version.rb +5 -0
  52. data/lib/tasks/nuntius_tasks.rake +1 -1
  53. metadata +139 -50
  54. data/app/assets/javascripts/nuntius/columns.js +0 -57
  55. data/app/assets/javascripts/nuntius/filters/select.js +0 -88
  56. data/app/assets/javascripts/nuntius/forms.js +0 -38
  57. data/app/assets/javascripts/nuntius/nested.js +0 -25
  58. data/config/initializers/assets.rb +0 -1
  59. data/lib/nuntius.rb +0 -13
  60. data/lib/nuntius/version.rb +0 -5
@@ -0,0 +1,23 @@
1
+ # Sample localization file for English. Add more files in this directory for other locales.
2
+ # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
+
4
+ en:
5
+ breadcrumbs:
6
+ application:
7
+ root: "Index"
8
+ pages:
9
+ pages: "Pages"
10
+ helpers:
11
+ actions: "Actions"
12
+ links:
13
+ back: "Back"
14
+ cancel: "Cancel"
15
+ confirm: "Are you sure?"
16
+ destroy: "Delete"
17
+ new: "New"
18
+ edit: "Edit"
19
+ titles:
20
+ edit: "Edit %{model}"
21
+ save: "Save %{model}"
22
+ new: "New %{model}"
23
+ delete: "Delete %{model}"
@@ -1,4 +1,4 @@
1
- Nuntius::Engine.routes.draw do
1
+ Noventius::Engine.routes.draw do
2
2
  resources :reports, param: :name, only: [:index, :show] do
3
3
  get :nested, on: :member
4
4
  end
@@ -0,0 +1,13 @@
1
+ require 'noventius/engine'
2
+ require 'noventius/report'
3
+ require 'noventius/filter'
4
+ require 'noventius/column'
5
+ require 'noventius/columns_group'
6
+ require 'noventius/validation'
7
+ require 'noventius/extensions/date_query'
8
+ require 'noventius/post_processors/date_ranges'
9
+ require 'noventius/assets'
10
+
11
+ module Noventius
12
+
13
+ end
@@ -0,0 +1,7 @@
1
+ require 'jquery-rails'
2
+ require 'jquery-tablesorter'
3
+ require 'twitter-bootstrap-rails'
4
+ require 'jquery-validation-rails'
5
+ require 'bootstrap3-datetimepicker-rails'
6
+ require 'momentjs-rails'
7
+ require 'moment_timezone/rails'
@@ -1,4 +1,4 @@
1
- module Nuntius
1
+ module Noventius
2
2
 
3
3
  class Column
4
4
 
@@ -1,4 +1,4 @@
1
- module Nuntius
1
+ module Noventius
2
2
 
3
3
  class ColumnsGroup
4
4
 
@@ -1,8 +1,8 @@
1
- module Nuntius
1
+ module Noventius
2
2
 
3
3
  class Engine < ::Rails::Engine
4
4
 
5
- isolate_namespace Nuntius
5
+ isolate_namespace Noventius
6
6
 
7
7
  config.autoload_paths << root.join('app/helpers/concerns/')
8
8
 
@@ -1,4 +1,4 @@
1
- module Nuntius
1
+ module Noventius
2
2
 
3
3
  module Extension
4
4
 
@@ -49,7 +49,7 @@ module Nuntius
49
49
  sql_function = SQL_FUNCTIONS[component].dup
50
50
 
51
51
  Class.new(OpenStruct) {
52
- include Nuntius::Report::Interpolator
52
+ include Noventius::Report::Interpolator
53
53
  }.new(column: column, time_zone: time_zone).interpolate(sql_function)
54
54
  end
55
55
 
@@ -1,4 +1,4 @@
1
- module Nuntius
1
+ module Noventius
2
2
 
3
3
  class Filter
4
4
 
@@ -1,11 +1,17 @@
1
- module Nuntius
1
+ module Noventius
2
2
 
3
3
  module PostProcessors
4
4
 
5
5
  class DateRanges
6
6
 
7
- DATE_STEPS = %i(day month)
8
- STEPS = %i(day month hour dow moy)
7
+ DAY = :day
8
+ MONTH = :month
9
+ HOUR = :hour
10
+ DAY_OF_WEEK = :dow
11
+ MONTH_OF_YEAR = :moy
12
+
13
+ STEPS = [DAY, MONTH, HOUR, DAY_OF_WEEK, MONTH_OF_YEAR]
14
+ DATE_STEPS = [DAY, MONTH]
9
15
 
10
16
  def initialize(column_index_or_name, step, time_zone = 'America/Montevideo')
11
17
  fail ArgumentError, "Step not supported [#{step}]." unless STEPS.include?(step.to_sym)
@@ -43,7 +49,11 @@ module Nuntius
43
49
 
44
50
  def parse_date_column(value)
45
51
  if DATE_STEPS.include?(@step)
46
- Time.parse(value).in_time_zone(@time_zone)
52
+ if value.is_a?(String)
53
+ Time.zone.parse(value).in_time_zone(@time_zone)
54
+ else
55
+ Time.zone.at(value).in_time_zone(@time_zone)
56
+ end
47
57
  else
48
58
  value.to_i
49
59
  end
@@ -60,16 +70,21 @@ module Nuntius
60
70
  end
61
71
 
62
72
  def build_empty_row(report)
63
- columns_count = report.columns.size
64
- [''] * (columns_count - 1)
73
+ Array.new(report.columns.count - 1)
65
74
  end
66
75
 
67
76
  def build_range(start_value, end_value)
68
77
  case @step
69
- when :day
78
+ when DAY
70
79
  (DayRange.new(start_value)..DayRange.new(end_value)).map(&:date)
71
- when :month
80
+ when MONTH
72
81
  (MonthRange.new(start_value)..MonthRange.new(end_value)).map(&:date)
82
+ when HOUR
83
+ 0..23
84
+ when DAY_OF_WEEK
85
+ 0..6
86
+ when MONTH_OF_YEAR
87
+ 0..11
73
88
  else
74
89
  start_value..end_value
75
90
  end
@@ -2,7 +2,7 @@ require_relative 'report/dsl'
2
2
  require_relative 'report/interpolator'
3
3
  require_relative 'serializers/csv'
4
4
 
5
- module Nuntius
5
+ module Noventius
6
6
 
7
7
  class Report
8
8
 
@@ -17,6 +17,14 @@ module Nuntius
17
17
  @tab_title = title
18
18
  end
19
19
 
20
+ def hidden(hidden)
21
+ @hidden_flag = hidden
22
+ end
23
+
24
+ def visible?
25
+ @hidden_flag.nil? || !@hidden_flag
26
+ end
27
+
20
28
  end
21
29
 
22
30
  def initialize(filter_params = {})
@@ -29,6 +37,10 @@ module Nuntius
29
37
  end
30
38
  end
31
39
 
40
+ def self.visibles
41
+ all.select(&:visible?)
42
+ end
43
+
32
44
  def result
33
45
  @result ||= ActiveRecord::Base.connection.exec_query(interpolate(sql))
34
46
  end
@@ -4,7 +4,7 @@ require_relative 'dsl/nested'
4
4
  require_relative 'dsl/post_processors'
5
5
  require_relative 'dsl/validations'
6
6
 
7
- module Nuntius
7
+ module Noventius
8
8
 
9
9
  class Report
10
10
 
@@ -1,4 +1,4 @@
1
- module Nuntius
1
+ module Noventius
2
2
 
3
3
  class Report
4
4
 
@@ -113,7 +113,7 @@ module Nuntius
113
113
 
114
114
  def build_columns_without_groups(columns)
115
115
  columns.map do |column|
116
- if column.is_a?(Nuntius::Column)
116
+ if column.is_a?(Noventius::Column)
117
117
  column
118
118
  else
119
119
  build_columns_without_groups(column.columns)
@@ -1,4 +1,4 @@
1
- module Nuntius
1
+ module Noventius
2
2
 
3
3
  class Report
4
4
 
@@ -1,4 +1,4 @@
1
- module Nuntius
1
+ module Noventius
2
2
 
3
3
  class Report
4
4
 
@@ -1,4 +1,4 @@
1
- module Nuntius
1
+ module Noventius
2
2
 
3
3
  class Report
4
4
 
@@ -1,4 +1,4 @@
1
- module Nuntius
1
+ module Noventius
2
2
 
3
3
  class Report
4
4
 
@@ -1,4 +1,4 @@
1
- module Nuntius
1
+ module Noventius
2
2
 
3
3
  class Report
4
4
 
@@ -1,6 +1,6 @@
1
1
  require 'csv'
2
2
 
3
- module Nuntius
3
+ module Noventius
4
4
 
5
5
  module Serializers
6
6
 
@@ -26,7 +26,7 @@ module Nuntius
26
26
  end
27
27
 
28
28
  def column_with_prefix(column, prefixes = [])
29
- if column.is_a?(Nuntius::Column)
29
+ if column.is_a?(Noventius::Column)
30
30
  [*prefixes, column.label].join(' ')
31
31
  else
32
32
  column.columns.map do |local_column|
@@ -1,4 +1,4 @@
1
- module Nuntius
1
+ module Noventius
2
2
 
3
3
  class Validation
4
4
 
@@ -0,0 +1,5 @@
1
+ module Noventius
2
+
3
+ VERSION = '2.0.0'
4
+
5
+ end
@@ -1,4 +1,4 @@
1
1
  # desc "Explaining what the task does"
2
- # task :nuntius do
2
+ # task :noventius do
3
3
  # # Task goes here
4
4
  # end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: noventius
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andres Pache
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-08-03 00:00:00.000000000 Z
12
+ date: 2016-08-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -25,6 +25,20 @@ dependencies:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
27
  version: '4.2'
28
+ - !ruby/object:Gem::Dependency
29
+ name: jquery-rails
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
28
42
  - !ruby/object:Gem::Dependency
29
43
  name: jquery-tablesorter
30
44
  requirement: !ruby/object:Gem::Requirement
@@ -65,6 +79,80 @@ dependencies:
65
79
  - - ">="
66
80
  - !ruby/object:Gem::Version
67
81
  version: 2.11.1
82
+ - !ruby/object:Gem::Dependency
83
+ name: moment_timezone-rails
84
+ requirement: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: '0.5'
89
+ type: :runtime
90
+ prerelease: false
91
+ version_requirements: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: '0.5'
96
+ - !ruby/object:Gem::Dependency
97
+ name: twitter-bootstrap-rails
98
+ requirement: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: '3.2'
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: 3.2.2
106
+ type: :runtime
107
+ prerelease: false
108
+ version_requirements: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - "~>"
111
+ - !ruby/object:Gem::Version
112
+ version: '3.2'
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ version: 3.2.2
116
+ - !ruby/object:Gem::Dependency
117
+ name: jquery-validation-rails
118
+ requirement: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - "~>"
121
+ - !ruby/object:Gem::Version
122
+ version: '1.13'
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: '1.13'
126
+ type: :runtime
127
+ prerelease: false
128
+ version_requirements: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - "~>"
131
+ - !ruby/object:Gem::Version
132
+ version: '1.13'
133
+ - - ">="
134
+ - !ruby/object:Gem::Version
135
+ version: '1.13'
136
+ - !ruby/object:Gem::Dependency
137
+ name: bootstrap3-datetimepicker-rails
138
+ requirement: !ruby/object:Gem::Requirement
139
+ requirements:
140
+ - - "~>"
141
+ - !ruby/object:Gem::Version
142
+ version: '4.17'
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: 4.17.37
146
+ type: :runtime
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: '4.17'
153
+ - - ">="
154
+ - !ruby/object:Gem::Version
155
+ version: 4.17.37
68
156
  - !ruby/object:Gem::Dependency
69
157
  name: sqlite3
70
158
  requirement: !ruby/object:Gem::Requirement
@@ -174,55 +262,56 @@ extra_rdoc_files: []
174
262
  files:
175
263
  - MIT-LICENSE
176
264
  - Rakefile
177
- - app/assets/javascripts/nuntius/application.js
178
- - app/assets/javascripts/nuntius/columns.js
179
- - app/assets/javascripts/nuntius/filters.js
180
- - app/assets/javascripts/nuntius/filters/select.js
181
- - app/assets/javascripts/nuntius/forms.js
182
- - app/assets/javascripts/nuntius/nested.js
183
- - app/assets/javascripts/nuntius/reports.js
184
- - app/assets/stylesheets/nuntius/application.css
185
- - app/assets/stylesheets/nuntius/nested.css
186
- - app/assets/stylesheets/nuntius/reports.css
187
- - app/controllers/concerns/nuntius/filter_params.rb
188
- - app/controllers/nuntius/application_controller.rb
189
- - app/controllers/nuntius/reports_controller.rb
190
- - app/helpers/concerns/nuntius/filter_wrappers.rb
191
- - app/helpers/nuntius/alerts_helper.rb
192
- - app/helpers/nuntius/application_helper.rb
193
- - app/helpers/nuntius/cells_helper.rb
194
- - app/helpers/nuntius/columns_helper.rb
195
- - app/helpers/nuntius/filters_helper.rb
196
- - app/helpers/nuntius/forms_helper.rb
197
- - app/helpers/nuntius/rows_helper.rb
198
- - app/views/layouts/nuntius/application.html.erb
199
- - app/views/nuntius/reports/_filter.erb
200
- - app/views/nuntius/reports/_form.erb
201
- - app/views/nuntius/reports/_table.erb
202
- - app/views/nuntius/reports/index.erb
203
- - app/views/nuntius/reports/nested.erb
204
- - app/views/nuntius/reports/show.erb
205
- - app/views/shared/nuntius/_header.erb
206
- - config/initializers/assets.rb
265
+ - app/assets/javascripts/noventius/application.js
266
+ - app/assets/javascripts/noventius/columns.js
267
+ - app/assets/javascripts/noventius/filters.js
268
+ - app/assets/javascripts/noventius/filters/select.js
269
+ - app/assets/javascripts/noventius/forms.js
270
+ - app/assets/javascripts/noventius/nested.js
271
+ - app/assets/javascripts/noventius/reports.js
272
+ - app/assets/stylesheets/noventius/application.css
273
+ - app/assets/stylesheets/noventius/nested.css
274
+ - app/assets/stylesheets/noventius/reports.css
275
+ - app/controllers/concerns/noventius/filter_params.rb
276
+ - app/controllers/noventius/application_controller.rb
277
+ - app/controllers/noventius/reports_controller.rb
278
+ - app/helpers/concerns/noventius/filter_wrappers.rb
279
+ - app/helpers/noventius/alerts_helper.rb
280
+ - app/helpers/noventius/application_helper.rb
281
+ - app/helpers/noventius/cells_helper.rb
282
+ - app/helpers/noventius/columns_helper.rb
283
+ - app/helpers/noventius/filters_helper.rb
284
+ - app/helpers/noventius/forms_helper.rb
285
+ - app/helpers/noventius/rows_helper.rb
286
+ - app/views/layouts/noventius/application.html.erb
287
+ - app/views/noventius/reports/_filter.erb
288
+ - app/views/noventius/reports/_form.erb
289
+ - app/views/noventius/reports/_table.erb
290
+ - app/views/noventius/reports/index.erb
291
+ - app/views/noventius/reports/nested.erb
292
+ - app/views/noventius/reports/show.erb
293
+ - app/views/shared/noventius/_header.erb
294
+ - config/locales/en.bootstrap.yml
207
295
  - config/routes.rb
208
- - lib/nuntius.rb
209
- - lib/nuntius/column.rb
210
- - lib/nuntius/columns_group.rb
211
- - lib/nuntius/engine.rb
212
- - lib/nuntius/extensions/date_query.rb
213
- - lib/nuntius/filter.rb
214
- - lib/nuntius/post_processors/date_ranges.rb
215
- - lib/nuntius/report.rb
216
- - lib/nuntius/report/dsl.rb
217
- - lib/nuntius/report/dsl/columns.rb
218
- - lib/nuntius/report/dsl/filters.rb
219
- - lib/nuntius/report/dsl/nested.rb
220
- - lib/nuntius/report/dsl/post_processors.rb
221
- - lib/nuntius/report/dsl/validations.rb
222
- - lib/nuntius/report/interpolator.rb
223
- - lib/nuntius/serializers/csv.rb
224
- - lib/nuntius/validation.rb
225
- - lib/nuntius/version.rb
296
+ - lib/noventius.rb
297
+ - lib/noventius/assets.rb
298
+ - lib/noventius/column.rb
299
+ - lib/noventius/columns_group.rb
300
+ - lib/noventius/engine.rb
301
+ - lib/noventius/extensions/date_query.rb
302
+ - lib/noventius/filter.rb
303
+ - lib/noventius/post_processors/date_ranges.rb
304
+ - lib/noventius/report.rb
305
+ - lib/noventius/report/dsl.rb
306
+ - lib/noventius/report/dsl/columns.rb
307
+ - lib/noventius/report/dsl/filters.rb
308
+ - lib/noventius/report/dsl/nested.rb
309
+ - lib/noventius/report/dsl/post_processors.rb
310
+ - lib/noventius/report/dsl/validations.rb
311
+ - lib/noventius/report/interpolator.rb
312
+ - lib/noventius/serializers/csv.rb
313
+ - lib/noventius/validation.rb
314
+ - lib/noventius/version.rb
226
315
  - lib/tasks/nuntius_tasks.rake
227
316
  homepage: https://github.com/g8labs/nuntius
228
317
  licenses: