Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 49 additions & 12 deletions dojo/templates/dojo/report_builder.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ <h4 class="pull-left">Report Format</h4>
</div>
<div class="panel-footer">
<div class="clearfix">
<a class="btn btn-success disabled pull-right run_report" href="#">Run</a>
<a class="btn btn-success disabled pull-right run_report" href="#" data-toggle="tooltip" title="Add at least one section from Available Widgets before running." style="pointer-events: auto;">Run</a>
</div>
</div>
</div>
Expand Down Expand Up @@ -83,8 +83,19 @@ <h4>Available Widgets</h4>
}
});

if ($('.in-use-widgets ul#sortable2 li').length > 0) {
$('a.run_report').removeClass('disabled');
if ($('.in-use-widgets ul#sortable2 li').not('.report-options').length > 0) {
var $run = $('a.run_report');
$run.removeClass('disabled')
.css('pointer-events', '')
.attr('title', 'Run the report')
.attr('data-original-title', 'Run the report');
}
else {
var $run = $('a.run_report');
$run.addClass('disabled')
.css('pointer-events', 'auto')
.attr('title', 'Add at least one section from "Available Widgets" before running.')
.attr('data-original-title', 'Add at least one section from "Available Widgets" before running.');
}
}

Expand Down Expand Up @@ -148,6 +159,13 @@ <h4>Available Widgets</h4>
function runReport(event) {
var valid = true;

// Require at least one content widget (exclude report options)
if ($('.in-use-widgets ul#sortable2 li').not('.report-options').length === 0) {
alert('Please add at least one section from "Available Widgets" before running.');
event.preventDefault();
return;
}

$('.in-use-widgets .form-control').not('#finding-list .form-control')
.not('#endpoint-list .form-control').not('#wysiwyg-content .form-control')
.not('.bs-searchbox .form-control').not('div').each(function () {
Expand Down Expand Up @@ -185,8 +203,7 @@ <h4>Available Widgets</h4>

event.preventDefault();
}
{% block report_functions %}
{% endblock %}
// placeholder for report widget scripts injected by Django blocks
$(function () {
$(".available-widgets > ul").sortable({
handle: "div.panel div.panel-heading",
Expand Down Expand Up @@ -218,11 +235,21 @@ <h4>Available Widgets</h4>
remove: function (event, ui) {
ui.item.find('[data-toggle="tooltip"]').tooltip('hide');

if ($('.in-use-widgets ul#sortable2 li').length > 0) {
$('a.run_report').removeClass('disabled');
if ($('.in-use-widgets ul#sortable2 li').not('.report-options').length > 0) {
var $run = $('a.run_report');
$run.removeClass('disabled')
.css('pointer-events', '')
.attr('title', 'Run the report')
.attr('data-original-title', 'Run the report')
.tooltip('fixTitle');
}
else {
$('a.run_report').addClass('disabled');
var $run = $('a.run_report');
$run.addClass('disabled')
.css('pointer-events', 'auto')
.attr('title', 'Add at least one section from "Available Widgets" before running.')
.attr('data-original-title', 'Add at least one section from "Available Widgets" before running.')
.tooltip('fixTitle');
}
},
receive: function(event, ui) {
Expand All @@ -235,11 +262,21 @@ <h4>Available Widgets</h4>
ui.item.find('[data-toggle="tooltip"]').tooltip();
ui.item.find('[data-toggle="tooltip"]').tooltip('hide');

if ($('.in-use-widgets ul#sortable2 li').length > 0) {
$('a.run_report').removeClass('disabled');
if ($('.in-use-widgets ul#sortable2 li').not('.report-options').length > 0) {
var $run = $('a.run_report');
$run.removeClass('disabled')
.css('pointer-events', '')
.attr('title', 'Run the report')
.attr('data-original-title', 'Run the report')
.tooltip('fixTitle');
}
else {
$('a.run_report').addClass('disabled');
var $run = $('a.run_report');
$run.addClass('disabled')
.css('pointer-events', 'auto')
.attr('title', 'Add at least one section from "Available Widgets" before running.')
.attr('data-original-title', 'Add at least one section from "Available Widgets" before running.')
.tooltip('fixTitle');
}

if (ui.item.attr('class') === 'wysiwyg-content') {
Expand Down Expand Up @@ -339,7 +376,7 @@ <h4>Available Widgets</h4>
retrieveReportData("{% url 'report_endpoints' %}" + $a.attr('href'), $a.closest('li.endpoint-list'));
})

$('[data-toggle="tooltip"]').tooltip()
$('[data-toggle="tooltip"]').tooltip({container: 'body', placement: 'top'})

$(document).on('click', '.in-use-widgets .panel-available-widget .panel-heading', function (event) {
$(this).siblings('.panel-body').slideToggle();
Expand Down