Insert attachments to description

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2018-06-17 21:43:18 +02:00
parent 7ad8080f82
commit 5b95beb153
7 changed files with 250 additions and 98 deletions

View File

@@ -58,5 +58,8 @@ Util::addScript('deck', 'build/deck');
<script type="text/ng-template" id="/card.sidebarView.html">
<?php print_unescaped($this->inc('part.card')); ?>
</script>
<script type="text/ng-template" id="/card.attachments.html">
<?php print_unescaped($this->inc('part.card.attachments')); ?>
</script>
</div>

View File

@@ -0,0 +1,42 @@
<div ng-class="{'attachment-list-wrapper': $ctrl.isFileSelector}">
<div class="attachment-list" ng-class="{selector: $ctrl.isFileSelector}">
<h3 class="attachment-selector" ng-if="$ctrl.isFileSelector"><?php p($l->t('Select an attachment')); ?> <a class="icon-close" ng-click="$ctrl.abort()"></a></h3>
<ul>
<li class="attachment"
ng-repeat="attachment in $ctrl.cardservice.getCurrent().attachments | filter: {type: 'deck_file'} | orderBy: ['deletedAt', '-lastModified']"
ng-class="{deleted: attachment.deletedAt > 0, selector: $ctrl.isFileSelector}"
ng-if="!$ctrl.isFileSelector || attachment.deletedAt == 0">
<a class="fileicon" ng-style="$ctrl.mimetypeForAttachment(attachment)" ng-href="{{ attachmentUrl(attachment) }}"></a>
<div class="details">
<a ng-href="{{ $ctrl.attachmentUrl(attachment) }}" target="_blank">
<div class="filename">
<span class="basename">{{ attachment.extendedData.info.filename}}</span>
<span class="extension">.{{ attachment.extendedData.info.extension}}</span>
</div>
<span class="filesize">{{ attachment.extendedData.filesize | bytes }}</span>
<span class="filedate">{{ attachment.lastModified|relativeDateFilter }}</span>
<span class="filedate"><?php p($l->t('by')); ?> {{ attachment.createdBy }}</span>
</a>
</div>
<button class="icon icon-history button-inline" ng-click="$ctrl.cardservice.attachmentRemoveUndo(attachment)" ng-if="!$ctrl.isFileSelector && attachment.deletedAt > 0" title="<?php p($l->t('Undo file deletion - Otherwise the file will be deleted during the next cronjob run.')); ?>">
<span class="hidden-visually"><?php p($l->t('Undo file deletion')); ?></span>
</button>
<button class="icon icon-confirm button-inline" ng-click="$ctrl.select(attachment)" ng-if="$ctrl.isFileSelector">
<span class="hidden-visually"><?php p($l->t('Insert the file into the description')); ?></span>
</button>
<div class="app-popover-menu-utils" ng-if="!$ctrl.isFileSelector && attachment.deletedAt == 0">
<button class="button-inline icon icon-more"></button>
<div class="popovermenu hidden">
<ul>
<li>
<a class="menuitem action action-delete"
ng-click="$ctrl.cardservice.attachmentRemove(attachment); $event.stopPropagation();"><span
class="icon icon-delete"></span><span><?php p($l->t('Delete')); ?></span></a>
</li>
</ul>
</div>
</div>
</a>
</li>
</ul>
</div>

View File

