diff --git a/bigbluebutton-html5/app/client/views/whiteboard/PresentationList.jsx b/bigbluebutton-html5/app/client/views/whiteboard/PresentationList.jsx new file mode 100755 index 0000000000..20815230d7 --- /dev/null +++ b/bigbluebutton-html5/app/client/views/whiteboard/PresentationList.jsx @@ -0,0 +1,42 @@ +PresentationList = React.createClass({ + handleShow(name){ + return console.info('Should show the file `' + name + '`'); + }, + + handleDelete(name){ + return console.info('Should delete the file `' + name + '`'); + }, + + render() { + return( + + ); + } +}); \ No newline at end of file diff --git a/bigbluebutton-html5/app/client/views/whiteboard/PresentationListItem.jsx b/bigbluebutton-html5/app/client/views/whiteboard/PresentationListItem.jsx deleted file mode 100755 index df0518c123..0000000000 --- a/bigbluebutton-html5/app/client/views/whiteboard/PresentationListItem.jsx +++ /dev/null @@ -1,25 +0,0 @@ -PresentationListItem = React.createClass({ - handleClickShow(){ - return console.info('Should show the file `' + this.name + '`'); - }, - - handleDelete(){ - return console.info('Should delete the file `' + this.name + '`'); - }, - render() { - var fileItemClasses = "presenter-uploader-file-item" + (this.props.current ? " current" : "" ) - return( -
  • - - {this.props.name} - - - {this.props.current ? null : - - } - - -
  • - ); - } -}); \ No newline at end of file diff --git a/bigbluebutton-html5/app/client/views/whiteboard/UploaderControls.jsx b/bigbluebutton-html5/app/client/views/whiteboard/UploaderControls.jsx new file mode 100755 index 0000000000..f8e46d1ecc --- /dev/null +++ b/bigbluebutton-html5/app/client/views/whiteboard/UploaderControls.jsx @@ -0,0 +1,123 @@ +UploaderControls = React.createClass ({ + getDefaultProps: function() { + return { + isOpen: new ReactiveVar(false), + files: new ReactiveList({ + sort(a, b) { + // Put the ones who still uploading first + let ref, ref1; + return (ref = a.isUploading === b.isUploading) != null ? ref : { + 0: (ref1 = a.isUploading) != null ? ref1 : -{ + 1: 1 + } + }; + } + }), + }; + }, + + mixins: [ReactMeteorData], + getMeteorData() { + let presentations; + presentations = Meteor.Presentations.find({}, { + sort: { + 'presentation.current': -1, + 'presentation.name': 1 + }, + fields: { + 'presentation': 1 + } + }).fetch(); + + return { + presentations: presentations, + }; + }, + + fakeUpload (file, list) { + return setTimeout((() => { + file.uploadedSize = file.uploadedSize + (Math.floor(Math.random() * file.size + file.uploadedSize) / 10); + file.percUploaded = Math.round((file.uploadedSize / file.size) * 100) + "%"; + if (!(file.size > file.uploadedSize)) { + file.uploadedSize = file.size; + file.isUploading = false; + } + list.update(file.name, file); + this.forceUpdate(); + if(file.isUploading === true) { + return this.fakeUpload(file, list); + } else { + list.remove(file.name); // TODO: Here we should remove and update te presentation on mongo + this.forceUpdate(); + return + } + }), 200); + }, + + isOpen() { + return this.props.isOpen.get() ? "is-open" : "" + }, + files() { + return this.props.files ? this.props.files.fetch() : null; + }, + presentations() { + return this.data.presentations.map(x => { + return x.presentation; + }); + }, + + handleInput(event) { + let files; + event.preventDefault(); + files = (event.dataTransfer || event.target).files; + return _.each(files, file => { + file.isUploading = true; + file.uploadedSize = 0; + file.percUploaded = "0"; + this.props.files.insert(file.name, file); + return this.fakeUpload(file, this.props.files); + }); + }, + + handleDragLeave(event) { + event.preventDefault(); + return $(event.currentTarget).removeClass('hover'); + }, + + handleDragOver(event) { + event.preventDefault(); + $(event.currentTarget).addClass('hover'); + }, + + handleClose() { + this.props.isOpen.set(false); + this.forceUpdate(); + }, + + handleOpen() { + this.props.isOpen.set(true); + this.forceUpdate(); + }, + + render() { + return ( +
    +
    + +
    + + + Drop files here
    or click to upload
    +
    +
    +
    + ) + } +}); \ No newline at end of file diff --git a/bigbluebutton-html5/app/client/views/whiteboard/UploadingFileListItem.jsx b/bigbluebutton-html5/app/client/views/whiteboard/UploadingFileListItem.jsx deleted file mode 100755 index e72c71b12b..0000000000 --- a/bigbluebutton-html5/app/client/views/whiteboard/UploadingFileListItem.jsx +++ /dev/null @@ -1,16 +0,0 @@ -UploadingFileListItem = React.createClass ({ - percUploaded() { - return Math.round((this.uploadedSize / this.size) * 100); - }, - - render() { -
  • - - {this.props.name} - - - {percUploaded}% - -
  • - } -}); \ No newline at end of file