Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:CulturePlex/Sylva into devel
Browse files Browse the repository at this point in the history
  • Loading branch information
versae committed Feb 16, 2015
2 parents 779af88 + 93fabb0 commit d72bf08
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 14 deletions.
19 changes: 14 additions & 5 deletions sylva/reports/static/app/js/controllers.js
Expand Up @@ -288,13 +288,22 @@ controllers.controller("DeleteReportCtrl", [
});
}

$scope.deleteReport = function () {
var post = new api.del();
post.template = $scope.slugs.template;
post.$save({}, function (data) {
$scope.confirmed = {val: 0}
$scope.deleteReport = function (confirmed) {
console.log("confirmed", confirmed)
if (parseInt(confirmed.val) === 1) {
console.log("confirmed")
var post = new api.del();
post.template = $scope.slugs.template;
post.$save({}, function (data) {
var redirect = '/';
$location.path(redirect);
});
} else {
console.log("noconfimr")
var redirect = '/';
$location.path(redirect);
});
}
}

$scope.getTemplate();
Expand Down
15 changes: 8 additions & 7 deletions sylva/reports/static/app/js/directives.js
Expand Up @@ -117,7 +117,9 @@ directives.directive('sylvaPvRowRepeat', ['tableArray', function (tableArray) {
, parent = elem.parent();

scope.tableWidth = parseInt(attrs.width)
//scope.tableWidth = parseInt(angular.element(elem.parents()[0]).css('width'));
scope.canvasWidth = parseInt(angular.element(elem.parents()[0]).css('width'));
var aspectRatio = 1.295;
console.log("tableWidth", scope.tableWidth)
var rowHeight = function (pagebreaks) {
var heights = {}
, rows = [];
Expand All @@ -127,8 +129,10 @@ directives.directive('sylvaPvRowRepeat', ['tableArray', function (tableArray) {
var numRows = rows.length;
for (var i=0; i<numRows; i++) {
var row = rows[i]
, height = 919.0 / numRows;
, pageHeight = scope.canvasWidth * aspectRatio
, height = pageHeight / numRows;
heights[row] = height;
console.log("pageHeight", pageHeight, height)
}
rows = [];
}
Expand Down Expand Up @@ -1105,15 +1109,12 @@ directives.directive('sylvaEtCell', ['$sanitize', '$compile', 'DJANGO_URLS', 'ST
result_dict = ctrl.parseResults(results)
if (scope.colors == undefined) {
scope.colors = {}
console.log("activeYs", scope.ySeries)
var ser = result_dict.cat.concat(result_dict.num);
angular.forEach(ser, function (elem) {
// This should be a service.
var col = simple_colors[Math.floor(Math.random() * simple_colors.length)]

scope.colors[elem.alias] = "#" + col;
if(!(elem.alias in scope.colors)) scope.colors[elem.alias] = "#" + col;
});
console.log("scope.colors", scope.colors)

}

if (result_dict.num.length > 1) {
Expand Down
17 changes: 15 additions & 2 deletions sylva/reports/templates/partials/delete_report.html
Expand Up @@ -6,9 +6,22 @@ <h3>{% trans "There are " %}{% verbatim %}<b>{{template.num_reports}}</b>{% endv
</h3>
<br />
<div>
<input type="submit" value="Delete" ng-click="deleteReport()">
<form>
<ul id="id_confirm">
<li>
<label for="id_confirm_0">
<input id="id_confirm_0" name="confirm" type="radio" ng-model="confirmed.val" value="1" /> Yes
</label>
</li>
<li>
<label for="id_confirm_1">
<input id="id_confirm_1" name="confirm" type="radio" ng-model="confirmed.val" value="0" /> No
</label>
</li>
</ul>
<input type="submit" value="Delete" ng-click="deleteReport(confirmed)" />
{% trans "or" %}
<a href="#">{% trans "Cancel" %}</a>
</form>
</div>
</div>

0 comments on commit d72bf08

Please sign in to comment.