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
@@ -1,57 +0,0 @@
|
|
1
|
-
function getSorterForType(type) {
|
2
|
-
switch(type) {
|
3
|
-
case 'datetime':
|
4
|
-
case 'date':
|
5
|
-
return 'date';
|
6
|
-
break;
|
7
|
-
case 'integer':
|
8
|
-
case 'float':
|
9
|
-
return 'digit';
|
10
|
-
break;
|
11
|
-
default:
|
12
|
-
return 'text';
|
13
|
-
}
|
14
|
-
}
|
15
|
-
|
16
|
-
function addColumnsSorting(table) {
|
17
|
-
var $this = $(table);
|
18
|
-
|
19
|
-
var headers = $this.find('th').map(function(index, element) {
|
20
|
-
var $element = $(element);
|
21
|
-
var sorter;
|
22
|
-
|
23
|
-
if ($element.hasClass('column-header')) {
|
24
|
-
var type = $element.data('type');
|
25
|
-
sorter = getSorterForType(type);
|
26
|
-
} else {
|
27
|
-
sorter = false;
|
28
|
-
}
|
29
|
-
|
30
|
-
return { sorter: sorter };
|
31
|
-
});
|
32
|
-
|
33
|
-
$this.tablesorter({
|
34
|
-
theme: 'bootstrap',
|
35
|
-
widthFixed: true,
|
36
|
-
headerTemplate: '{content} {icon}',
|
37
|
-
widgets: ['uitheme'],
|
38
|
-
headers: headers
|
39
|
-
});
|
40
|
-
}
|
41
|
-
|
42
|
-
$(function() {
|
43
|
-
$.tablesorter.addParser({
|
44
|
-
id: 'date',
|
45
|
-
is: function(s) {
|
46
|
-
return false;
|
47
|
-
},
|
48
|
-
format: function(datetime) {
|
49
|
-
return moment(datetime).utc().format('x');
|
50
|
-
},
|
51
|
-
type: 'numeric'
|
52
|
-
});
|
53
|
-
|
54
|
-
$('table').each(function() {
|
55
|
-
addColumnsSorting(this);
|
56
|
-
});
|
57
|
-
});
|
@@ -1,88 +0,0 @@
|
|
1
|
-
function depedencyValue(depedency) {
|
2
|
-
return $('select.nuntius-filter#q_' + depedency).val();
|
3
|
-
}
|
4
|
-
|
5
|
-
function handleSelectChange(filter, clear) {
|
6
|
-
var filterId = $(filter).attr('id').replace('q_', '');
|
7
|
-
|
8
|
-
$('select.nuntius-filter').each(function() {
|
9
|
-
var $this = $(this);
|
10
|
-
var dependentFilters = $this.data('dependent') || [];
|
11
|
-
|
12
|
-
if (!Array.isArray(dependentFilters)) {
|
13
|
-
dependentFilters = [dependentFilters];
|
14
|
-
}
|
15
|
-
|
16
|
-
if (dependentFilters.includes(filterId)) {
|
17
|
-
if (clear) {
|
18
|
-
clearDependentSelect($this);
|
19
|
-
} else {
|
20
|
-
updateDependentSelect($this, dependentFilters);
|
21
|
-
}
|
22
|
-
}
|
23
|
-
});
|
24
|
-
}
|
25
|
-
|
26
|
-
function clearDependentSelect($filter) {
|
27
|
-
$filter.html('').select2({data: null});
|
28
|
-
$filter.prop('disabled', true);
|
29
|
-
handleSelectChange($filter, true);
|
30
|
-
}
|
31
|
-
|
32
|
-
function updateDependentSelect($filter, dependencies) {
|
33
|
-
var values = dependencies.map(depedencyValue);
|
34
|
-
var options = $filter.data('options')[values.join('_!_')];
|
35
|
-
var currentValue = $filter.data('currentValue');
|
36
|
-
|
37
|
-
if (typeof options == 'undefined') {
|
38
|
-
$filter.html('').select2({data: null});
|
39
|
-
$filter.prop('disabled', true);
|
40
|
-
return;
|
41
|
-
}
|
42
|
-
|
43
|
-
$filter.prop('disabled', false);
|
44
|
-
|
45
|
-
options = options.map(function(option) {
|
46
|
-
if (typeof option == 'object' && option.length == 2 && typeof option[1] != 'undefined') {
|
47
|
-
return { id: option[1] || '', text: option[0] }
|
48
|
-
} else {
|
49
|
-
return { id: option, text: option }
|
50
|
-
}
|
51
|
-
});
|
52
|
-
|
53
|
-
var selectOptions = { data: options };
|
54
|
-
var includeBlank = $filter.data('includeBlank');
|
55
|
-
|
56
|
-
if (includeBlank != null && typeof includeBlank != 'undefined') {
|
57
|
-
options.unshift({ id: '', text: '' });
|
58
|
-
|
59
|
-
selectOptions.allowClear = true;
|
60
|
-
selectOptions.placeholder = $filter.data('includeBlank')
|
61
|
-
}
|
62
|
-
|
63
|
-
$filter.html('').select2(selectOptions);
|
64
|
-
handleSelectChange($filter, false);
|
65
|
-
|
66
|
-
if (currentValue != null && typeof currentValue != 'undefined') {
|
67
|
-
$filter.val(currentValue).trigger('change');
|
68
|
-
}
|
69
|
-
}
|
70
|
-
|
71
|
-
$(function() {
|
72
|
-
$('select.nuntius-filter').each(function() {
|
73
|
-
var $this = $(this);
|
74
|
-
|
75
|
-
var selectOptions = {};
|
76
|
-
var includeBlank = $this.data('includeBlank');
|
77
|
-
if (includeBlank != null && includeBlank != 'undefined') {
|
78
|
-
selectOptions.allowClear = true;
|
79
|
-
selectOptions.placeholder = $this.data('includeBlank')
|
80
|
-
}
|
81
|
-
|
82
|
-
$(this).select2(selectOptions)
|
83
|
-
.on('select2:select', function() { handleSelectChange(this, false) })
|
84
|
-
.on('select2:unselect', function() { handleSelectChange(this, true) });
|
85
|
-
handleSelectChange(this, false);
|
86
|
-
})
|
87
|
-
|
88
|
-
});
|
@@ -1,38 +0,0 @@
|
|
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
|
-
$(document).on('ready page:load', function(){
|
14
|
-
var $form = $(FORM_SELECTOR);
|
15
|
-
$form.validate({
|
16
|
-
errorClass: 'has-error has-feedback',
|
17
|
-
validClass: 'has-success has-feedback',
|
18
|
-
errorPlacement: function(error, element) {
|
19
|
-
$error = $(error);
|
20
|
-
$element = $(element);
|
21
|
-
$(error).addClass('control-label');
|
22
|
-
$element.closest('.form-group').append(error);
|
23
|
-
},
|
24
|
-
rules: VALIDATIONS['rules'],
|
25
|
-
messages: VALIDATIONS['messages']
|
26
|
-
});
|
27
|
-
|
28
|
-
$form.on('click', 'input[name=commit]', function(e) {
|
29
|
-
submitWithFormat($form, e, 'html');
|
30
|
-
});
|
31
|
-
|
32
|
-
$form.on('click', '.download', function(e) {
|
33
|
-
submitWithFormat($form, e, 'csv');
|
34
|
-
});
|
35
|
-
|
36
|
-
});
|
37
|
-
|
38
|
-
})();
|
@@ -1,25 +0,0 @@
|
|
1
|
-
$(function() {
|
2
|
-
$('table').on('click', 'tr[data-nested]', function() {
|
3
|
-
var $this = $(this);
|
4
|
-
var nested = $this.data('nested');
|
5
|
-
|
6
|
-
if ($this.next('tr.nested-container').length) {
|
7
|
-
$this.siblings('tr.nested-container').remove();
|
8
|
-
return;
|
9
|
-
}
|
10
|
-
|
11
|
-
var td = $('<td>').attr('colspan', $this.find('td').length);
|
12
|
-
var tr = $('<tr>').append(td).addClass('nested-container');
|
13
|
-
|
14
|
-
$this.siblings('tr.nested-container').remove();
|
15
|
-
|
16
|
-
$this.after(tr);
|
17
|
-
|
18
|
-
var data = nested.filters;
|
19
|
-
data.row = nested.row;
|
20
|
-
$.get(nested.url, data, function(table) {
|
21
|
-
td.append(table);
|
22
|
-
addColumnsSorting(td.find('table'));
|
23
|
-
});
|
24
|
-
});
|
25
|
-
});
|
@@ -1 +0,0 @@
|
|
1
|
-
Nuntius::Engine.config.assets.paths << Nuntius::Engine.root.join('vendor', 'assets', 'bower_components')
|
data/lib/nuntius.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
require 'nuntius/engine'
|
2
|
-
require 'nuntius/report'
|
3
|
-
require 'nuntius/filter'
|
4
|
-
require 'nuntius/column'
|
5
|
-
require 'nuntius/columns_group'
|
6
|
-
require 'nuntius/validation'
|
7
|
-
require 'nuntius/extensions/date_query'
|
8
|
-
require 'nuntius/post_processors/date_ranges'
|
9
|
-
require 'jquery-tablesorter'
|
10
|
-
|
11
|
-
module Nuntius
|
12
|
-
|
13
|
-
end
|