mirror of
https://github.com/sismics/docs.git
synced 2024-11-24 22:57:56 +01:00
list display mode in the share app
This commit is contained in:
parent
a89543b555
commit
7effbc8de0
@ -4,6 +4,15 @@
|
|||||||
* Share controller.
|
* Share controller.
|
||||||
*/
|
*/
|
||||||
angular.module('share').controller('Share', function($scope, $state, $stateParams, Restangular, $uibModal) {
|
angular.module('share').controller('Share', function($scope, $state, $stateParams, Restangular, $uibModal) {
|
||||||
|
$scope.displayMode = _.isUndefined(localStorage.fileDisplayMode) ? 'grid' : localStorage.fileDisplayMode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Watch for display mode change.
|
||||||
|
*/
|
||||||
|
$scope.$watch('displayMode', function (next) {
|
||||||
|
localStorage.fileDisplayMode = next;
|
||||||
|
});
|
||||||
|
|
||||||
// Load document
|
// Load document
|
||||||
Restangular.one('document', $stateParams.documentId).get({ share: $stateParams.shareId })
|
Restangular.one('document', $stateParams.documentId).get({ share: $stateParams.shareId })
|
||||||
.then(function (data) {
|
.then(function (data) {
|
||||||
|
@ -77,12 +77,13 @@
|
|||||||
<span class="fas fa-spin fa-circle-notch"></span>
|
<span class="fas fa-spin fa-circle-notch"></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<a class="file-thumbnail" ng-click="openFile(file, $event)">
|
<a class="file-thumbnail" ng-click="openFile(file, $event)"
|
||||||
<img ng-src="../api/file/{{ file.id }}/data?size=thumb" uib-tooltip="{{ file.mimetype }} | {{ file.size | filesize }}" tooltip-placement="top" />
|
uib-tooltip="{{ file.mimetype }} | {{ file.size | filesize }}" tooltip-placement="top">
|
||||||
|
<img ng-src="../api/file/{{ file.id }}/data?size=thumb" />
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<div class="file-info">
|
<div class="file-info">
|
||||||
<div></div><!-- Actually useful -->
|
<div></div>
|
||||||
<div class="v-align file-name" ng-if="file.name" title="{{ file.name }} (v{{ file.version + 1 }}.0)">{{ file.name }}</div>
|
<div class="v-align file-name" ng-if="file.name" title="{{ file.name }} (v{{ file.version + 1 }}.0)">{{ file.name }}</div>
|
||||||
<div class="v-align" ng-show="document.writable">
|
<div class="v-align" ng-show="document.writable">
|
||||||
<div uib-dropdown>
|
<div uib-dropdown>
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p ng-bind-html="document.description"></p>
|
<p class="well-sm" ng-bind-html="document.description"></p>
|
||||||
<dl class="dl-horizontal">
|
<dl class="dl-horizontal">
|
||||||
<dt ng-if="document.subject">{{ 'document.subject' | translate }}</dt>
|
<dt ng-if="document.subject">{{ 'document.subject' | translate }}</dt>
|
||||||
<dd ng-if="document.subject">{{ document.subject }}</dd>
|
<dd ng-if="document.subject">{{ document.subject }}</dd>
|
||||||
@ -63,18 +63,80 @@
|
|||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</dd>
|
</dd>
|
||||||
|
<dt ng-if="false" ng-repeat-start="meta in document.metadata"></dt>
|
||||||
|
<dt ng-if="meta.value != null">{{ meta.name }}</dt>
|
||||||
|
<dd ng-if="meta.value != null && (meta.type == 'STRING' || meta.type == 'INTEGER' || meta.type == 'FLOAT')">{{ meta.value }}</dd>
|
||||||
|
<dd ng-if="meta.value != null && meta.type == 'DATE'">{{ meta.value | date: dateFormat }}</dd>
|
||||||
|
<dd ng-if="meta.value != null && meta.type == 'BOOLEAN'">{{ meta.value ? 'yes' : 'no' | translate }}</dd>
|
||||||
|
<dd ng-if="false" ng-repeat-end></dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
|
<!-- Display mode (list or grid) -->
|
||||||
|
<div class="btn-group mt-10 mb-10 pull-right">
|
||||||
|
<span class="btn btn-default" ng-class="{ active: displayMode == 'list' }"
|
||||||
|
uib-tooltip="{{ 'document.view.content.display_mode_list' | translate }}"
|
||||||
|
tooltip-append-to-body="true"
|
||||||
|
ng-click="displayMode = 'list'">
|
||||||
|
<span class="fas fa-list"></span>
|
||||||
|
</span>
|
||||||
|
<span class="btn btn-default" ng-class="{ active: displayMode == 'grid' }"
|
||||||
|
uib-tooltip="{{ 'document.view.content.display_mode_grid' | translate }}"
|
||||||
|
tooltip-append-to-body="true"
|
||||||
|
ng-click="displayMode = 'grid'">
|
||||||
|
<span class="fas fa-th"></span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="clearfix"></div>
|
||||||
|
|
||||||
|
<!-- List of files -->
|
||||||
<div class="row" ng-show="files.length > 0">
|
<div class="row" 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">
|
<!-- Grid view -->
|
||||||
<div class="thumbnail">
|
<div ng-show="displayMode == 'grid'">
|
||||||
<a ng-click="openFile(file)">
|
<div class="col-xs-6 col-sm-4 col-md-4 col-lg-3 text-center" ng-repeat="file in files">
|
||||||
<img ng-src="../api/file/{{ file.id }}/data?size=thumb&share={{ $stateParams.shareId }}"
|
<div class="thumbnail">
|
||||||
uib-tooltip="{{ file.mimetype }} | {{ file.size | filesize }}" tooltip-placement="top" />
|
<a class="file-thumbnail" ng-click="openFile(file)"
|
||||||
</a>
|
uib-tooltip="{{ file.mimetype }} | {{ file.size | filesize }}" tooltip-placement="top">
|
||||||
|
<img ng-src="../api/file/{{ file.id }}/data?size=thumb&share={{ $stateParams.shareId }}" />
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<div class="file-info">
|
||||||
|
<div></div>
|
||||||
|
<div class="v-align file-name" ng-if="file.name" title="{{ file.name }} (v{{ file.version + 1 }}.0)">{{ file.name }}</div>
|
||||||
|
<div></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
<!-- List view -->
|
||||||
|
<table ng-show="displayMode == 'list'" class="table table-hover table-files">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th width="3%"></th>
|
||||||
|
<th>Filename</th>
|
||||||
|
<th>Type</th>
|
||||||
|
<th>Size</th>
|
||||||
|
<th width="10%">Version</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr ng-repeat="file in files">
|
||||||
|
<td class="pointer" ng-click="openFile(file)">
|
||||||
|
<div class="thumbnail-list">
|
||||||
|
<img ng-src="../api/file/{{ file.id }}/data?size=thumb&share={{ $stateParams.shareId }}" />
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td class="pointer" ng-click="openFile(file)">
|
||||||
|
{{ file.name }}
|
||||||
|
</td>
|
||||||
|
<td>{{ file.mimetype }}</td>
|
||||||
|
<td>{{ file.size | filesize }}</td>
|
||||||
|
<td>v{{ file.version + 1 }}.0</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div ui-view="file"></div>
|
<div ui-view="file"></div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user