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.
- checksums.yaml +4 -4
- data/app/assets/javascripts/{nuntius → noventius}/application.js +10 -10
- data/app/assets/javascripts/noventius/columns.js +61 -0
- data/app/assets/javascripts/{nuntius → noventius}/filters.js +1 -4
- data/app/assets/javascripts/noventius/filters/select.js +92 -0
- data/app/assets/javascripts/noventius/forms.js +39 -0
- data/app/assets/javascripts/noventius/nested.js +29 -0
- data/app/assets/javascripts/{nuntius → noventius}/reports.js +4 -4
- data/app/assets/stylesheets/{nuntius → noventius}/application.css +6 -5
- data/app/assets/stylesheets/{nuntius → noventius}/nested.css +0 -0
- data/app/assets/stylesheets/{nuntius → noventius}/reports.css +1 -1
- data/app/controllers/concerns/{nuntius → noventius}/filter_params.rb +1 -1
- data/app/controllers/{nuntius → noventius}/application_controller.rb +2 -2
- data/app/controllers/{nuntius → noventius}/reports_controller.rb +2 -2
- data/app/helpers/concerns/{nuntius → noventius}/filter_wrappers.rb +1 -1
- data/app/helpers/{nuntius → noventius}/alerts_helper.rb +1 -1
- data/app/helpers/{nuntius → noventius}/application_helper.rb +2 -2
- data/app/helpers/{nuntius → noventius}/cells_helper.rb +1 -1
- data/app/helpers/{nuntius → noventius}/columns_helper.rb +1 -1
- data/app/helpers/{nuntius → noventius}/filters_helper.rb +3 -3
- data/app/helpers/{nuntius → noventius}/forms_helper.rb +1 -1
- data/app/helpers/{nuntius → noventius}/rows_helper.rb +1 -1
- data/app/views/layouts/{nuntius → noventius}/application.html.erb +4 -4
- data/app/views/{nuntius → noventius}/reports/_filter.erb +0 -0
- data/app/views/{nuntius → noventius}/reports/_form.erb +0 -0
- data/app/views/{nuntius → noventius}/reports/_table.erb +0 -0
- data/app/views/{nuntius → noventius}/reports/index.erb +0 -0
- data/app/views/{nuntius → noventius}/reports/nested.erb +0 -0
- data/app/views/{nuntius → noventius}/reports/show.erb +0 -0
- data/app/views/shared/{nuntius → noventius}/_header.erb +0 -0
- data/config/locales/en.bootstrap.yml +23 -0
- data/config/routes.rb +1 -1
- data/lib/noventius.rb +13 -0
- data/lib/noventius/assets.rb +7 -0
- data/lib/{nuntius → noventius}/column.rb +1 -1
- data/lib/{nuntius → noventius}/columns_group.rb +1 -1
- data/lib/{nuntius → noventius}/engine.rb +2 -2
- data/lib/{nuntius → noventius}/extensions/date_query.rb +2 -2
- data/lib/{nuntius → noventius}/filter.rb +1 -1
- data/lib/{nuntius → noventius}/post_processors/date_ranges.rb +23 -8
- data/lib/{nuntius → noventius}/report.rb +13 -1
- data/lib/{nuntius → noventius}/report/dsl.rb +1 -1
- data/lib/{nuntius → noventius}/report/dsl/columns.rb +2 -2
- data/lib/{nuntius → noventius}/report/dsl/filters.rb +1 -1
- data/lib/{nuntius → noventius}/report/dsl/nested.rb +1 -1
- data/lib/{nuntius → noventius}/report/dsl/post_processors.rb +1 -1
- data/lib/{nuntius → noventius}/report/dsl/validations.rb +1 -1
- data/lib/{nuntius → noventius}/report/interpolator.rb +1 -1
- data/lib/{nuntius → noventius}/serializers/csv.rb +2 -2
- data/lib/{nuntius → noventius}/validation.rb +1 -1
- data/lib/noventius/version.rb +5 -0
- data/lib/tasks/nuntius_tasks.rake +1 -1
- metadata +139 -50
- data/app/assets/javascripts/nuntius/columns.js +0 -57
- data/app/assets/javascripts/nuntius/filters/select.js +0 -88
- data/app/assets/javascripts/nuntius/forms.js +0 -38
- data/app/assets/javascripts/nuntius/nested.js +0 -25
- data/config/initializers/assets.rb +0 -1
- data/lib/nuntius.rb +0 -13
- data/lib/nuntius/version.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62c4cea8aeef8cb726c35f40b7bc99455ce6bb95
|
4
|
+
data.tar.gz: 81eb082efbc4966ad895dfa00dc5115e3cf1f245
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14fbf5d142b5685dd00ba111dcf71458fb2e1e83fd4207e19bd4221ed3dd13dec6bdedbc2eeb8336a2fa2ed0392fec4e79c7b217d067b47a2c4a8fe2da21c50c
|
7
|
+
data.tar.gz: 4f9e9d9b6f68e1706fd25e1c8ee6dad358daceeb0fd46ca78a1f7ca58e15d8f0339d10b7a706d1439f8cfc1f4df57ab61f55c803158961bab2c31d015687a75d
|
@@ -10,18 +10,18 @@
|
|
10
10
|
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
11
11
|
// about supported directives.
|
12
12
|
//
|
13
|
-
//= require jquery
|
14
|
-
//= require
|
15
|
-
//= require
|
16
|
-
//= require moment-timezone/builds/moment-timezone-with-data.min
|
17
|
-
//= require eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min
|
18
|
-
//= require jquery-validation/dist/jquery.validate.min
|
19
|
-
//= require jquery-validation/dist/additional-methods.min
|
20
|
-
//= require select2-dist/dist/js/select2.full
|
21
|
-
//= require jquery-tablesorter
|
13
|
+
//= require jquery
|
14
|
+
//= require jquery_ujs
|
15
|
+
//= require twitter/bootstrap
|
22
16
|
//= require moment
|
17
|
+
//= require moment-timezone-with-data
|
18
|
+
//= require bootstrap-datetimepicker
|
19
|
+
//= require jquery.validate
|
20
|
+
//= require jquery.validate.additional-methods
|
21
|
+
//= require select2/select2.full
|
22
|
+
//= require jquery-tablesorter
|
23
23
|
//= require_self
|
24
|
-
//= require
|
24
|
+
//= require noventius/reports
|
25
25
|
|
26
26
|
var DATE_FORMAT = 'DD/MM/YYYY';
|
27
27
|
var DATETIME_FORMAT = 'DD/MM/YYYY HH:mm';
|
@@ -0,0 +1,61 @@
|
|
1
|
+
(function(){
|
2
|
+
|
3
|
+
function getSorterForType(type) {
|
4
|
+
switch(type) {
|
5
|
+
case 'datetime':
|
6
|
+
case 'date':
|
7
|
+
return 'date';
|
8
|
+
break;
|
9
|
+
case 'integer':
|
10
|
+
case 'float':
|
11
|
+
return 'digit';
|
12
|
+
break;
|
13
|
+
default:
|
14
|
+
return 'text';
|
15
|
+
}
|
16
|
+
}
|
17
|
+
|
18
|
+
function addColumnsSorting(table) {
|
19
|
+
var $this = $(table);
|
20
|
+
|
21
|
+
var headers = $this.find('th').map(function(index, element) {
|
22
|
+
var $element = $(element);
|
23
|
+
var sorter;
|
24
|
+
|
25
|
+
if ($element.hasClass('column-header')) {
|
26
|
+
var type = $element.data('type');
|
27
|
+
sorter = getSorterForType(type);
|
28
|
+
} else {
|
29
|
+
sorter = false;
|
30
|
+
}
|
31
|
+
|
32
|
+
return { sorter: sorter };
|
33
|
+
});
|
34
|
+
|
35
|
+
$this.tablesorter({
|
36
|
+
theme: 'bootstrap',
|
37
|
+
widthFixed: true,
|
38
|
+
headerTemplate: '{content} {icon}',
|
39
|
+
widgets: ['uitheme'],
|
40
|
+
headers: headers
|
41
|
+
});
|
42
|
+
}
|
43
|
+
|
44
|
+
$(function() {
|
45
|
+
$.tablesorter.addParser({
|
46
|
+
id: 'date',
|
47
|
+
is: function(s) {
|
48
|
+
return false;
|
49
|
+
},
|
50
|
+
format: function(datetime) {
|
51
|
+
return moment(datetime).utc().format('x');
|
52
|
+
},
|
53
|
+
type: 'numeric'
|
54
|
+
});
|
55
|
+
|
56
|
+
$('table').each(function() {
|
57
|
+
addColumnsSorting(this);
|
58
|
+
});
|
59
|
+
});
|
60
|
+
|
61
|
+
})();
|
@@ -1,9 +1,6 @@
|
|
1
|
-
// Place all the behaviors and hooks related to the matching controller here.
|
2
|
-
// All this logic will automatically be available in application.js.
|
3
1
|
(function(){
|
4
2
|
|
5
|
-
$(
|
6
|
-
|
3
|
+
$(function() {
|
7
4
|
// Initialize all DatePickers
|
8
5
|
$("[type='date']").each(function (index, el) {
|
9
6
|
var $el = $(el);
|
@@ -0,0 +1,92 @@
|
|
1
|
+
(function(){
|
2
|
+
function dependencyValue(dependency) {
|
3
|
+
|
4
|
+
return $('select.noventius-filter#q_' + dependency).val();
|
5
|
+
}
|
6
|
+
|
7
|
+
function handleSelectChange(filter, clear) {
|
8
|
+
var filterId = $(filter).attr('id').replace('q_', '');
|
9
|
+
|
10
|
+
$('select.noventius-filter').each(function() {
|
11
|
+
var $this = $(this);
|
12
|
+
var dependentFilters = $this.data('dependent') || [];
|
13
|
+
|
14
|
+
if (!Array.isArray(dependentFilters)) {
|
15
|
+
dependentFilters = [dependentFilters];
|
16
|
+
}
|
17
|
+
|
18
|
+
if (dependentFilters.includes(filterId)) {
|
19
|
+
if (clear) {
|
20
|
+
clearDependentSelect($this);
|
21
|
+
} else {
|
22
|
+
updateDependentSelect($this, dependentFilters);
|
23
|
+
}
|
24
|
+
}
|
25
|
+
});
|
26
|
+
}
|
27
|
+
|
28
|
+
function clearDependentSelect($filter) {
|
29
|
+
$filter.html('').select2({data: null});
|
30
|
+
$filter.prop('disabled', true);
|
31
|
+
handleSelectChange($filter, true);
|
32
|
+
}
|
33
|
+
|
34
|
+
function updateDependentSelect($filter, dependencies) {
|
35
|
+
var values = dependencies.map(dependencyValue);
|
36
|
+
var options = $filter.data('options')[values.join('_!_')];
|
37
|
+
var currentValue = $filter.data('currentValue');
|
38
|
+
|
39
|
+
if (typeof options == 'undefined') {
|
40
|
+
$filter.html('').select2({data: null});
|
41
|
+
$filter.prop('disabled', true);
|
42
|
+
return;
|
43
|
+
}
|
44
|
+
|
45
|
+
$filter.prop('disabled', false);
|
46
|
+
|
47
|
+
options = options.map(function(option) {
|
48
|
+
if (typeof option == 'object' && option.length == 2 && typeof option[1] != 'undefined') {
|
49
|
+
return { id: option[1] || '', text: option[0] }
|
50
|
+
} else {
|
51
|
+
return { id: option, text: option }
|
52
|
+
}
|
53
|
+
});
|
54
|
+
|
55
|
+
var selectOptions = { data: options };
|
56
|
+
var includeBlank = $filter.data('includeBlank');
|
57
|
+
|
58
|
+
if (includeBlank != null && typeof includeBlank != 'undefined') {
|
59
|
+
options.unshift({ id: '', text: '' });
|
60
|
+
|
61
|
+
selectOptions.allowClear = true;
|
62
|
+
selectOptions.placeholder = $filter.data('includeBlank')
|
63
|
+
}
|
64
|
+
|
65
|
+
$filter.html('').select2(selectOptions);
|
66
|
+
handleSelectChange($filter, false);
|
67
|
+
|
68
|
+
if (currentValue != null && typeof currentValue != 'undefined') {
|
69
|
+
$filter.val(currentValue).trigger('change');
|
70
|
+
}
|
71
|
+
}
|
72
|
+
|
73
|
+
$(function() {
|
74
|
+
$('select.noventius-filter').each(function() {
|
75
|
+
var $this = $(this);
|
76
|
+
|
77
|
+
var selectOptions = {};
|
78
|
+
var includeBlank = $this.data('includeBlank');
|
79
|
+
if (includeBlank != null && includeBlank != 'undefined') {
|
80
|
+
selectOptions.allowClear = true;
|
81
|
+
selectOptions.placeholder = $this.data('includeBlank')
|
82
|
+
}
|
83
|
+
|
84
|
+
$(this).select2(selectOptions)
|
85
|
+
.on('select2:select', function() { handleSelectChange(this, false) })
|
86
|
+
.on('select2:unselect', function() { handleSelectChange(this, true) });
|
87
|
+
handleSelectChange(this, false);
|
88
|
+
})
|
89
|
+
|
90
|
+
});
|
91
|
+
|
92
|
+
})();
|
@@ -0,0 +1,39 @@
|
|
1
|
+
(function(){
|
2
|
+
|
3
|
+
var FORM_SELECTOR = '#filter-form';
|
4
|
+
|
5
|
+
function submitWithFormat(form, event, format) {
|
6
|
+
event.preventDefault();
|
7
|
+
event.stopPropagation();
|
8
|
+
|
9
|
+
form.find('input[name=format]').val(format);
|
10
|
+
form.submit();
|
11
|
+
}
|
12
|
+
|
13
|
+
$(function() {
|
14
|
+
var $form = $(FORM_SELECTOR);
|
15
|
+
if ($form.length > 0) {
|
16
|
+
$form.validate({
|
17
|
+
errorClass: 'has-error has-feedback',
|
18
|
+
validClass: 'has-success has-feedback',
|
19
|
+
errorPlacement: function(error, element) {
|
20
|
+
$error = $(error);
|
21
|
+
$element = $(element);
|
22
|
+
$(error).addClass('control-label');
|
23
|
+
$element.closest('.form-group').append(error);
|
24
|
+
},
|
25
|
+
rules: VALIDATIONS['rules'],
|
26
|
+
messages: VALIDATIONS['messages']
|
27
|
+
});
|
28
|
+
|
29
|
+
$form.on('click', 'input[name=commit]', function(e) {
|
30
|
+
submitWithFormat($form, e, 'html');
|
31
|
+
});
|
32
|
+
|
33
|
+
$form.on('click', '.download', function(e) {
|
34
|
+
submitWithFormat($form, e, 'csv');
|
35
|
+
});
|
36
|
+
}
|
37
|
+
});
|
38
|
+
|
39
|
+
})();
|
@@ -0,0 +1,29 @@
|
|
1
|
+
(function(){
|
2
|
+
|
3
|
+
$(function() {
|
4
|
+
$('table').on('click', 'tr[data-nested]', function() {
|
5
|
+
var $this = $(this);
|
6
|
+
var nested = $this.data('nested');
|
7
|
+
|
8
|
+
if ($this.next('tr.nested-container').length) {
|
9
|
+
$this.siblings('tr.nested-container').remove();
|
10
|
+
return;
|
11
|
+
}
|
12
|
+
|
13
|
+
var td = $('<td>').attr('colspan', $this.find('td').length);
|
14
|
+
var tr = $('<tr>').append(td).addClass('nested-container');
|
15
|
+
|
16
|
+
$this.siblings('tr.nested-container').remove();
|
17
|
+
|
18
|
+
$this.after(tr);
|
19
|
+
|
20
|
+
var data = nested.filters;
|
21
|
+
data.row = nested.row;
|
22
|
+
$.get(nested.url, data, function(table) {
|
23
|
+
td.append(table);
|
24
|
+
addColumnsSorting(td.find('table'));
|
25
|
+
});
|
26
|
+
});
|
27
|
+
});
|
28
|
+
|
29
|
+
})();
|
@@ -1,7 +1,7 @@
|
|
1
1
|
// Place all the behaviors and hooks related to the matching controller here.
|
2
2
|
// All this logic will automatically be available in application.js.
|
3
|
-
//= require
|
4
|
-
//= require
|
5
|
-
//= require
|
6
|
-
//= require
|
3
|
+
//= require noventius/filters
|
4
|
+
//= require noventius/forms
|
5
|
+
//= require noventius/columns
|
6
|
+
//= require noventius/nested
|
7
7
|
//= require_tree ./filters
|
@@ -10,13 +10,14 @@
|
|
10
10
|
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
|
11
11
|
* file per style scope.
|
12
12
|
*
|
13
|
-
*= require bootstrap/
|
14
|
-
*= require
|
15
|
-
*= require
|
13
|
+
*= require twitter-bootstrap-static/bootstrap
|
14
|
+
*= require twitter-bootstrap-static/sprites
|
15
|
+
*= require bootstrap-datetimepicker
|
16
|
+
*= require select2/select2
|
16
17
|
*= require jquery-tablesorter/theme.bootstrap
|
17
18
|
*= require_self
|
18
|
-
*= require
|
19
|
-
*= require
|
19
|
+
*= require noventius/reports
|
20
|
+
*= require noventius/nested
|
20
21
|
*/
|
21
22
|
|
22
23
|
.navbar {
|
File without changes
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module Noventius
|
2
2
|
|
3
3
|
class ApplicationController < ActionController::Base
|
4
4
|
|
@@ -9,7 +9,7 @@ module Nuntius
|
|
9
9
|
protect_from_forgery with: :exception
|
10
10
|
|
11
11
|
def reports
|
12
|
-
@reports ||= Report.
|
12
|
+
@reports ||= Report.visibles
|
13
13
|
end
|
14
14
|
|
15
15
|
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# rubocop:disable all
|
2
|
-
module
|
2
|
+
module Noventius
|
3
3
|
|
4
4
|
module FiltersHelper
|
5
5
|
|
6
|
-
include
|
6
|
+
include Noventius::FilterWrappers
|
7
7
|
|
8
8
|
RESERVED_OPTIONS = [:dependent]
|
9
9
|
|
@@ -26,7 +26,7 @@ module Nuntius
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def class_for_filter(filter)
|
29
|
-
classes = ['
|
29
|
+
classes = ['noventius-filter']
|
30
30
|
|
31
31
|
unless filter.type == :select
|
32
32
|
classes << 'form-control'
|
@@ -1,13 +1,13 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
2
|
<html>
|
3
3
|
<head>
|
4
|
-
<title>
|
5
|
-
<%= stylesheet_link_tag "
|
4
|
+
<title>Noventius</title>
|
5
|
+
<%= stylesheet_link_tag "noventius/application", media: "all" %>
|
6
6
|
<%= csrf_meta_tags %>
|
7
7
|
</head>
|
8
8
|
<body>
|
9
9
|
<header>
|
10
|
-
<%= render partial: 'shared/
|
10
|
+
<%= render partial: 'shared/noventius/header' %>
|
11
11
|
</header>
|
12
12
|
<main>
|
13
13
|
<div class='container-fluid'>
|
@@ -16,6 +16,6 @@
|
|
16
16
|
</div>
|
17
17
|
</main>
|
18
18
|
<footer></footer>
|
19
|
-
<%= javascript_include_tag '
|
19
|
+
<%= javascript_include_tag 'noventius/application' %>
|
20
20
|
</body>
|
21
21
|
</html>
|