Browse Source

Switch to es6 templates

Artur Paikin 9 years ago
parent
commit
9ac7718748
2 changed files with 20 additions and 18 deletions
  1. 1 1
      src/plugins/DragDrop.js
  2. 19 17
      src/templates/dragdrop.js

+ 1 - 1
src/plugins/DragDrop.js

@@ -1,6 +1,6 @@
 import Utils from '../core/Utils'
 import Plugin from './Plugin'
-import templateDragDrop from '../templates/dragdrop.ejs'
+import templateDragDrop from '../templates/dragdrop.js'
 
 /**
  * Drag & Drop plugin

+ 19 - 17
src/templates/dragdrop.js

@@ -1,19 +1,21 @@
-export default function (strings) {
+export default (context) => {
   return `<form class="UppyDragDrop-form"
-        method="post"
-        action="/"
-        enctype="multipart/form-data">
-      <img class="UppyDragDrop-puppy" src="/images/uppy.svg" />
-      <input class="UppyDragDrop-input"
-             type="file"
-             name="files[]"
-             data-multiple-caption="{count} files selected"
-             multiple />
-      <label class="UppyDragDrop-label" for="UppyDragDrop-input">
-        <strong>${strings.chooseFile}</strong>
-        <span class="UppyDragDrop-dragText">${strings.orDragDrop}</span>.
-      </label>
-      <button class="UppyDragDrop-btn" type="submit">Upload</button>
-    <div class="UppyDragDrop-status"></div>
-  </form>`
+      method="post"
+      action="<%= endpoint %>"
+      enctype="multipart/form-data">
+    <img class="UppyDragDrop-puppy" src="/images/uppy.svg" />
+    <input class="UppyDragDrop-input"
+           type="file"
+           name="files[]"
+           data-multiple-caption="{count} files selected"
+           multiple />
+    <label class="UppyDragDrop-label" for="UppyDragDrop-input">
+      <strong>${context.chooseFile}</strong>
+      <span class="UppyDragDrop-dragText">${context.orDragDrop}</span>.
+    </label>
+  ${!context.showUploadBtn
+    ? `<button class="UppyDragDrop-uploadBtn" type="submit">${context.upload}</button>`
+    : ''}
+  <div class="UppyDragDrop-status"></div>
+</form>`
 }