Closes #334: highlight previously opened file

This commit is contained in:
bgamard 2020-03-07 17:56:01 +01:00
parent 3b5c27096b
commit 82737e2280
3 changed files with 4 additions and 4 deletions

View File

@ -13,7 +13,6 @@ angular.module('docs').controller('DocumentDefault', function ($scope, $rootScop
$scope.loadFiles = function () { $scope.loadFiles = function () {
Restangular.one('file/list').get().then(function (data) { Restangular.one('file/list').get().then(function (data) {
$scope.files = data.files; $scope.files = data.files;
// TODO Keep currently uploading files
}); });
}; };
$scope.loadFiles(); $scope.loadFiles();

View File

@ -5,6 +5,7 @@
*/ */
angular.module('docs').controller('DocumentViewContent', function ($scope, $rootScope, $stateParams, Restangular, $dialog, $state, Upload, $translate, $uibModal) { angular.module('docs').controller('DocumentViewContent', function ($scope, $rootScope, $stateParams, Restangular, $dialog, $state, Upload, $translate, $uibModal) {
$scope.displayMode = _.isUndefined(localStorage.fileDisplayMode) ? 'grid' : localStorage.fileDisplayMode; $scope.displayMode = _.isUndefined(localStorage.fileDisplayMode) ? 'grid' : localStorage.fileDisplayMode;
$scope.openedFile = undefined;
/** /**
* Watch for display mode change. * Watch for display mode change.
@ -45,7 +46,6 @@ angular.module('docs').controller('DocumentViewContent', function ($scope, $root
$scope.loadFiles = function () { $scope.loadFiles = function () {
Restangular.one('file/list').get({ id: $stateParams.id }).then(function (data) { Restangular.one('file/list').get({ id: $stateParams.id }).then(function (data) {
$scope.files = data.files; $scope.files = data.files;
// TODO Keep currently uploading files
}); });
}; };
$scope.loadFiles(); $scope.loadFiles();
@ -55,7 +55,8 @@ angular.module('docs').controller('DocumentViewContent', function ($scope, $root
*/ */
$scope.openFile = function (file, $event) { $scope.openFile = function (file, $event) {
if ($($event.target).parents('.currently-dragging').length === 0) { if ($($event.target).parents('.currently-dragging').length === 0) {
$state.go('document.view.content.file', {id: $stateParams.id, fileId: file.id}) $scope.openedFile = file;
$state.go('document.view.content.file', { id: $stateParams.id, fileId: file.id });
} }
}; };

View File

@ -161,7 +161,7 @@
</tr> </tr>
</thead> </thead>
<tbody ui-sortable="fileSortableOptions" ng-model="files"> <tbody ui-sortable="fileSortableOptions" ng-model="files">
<tr ng-repeat="file in files"> <tr ng-repeat="file in files" ng-class="{ 'active': openedFile.id == file.id }">
<td class="pointer" ng-click="openFile(file, $event)"> <td class="pointer" ng-click="openFile(file, $event)">
<div class="thumbnail-list"> <div class="thumbnail-list">
<img ng-src="../api/file/{{ file.id }}/data?size=thumb" /> <img ng-src="../api/file/{{ file.id }}/data?size=thumb" />