Close button on file preview

This commit is contained in:
jendib 2013-08-11 23:06:44 +02:00
parent 2fa2d32873
commit 10b31aec29
4 changed files with 15 additions and 4 deletions

View File

@ -1 +0,0 @@
- Close button on file preview

View File

@ -7,7 +7,7 @@ App.controller('FileView', function($dialog, $state, $stateParams) {
var dialog = $dialog.dialog({
keyboard: true,
templateUrl: 'partial/file.view.html',
controller: function($scope, $state, $stateParams, Restangular) {
controller: function($scope, $state, $stateParams, Restangular, dialog) {
$scope.id = $stateParams.fileId;
// Load files
@ -58,9 +58,17 @@ App.controller('FileView', function($dialog, $state, $stateParams) {
$scope.openFile = function() {
window.open('api/file/' + $scope.id + '/data');
};
/**
* Close the file preview.
*/
$scope.closeFile = function () {
dialog.close();
};
}
});
// Returns to document view on file close
dialog.open().then(function(result) {
if (result == null) {
$state.transitionTo('document.view', { id: $stateParams.id });

View File

@ -1,4 +1,8 @@
<div class="text-center">
<div class="btn-group pull-left">
<button type="button" class="btn" ng-click="closeFile()"><span class="icon-remove"></span></button>
</div>
<div class="btn-group">
<button type="button" class="btn" ng-click="previousFile()">Previous</button>
<button type="button" class="btn" ng-click="nextFile()">Next</button>

View File

@ -54,7 +54,7 @@
<button type="submit" class="btn btn-primary" ng-click="edit()" ng-disabled="!editUserForm.$valid">
<span class="icon-pencil icon-white"></span> {{ isEdit() ? 'Edit' : 'Add' }}
</button>
<button type="button" class="btn btn-danger" ng-click="remove()">
<button type="button" class="btn btn-danger" ng-click="remove()" ng-show="isEdit()">
<span class="icon-trash icon-white"></span> Delete
</button>
</div>