Migration of /share.html

This commit is contained in:
jendib 2014-01-11 21:39:26 +01:00
parent 438a38985a
commit 03976160bf
10 changed files with 48 additions and 45 deletions

View File

@ -129,7 +129,7 @@ App.controller('DocumentView', function ($scope, $state, $stateParams, $location
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 + '" />';
'<input class="form-control share-link" type="text" readonly="readonly" value="' + link + '" />';
var btns = [
{result: 'unshare', label: 'Unshare', cssClass: 'btn-danger'},
{result: 'close', label: 'Close'}

View File

@ -5,7 +5,7 @@
*/
var App = angular.module('share',
// Dependencies
['ui.state', 'ui.bootstrap', 'restangular', 'ngSanitize', 'ngMobile']
['ui.router', 'ui.bootstrap', 'restangular', 'ngSanitize', 'ngTouch']
)
/**

View File

@ -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/share/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.documentId, share: $stateParams.shareId }).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('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) {
var previous = $scope.files[key - 1];
if (previous) {
dialog.close({});
$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.
*/
$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 == 'share.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 == 'share.file') {
modal.close();
} else {
modal.dismiss();
}
}
off();
});
@ -76,9 +77,11 @@ App.controller('FileView', function($dialog, $state, $stateParams) {
});
// Returns to share view on file close
dialog.open().then(function(result) {
if (result == null) {
modal.closed = false;
modal.result.then(function() {
modal.closed = true;
},function(result) {
modal.closed = true;
$state.transitionTo('share', { documentId: $stateParams.documentId, shareId: $stateParams.shareId });
}
});
});

View File

@ -4,7 +4,7 @@
<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" />
<input class="form-control" type="text" id="share-result" ng-model="name" />
</p>
</div>
<div class="modal-footer">

View File

@ -9,7 +9,7 @@
</thead>
<tbody>
<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.tag }}</td>
<td class="cell-message">{{ log.message }}</td>

View File

@ -1,4 +1,4 @@
<div class="hero-unit">
<div class="jumbotron">
<h1>Not authorized</h1>
<p>The document you are trying to view is not shared anymore</p>
</div>

View File

@ -1,21 +1,23 @@
<div class="text-center">
<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 class="btn-group">
<button type="button" class="btn" ng-click="previousFile()">Previous</button>
<button type="button" class="btn" ng-click="nextFile()">Next</button>
<button type="button" class="btn btn-default" ng-click="previousFile()">Previous</button>
<button type="button" class="btn btn-default" ng-click="nextFile()">Next</button>
</div>
<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>
<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 && file.mimetype == 'application/pdf'">
<div class="text-center" ng-if="$stateParams.fileId">
<img ng-src="api/file/{{ $stateParams.fileId }}/data?size=web&share={{ $stateParams.shareId }}" />
</div>

View File

@ -1,4 +1,4 @@
<div class="hero-unit">
<div class="jumbotron">
<h1>Sismics Docs</h1>
<p>Ask a shared document link to access it</p>
</div>

View File

@ -1,23 +1,23 @@
<div class="row-fluid">
<div class="well span12">
<div class="row">
<div class="well col-md-12">
<div class="page-header">
<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>
</ul>
</div>
<p ng-bind-html="document.description | newline"></p>
<ul class="thumbnails thumbnails-file" 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="row" ui-sortable="fileSortableOptions" ng-model="files" ng-show="files.length > 0">
<div class="col-xs-6 col-sm-4 col-md-3 col-lg-2 text-center" ng-repeat="file in files">
<div class="thumbnail">
<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" />
</a>
</div>
</li>
</ul>
</div>
</div>
<div ui-view="file"></div>
</div>

View File

@ -33,15 +33,13 @@
<script src="app/docs/filter/Newline.js" type="text/javascript"></script>
</head>
<body>
<div class="navbar">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="#">Sismics Docs</a>
</div>
<div class="navbar navbar-default" role="navigation">
<div class="navbar-header">
<a class="navbar-brand" href="#">Sismics Docs</a>
</div>
</div>
<main ui-view="page">
</main>
<div ui-view="page">
</div>
</body>
</html>