mirror of
https://github.com/sismics/docs.git
synced 2024-11-22 14:07:55 +01:00
Closes #37: Search terms in URL
+ empty tag tree + transitionTo -> go + audit log message can be empty
This commit is contained in:
parent
c7b7527183
commit
2c782a23d8
@ -19,6 +19,7 @@ import com.sismics.docs.core.util.jpa.PaginatedLists;
|
||||
import com.sismics.docs.core.util.jpa.SortCriteria;
|
||||
import com.sismics.rest.exception.ForbiddenClientException;
|
||||
import com.sismics.rest.exception.ServerException;
|
||||
import com.sismics.rest.util.JsonUtil;
|
||||
|
||||
/**
|
||||
* Audit log REST resources.
|
||||
@ -70,7 +71,7 @@ public class AuditLogResource extends BaseResource {
|
||||
.add("target", auditLogDto.getEntityId())
|
||||
.add("class", auditLogDto.getEntityClass())
|
||||
.add("type", auditLogDto.getType().name())
|
||||
.add("message", auditLogDto.getMessage())
|
||||
.add("message", JsonUtil.nullable(auditLogDto.getMessage()))
|
||||
.add("create_date", auditLogDto.getCreateTimestamp()));
|
||||
}
|
||||
|
||||
|
@ -125,6 +125,9 @@ angular.module('docs',
|
||||
}
|
||||
}
|
||||
})
|
||||
.state('document.default.search', {
|
||||
url: '/search/:search'
|
||||
})
|
||||
.state('document.default.file', {
|
||||
url: '/file/:fileId',
|
||||
views: {
|
||||
|
@ -12,7 +12,7 @@ angular.module('docs').controller('Document', function($scope, $timeout, $state,
|
||||
$scope.offset = 0;
|
||||
$scope.currentPage = 1;
|
||||
$scope.limit = _.isUndefined(localStorage.documentsPageSize) ? 10 : localStorage.documentsPageSize;
|
||||
$scope.search = '';
|
||||
$scope.search = $state.params.search ? $state.params.search : '';
|
||||
$scope.setSearch = function(search) { $scope.search = search };
|
||||
|
||||
// A timeout promise is used to slow down search requests to the server
|
||||
@ -66,6 +66,17 @@ angular.module('docs').controller('Document', function($scope, $timeout, $state,
|
||||
$timeout.cancel(timeoutPromise);
|
||||
}
|
||||
|
||||
if ($state.current.name == 'document.default'
|
||||
|| $state.current.name == 'document.default.search') {
|
||||
$state.go($scope.search == '' ?
|
||||
'document.default' : 'document.default.search', {
|
||||
search: $scope.search
|
||||
}, {
|
||||
location: 'replace',
|
||||
notify: false
|
||||
});
|
||||
}
|
||||
|
||||
// Call API later
|
||||
timeoutPromise = $timeout(function () {
|
||||
$scope.loadDocuments();
|
||||
@ -100,7 +111,7 @@ angular.module('docs').controller('Document', function($scope, $timeout, $state,
|
||||
* Display a document.
|
||||
*/
|
||||
$scope.viewDocument = function(id) {
|
||||
$state.transitionTo('document.view', { id: id });
|
||||
$state.go('document.view', { id: id });
|
||||
};
|
||||
|
||||
// Load tags
|
||||
|
@ -81,7 +81,7 @@ angular.module('docs').controller('DocumentDefault', function($scope, $state, Re
|
||||
* Navigate to the selected file.
|
||||
*/
|
||||
$scope.openFile = function (file) {
|
||||
$state.transitionTo('document.default.file', { fileId: file.id })
|
||||
$state.go('document.default.file', { fileId: file.id })
|
||||
};
|
||||
|
||||
/**
|
||||
@ -107,6 +107,6 @@ angular.module('docs').controller('DocumentDefault', function($scope, $state, Re
|
||||
* Add a document with checked files.
|
||||
*/
|
||||
$scope.addDocument = function() {
|
||||
$state.transitionTo('document.add', { files: _.pluck($scope.checkedFiles(), 'id') });
|
||||
$state.go('document.add', { files: _.pluck($scope.checkedFiles(), 'id') });
|
||||
};
|
||||
});
|
@ -95,7 +95,7 @@ angular.module('docs').controller('DocumentEdit', function($rootScope, $scope, $
|
||||
if ($scope.isEdit()) {
|
||||
// Go back to the edited document
|
||||
$scope.pageDocuments();
|
||||
$state.transitionTo('document.view', { id: $stateParams.id });
|
||||
$state.go('document.view', { id: $stateParams.id });
|
||||
} else {
|
||||
// Reset the scope and stay here
|
||||
var fileUploadCount = _.size($scope.newFiles) + resolve.length;
|
||||
@ -188,9 +188,9 @@ angular.module('docs').controller('DocumentEdit', function($rootScope, $scope, $
|
||||
*/
|
||||
$scope.cancel = function() {
|
||||
if ($scope.isEdit()) {
|
||||
$state.transitionTo('document.view', { id: $stateParams.id });
|
||||
$state.go('document.view', { id: $stateParams.id });
|
||||
} else {
|
||||
$state.transitionTo('document.default');
|
||||
$state.go('document.default');
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -62,7 +62,7 @@ angular.module('docs').controller('DocumentView', function ($scope, $state, $sta
|
||||
* Navigate to the selected file.
|
||||
*/
|
||||
$scope.openFile = function (file) {
|
||||
$state.transitionTo('document.view.file', { id: $stateParams.id, fileId: file.id })
|
||||
$state.go('document.view.file', { id: $stateParams.id, fileId: file.id })
|
||||
};
|
||||
|
||||
/**
|
||||
@ -80,7 +80,7 @@ angular.module('docs').controller('DocumentView', function ($scope, $state, $sta
|
||||
if (result == 'ok') {
|
||||
Restangular.one('document', document.id).remove().then(function () {
|
||||
$scope.loadDocuments();
|
||||
$state.transitionTo('document.default');
|
||||
$state.go('document.default');
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -9,7 +9,7 @@ angular.module('docs').controller('Login', function($scope, $rootScope, $state,
|
||||
User.userInfo(true).then(function(data) {
|
||||
$rootScope.userInfo = data;
|
||||
});
|
||||
$state.transitionTo('document.default');
|
||||
$state.go('document.default');
|
||||
}, function() {
|
||||
var title = 'Login failed';
|
||||
var msg = 'Username or password invalid';
|
||||
|
@ -6,9 +6,9 @@
|
||||
angular.module('docs').controller('Main', function($scope, $rootScope, $state, User) {
|
||||
User.userInfo().then(function(data) {
|
||||
if (data.anonymous) {
|
||||
$state.transitionTo('login');
|
||||
$state.go('login');
|
||||
} else {
|
||||
$state.transitionTo('document.default');
|
||||
$state.go('document.default');
|
||||
}
|
||||
});
|
||||
});
|
@ -41,7 +41,7 @@ angular.module('docs').controller('Navigation', function($scope, $http, $state,
|
||||
*/
|
||||
$scope.openLogs = function() {
|
||||
$scope.errorNumber = 0;
|
||||
$state.transitionTo('settings.log');
|
||||
$state.go('settings.log');
|
||||
};
|
||||
|
||||
/**
|
||||
@ -52,7 +52,7 @@ angular.module('docs').controller('Navigation', function($scope, $http, $state,
|
||||
User.userInfo(true).then(function(data) {
|
||||
$rootScope.userInfo = data;
|
||||
});
|
||||
$state.transitionTo('main');
|
||||
$state.go('main');
|
||||
});
|
||||
$event.preventDefault();
|
||||
};
|
||||
|
@ -19,6 +19,6 @@ angular.module('docs').controller('SettingsUser', function($scope, $state, Resta
|
||||
* Edit a user.
|
||||
*/
|
||||
$scope.editUser = function(user) {
|
||||
$state.transitionTo('settings.user.edit', { username: user.username });
|
||||
$state.go('settings.user.edit', { username: user.username });
|
||||
};
|
||||
});
|
@ -38,7 +38,7 @@ angular.module('docs').controller('SettingsUserEdit', function($scope, $dialog,
|
||||
|
||||
promise.then(function() {
|
||||
$scope.loadUsers();
|
||||
$state.transitionTo('settings.user');
|
||||
$state.go('settings.user');
|
||||
});
|
||||
};
|
||||
|
||||
@ -54,9 +54,9 @@ angular.module('docs').controller('SettingsUserEdit', function($scope, $dialog,
|
||||
if (result == 'ok') {
|
||||
Restangular.one('user', $stateParams.username).remove().then(function() {
|
||||
$scope.loadUsers();
|
||||
$state.transitionTo('settings.user');
|
||||
$state.go('settings.user');
|
||||
}, function () {
|
||||
$state.transitionTo('settings.user');
|
||||
$state.go('settings.user');
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -24,7 +24,7 @@ angular.module('share').controller('FileModalView', function($rootScope, $modalI
|
||||
if (value.id == $stateParams.fileId) {
|
||||
var next = $scope.files[key + 1];
|
||||
if (next) {
|
||||
$state.transitionTo('share.file', { documentId: $stateParams.documentId, shareId: $stateParams.shareId, fileId: next.id });
|
||||
$state.go('share.file', { documentId: $stateParams.documentId, shareId: $stateParams.shareId, fileId: next.id });
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -38,7 +38,7 @@ angular.module('share').controller('FileModalView', function($rootScope, $modalI
|
||||
if (value.id == $stateParams.fileId) {
|
||||
var previous = $scope.files[key - 1];
|
||||
if (previous) {
|
||||
$state.transitionTo('share.file', { documentId: $stateParams.documentId, shareId: $stateParams.shareId, fileId: previous.id });
|
||||
$state.go('share.file', { documentId: $stateParams.documentId, shareId: $stateParams.shareId, fileId: previous.id });
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -16,6 +16,6 @@ angular.module('share').controller('FileView', function($modal, $state, $statePa
|
||||
modal.closed = true;
|
||||
},function(result) {
|
||||
modal.closed = true;
|
||||
$state.transitionTo('share', { documentId: $stateParams.documentId, shareId: $stateParams.shareId });
|
||||
$state.go('share', { documentId: $stateParams.documentId, shareId: $stateParams.shareId });
|
||||
});
|
||||
});
|
@ -10,7 +10,7 @@ angular.module('share').controller('Share', function($scope, $state, $stateParam
|
||||
$scope.document = data;
|
||||
}, function (response) {
|
||||
if (response.status == 403) {
|
||||
$state.transitionTo('403');
|
||||
$state.go('403');
|
||||
}
|
||||
});
|
||||
|
||||
@ -24,6 +24,6 @@ angular.module('share').controller('Share', function($scope, $state, $stateParam
|
||||
* Navigate to the selected file.
|
||||
*/
|
||||
$scope.openFile = function (file) {
|
||||
$state.transitionTo('share.file', { documentId: $stateParams.documentId, shareId: $stateParams.shareId, fileId: file.id })
|
||||
$state.go('share.file', { documentId: $stateParams.documentId, shareId: $stateParams.shareId, fileId: file.id })
|
||||
};
|
||||
});
|
@ -11,6 +11,7 @@
|
||||
Tags <span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu tag-tree">
|
||||
<li ng-if="getChildrenTags().length == 0">No tags</li>
|
||||
<li ng-repeat="tag in getChildrenTags()" ng-include="'tag-tree-item'"></li>
|
||||
</ul>
|
||||
</div>
|
||||
@ -48,7 +49,7 @@
|
||||
<td>
|
||||
{{ document.title }} ({{ document.file_count }})
|
||||
<span class="glyphicon glyphicon-share" ng-if="document.shared" tooltip="Shared"></span>
|
||||
<a href="#/document/view/{{ document.id }}" ng-click="$event.stopPropagation()"><span class="glyphicon glyphicon-link"></span></a>
|
||||
<a href="#/document/view/{{ document.id }}" target="_blank" ng-click="$event.stopPropagation()"><span class="glyphicon glyphicon-link"></span></a>
|
||||
</td>
|
||||
<td>{{ document.create_date | date: 'yyyy-MM-dd' }}</td>
|
||||
<td class="hidden-xs cell-tags">
|
||||
|
Loading…
Reference in New Issue
Block a user