From 58ce0c14509df371cf19fd541a7c23a66ea60f2a Mon Sep 17 00:00:00 2001 From: Joachim Bauch Date: Wed, 9 Jul 2014 16:57:10 +0200 Subject: [PATCH] Added "Upload" button to present a document. --- src/styles/components/_presentation.scss | 4 ++++ static/js/directives/presentation.js | 27 ++++++++++++++++++------ static/partials/presentation.html | 1 + 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/src/styles/components/_presentation.scss b/src/styles/components/_presentation.scss index 803c1b21..71a6a120 100644 --- a/src/styles/components/_presentation.scss +++ b/src/styles/components/_presentation.scss @@ -45,6 +45,10 @@ text-align: center; } +.presentationpane .welcome button { + margin-top: 30px; +} + .presentationpane .welcome .progress span { text-shadow: none; } diff --git a/static/js/directives/presentation.js b/static/js/directives/presentation.js index 466a158a..e98413dd 100644 --- a/static/js/directives/presentation.js +++ b/static/js/directives/presentation.js @@ -304,16 +304,13 @@ define(['jquery', 'underscore', 'text!partials/presentation.html'], function($, $scope.$emit("openPdf", file); }; - // create drag-drop target - var namespace = "file_" + $scope.id; - var binder = fileUpload.bindDrop(namespace, $element, _.bind(function(files) { - console.log("Files dragged", files); + var filesSelected = function(files) { if (files.length > 1) { alertify.dialog.alert(translation._("Only single PDF documents can be shared at this time.")); return; } - _.each(files, _.bind(function(f) { + _.each(files, function(f) { var info = $.extend({ id: f.id }, f.info); @@ -323,13 +320,29 @@ define(['jquery', 'underscore', 'text!partials/presentation.html'], function($, return; } $scope.startPresentingFile(f, info); - }, this)); - }, this)); + }); + }; + + // create drag-drop target + var namespace = "file_" + $scope.id; + var binder = fileUpload.bindDrop(namespace, $element, function(files) { + console.log("Files dragged", files); + filesSelected(files); + }); binder.namespace = function() { // Inject own id into namespace. return namespace + "_" + $scope.myid; }; + var clickBinder = fileUpload.bindClick(namespace, $element.find('.welcome button')[0], function(files) { + console.log("Files selected", files); + filesSelected(files); + }); + clickBinder.namespace = function() { + // Inject own id into namespace. + return namespace + "_" + $scope.myid; + }; + $scope.showPresentation = function() { console.log("Presentation active"); $scope.layout.presentation = true; diff --git a/static/partials/presentation.html b/static/partials/presentation.html index 3208de46..fdcf43ef 100644 --- a/static/partials/presentation.html +++ b/static/partials/presentation.html @@ -10,6 +10,7 @@

{{_('Please drop a PDF document here to present it to the other participants.')}}

+