Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
brainfood
/
frontend-uploads
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
e30e3209
authored
2016-09-05 20:24:13 -0500
by
Ean Schuessler
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
WIP, sync with Adam
Refs: #7621
1 parent
1a60a492
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
41 deletions
src/scripts/Upload.js
src/scripts/Upload.js
View file @
e30e320
...
...
@@ -5,7 +5,6 @@ define(function(require) {
var
Backbone
=
require
(
'backbone'
);
var
Flow
=
require
(
'flow'
);
var
api
=
require
(
'api'
);
var
OwnerContent
=
require
(
'models/OwnerContent'
);
var
Status
=
Backbone
.
Model
.
extend
({
defaults
:
function
()
{
...
...
@@ -75,46 +74,8 @@ define(function(require) {
Status
:
Status
,
flowEventHandlers
:
{
uploadStart
:
function
()
{
var
self
=
this
;
// Pre-allocate the contentIds for each file's upload
if
(
!
this
.
model
.
get
(
'prechecked'
))
{
this
.
flow
.
pause
();
var
ownerContentDeferreds
=
[];
self
.
model
.
get
(
'collection'
).
each
(
function
(
file
)
{
if
(
file
.
flowFile
!=
undefined
)
{
var
flowFile
=
file
.
flowFile
;
var
flowTotalChunks
=
Math
.
floor
(
file
.
get
(
'size'
)
/
flowFile
.
flowObj
.
opts
.
chunkSize
);
if
(
flowTotalChunks
==
0
)
{
flowTotalChunks
=
1
;
}
var
ownerContent
=
new
OwnerContent
({
flowChunkNumber
:
0
,
flowChunkSize
:
flowFile
.
flowObj
.
opts
.
chunkSize
,
flowCurrentChunkSize
:
(
file
.
get
(
'size'
)
<
flowFile
.
flowObj
.
opts
.
chunkSize
)
?
file
.
get
(
'size'
)
:
flowFile
.
flowObj
.
opts
.
chunkSize
,
flowTotalSize
:
file
.
get
(
'size'
),
flowIdentifier
:
flowFile
.
uniqueIdentifier
,
flowFilename
:
flowFile
.
name
,
flowRelativePath
:
flowFile
.
relativePath
,
flowTotalChunks
:
flowTotalChunks
});
flowFile
.
flowObj
.
ownerContent
=
ownerContent
;
var
deferred
=
ownerContent
.
save
();
ownerContentDeferreds
.
push
(
deferred
);
}
});
$
.
when
(
ownerContentDeferreds
).
done
(
function
(
ownerContent
)
{
self
.
model
.
set
(
'prechecked'
,
true
);
self
.
flow
.
resume
();
setTimeout
(
function
()
{
self
.
model
.
set
(
'prechecked'
,
false
);
},
500
);
});
if
(
this
.
model
.
get
(
'handlers'
)
&&
this
.
model
.
get
(
'handlers'
).
uploadStart
!==
undefined
)
{
this
.
model
.
get
(
'handlers'
).
uploadStart
();
}
if
(
this
.
model
.
get
(
'handlers'
)
&&
this
.
model
.
get
(
'handlers'
).
uploadStart
!==
undefined
)
{
this
.
model
.
get
(
'handlers'
).
uploadStart
();
}
},
fileAdded
:
function
(
flowFile
)
{
...
...
Please
register
or
sign in
to post a comment