mirror of
https://github.com/sismics/docs.git
synced 2024-11-22 14:07:55 +01:00
Migration of /share.html
This commit is contained in:
parent
438a38985a
commit
03976160bf
@ -129,7 +129,7 @@ App.controller('DocumentView', function ($scope, $state, $stateParams, $location
|
|||||||
var title = 'Shared document';
|
var title = 'Shared document';
|
||||||
var msg = 'You can share this document by giving this link. ' +
|
var msg = 'You can share this document by giving this link. ' +
|
||||||
'Note that everyone having this link can see the document.<br/>' +
|
'Note that everyone having this link can see the document.<br/>' +
|
||||||
'<input class="input-block-level share-link" type="text" readonly="readonly" value="' + link + '" />';
|
'<input class="form-control share-link" type="text" readonly="readonly" value="' + link + '" />';
|
||||||
var btns = [
|
var btns = [
|
||||||
{result: 'unshare', label: 'Unshare', cssClass: 'btn-danger'},
|
{result: 'unshare', label: 'Unshare', cssClass: 'btn-danger'},
|
||||||
{result: 'close', label: 'Close'}
|
{result: 'close', label: 'Close'}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
var App = angular.module('share',
|
var App = angular.module('share',
|
||||||
// Dependencies
|
// Dependencies
|
||||||
['ui.state', 'ui.bootstrap', 'restangular', 'ngSanitize', 'ngMobile']
|
['ui.router', 'ui.bootstrap', 'restangular', 'ngSanitize', 'ngTouch']
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3,12 +3,11 @@
|
|||||||
/**
|
/**
|
||||||
* File view controller.
|
* File view controller.
|
||||||
*/
|
*/
|
||||||
App.controller('FileView', function($dialog, $state, $stateParams) {
|
App.controller('FileView', function($modal, $state, $stateParams) {
|
||||||
var dialog = $dialog.dialog({
|
var modal = $modal.open({
|
||||||
keyboard: true,
|
windowClass: 'modal modal-fileview',
|
||||||
dialogClass: 'modal modal-fileview',
|
|
||||||
templateUrl: 'partial/share/file.view.html',
|
templateUrl: 'partial/share/file.view.html',
|
||||||
controller: function($scope, $state, $stateParams, Restangular, dialog) {
|
controller: function($rootScope, $scope, $state, $stateParams, Restangular) {
|
||||||
// Load files
|
// Load files
|
||||||
Restangular.one('file').getList('list', { id: $stateParams.documentId, share: $stateParams.shareId }).then(function(data) {
|
Restangular.one('file').getList('list', { id: $stateParams.documentId, share: $stateParams.shareId }).then(function(data) {
|
||||||
$scope.files = data.files;
|
$scope.files = data.files;
|
||||||
@ -29,7 +28,6 @@ App.controller('FileView', function($dialog, $state, $stateParams) {
|
|||||||
if (value.id == $stateParams.fileId) {
|
if (value.id == $stateParams.fileId) {
|
||||||
var next = $scope.files[key + 1];
|
var next = $scope.files[key + 1];
|
||||||
if (next) {
|
if (next) {
|
||||||
dialog.close({});
|
|
||||||
$state.transitionTo('share.file', { documentId: $stateParams.documentId, shareId: $stateParams.shareId, fileId: next.id });
|
$state.transitionTo('share.file', { documentId: $stateParams.documentId, shareId: $stateParams.shareId, fileId: next.id });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -44,7 +42,6 @@ App.controller('FileView', function($dialog, $state, $stateParams) {
|
|||||||
if (value.id == $stateParams.fileId) {
|
if (value.id == $stateParams.fileId) {
|
||||||
var previous = $scope.files[key - 1];
|
var previous = $scope.files[key - 1];
|
||||||
if (previous) {
|
if (previous) {
|
||||||
dialog.close({});
|
|
||||||
$state.transitionTo('share.file', { documentId: $stateParams.documentId, shareId: $stateParams.shareId, fileId: previous.id });
|
$state.transitionTo('share.file', { documentId: $stateParams.documentId, shareId: $stateParams.shareId, fileId: previous.id });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -62,13 +59,17 @@ App.controller('FileView', function($dialog, $state, $stateParams) {
|
|||||||
* Close the file preview.
|
* Close the file preview.
|
||||||
*/
|
*/
|
||||||
$scope.closeFile = function () {
|
$scope.closeFile = function () {
|
||||||
dialog.close();
|
modal.dismiss();
|
||||||
};
|
};
|
||||||
|
|
||||||
// Close the dialog when the user exits this state
|
// Close the modal when the user exits this state
|
||||||
var off = $scope.$on('$stateChangeStart', function(event, toState){
|
var off = $rootScope.$on('$stateChangeStart', function(event, toState){
|
||||||
if (dialog.isOpen()) {
|
if (!modal.closed) {
|
||||||
dialog.close(toState.name == 'share.file' ? {} : null);
|
if (toState.name == 'share.file') {
|
||||||
|
modal.close();
|
||||||
|
} else {
|
||||||
|
modal.dismiss();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
off();
|
off();
|
||||||
});
|
});
|
||||||
@ -76,9 +77,11 @@ App.controller('FileView', function($dialog, $state, $stateParams) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Returns to share view on file close
|
// Returns to share view on file close
|
||||||
dialog.open().then(function(result) {
|
modal.closed = false;
|
||||||
if (result == null) {
|
modal.result.then(function() {
|
||||||
|
modal.closed = true;
|
||||||
|
},function(result) {
|
||||||
|
modal.closed = true;
|
||||||
$state.transitionTo('share', { documentId: $stateParams.documentId, shareId: $stateParams.shareId });
|
$state.transitionTo('share', { documentId: $stateParams.documentId, shareId: $stateParams.shareId });
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
@ -4,7 +4,7 @@
|
|||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<p>
|
<p>
|
||||||
<label for="share-result">Name the sharing if you want to share multiple times the same document.</label>
|
<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" />
|
<input class="form-control" type="text" id="share-result" ng-model="name" />
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr ng-repeat="log in logs"
|
<tr ng-repeat="log in logs"
|
||||||
ng-class="{ info: log.level == 'INFO' || log.level == 'DEBUG', warning: log.level == 'WARN', error: log.level == 'ERROR' || log.level == 'FATAL' }">
|
ng-class="{ info: log.level == 'INFO' || log.level == 'DEBUG', warning: log.level == 'WARN', danger: log.level == 'ERROR' || log.level == 'FATAL' }">
|
||||||
<td>{{ log.date | date: 'yyyy-MM-dd HH:mm' }}</td>
|
<td>{{ log.date | date: 'yyyy-MM-dd HH:mm' }}</td>
|
||||||
<td>{{ log.tag }}</td>
|
<td>{{ log.tag }}</td>
|
||||||
<td class="cell-message">{{ log.message }}</td>
|
<td class="cell-message">{{ log.message }}</td>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<div class="hero-unit">
|
<div class="jumbotron">
|
||||||
<h1>Not authorized</h1>
|
<h1>Not authorized</h1>
|
||||||
<p>The document you are trying to view is not shared anymore</p>
|
<p>The document you are trying to view is not shared anymore</p>
|
||||||
</div>
|
</div>
|
@ -1,21 +1,23 @@
|
|||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<div class="btn-group pull-left">
|
<div class="btn-group pull-left">
|
||||||
<button type="button" class="btn" ng-click="closeFile()"><span class="icon-remove"></span></button>
|
<button type="button" class="btn btn-default" ng-click="closeFile()">
|
||||||
|
<span class="glyphicon glyphicon-remove"></span>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
<button type="button" class="btn" ng-click="previousFile()">Previous</button>
|
<button type="button" class="btn btn-default" ng-click="previousFile()">Previous</button>
|
||||||
<button type="button" class="btn" ng-click="nextFile()">Next</button>
|
<button type="button" class="btn btn-default" ng-click="nextFile()">Next</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="btn-group pull-right">
|
<div class="btn-group pull-right">
|
||||||
<button type="button" class="btn" ng-click="openFile()"><span class="icon-download-alt"></span></button>
|
<button type="button" class="btn btn-default" ng-click="openFile()">
|
||||||
|
<span class="glyphicon glyphicon-download-alt"></span>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<img ng-if="$stateParams.fileId && (file.mimetype == 'image/png' || file.mimetype == 'image/jpeg' || file.mimetype == 'image/gif')" ng-src="api/file/{{ $stateParams.fileId }}/data?size=web&share={{ $stateParams.shareId }}" />
|
<div class="text-center" ng-if="$stateParams.fileId">
|
||||||
|
|
||||||
<div class="text-center" ng-if="$stateParams.fileId && file.mimetype == 'application/pdf'">
|
|
||||||
<img ng-src="api/file/{{ $stateParams.fileId }}/data?size=web&share={{ $stateParams.shareId }}" />
|
<img ng-src="api/file/{{ $stateParams.fileId }}/data?size=web&share={{ $stateParams.shareId }}" />
|
||||||
</div>
|
</div>
|
@ -1,4 +1,4 @@
|
|||||||
<div class="hero-unit">
|
<div class="jumbotron">
|
||||||
<h1>Sismics Docs</h1>
|
<h1>Sismics Docs</h1>
|
||||||
<p>Ask a shared document link to access it</p>
|
<p>Ask a shared document link to access it</p>
|
||||||
</div>
|
</div>
|
@ -1,23 +1,23 @@
|
|||||||
<div class="row-fluid">
|
<div class="row">
|
||||||
<div class="well span12">
|
<div class="well col-md-12">
|
||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<h1>{{ document.title }} <small>{{ document.create_date | date: 'yyyy-MM-dd' }}</small></h1>
|
<h1>{{ document.title }} <small>{{ document.create_date | date: 'yyyy-MM-dd' }}</small></h1>
|
||||||
<ul class="inline">
|
<ul class="list-inline">
|
||||||
<li ng-repeat="tag in document.tags"><span class="label label-info" ng-style="{ 'background': tag.color }">{{ tag.name }}</span></li>
|
<li ng-repeat="tag in document.tags"><span class="label label-info" ng-style="{ 'background': tag.color }">{{ tag.name }}</span></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p ng-bind-html="document.description | newline"></p>
|
<p ng-bind-html="document.description | newline"></p>
|
||||||
|
|
||||||
<ul class="thumbnails thumbnails-file" ui-sortable="fileSortableOptions" ng-model="files" ng-show="files.length > 0">
|
<div class="row" ui-sortable="fileSortableOptions" ng-model="files" ng-show="files.length > 0">
|
||||||
<li class="span2 text-center thumbnail-container" ng-repeat="file in files">
|
<div class="col-xs-6 col-sm-4 col-md-3 col-lg-2 text-center" ng-repeat="file in files">
|
||||||
<div class="thumbnail">
|
<div class="thumbnail">
|
||||||
<a ng-click="openFile(file)">
|
<a ng-click="openFile(file)">
|
||||||
<img class="thumbnail-file" ng-src="api/file/{{ file.id }}/data?size=thumb&share={{ $stateParams.shareId }}" tooltip="{{ file.mimetype }}" tooltip-placement="top" />
|
<img class="thumbnail-file" ng-src="api/file/{{ file.id }}/data?size=thumb&share={{ $stateParams.shareId }}" tooltip="{{ file.mimetype }}" tooltip-placement="top" />
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</div>
|
||||||
</ul>
|
</div>
|
||||||
|
|
||||||
<div ui-view="file"></div>
|
<div ui-view="file"></div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -33,15 +33,13 @@
|
|||||||
<script src="app/docs/filter/Newline.js" type="text/javascript"></script>
|
<script src="app/docs/filter/Newline.js" type="text/javascript"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="navbar">
|
<div class="navbar navbar-default" role="navigation">
|
||||||
<div class="navbar-inner">
|
<div class="navbar-header">
|
||||||
<div class="container">
|
<a class="navbar-brand" href="#">Sismics Docs</a>
|
||||||
<a class="brand" href="#">Sismics Docs</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<main ui-view="page">
|
<div ui-view="page">
|
||||||
</main>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
Loading…
Reference in New Issue
Block a user