Skip to content

Instantly share code, notes, and snippets.

LOGGING = {
"version": 1,
"disable_existing_loggers": False,
"root": {"level": "DEBUG", "handlers": ["console"]},
"formatters": {
"verbose": {
"format": "%(levelname)s %(asctime)s %(module)s "
"%(process)d %(thread)d %(message)s"
}
},
<style lang="sass" scoped>
.upload
&__documents
border: 1px dashed #eee
border-radius: 0.2em
margin: 0.5em
padding: 1em 0 0.5em 0.5em
transition: all 0.1s ease-in
&:hover
import FileIcon from '@/components/files/FileIcon'
import { DraggingMixins, UploadMixin } from '@/mixins/upload'
import { ACCEPT_INPUT } from '@/upload-config'
export default {
name: 'Documents',
props: {
documents: {
type: Array,
export const DraggingMixins = {
dragenter() {
this.dragging = true
},
drop() {
this.dragging = false
},
dragleave() {
import { MAX_FILE_SIZE } from '@/upload-config'
import { uploadDocument } from '@/api/documents'
import { LoadingBar } from 'iview'
const STATUS_INITIAL = 0
const STATUS_SAVING = 1
const STATUS_SUCCESS = 2
const STATUS_FAILED = 3
const prepareFiles = (fieldName, files) => {
<template>
<div class="upload">
<h2 class="upload__title">
Documents
<span v-if="documents">
({{documents.length}})
</span>
</h2>
<form enctype="multipart/form-data" novalidate class="upload__documents" id="document_upload">
export function upload(uri, data) {
return fetch(uri, {
headers: getHeaders(true),
cors: true,
method: 'POST',
body: data
})
}
@sultaniman
sultaniman / upload-config.js
Created June 6, 2018 09:19
Configuration for file upload component
export const ACCEPT_INPUT = [
'application/csv',
'text/csv',
'image/*',
'application/pdf',
'text/plain',
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'application/vnd.ms-excel',
'application/pdf',
'application/msword',
<template>
<div class="awesome">
<img class="awesome__logo" src="@/assets/logo.png">
<h2 class="awesome__heading">Awesome</h2>
</div>
</template>
<script>
export default {
<template>
<Awesome class="awesome--dark awesome--raised"></Awesome>
</template>