<div class="task-group-inner">
	<small ng-show="files.length == 0">No attachments</small>
	<div ng-show="files.length > 0" class="attachments-list">
		<div class="attachment-item clearfix" ng-repeat="file in files" ng-class="{'col-md-6 pull-left': files.length > 1, 'col-md-12': files.length == 1}">
			<div class="attachment-content">
				<i class="fa fa-file-o"></i> 
				<a href="/api/v1/files/download/{[{ file.id }]}" data-ng-show="! file.progress" class="attachment-link">{[{ file.name }]}</a> 
				<span ng-click="removeFile(file)" class="attachment-remove">
					<a href="#"><i class="text-danger fa fa-times"></i></a>
				</span>
			</div>
			<progress data-percent="file.progress" data-ng-show="file.progress"></progress>
			<div class="attachment-meta">
				<small class="muted">
					{[{ file.format_file_size }]} &middot; {[{ file.creator ? file.creator.name : 'Unknown' }]}
				</small>
			</div>
		</div>
	</div>
	<div class="buttons text-right clearfix">
		<div class="btn btn-default file-upload">
			<input id="photos_upload" type="file" name="files" data-files="files" data-related-id="{[{ task.id }]}" data-related-type="{[{ type }]}" multiple fileupload>
			<i class="fa fa-arrow-circle-o-up"></i> Upload files
		</div>
	</div>
</div>

<style>
.attachments-list {
	margin: 10px 0;
}

.attachment-item {
	margin-bottom: 8px;
	padding: 6px;
	border: 1px solid #e0e0e0;
	border-radius: 4px;
	background-color: #f9f9f9;
	box-sizing: border-box;
}

.attachment-content {
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.attachment-link {
	flex: 1;
	margin-left: 8px;
	text-decoration: none;
	font-size: 12px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.attachment-link:hover {
	text-decoration: underline;
}

.attachment-remove {
	margin-left: 5px;
}

.attachment-meta {
	margin-top: 4px;
	padding-left: 20px;
}

.attachment-meta .muted {
	color: #666;
	font-size: 11px;
}

.clearfix::after {
	content: "";
	display: table;
	clear: both;
}
</style>
