PDF handling, file upload progression

This commit is contained in:
jendib
2013-07-28 18:29:03 +02:00
parent 19000d095f
commit 471933ca8c
14 changed files with 186 additions and 105 deletions
@@ -3,34 +3,62 @@
/**
* File view controller.
*/
App.controller('FileView', function($rootScope, $state, $scope, $stateParams) {
$scope.id = $stateParams.fileId;
/**
* Navigate to the next file.
*/
$scope.nextFile = function() {
_.each($rootScope.files, function(value, key, list) {
if (value.id == $scope.id) {
var next = $rootScope.files[key + 1];
if (next) {
$state.transitionTo('document.view.file', { id: $stateParams.id, fileId: next.id });
App.controller('FileView', function($dialog, $state, $stateParams) {
var dialog = $dialog.dialog({
keyboard: true,
templateUrl: 'partial/file.view.html',
controller: function($rootScope, $scope, $state, $stateParams) {
$scope.id = $stateParams.fileId;
// Search current file
_.each($rootScope.files, function(value, key, list) {
if (value.id == $scope.id) {
$scope.file = value;
}
}
});
};
});
/**
* Navigate to the next file.
*/
$scope.nextFile = function() {
_.each($rootScope.files, function(value, key, list) {
if (value.id == $scope.id) {
var next = $rootScope.files[key + 1];
if (next) {
dialog.close({});
$state.transitionTo('document.view.file', { id: $stateParams.id, fileId: next.id });
}
}
});
};
/**
* Navigate to the previous file.
*/
$scope.previousFile = function() {
_.each($rootScope.files, function(value, key, list) {
if (value.id == $scope.id) {
var previous = $rootScope.files[key - 1];
if (previous) {
dialog.close({});
$state.transitionTo('document.view.file', { id: $stateParams.id, fileId: previous.id });
}
}
});
};
/**
* Open the file in a new window.
*/
$scope.openFile = function() {
window.open('api/file/' + $scope.id + '/data');
};
}
});
/**
* Navigate to the previous file.
*/
$scope.previousFile = function() {
_.each($rootScope.files, function(value, key, list) {
if (value.id == $scope.id) {
var previous = $rootScope.files[key - 1];
if (previous) {
$state.transitionTo('document.view.file', { id: $stateParams.id, fileId: previous.id });
}
}
});
};
dialog.open().then(function(result) {
if (result == null) {
$state.transitionTo('document.view', { id: $stateParams.id });
}
});
});