Guest User

Untitled

a guest
Oct 19th, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. const initDropzone = (obj) => {
  2. const newobj = obj;
  3. console.log(newobj);
  4. console.log(newobj.options);
  5. newobj.confirm = function (question, accepted, rejected) {
  6. console.log('asking question');
  7. mscConfirm({
  8. title: 'Management Console',
  9. subtitle: question,
  10. dismissOverlay: true,
  11. onOk() {
  12. accepted();
  13. },
  14. });
  15. };
  16. return newobj;
  17. }
  18.  
  19. Dropzone.confirm = function(question, accepted, rejected) {
  20.  
  21. showConfirm(question);
  22.  
  23.  
  24. $(document).on('click', '#accept-confirm', function() {
  25. hideConfirm();
  26. accepted();
  27. });
  28.  
  29. }
  30.  
  31. $("div#resource_upload_{{ $lecture->id }}").dropzone({
  32.  
  33. // here go your other dropzone options
  34.  
  35. // this option stops the files form auto-uploading
  36. autoProcessQueue: false,
  37.  
  38. // here we add the question
  39. init: function (){
  40.  
  41. // get the dropzone object
  42. myDropzone = this;
  43.  
  44. // overwrite the addedfile function
  45. myDropzone.on("addedfile", function(event) {
  46.  
  47. // this is my confirm function, you can insert your
  48. var r = confirm("Press a button!");
  49.  
  50. if (r == true) {
  51. txt = "You pressed OK!";
  52. // this starts the upload proces....
  53. myDropzone.processQueue();
  54. } else {
  55. // ...or not
  56. txt = "You pressed Cancel!";
  57. }
  58. });
  59. });
Add Comment
Please, Sign In to add comment