Skip to content

Commit

Permalink
Merge pull request #362 from RocketChat/upload
Browse files Browse the repository at this point in the history
Upload
  • Loading branch information
rodrigok committed Jul 29, 2015
2 parents c8c9cf7 + 22a9a22 commit e9e5e57
Show file tree
Hide file tree
Showing 4 changed files with 263 additions and 220 deletions.
29 changes: 29 additions & 0 deletions client/stylesheets/base.less
Original file line number Diff line number Diff line change
Expand Up @@ -3308,3 +3308,32 @@ a.github-fork {
}
}
}

.dropzone {
.dropzone-overlay {
display: none;
}

&.over .dropzone-overlay {
background-color: rgba(0, 0, 0, 0.5);
position: fixed;
top: 0;
left: 0;
bottom: 0;
right: 0;
z-index: 1000000;
display: block;
color: white;
font-size: 50px;
display: flex;
align-items: center;
justify-content: center;

> div {
background-color: rgba(0,0,0,0.6);
padding: 40px;
border-radius: 10px;
pointer-events: none;
}
}
}
20 changes: 8 additions & 12 deletions client/views/app/room.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -457,26 +457,22 @@ Template.room.events
'click .stop-video': (event) ->
webrtc.stop()

'dragenter #dropzone': (e) ->
console.log 'DRAG ENTER'
'dragenter .dropzone': (e) ->
e.currentTarget.classList.add 'over'

'dragleave #dropzone': (e) ->
console.log 'DRAG OUT'
'dragleave .dropzone-overlay': (e) ->
e.currentTarget.parentNode.classList.remove 'over'

'dropped .dropzone-overlay': (e) ->
e.currentTarget.parentNode.classList.remove 'over'

'dropped #dropzone': (e) ->
FS?.Utility?.eachFile e, (file) ->
newFile = new (FS.File)(file)
newFile.rid = Session.get('openedRoom')
newFile.userId = Meteor.userId()
Files.insert newFile, (error, fileObj) ->
unless error
toastr.success 'Upload succeeded!'
console.log('room fileObj', fileObj) if window.rocketDebug
Meteor.call 'sendMessage',
_id: Random.id()
rid: fileObj.rid
msg: 'File Uploaded: *' + fileObj.original.name + '* \n' + document.location.origin + '/cfs/files/Files/' + fileObj._id
file:
_id: fileObj._id

Template.room.onCreated ->
# this.scrollOnBottom = true
Expand Down
Loading

0 comments on commit e9e5e57

Please sign in to comment.