Skip to content

Commit

Permalink
adding fullscreen feature to render interactive highcharts from repor…
Browse files Browse the repository at this point in the history
…t instance, this will be used as email url. almost done, need to fix breadcrumbs
  • Loading branch information
davebshow committed May 28, 2015
1 parent f2ae53d commit 3eb9410
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 16 deletions.
4 changes: 4 additions & 0 deletions sylva/reports/static/app/js/app.js
Expand Up @@ -54,6 +54,10 @@ reports.config([
templateUrl: DJANGO_URLS.partials + '?name=delete_report',
controller: 'DeleteReportCtrl'
}).
when('/fullscreen/:reportSlug/:reportId', {
templateUrl: DJANGO_URLS.partials + '?name=fullscreen',
controller: 'FullscreenCtrl'
}).
otherwise({
redirectTo: '/'
});
Expand Down
20 changes: 14 additions & 6 deletions sylva/reports/static/app/js/controller_tests.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions sylva/reports/static/app/js/controllers.js
Expand Up @@ -491,5 +491,28 @@ controllers.controller("DeleteReportCtrl", [
graphBreadcrumb.css('display', 'none');
graphBreadcrumb.next().css('display', 'none');
}
}]);


controllers.controller("FullscreenCtrl", [
"$scope",
"$routeParams",
"api",
"breadService",
function ($scope, $routeParams, api, breadService) {

var reportId = $routeParams.reportId;

getReport(reportId);

function getReport(id) {
api.history.report({
report: id
}, function (data) {
$scope.report = data;
$scope.resp = {table: {layout: data.table.layout,
pagebreaks: data.table.pagebreaks}}
});
}

}]);
9 changes: 6 additions & 3 deletions sylva/reports/tasks.py
Expand Up @@ -26,9 +26,12 @@ def send_email(inst_id):
graph_slug = inst.template.graph.slug
emails = [u.email for u in inst.template.email_to.all()]
site = Site.objects.get_current()
url = "{0}://{1}/reports/{2}/pdfgen/{3}".format("http", site.domain,
graph_slug,
inst.template.slug)
url = "{0}://{1}/reports/{2}/#/fullscreen/{3}/{4}".format(
"http",
site.domain,
graph_slug,
inst.template.slug,
inst.id)
send_mail("Sylva Reports", "Please view this report: {0}".format(url),
settings.DEFAULT_FROM_EMAIL, emails, fail_silently=False)

Expand Down
21 changes: 14 additions & 7 deletions sylva/reports/templates/partials/report_history.html
Expand Up @@ -17,19 +17,26 @@ <h2 ng-click="expand(bucket)"><a href="">
</a>
<ul ng-show="bucket.expanded">
<li ng-repeat="report in bucket.reports">
<h3><a href="" ng-click="getReport(report.id)">{{ report.date_run }}</a>
<h3>
<a href="" ng-click="getReport(report.id)">{{ report.date_run }}</a>
<!-- To enable fullscreen from history, modal must be implemented!!! -->
<!-- <a ng-href="#/fullscreen/{{template.slug}}/{{report.id}}"> -->
{% endverbatim %}
{% if OPTIONS.ENABLE_REPORTS_PDF %}
{% verbatim %}
<a ng-href="/reports/{{slugs.graph}}/pdf/{{report.id}}">pdf</a>
{% endverbatim %}
{% endif %}
<!-- {% trans "fullscreen" %}
</a> -->
{% if OPTIONS.ENABLE_REPORTS_PDF %}
{% verbatim %}
<a ng-href="/reports/{{slugs.graph}}/pdf/{{report.id}}">
{% endverbatim %}
{% trans "pdf" %}
</a>
{% endif %}
</h3>
</li>
</ul>
</li>
</ul>
<span class='pagination-info'>
<span class='pagination-info'>

{% trans "Showing" %}
{% verbatim %} {{ template.num_objects }} {% endverbatim %}
Expand Down
1 change: 1 addition & 0 deletions sylva/reports/views.py
Expand Up @@ -284,6 +284,7 @@ def history_endpoint(request, graph_slug):
]
response = {
'name': template.name,
'slug': template.slug,
'reports': report_buckets,
'num_pages': pgntr.num_pages,
'total_count': pgntr.count,
Expand Down

0 comments on commit 3eb9410

Please sign in to comment.