diff --git a/docs-web/src/main/webapp/app/docs/app.js b/docs-web/src/main/webapp/app/docs/app.js index bf0f5f3a..8b19a178 100644 --- a/docs-web/src/main/webapp/app/docs/app.js +++ b/docs-web/src/main/webapp/app/docs/app.js @@ -5,8 +5,8 @@ */ var App = angular.module('docs', // Dependencies - ['ui.state', 'ui.route', 'ui.bootstrap', 'ui.keypress', 'ui.validate', - 'ui.sortable', 'restangular', 'ngSanitize', 'ngMobile', 'colorpicker.module'] + ['ui.router', 'ui.route', 'ui.bootstrap', 'ui.keypress', 'ui.validate', 'dialog', + 'ui.sortable', 'restangular', 'ngSanitize', 'ngTouch', 'colorpicker.module'] ) /** diff --git a/docs-web/src/main/webapp/app/docs/controller/Document.js b/docs-web/src/main/webapp/app/docs/controller/Document.js index 4e642fe2..a527e01c 100644 --- a/docs-web/src/main/webapp/app/docs/controller/Document.js +++ b/docs-web/src/main/webapp/app/docs/controller/Document.js @@ -33,7 +33,6 @@ App.controller('Document', function($scope, $timeout, $state, Restangular) { .then(function (data) { $scope.documents = data.documents; $scope.totalDocuments = data.total; - $scope.numPages = Math.ceil(data.total / $scope.limit); }); }; diff --git a/docs-web/src/main/webapp/app/docs/controller/DocumentDefault.js b/docs-web/src/main/webapp/app/docs/controller/DocumentDefault.js index 37772c00..a4b857db 100644 --- a/docs-web/src/main/webapp/app/docs/controller/DocumentDefault.js +++ b/docs-web/src/main/webapp/app/docs/controller/DocumentDefault.js @@ -5,5 +5,7 @@ */ App.controller('DocumentDefault', function($scope, $state, Restangular) { // Load app data - $scope.app = Restangular.one('app').get(); + Restangular.one('app').get().then(function(data) { + $scope.app = data; + }); }); \ No newline at end of file diff --git a/docs-web/src/main/webapp/app/docs/controller/DocumentEdit.js b/docs-web/src/main/webapp/app/docs/controller/DocumentEdit.js index f573e056..107468ad 100644 --- a/docs-web/src/main/webapp/app/docs/controller/DocumentEdit.js +++ b/docs-web/src/main/webapp/app/docs/controller/DocumentEdit.js @@ -109,13 +109,13 @@ App.controller('DocumentEdit', function($rootScope, $scope, $q, $http, $state, $ var formData = new FormData(); formData.append('id', data.id); formData.append('file', file); - + // Send the file var promiseFile = $http.put('api/file', formData, { - headers: { 'Content-Type': false }, - transformRequest: function(data) { return data; } - }); + headers: { 'Content-Type': undefined }, + transformRequest: function(data) { return data; } + }); // TODO Handle progression when $q.notify will be released diff --git a/docs-web/src/main/webapp/app/docs/controller/DocumentView.js b/docs-web/src/main/webapp/app/docs/controller/DocumentView.js index 89b2776d..d28b1214 100644 --- a/docs-web/src/main/webapp/app/docs/controller/DocumentView.js +++ b/docs-web/src/main/webapp/app/docs/controller/DocumentView.js @@ -3,7 +3,7 @@ /** * Document view controller. */ -App.controller('DocumentView', function ($scope, $state, $stateParams, $location, $dialog, Restangular) { +App.controller('DocumentView', function ($scope, $state, $stateParams, $location, $dialog, $modal, Restangular) { // Load data from server Restangular.one('document', $stateParams.id).get().then(function(data) { $scope.document = data; @@ -56,16 +56,14 @@ App.controller('DocumentView', function ($scope, $state, $stateParams, $location {result: 'ok', label: 'OK', cssClass: 'btn-primary'} ]; - $dialog.messageBox(title, msg, btns) - .open() - .then(function (result) { - if (result == 'ok') { - Restangular.one('document', document.id).remove().then(function () { - $scope.loadDocuments(); - $state.transitionTo('document.default'); - }); - } + $dialog.messageBox(title, msg, btns, function (result) { + if (result == 'ok') { + Restangular.one('document', document.id).remove().then(function () { + $scope.loadDocuments(); + $state.transitionTo('document.default'); }); + } + }); }; /** @@ -79,31 +77,28 @@ App.controller('DocumentView', function ($scope, $state, $stateParams, $location {result: 'ok', label: 'OK', cssClass: 'btn-primary'} ]; - $dialog.messageBox(title, msg, btns) - .open() - .then(function (result) { - if (result == 'ok') { - Restangular.one('file', file.id).remove().then(function () { - $scope.loadFiles(); - }); - } + $dialog.messageBox(title, msg, btns, function (result) { + if (result == 'ok') { + Restangular.one('file', file.id).remove().then(function () { + $scope.loadFiles(); }); + } + }); }; /** * Open the share dialog. */ $scope.share = function () { - $dialog.dialog({ - keyboard: true, + $modal.open({ templateUrl: 'partial/docs/document.share.html', - controller: function ($scope, dialog) { + controller: function ($scope, $modalInstance) { $scope.name = ''; $scope.close = function (name) { - dialog.close(name); + $modalInstance.close(name); } } - }).open().then(function (name) { + }).result.then(function (name) { if (name == null) { return; } @@ -140,17 +135,15 @@ App.controller('DocumentView', function ($scope, $state, $stateParams, $location {result: 'close', label: 'Close'} ]; - $dialog.messageBox(title, msg, btns) - .open() - .then(function (result) { - if (result == 'unshare') { - // Unshare this document and update the local shares - Restangular.one('share', share.id).remove().then(function () { - $scope.document.shares = _.reject($scope.document.shares, function(s) { - return share.id == s.id; - }); - }); - } + $dialog.messageBox(title, msg, btns, function (result) { + if (result == 'unshare') { + // Unshare this document and update the local shares + Restangular.one('share', share.id).remove().then(function () { + $scope.document.shares = _.reject($scope.document.shares, function(s) { + return share.id == s.id; + }); }); + } + }); }; }); \ No newline at end of file diff --git a/docs-web/src/main/webapp/app/docs/controller/FileView.js b/docs-web/src/main/webapp/app/docs/controller/FileView.js index 1e6963ed..b16073a8 100644 --- a/docs-web/src/main/webapp/app/docs/controller/FileView.js +++ b/docs-web/src/main/webapp/app/docs/controller/FileView.js @@ -3,12 +3,11 @@ /** * File view controller. */ -App.controller('FileView', function($dialog, $state, $stateParams) { - var dialog = $dialog.dialog({ - keyboard: true, - dialogClass: 'modal modal-fileview', +App.controller('FileView', function($modal, $state, $stateParams) { + var modal = $modal.open({ + windowClass: 'modal modal-fileview', templateUrl: 'partial/docs/file.view.html', - controller: function($scope, $state, $stateParams, Restangular, dialog) { + controller: function($rootScope, $scope, $state, $stateParams, Restangular) { // Load files Restangular.one('file').getList('list', { id: $stateParams.id }).then(function(data) { $scope.files = data.files; @@ -29,7 +28,6 @@ App.controller('FileView', function($dialog, $state, $stateParams) { if (value.id == $stateParams.fileId) { var next = $scope.files[key + 1]; if (next) { - dialog.close({}); $state.transitionTo('document.view.file', { id: $stateParams.id, fileId: next.id }); } } @@ -44,7 +42,6 @@ App.controller('FileView', function($dialog, $state, $stateParams) { if (value.id == $stateParams.fileId) { var previous = $scope.files[key - 1]; if (previous) { - dialog.close({}); $state.transitionTo('document.view.file', { id: $stateParams.id, fileId: previous.id }); } } @@ -62,13 +59,17 @@ App.controller('FileView', function($dialog, $state, $stateParams) { * Close the file preview. */ $scope.closeFile = function () { - dialog.close(); + modal.dismiss(); }; - // Close the dialog when the user exits this state - var off = $scope.$on('$stateChangeStart', function(event, toState){ - if (dialog.isOpen()) { - dialog.close(toState.name == 'document.view.file' ? {} : null); + // Close the modal when the user exits this state + var off = $rootScope.$on('$stateChangeStart', function(event, toState) { + if (!modal.closed) { + if (toState.name == 'document.view.file') { + modal.close(); + } else { + modal.dismiss(); + } } off(); }); @@ -76,9 +77,11 @@ App.controller('FileView', function($dialog, $state, $stateParams) { }); // Returns to document view on file close - dialog.open().then(function(result) { - if (result == null) { - $state.transitionTo('document.view', { id: $stateParams.id }); - } + modal.closed = false; + modal.result.then(function() { + modal.closed = true; + }, function() { + modal.closed = true; + $state.transitionTo('document.view', { id: $stateParams.id }); }); }); \ No newline at end of file diff --git a/docs-web/src/main/webapp/app/docs/controller/Login.js b/docs-web/src/main/webapp/app/docs/controller/Login.js index f159d211..d8320248 100644 --- a/docs-web/src/main/webapp/app/docs/controller/Login.js +++ b/docs-web/src/main/webapp/app/docs/controller/Login.js @@ -13,7 +13,7 @@ App.controller('Login', function($scope, $rootScope, $state, $dialog, User) { var msg = 'Username or password invalid'; var btns = [{result:'ok', label: 'OK', cssClass: 'btn-primary'}]; - $dialog.messageBox(title, msg, btns).open(); + $dialog.messageBox(title, msg, btns); }); }; }); \ No newline at end of file diff --git a/docs-web/src/main/webapp/app/docs/controller/Navigation.js b/docs-web/src/main/webapp/app/docs/controller/Navigation.js index 7838ef4f..3579050e 100644 --- a/docs-web/src/main/webapp/app/docs/controller/Navigation.js +++ b/docs-web/src/main/webapp/app/docs/controller/Navigation.js @@ -4,7 +4,9 @@ * Navigation controller. */ App.controller('Navigation', function($scope, $http, $state, $rootScope, User, Restangular) { - $rootScope.userInfo = User.userInfo(); + User.userInfo().then(function(data) { + $rootScope.userInfo = data; + }); // Last time when the errors logs was checked $scope.lastLogCheck = new Date().getTime(); @@ -47,7 +49,9 @@ App.controller('Navigation', function($scope, $http, $state, $rootScope, User, R */ $scope.logout = function($event) { User.logout().then(function() { - $rootScope.userInfo = User.userInfo(true); + User.userInfo(true).then(function(data) { + $rootScope.userInfo = data; + }); $state.transitionTo('main'); }); $event.preventDefault(); diff --git a/docs-web/src/main/webapp/app/docs/controller/Settings.js b/docs-web/src/main/webapp/app/docs/controller/Settings.js index dfd6fbb1..269f11e6 100644 --- a/docs-web/src/main/webapp/app/docs/controller/Settings.js +++ b/docs-web/src/main/webapp/app/docs/controller/Settings.js @@ -5,7 +5,5 @@ */ App.controller('Settings', function($scope, Restangular) { // Flag if the user is admin - $scope.userInfo.then(function (data) { - $scope.isAdmin = data.base_functions.indexOf('ADMIN') != -1; - }); + $scope.isAdmin = $scope.userInfo.base_functions.indexOf('ADMIN') != -1; }); \ No newline at end of file diff --git a/docs-web/src/main/webapp/app/docs/controller/SettingsUserEdit.js b/docs-web/src/main/webapp/app/docs/controller/SettingsUserEdit.js index 528899e3..44652ff0 100644 --- a/docs-web/src/main/webapp/app/docs/controller/SettingsUserEdit.js +++ b/docs-web/src/main/webapp/app/docs/controller/SettingsUserEdit.js @@ -50,18 +50,16 @@ App.controller('SettingsUserEdit', function($scope, $dialog, $state, $stateParam var msg = 'Do you really want to delete this user? All associated documents, files and tags will be deleted'; var btns = [{result:'cancel', label: 'Cancel'}, {result:'ok', label: 'OK', cssClass: 'btn-primary'}]; - $dialog.messageBox(title, msg, btns) - .open() - .then(function(result) { - if (result == 'ok') { - Restangular.one('user', $stateParams.username).remove().then(function() { - $scope.loadUsers(); - $state.transitionTo('settings.user'); - }, function () { - $state.transitionTo('settings.user'); - }); - } - }); + $dialog.messageBox(title, msg, btns, function(result) { + if (result == 'ok') { + Restangular.one('user', $stateParams.username).remove().then(function() { + $scope.loadUsers(); + $state.transitionTo('settings.user'); + }, function () { + $state.transitionTo('settings.user'); + }); + } + }); }; }); \ No newline at end of file diff --git a/docs-web/src/main/webapp/app/docs/controller/Tag.js b/docs-web/src/main/webapp/app/docs/controller/Tag.js index dd6827e2..45609631 100644 --- a/docs-web/src/main/webapp/app/docs/controller/Tag.js +++ b/docs-web/src/main/webapp/app/docs/controller/Tag.js @@ -55,9 +55,7 @@ App.controller('Tag', function($scope, $dialog, $state, Tag, Restangular) { {result: 'ok', label: 'OK', cssClass: 'btn-primary'} ]; - $dialog.messageBox(title, msg, btns) - .open() - .then(function(result) { + $dialog.messageBox(title, msg, btns, function(result) { if (result == 'ok') { Restangular.one('tag', tag.id).remove().then(function() { $scope.tags = _.reject($scope.tags, function(t) { diff --git a/docs-web/src/main/webapp/app/docs/directive/InlineEdit.js b/docs-web/src/main/webapp/app/docs/directive/InlineEdit.js index 04e71eeb..649074ab 100644 --- a/docs-web/src/main/webapp/app/docs/directive/InlineEdit.js +++ b/docs-web/src/main/webapp/app/docs/directive/InlineEdit.js @@ -11,7 +11,7 @@ App.directive('inlineEdit', function() { value: '=', editCallback: '&onEdit' }, - template: '', + template: '', link: function (scope, element, attrs) { // Let's get a reference to the input element, as we'll want to reference it. var inputElement = angular.element(element.children()[1]); diff --git a/docs-web/src/main/webapp/fonts/glyphicons-halflings-regular.eot b/docs-web/src/main/webapp/fonts/glyphicons-halflings-regular.eot new file mode 100644 index 00000000..423bd5d3 Binary files /dev/null and b/docs-web/src/main/webapp/fonts/glyphicons-halflings-regular.eot differ diff --git a/docs-web/src/main/webapp/fonts/glyphicons-halflings-regular.svg b/docs-web/src/main/webapp/fonts/glyphicons-halflings-regular.svg new file mode 100644 index 00000000..44694887 --- /dev/null +++ b/docs-web/src/main/webapp/fonts/glyphicons-halflings-regular.svg @@ -0,0 +1,229 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs-web/src/main/webapp/fonts/glyphicons-halflings-regular.ttf b/docs-web/src/main/webapp/fonts/glyphicons-halflings-regular.ttf new file mode 100644 index 00000000..a498ef4e Binary files /dev/null and b/docs-web/src/main/webapp/fonts/glyphicons-halflings-regular.ttf differ diff --git a/docs-web/src/main/webapp/fonts/glyphicons-halflings-regular.woff b/docs-web/src/main/webapp/fonts/glyphicons-halflings-regular.woff new file mode 100644 index 00000000..d83c539b Binary files /dev/null and b/docs-web/src/main/webapp/fonts/glyphicons-halflings-regular.woff differ diff --git a/docs-web/src/main/webapp/index.html b/docs-web/src/main/webapp/index.html index 59f7ac29..98c78755 100644 --- a/docs-web/src/main/webapp/index.html +++ b/docs-web/src/main/webapp/index.html @@ -22,9 +22,9 @@ - - - + + + @@ -57,34 +57,54 @@ -