diff --git a/services/web/app/views/project/editor.pug b/services/web/app/views/project/editor.pug index b89fb28e94..d0e1fc3f68 100644 --- a/services/web/app/views/project/editor.pug +++ b/services/web/app/views/project/editor.pug @@ -169,5 +169,3 @@ block requirejs data-ace-base=buildJsPath(lib('ace'), {fingerprint:false}), src=buildJsPath('libs/require.js') ) - - diff --git a/services/web/app/views/project/editor/file-tree.pug b/services/web/app/views/project/editor/file-tree.pug index dbaa9bea76..9cec07a28c 100644 --- a/services/web/app/views/project/editor/file-tree.pug +++ b/services/web/app/views/project/editor/file-tree.pug @@ -364,6 +364,38 @@ script(type='text/ng-template', id='newFolderModalTemplate') span(ng-hide="state.inflight") #{translate("create")} span(ng-show="state.inflight") #{translate("creating")}... + +script(type="text/template", id="qq-file-uploader-template"). +
+
+ #{translate('drop_files_here_to_upload')} +
+
+
#{translate('upload')}
+
+ #{translate('or')} + #{translate('drag_here')} + #{translate('processing')} + +
+ script(type="text/ng-template", id="uploadFileModalTemplate") .modal-header h3 #{translate("upload_files")} @@ -385,6 +417,7 @@ script(type="text/ng-template", id="uploadFileModalTemplate") .modal-body( fine-upload endpoint="/project/{{ project_id }}/upload" + template-id="qq-file-uploader-template" multiple="true" auto-upload="false" on-complete-callback="onComplete" diff --git a/services/web/app/views/project/list.pug b/services/web/app/views/project/list.pug index c2fcb53a31..deecc46911 100644 --- a/services/web/app/views/project/list.pug +++ b/services/web/app/views/project/list.pug @@ -6,6 +6,7 @@ block content script#data(type="application/json"). !{JSON.stringify({ projects: projects, tags: tags, notifications: notifications }).replace(/\//g, '\\/')} + script(type="text/javascript"). window.data = JSON.parse($("#data").text()); window.algolia = { diff --git a/services/web/app/views/project/list/modals.pug b/services/web/app/views/project/list/modals.pug index 877478062f..7fbf88cb37 100644 --- a/services/web/app/views/project/list/modals.pug +++ b/services/web/app/views/project/list/modals.pug @@ -213,6 +213,37 @@ script(type='text/ng-template', id='deleteProjectsModalTemplate') ng-click="delete()" ) #{translate("confirm")} +script(type="text/template", id="qq-project-uploader-template"). +
+
+ #{translate('drop_files_here_to_upload')} +
+
+
#{translate('select_a_zip_file')}
+
+ #{translate('or')} + #{translate('drag_a_zip_file')} + #{translate('creating_project')} + +
+ script(type="text/ng-template", id="uploadProjectModalTemplate") .modal-header button.close( @@ -224,10 +255,7 @@ script(type="text/ng-template", id="uploadProjectModalTemplate") .modal-body( fine-upload endpoint="/project/new/upload" - waiting-for-response-text="Creating project..." - failed-upload-text="Upload failed. Is it a valid zip file?" - upload-button-text="Select a .zip file" - drag-area-text="drag .zip file" + template-id="qq-project-uploader-template" multiple="false" allowed-extensions="['zip']" on-complete-callback="onComplete" diff --git a/services/web/public/coffee/directives/fineUpload.coffee b/services/web/public/coffee/directives/fineUpload.coffee index 1f404d30a2..7fffcc366a 100644 --- a/services/web/public/coffee/directives/fineUpload.coffee +++ b/services/web/public/coffee/directives/fineUpload.coffee @@ -7,11 +7,7 @@ define [ scope: { multiple: "=" endpoint: "@" - waitingForResponseText: "@" - failedUploadText: "@" - uploadButtonText: "@" - dragAreaText: "@" - hintText: "@" + templateId: "@" allowedExtensions: "=" onCompleteCallback: "=" onUploadCallback: "=" @@ -26,17 +22,12 @@ define [ link: (scope, element, attrs) -> multiple = scope.multiple or false endpoint = scope.endpoint + templateId = scope.templateId if scope.allowedExtensions? - validation = + 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 "" maxConnections = scope.maxConnections or 1 onComplete = scope.onCompleteCallback or () -> onUpload = scope.onUploadCallback or () -> @@ -50,39 +41,6 @@ define [ autoUpload = scope.autoUpload params = scope.params or {} params._csrf = window.csrfToken - templateElement = document.createElement('div') - templateElement.innerHTML = """ -
-
- Drop files here to upload -
-
-
#{text.uploadButton}
-
- or - #{dragAreaText} - #{text.waitingForResponse} -
#{hintText}
- -
- """ q = new qq.FineUploader element: element[0] @@ -103,9 +61,7 @@ define [ onError: onError onSubmit: onSubmit onCancel: onCancel - text: text - # template: "qq-uploader" - template: templateElement + template: templateId window.q = q scope.control?.q = q return q