define [ "base" ], (App) -> App.directive 'fineUpload', ($timeout) -> return { scope: { multiple: "=" endpoint: "@" waitingForResponseText: "@" failedUploadText: "@" uploadButtonText: "@" dragAreaText: "@" hintText: "@" allowedExtensions: "=" onCompleteCallback: "=" onUploadCallback: "=" onValidateBatch: "=" onErrorCallback: "=" params: "=" } link: (scope, element, attrs) -> multiple = scope.multiple or false endpoint = scope.endpoint if scope.allowedExtensions? validation = allowedExtensions: scope.allowedExtensions else validation = {} text = waitingForResponse: scope.waitingForResponseText or "Processing..." failUpload: scope.failedUploadText or "Failed :(" uploadButton: scope.uploadButtonText or "Upload" dragAreaText = scope.dragAreaText or "drag here" hintText = scope.hintText or "" onComplete = scope.onCompleteCallback or () -> onUpload = scope.onUploadCallback or () -> onError = scope.onErrorCallback or () -> onValidateBatch = scope.onValidateBatch or () -> params = scope.params or {} params._csrf = window.csrfToken q = new qq.FineUploader element: element[0] multiple: multiple disabledCancelForFormUploads: true validation: validation request: endpoint: endpoint forceMultipart: true params: params paramsInBody: false callbacks: onComplete: onComplete onUpload: onUpload onValidateBatch: onValidateBatch onError: onError text: text template: """
{dragZoneText}
{uploadButtonText}
or #{dragAreaText} {dropProcessingText}
#{hintText}
""" return q }