@@ -1,4 +1,4 @@
<div nv-file-drop="" uploader="uploader" class="drop-zone" options="{cardId: cardservice.getCurrent().id}">
<div nv-file-drop="" uploader="uploader" class="drop-zone" options="{cardId: cardservice.getCurrent().id}">
<div class="drop-indicator" nv-file-over uploader="uploader">
<p><?php p($l->t('Drop your files here to upload it to the card')); ?></p>
</div>
@@ -97,50 +97,26 @@
<span class="save-indicator saved"><?php p($l->t('Saved')); ?></span>
<span class="save-indicator unsaved"><?php p($l->t('Unsaved changes')); ?></span>
<a ng-if="params.tab === 0" href="https://github.com/nextcloud/deck/wiki/Markdown-Help" target="_blank" class="icon icon-help" data-toggle="tooltip" data-placement="left" title="<?php p($l->t('Formatting help')); ?>"><span class="hidden-visually"><?php p($l->t('Formatting help')); ?></span></a>
<label for="attachment-upload" class="button icon-upload" ng-class="{'icon-loading-small': uploader.isUploading}"></label>
<input id="attachment-upload" type="file" nv-file-select="" uploader="uploader" class="hidden" options="{cardId: cardservice.getCurrent().id}" />
<label ng-if="params.tab === 1" for="attachment-upload" class="button icon-upload" ng-class="{'icon-loading-small': uploader.isUploading}" data-toggle="tooltip" data-placement="left" title="<?php p($l->t('Upload attachment')); ?>"></label>
<input id="attachment-upload" type="file" nv-file-select="" uploader="uploader" class="hidden" options="{cardId: cardservice.getCurrent().id}"/>
<input ng-if="status.cardEditDescription" type="button" ng-mousedown="status.continueEdit = true; status.selectAttachment = true;" class="icon-files-dark" data-toggle="tooltip" data-placement="left" title="<?php p($l->t('Insert attachment')); ?>"/>
</div>
</div>
<div class="section-content card-attachments" ng-if="params.tab === 1 && cardservice.getCurrent() && isArray(cardservice.getCurrent().attachments)">
<ul>
<li class="attachment" ng-repeat="attachment in cardservice.getCurrent().attachments | filter: {type: 'deck_file'} | orderBy: ['deletedAt', '-lastModified']" ng-class="{deleted: attachment.deletedAt > 0}">
<a class="fileicon" ng-style="mimetypeForAttachment(attachment)" ng-href="{{ attachmentUrl(attachment) }}"></a>
<div class="details">
<a ng-href="{{ attachmentUrl(attachment) }}" target="_blank">
<div class="filename">
<span class="basename">{{ attachment.extendedData.info.filename}}</span>
<span class="extension">.{{ attachment.extendedData.info.extension}}</span>
</div>
<span class="filesize">{{ attachment.extendedData.filesize | bytes }}</span>
<span class="filedate">{{ attachment.createdAt|relativeDateFilter }}</span>
<span class="filedate">{{ attachment.lastModified|relativeDateFilter }}</span>
<span class="filedate">{{ attachment.createdBy }}</span>
</a>
</div>
<button class="icon icon-history button-inline" ng-click="cardservice.attachmentRemoveUndo(attachment)" ng-if="attachment.deletedAt > 0" title="<?php p($l->t('Undo file deletion - Otherwise the file will be deleted during the next cronjob run.')); ?>">
<span class="hidden-visually"><?php p($l->t('Undo file deletion')); ?></span>
</button>
<div class="app-popover-menu-utils" ng-if="attachment.deletedAt == 0">
<button class="button-inline icon icon-more" ng-model="attachment"></button>
<div class="popovermenu hidden">
<ul>
<li>
<a class="menuitem action action-delete"
ng-click="cardservice.attachmentRemove(attachment); $event.stopPropagation();"><span
class="icon icon-delete"></span><span><?php p($l->t('Delete')); ?></span></a>
</li>
</ul>
</div>
</div>
</a>
</li>
</ul>
<div class="section-content card-attachments">
<attachment-list-component ng-if="params.tab === 1 && cardservice.getCurrent() && isArray(cardservice.getCurrent().attachments)" attachments="cardservice.getCurrent().attachments"></attachment-list-component>
</div>
<div class="section-content card-description" ng-if="params.tab === 0">
<attachment-list-component
ng-if="status.selectAttachment"
attachments="cardservice.getCurrent().attachments"
is-file-selector="true"
on-select="addAttachmentToDescription(attachment)" on-abort="abortAttachmentSelection()">
</attachment-list-component>
<textarea elastic ng-if="status.cardEditDescription"
placeholder="<?php p($l->t('Add a card description…')); ?>"
ng-blur="cardUpdate(status.edit)"
ng-blur="!status.continueEdit && cardUpdate(status.edit)"
ng-model="status.edit.description"
ng-change="cardEditDescriptionChanged(); updateMarkdown(status.edit.description)"
autofocus-on-insert> </textarea>