mirror of
https://github.com/sismics/docs.git
synced 2024-11-24 14:47:57 +01:00
Init share app, client refactoring
This commit is contained in:
parent
ecb2afd628
commit
ed85909d00
@ -103,7 +103,7 @@ public class ShareDao {
|
||||
// The share is linked to the document
|
||||
if (shareId != null) {
|
||||
Share share = getShare(shareId);
|
||||
if (share.getDocumentId().equals(document.getId())) {
|
||||
if (share != null && share.getDocumentId().equals(document.getId())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1 +1,2 @@
|
||||
- Share a document with a link (client)
|
||||
- Advanced search: shared documents (client/server)
|
@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Trackino application.
|
||||
* Sismics Docs application.
|
||||
*/
|
||||
var App = angular.module('docs',
|
||||
// Dependencies
|
||||
@ -19,7 +19,7 @@ var App = angular.module('docs',
|
||||
url: '',
|
||||
views: {
|
||||
'page': {
|
||||
templateUrl: 'partial/main.html',
|
||||
templateUrl: 'partial/docs/main.html',
|
||||
controller: 'Main'
|
||||
}
|
||||
}
|
||||
@ -28,7 +28,7 @@ var App = angular.module('docs',
|
||||
url: '/tag',
|
||||
views: {
|
||||
'page': {
|
||||
templateUrl: 'partial/tag.html',
|
||||
templateUrl: 'partial/docs/tag.html',
|
||||
controller: 'Tag'
|
||||
}
|
||||
}
|
||||
@ -38,7 +38,7 @@ var App = angular.module('docs',
|
||||
abstract: true,
|
||||
views: {
|
||||
'page': {
|
||||
templateUrl: 'partial/settings.html',
|
||||
templateUrl: 'partial/docs/settings.html',
|
||||
controller: 'Settings'
|
||||
}
|
||||
}
|
||||
@ -47,7 +47,7 @@ var App = angular.module('docs',
|
||||
url: '',
|
||||
views: {
|
||||
'settings': {
|
||||
templateUrl: 'partial/settings.default.html',
|
||||
templateUrl: 'partial/docs/settings.default.html',
|
||||
controller: 'SettingsDefault'
|
||||
}
|
||||
}
|
||||
@ -56,7 +56,7 @@ var App = angular.module('docs',
|
||||
url: '/account',
|
||||
views: {
|
||||
'settings': {
|
||||
templateUrl: 'partial/settings.account.html',
|
||||
templateUrl: 'partial/docs/settings.account.html',
|
||||
controller: 'SettingsAccount'
|
||||
}
|
||||
}
|
||||
@ -65,7 +65,7 @@ var App = angular.module('docs',
|
||||
url: '/session',
|
||||
views: {
|
||||
'settings': {
|
||||
templateUrl: 'partial/settings.session.html',
|
||||
templateUrl: 'partial/docs/settings.session.html',
|
||||
controller: 'SettingsSession'
|
||||
}
|
||||
}
|
||||
@ -74,7 +74,7 @@ var App = angular.module('docs',
|
||||
url: '/log',
|
||||
views: {
|
||||
'settings': {
|
||||
templateUrl: 'partial/settings.log.html',
|
||||
templateUrl: 'partial/docs/settings.log.html',
|
||||
controller: 'SettingsLog'
|
||||
}
|
||||
}
|
||||
@ -83,7 +83,7 @@ var App = angular.module('docs',
|
||||
url: '/user',
|
||||
views: {
|
||||
'settings': {
|
||||
templateUrl: 'partial/settings.user.html',
|
||||
templateUrl: 'partial/docs/settings.user.html',
|
||||
controller: 'SettingsUser'
|
||||
}
|
||||
}
|
||||
@ -92,7 +92,7 @@ var App = angular.module('docs',
|
||||
url: '/edit/:username',
|
||||
views: {
|
||||
'user': {
|
||||
templateUrl: 'partial/settings.user.edit.html',
|
||||
templateUrl: 'partial/docs/settings.user.edit.html',
|
||||
controller: 'SettingsUserEdit'
|
||||
}
|
||||
}
|
||||
@ -101,7 +101,7 @@ var App = angular.module('docs',
|
||||
url: '/add',
|
||||
views: {
|
||||
'user': {
|
||||
templateUrl: 'partial/settings.user.edit.html',
|
||||
templateUrl: 'partial/docs/settings.user.edit.html',
|
||||
controller: 'SettingsUserEdit'
|
||||
}
|
||||
}
|
||||
@ -111,7 +111,7 @@ var App = angular.module('docs',
|
||||
abstract: true,
|
||||
views: {
|
||||
'page': {
|
||||
templateUrl: 'partial/document.html',
|
||||
templateUrl: 'partial/docs/document.html',
|
||||
controller: 'Document'
|
||||
}
|
||||
}
|
||||
@ -120,7 +120,7 @@ var App = angular.module('docs',
|
||||
url: '',
|
||||
views: {
|
||||
'document': {
|
||||
templateUrl: 'partial/document.default.html',
|
||||
templateUrl: 'partial/docs/document.default.html',
|
||||
controller: 'DocumentDefault'
|
||||
}
|
||||
}
|
||||
@ -129,7 +129,7 @@ var App = angular.module('docs',
|
||||
url: '/add',
|
||||
views: {
|
||||
'document': {
|
||||
templateUrl: 'partial/document.edit.html',
|
||||
templateUrl: 'partial/docs/document.edit.html',
|
||||
controller: 'DocumentEdit'
|
||||
}
|
||||
}
|
||||
@ -138,7 +138,7 @@ var App = angular.module('docs',
|
||||
url: '/edit/:id',
|
||||
views: {
|
||||
'document': {
|
||||
templateUrl: 'partial/document.edit.html',
|
||||
templateUrl: 'partial/docs/document.edit.html',
|
||||
controller: 'DocumentEdit'
|
||||
}
|
||||
}
|
||||
@ -147,7 +147,7 @@ var App = angular.module('docs',
|
||||
url: '/view/:id',
|
||||
views: {
|
||||
'document': {
|
||||
templateUrl: 'partial/document.view.html',
|
||||
templateUrl: 'partial/docs/document.view.html',
|
||||
controller: 'DocumentView'
|
||||
}
|
||||
}
|
||||
@ -164,7 +164,7 @@ var App = angular.module('docs',
|
||||
url: '/login',
|
||||
views: {
|
||||
'page': {
|
||||
templateUrl: 'partial/login.html',
|
||||
templateUrl: 'partial/docs/login.html',
|
||||
controller: 'Login'
|
||||
}
|
||||
}
|
157
docs-web/src/main/webapp/app/docs/controller/DocumentView.js
Normal file
157
docs-web/src/main/webapp/app/docs/controller/DocumentView.js
Normal file
@ -0,0 +1,157 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Document view controller.
|
||||
*/
|
||||
App.controller('DocumentView', function ($scope, $state, $stateParams, $location, $dialog, Restangular) {
|
||||
// Load data from server
|
||||
Restangular.one('document', $stateParams.id).get().then(function(data) {
|
||||
$scope.document = data;
|
||||
});
|
||||
|
||||
/**
|
||||
* Configuration for file sorting.
|
||||
*/
|
||||
$scope.fileSortableOptions = {
|
||||
forceHelperSize: true,
|
||||
forcePlaceholderSize: true,
|
||||
tolerance: 'pointer',
|
||||
handle: '.handle',
|
||||
stop: function (e, ui) {
|
||||
// Send new positions to server
|
||||
$scope.$apply(function () {
|
||||
Restangular.one('file').post('reorder', {
|
||||
id: $stateParams.id,
|
||||
order: _.pluck($scope.files, 'id')
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Load files from server.
|
||||
*/
|
||||
$scope.loadFiles = function () {
|
||||
Restangular.one('file').getList('list', { id: $stateParams.id }).then(function (data) {
|
||||
$scope.files = data.files;
|
||||
});
|
||||
};
|
||||
$scope.loadFiles();
|
||||
|
||||
/**
|
||||
* Navigate to the selected file.
|
||||
*/
|
||||
$scope.openFile = function (file) {
|
||||
$state.transitionTo('document.view.file', { id: $stateParams.id, fileId: file.id })
|
||||
};
|
||||
|
||||
/**
|
||||
* Delete a document.
|
||||
*/
|
||||
$scope.deleteDocument = function (document) {
|
||||
var title = 'Delete document';
|
||||
var msg = 'Do you really want to delete this document?';
|
||||
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('document', document.id).remove().then(function () {
|
||||
$scope.loadDocuments();
|
||||
$state.transitionTo('document.default');
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Delete a file.
|
||||
*/
|
||||
$scope.deleteFile = function (file) {
|
||||
var title = 'Delete file';
|
||||
var msg = 'Do you really want to delete this file?';
|
||||
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('file', file.id).remove().then(function () {
|
||||
$scope.loadFiles();
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Open the share dialog.
|
||||
*/
|
||||
$scope.share = function () {
|
||||
$dialog.dialog({
|
||||
backdrop: false,
|
||||
keyboard: true,
|
||||
templateUrl: 'partial/docs/document.share.html',
|
||||
controller: function ($scope, dialog) {
|
||||
$scope.name = '';
|
||||
$scope.close = function (name) {
|
||||
dialog.close(name);
|
||||
}
|
||||
}
|
||||
}).open().then(function (name) {
|
||||
if (name == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Share the document
|
||||
Restangular.one('share').put({
|
||||
name: name,
|
||||
id: $stateParams.id
|
||||
}).then(function (data) {
|
||||
var share = {
|
||||
name: name,
|
||||
id: data.id
|
||||
};
|
||||
|
||||
// Display the new share and add it to the local shares
|
||||
$scope.showShare(share);
|
||||
$scope.document.shares.push(share);
|
||||
})
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Display a share.
|
||||
*/
|
||||
$scope.showShare = function(share) {
|
||||
// Show the link
|
||||
var link = $location.absUrl().replace($location.path(), '').replace('#', '') + 'share.html#/share/' + $stateParams.id + '/' + share.id;
|
||||
var title = 'Shared document';
|
||||
var msg = 'You can share this document by giving this link. ' +
|
||||
'Note that everyone having this link can see the document.<br/>' +
|
||||
'<input class="input-block-level share-link" type="text" readonly="readonly" value="' + link + '" />';
|
||||
var btns = [
|
||||
{result: 'unshare', label: 'Unshare', cssClass: 'btn-danger'},
|
||||
{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;
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
@ -6,7 +6,7 @@
|
||||
App.controller('FileView', function($dialog, $state, $stateParams) {
|
||||
var dialog = $dialog.dialog({
|
||||
keyboard: true,
|
||||
templateUrl: 'partial/file.view.html',
|
||||
templateUrl: 'partial/docs/file.view.html',
|
||||
controller: function($scope, $state, $stateParams, Restangular, dialog) {
|
||||
$scope.id = $stateParams.fileId;
|
||||
|
@ -42,7 +42,10 @@ App.controller('Tag', function($scope, $dialog, $state, Tag, Restangular) {
|
||||
$scope.deleteTag = function(tag) {
|
||||
var title = 'Delete tag';
|
||||
var msg = 'Do you really want to delete this tag?';
|
||||
var btns = [{result:'cancel', label: 'Cancel'}, {result:'ok', label: 'OK', cssClass: 'btn-primary'}];
|
||||
var btns = [
|
||||
{result: 'cancel', label: 'Cancel'},
|
||||
{result: 'ok', label: 'OK', cssClass: 'btn-primary'}
|
||||
];
|
||||
|
||||
$dialog.messageBox(title, msg, btns)
|
||||
.open()
|
||||
@ -67,7 +70,10 @@ App.controller('Tag', function($scope, $dialog, $state, Tag, Restangular) {
|
||||
var stat = _.find($scope.stats, function (t) {
|
||||
return tag.id == t.id;
|
||||
});
|
||||
|
||||
if (stat) {
|
||||
_.extend(stat, tag);
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
@ -6,7 +6,7 @@
|
||||
App.directive('selectTag', function() {
|
||||
return {
|
||||
restrict: 'E',
|
||||
templateUrl: 'partial/directive.selecttag.html',
|
||||
templateUrl: 'partial/docs/directive.selecttag.html',
|
||||
replace: true,
|
||||
scope: {
|
||||
tags: '=',
|
85
docs-web/src/main/webapp/app/share/app.js
Normal file
85
docs-web/src/main/webapp/app/share/app.js
Normal file
@ -0,0 +1,85 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Share application.
|
||||
*/
|
||||
var App = angular.module('share',
|
||||
// Dependencies
|
||||
['ui.state', 'ui.bootstrap', 'ui.route', 'restangular', 'ngSanitize', 'ngMobile']
|
||||
)
|
||||
|
||||
/**
|
||||
* Configuring modules.
|
||||
*/
|
||||
.config(function($stateProvider, $httpProvider, $routeProvider, RestangularProvider) {
|
||||
// Configuring UI Router
|
||||
$stateProvider
|
||||
.state('main', {
|
||||
url: '',
|
||||
views: {
|
||||
'page': {
|
||||
templateUrl: 'partial/share/main.html',
|
||||
controller: 'Main'
|
||||
}
|
||||
}
|
||||
})
|
||||
.state('share', {
|
||||
url: '/share/:documentId/:shareId',
|
||||
views: {
|
||||
'page': {
|
||||
templateUrl: 'partial/share/share.html',
|
||||
controller: 'Share'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Configuring Restangular
|
||||
RestangularProvider.setBaseUrl('api');
|
||||
|
||||
// Configuring $http to act like jQuery.ajax
|
||||
$httpProvider.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=utf-8';
|
||||
$httpProvider.defaults.headers.put['Content-Type'] = 'application/x-www-form-urlencoded;charset=utf-8';
|
||||
$httpProvider.defaults.transformRequest = [function(data) {
|
||||
var param = function(obj) {
|
||||
var query = '';
|
||||
var name, value, fullSubName, subName, subValue, innerObj, i;
|
||||
|
||||
for(name in obj) {
|
||||
value = obj[name];
|
||||
|
||||
if(value instanceof Array) {
|
||||
for(i=0; i<value.length; ++i) {
|
||||
subValue = value[i];
|
||||
fullSubName = name;
|
||||
innerObj = {};
|
||||
innerObj[fullSubName] = subValue;
|
||||
query += param(innerObj) + '&';
|
||||
}
|
||||
} else if(value instanceof Object) {
|
||||
for(subName in value) {
|
||||
subValue = value[subName];
|
||||
fullSubName = name + '[' + subName + ']';
|
||||
innerObj = {};
|
||||
innerObj[fullSubName] = subValue;
|
||||
query += param(innerObj) + '&';
|
||||
}
|
||||
}
|
||||
else if(value !== undefined && value !== null) {
|
||||
query += encodeURIComponent(name) + '=' + encodeURIComponent(value) + '&';
|
||||
}
|
||||
}
|
||||
|
||||
return query.length ? query.substr(0, query.length - 1) : query;
|
||||
};
|
||||
|
||||
return angular.isObject(data) && String(data) !== '[object File]' ? param(data) : data;
|
||||
}];
|
||||
})
|
||||
|
||||
/**
|
||||
* Application initialization.
|
||||
*/
|
||||
.run(function($rootScope, $state, $stateParams) {
|
||||
$rootScope.$state = $state;
|
||||
$rootScope.$stateParams = $stateParams;
|
||||
});
|
22
docs-web/src/main/webapp/app/share/controller/Share.js
Normal file
22
docs-web/src/main/webapp/app/share/controller/Share.js
Normal file
@ -0,0 +1,22 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Share controller.
|
||||
*/
|
||||
App.controller('Share', function($scope, $state, $stateParams, Restangular) {
|
||||
// Load document
|
||||
Restangular.one('document', $stateParams.documentId).get({ share: $stateParams.shareId })
|
||||
.then(function (data) {
|
||||
$scope.document = data;
|
||||
}, function (response) {
|
||||
if (response.data.status == 403) {
|
||||
// TODO Sharing no more valid
|
||||
}
|
||||
});
|
||||
|
||||
// Load files
|
||||
Restangular.one('file').getList('list', { id: $stateParams.documentId, share: $stateParams.shareId })
|
||||
.then(function (data) {
|
||||
$scope.files = data.files;
|
||||
});
|
||||
});
|
@ -31,30 +31,30 @@
|
||||
<script src="lib/angular.ui-sortable.js" type="text/javascript"></script>
|
||||
<script src="lib/angular.restangular.js" type="text/javascript"></script>
|
||||
<script src="lib/angular.colorpicker.js" type="text/javascript"></script>
|
||||
<script src="js/app.js" type="text/javascript"></script>
|
||||
<script src="js/controller/Main.js" type="text/javascript"></script>
|
||||
<script src="js/controller/Document.js" type="text/javascript"></script>
|
||||
<script src="js/controller/DocumentDefault.js" type="text/javascript"></script>
|
||||
<script src="js/controller/DocumentEdit.js" type="text/javascript"></script>
|
||||
<script src="js/controller/DocumentView.js" type="text/javascript"></script>
|
||||
<script src="js/controller/FileView.js" type="text/javascript"></script>
|
||||
<script src="js/controller/Login.js" type="text/javascript"></script>
|
||||
<script src="js/controller/Tag.js" type="text/javascript"></script>
|
||||
<script src="js/controller/Navigation.js" type="text/javascript"></script>
|
||||
<script src="js/controller/Settings.js" type="text/javascript"></script>
|
||||
<script src="js/controller/SettingsDefault.js" type="text/javascript"></script>
|
||||
<script src="js/controller/SettingsAccount.js" type="text/javascript"></script>
|
||||
<script src="js/controller/SettingsSession.js" type="text/javascript"></script>
|
||||
<script src="js/controller/SettingsLog.js" type="text/javascript"></script>
|
||||
<script src="js/controller/SettingsUser.js" type="text/javascript"></script>
|
||||
<script src="js/controller/SettingsUserEdit.js" type="text/javascript"></script>
|
||||
<script src="js/service/User.js" type="text/javascript"></script>
|
||||
<script src="js/service/Tag.js" type="text/javascript"></script>
|
||||
<script src="js/filter/Newline.js" type="text/javascript"></script>
|
||||
<script src="js/filter/Shorten.js" type="text/javascript"></script>
|
||||
<script src="js/directive/File.js" type="text/javascript"></script>
|
||||
<script src="js/directive/SelectTag.js" type="text/javascript"></script>
|
||||
<script src="js/directive/InlineEdit.js" type="text/javascript"></script>
|
||||
<script src="app/docs/app.js" type="text/javascript"></script>
|
||||
<script src="app/docs/controller/Main.js" type="text/javascript"></script>
|
||||
<script src="app/docs/controller/Document.js" type="text/javascript"></script>
|
||||
<script src="app/docs/controller/DocumentDefault.js" type="text/javascript"></script>
|
||||
<script src="app/docs/controller/DocumentEdit.js" type="text/javascript"></script>
|
||||
<script src="app/docs/controller/DocumentView.js" type="text/javascript"></script>
|
||||
<script src="app/docs/controller/FileView.js" type="text/javascript"></script>
|
||||
<script src="app/docs/controller/Login.js" type="text/javascript"></script>
|
||||
<script src="app/docs/controller/Tag.js" type="text/javascript"></script>
|
||||
<script src="app/docs/controller/Navigation.js" type="text/javascript"></script>
|
||||
<script src="app/docs/controller/Settings.js" type="text/javascript"></script>
|
||||
<script src="app/docs/controller/SettingsDefault.js" type="text/javascript"></script>
|
||||
<script src="app/docs/controller/SettingsAccount.js" type="text/javascript"></script>
|
||||
<script src="app/docs/controller/SettingsSession.js" type="text/javascript"></script>
|
||||
<script src="app/docs/controller/SettingsLog.js" type="text/javascript"></script>
|
||||
<script src="app/docs/controller/SettingsUser.js" type="text/javascript"></script>
|
||||
<script src="app/docs/controller/SettingsUserEdit.js" type="text/javascript"></script>
|
||||
<script src="app/docs/service/User.js" type="text/javascript"></script>
|
||||
<script src="app/docs/service/Tag.js" type="text/javascript"></script>
|
||||
<script src="app/docs/filter/Newline.js" type="text/javascript"></script>
|
||||
<script src="app/docs/filter/Shorten.js" type="text/javascript"></script>
|
||||
<script src="app/docs/directive/File.js" type="text/javascript"></script>
|
||||
<script src="app/docs/directive/SelectTag.js" type="text/javascript"></script>
|
||||
<script src="app/docs/directive/InlineEdit.js" type="text/javascript"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="navbar" ng-controller="Navigation">
|
||||
|
@ -1,84 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Document view controller.
|
||||
*/
|
||||
App.controller('DocumentView', function($scope, $state, $stateParams, $dialog, Restangular) {
|
||||
// Load data from server
|
||||
$scope.document = Restangular.one('document', $stateParams.id).get();
|
||||
|
||||
/**
|
||||
* Configuration for file sorting.
|
||||
*/
|
||||
$scope.fileSortableOptions = {
|
||||
forceHelperSize: true,
|
||||
forcePlaceholderSize: true,
|
||||
tolerance: 'pointer',
|
||||
handle: '.handle',
|
||||
stop: function(e, ui) {
|
||||
// Send new positions to server
|
||||
$scope.$apply(function() {
|
||||
Restangular.one('file').post('reorder', {
|
||||
id: $stateParams.id,
|
||||
order: _.pluck($scope.files, 'id')
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Load files from server.
|
||||
*/
|
||||
$scope.loadFiles = function() {
|
||||
Restangular.one('file').getList('list', { id: $stateParams.id }).then(function(data) {
|
||||
$scope.files = data.files;
|
||||
});
|
||||
};
|
||||
$scope.loadFiles();
|
||||
|
||||
/**
|
||||
* Navigate to the selected file.
|
||||
*/
|
||||
$scope.openFile = function(file) {
|
||||
$state.transitionTo('document.view.file', { id: $stateParams.id, fileId: file.id })
|
||||
};
|
||||
|
||||
/**
|
||||
* Delete a document.
|
||||
*/
|
||||
$scope.deleteDocument = function(document) {
|
||||
var title = 'Delete document';
|
||||
var msg = 'Do you really want to delete this document?';
|
||||
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('document', document.id).remove().then(function() {
|
||||
$scope.loadDocuments();
|
||||
$state.transitionTo('document.default');
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Delete a file.
|
||||
*/
|
||||
$scope.deleteFile = function(file) {
|
||||
var title = 'Delete file';
|
||||
var msg = 'Do you really want to delete this file?';
|
||||
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('file', file.id).remove().then(function() {
|
||||
$scope.loadFiles();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
@ -3288,7 +3288,7 @@ angular.module("template/dialog/message.html", []).run(["$templateCache", functi
|
||||
" <h3>{{ title }}</h3>\n" +
|
||||
"</div>\n" +
|
||||
"<div class=\"modal-body\">\n" +
|
||||
" <p>{{ message }}</p>\n" +
|
||||
" <p ng-bind-html-unsafe=\"message\"></p>\n" +
|
||||
"</div>\n" +
|
||||
"<div class=\"modal-footer\">\n" +
|
||||
" <button ng-repeat=\"btn in buttons\" ng-click=\"close(btn.result)\" class=\"btn\" ng-class=\"btn.cssClass\">{{ btn.label }}</button>\n" +
|
||||
|
@ -9895,8 +9895,7 @@ function $HttpProvider() {
|
||||
* - **withCredentials** - `{boolean}` - whether to to set the `withCredentials` flag on the
|
||||
* XHR object. See {@link https://developer.mozilla.org/en/http_access_control#section_5
|
||||
* requests with credentials} for more information.
|
||||
* - **responseType** - `{string}` - see {@link
|
||||
* https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest#responseType requestType}.
|
||||
* - **responseType** - `{string}` - see {@link https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest#responseType requestType}.
|
||||
*
|
||||
* @returns {HttpPromise} Returns a {@link ng.$q promise} object with the
|
||||
* standard `then` method and two http specific methods: `success` and `error`. The `then`
|
||||
|
13
docs-web/src/main/webapp/partial/docs/document.share.html
Normal file
13
docs-web/src/main/webapp/partial/docs/document.share.html
Normal file
@ -0,0 +1,13 @@
|
||||
<div class="modal-header">
|
||||
<h3>Share document</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>
|
||||
<label for="share-result">Name the sharing if you want to share multiple times the same document.</label>
|
||||
<input type="text" id="share-result" ng-model="name" />
|
||||
</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button ng-click="close(name)" class="btn btn-primary"><span class="icon-share icon-white"></span> Share</button>
|
||||
<button ng-click="close(null)" class="btn">Cancel</button>
|
||||
</div>
|
@ -7,6 +7,10 @@
|
||||
|
||||
<div class="page-header">
|
||||
<h1>{{ document.title }} <small>{{ document.create_date | date: 'yyyy-MM-dd' }}</small></h1>
|
||||
<p>
|
||||
<button class="btn btn-small btn-inverse" ng-click="share()"><span class="icon-share icon-white"></span> Share</button>
|
||||
<button class="btn btn-small" ng-repeat="share in document.shares" ng-click="showShare(share)"><span class="icon-ok"></span> {{ share.name ? share.name : 'shared' }}</button>
|
||||
</p>
|
||||
<ul class="inline">
|
||||
<li ng-repeat="tag in document.tags"><span class="label label-info" ng-style="{ 'background': tag.color }">{{ tag.name }}</span></li>
|
||||
</ul>
|
0
docs-web/src/main/webapp/partial/share/main.html
Normal file
0
docs-web/src/main/webapp/partial/share/main.html
Normal file
1
docs-web/src/main/webapp/partial/share/share.html
Normal file
1
docs-web/src/main/webapp/partial/share/share.html
Normal file
@ -0,0 +1 @@
|
||||
Shared document
|
35
docs-web/src/main/webapp/share.html
Normal file
35
docs-web/src/main/webapp/share.html
Normal file
@ -0,0 +1,35 @@
|
||||
<!DOCTYPE html>
|
||||
<html ng-app="share">
|
||||
<head>
|
||||
<title>Sismics Docs</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<link rel="shortcut icon" href="favicon.png" />
|
||||
<link rel="stylesheet" href="style/bootstrap.css" type="text/css" />
|
||||
<script>
|
||||
less = {
|
||||
env: 'development', // or "production"
|
||||
async: false, // load imports async
|
||||
fileAsync: false, // load imports async when in a page under a file protocol
|
||||
poll: 1000, // when in watch mode, time in ms between polls
|
||||
dumpLineNumbers: 'all' // or "mediaQuery" or "comments"
|
||||
};
|
||||
</script>
|
||||
<script src="lib/jquery.js" type="text/javascript"></script>
|
||||
<script src="lib/less.js" type="text/javascript"></script>
|
||||
<script src="lib/underscore.js" type="text/javascript"></script>
|
||||
<script src="lib/angular/angular.js" type="text/javascript"></script>
|
||||
<script src="lib/angular/angular-sanitize.js" type="text/javascript"></script>
|
||||
<script src="lib/angular/angular-mobile.js" type="text/javascript"></script>
|
||||
<script src="lib/angular.ui-router.js" type="text/javascript"></script>
|
||||
<script src="lib/angular.ui-bootstrap.js" type="text/javascript"></script>
|
||||
<script src="lib/angular.ui-utils.js" type="text/javascript"></script>
|
||||
<script src="lib/angular.restangular.js" type="text/javascript"></script>
|
||||
<script src="app/share/app.js" type="text/javascript"></script>
|
||||
<script src="app/share/controller/Share.js" type="text/javascript"></script>
|
||||
</head>
|
||||
<body>
|
||||
<main ui-view="page">
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
@ -88,6 +88,11 @@ input[readonly][datepicker-popup] {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
// Share link
|
||||
input[readonly].share-link {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
// Inline edition
|
||||
.inline-edit {
|
||||
cursor: pointer;
|
||||
|
Loading…
Reference in New Issue
Block a user