Move uploading logic to dedicated FileService

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2018-06-13 18:57:26 +02:00
parent 7b230d567e
commit 8229fbacea
6 changed files with 134 additions and 55 deletions

View File

@@ -61,7 +61,11 @@
data-as-sortable-item
ng-click="$event.stopPropagation()"
ui-sref="board.card({boardId: id, cardId: c.id})"
ng-class="{'archived': cardservice.get(c.id).archived, 'has-labels': cardservice.get(c.id).labels.length>0, 'current': cardservice.get(c.id).id == params.cardId }">
ng-class="{'archived': cardservice.get(c.id).archived, 'has-labels': cardservice.get(c.id).labels.length>0, 'current': cardservice.get(c.id).id == params.cardId }"
nv-file-drop="" uploader="uploader" options="{cardId: c.id}">
<div class="drop-indicator" uploader="uploader" nv-file-over>
<p><?php p($l->t('Drop your files here to upload it to the card')); ?></p>
</div>
<div data-as-sortable-item-handle>
<div class="card-upper">
<h4>{{ cardservice.get(c.id).title }}</h4>
@@ -84,9 +88,9 @@
<i class="icon icon-checkmark"></i>
<span>{{ getCheckboxes(cardservice.get(c.id).description)[0] }}/{{ getCheckboxes(cardservice.get(c.id).description)[1] }}</span>
</div>
<div class="card-files" ng-if="attachmentCount(cardservice.get(c.id).attachments) > 0">
<div class="card-files" ng-if="attachmentCount(cardservice.get(c.id)) > 0">
<i class="icon icon-files-dark"></i>
<span>{{ attachmentCount(cardservice.get(c.id).attachments) }}</span>
<span>{{ attachmentCount(cardservice.get(c.id)) }}</span>
</div>
<div class="card-assigned-users">
<div class="assigned-user" ng-repeat="user in cardservice.get(c.id).assignedUsers | limitTo: 3">

View File

@@ -1,5 +1,5 @@
<div nv-file-drop="" uploader="uploader" nv-file-over over-class="file-drop" class="drop-zone">
<div class="drop-indicator">
<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>
<div id="board-status" ng-if="statusservice.active">
@@ -90,11 +90,11 @@
<div class="section-header">
<h4><?php p($l->t('Attachments')); ?></h4>
<label for="attachment-upload" class="button icon-upload"></label>
<input id="attachment-upload" type="file" nv-file-select="" uploader="uploader" class="hidden" />
<input id="attachment-upload" type="file" nv-file-select="" uploader="uploader" class="hidden" options="{cardId: cardservice.getCurrent().id}" />
</div>
<div class="section-content card-attachments" v-if="cardservice.getCurrent().attachments">
<div class="section-content card-attachments" ng-if="cardservice.getCurrent() && isArray(cardservice.getCurrent().attachments)">
<ul>
<li class="attachment" ng-repeat="attachment in cardservice.getCurrent().attachments | orderBy: ['deletedAt', '-lastModified']" ng-class="{deleted: attachment.deletedAt > 0}">
<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">