Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
ab6af2b5
Commit
ab6af2b5
authored
Sep 24, 2013
by
cahrens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Put assets JavaScript code back in something that goes through pipelining.
parent
b4576191
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
93 additions
and
90 deletions
+93
-90
cms/envs/common.py
+1
-0
cms/static/js/views/assets.js
+90
-0
cms/templates/asset_index.html
+2
-90
No files found.
cms/envs/common.py
View file @
ab6af2b5
...
@@ -257,6 +257,7 @@ PIPELINE_JS = {
...
@@ -257,6 +257,7 @@ PIPELINE_JS = {
'js/src/utility.js'
,
'js/src/utility.js'
,
'js/models/settings/course_grading_policy.js'
,
'js/models/settings/course_grading_policy.js'
,
'js/models/asset.js'
,
'js/models/assets.js'
,
'js/models/asset.js'
,
'js/models/assets.js'
,
'js/views/assets.js'
,
'js/views/assets_view.js'
,
'js/views/asset_view.js'
],
'js/views/assets_view.js'
,
'js/views/asset_view.js'
],
'output_filename'
:
'js/cms-application.js'
,
'output_filename'
:
'js/cms-application.js'
,
'test_order'
:
0
'test_order'
:
0
...
...
cms/static/js/views/assets.js
0 → 100644
View file @
ab6af2b5
// This code is temporarily moved out of asset_index.html
// to fix AWS pipelining issues. We can move it back after RequireJS is integrated.
$
(
document
).
ready
(
function
()
{
$
(
'.uploads .upload-button'
).
bind
(
'click'
,
showUploadModal
);
$
(
'.upload-modal .close-button'
).
bind
(
'click'
,
hideModal
);
$
(
'.upload-modal .choose-file-button'
).
bind
(
'click'
,
showFileSelectionMenu
);
});
var
showUploadModal
=
function
(
e
)
{
e
.
preventDefault
();
resetUploadModal
();
// $modal has to be global for hideModal to work.
$modal
=
$
(
'.upload-modal'
).
show
();
$
(
'.file-input'
).
bind
(
'change'
,
startUpload
);
$
(
'.upload-modal .file-chooser'
).
fileupload
({
dataType
:
'json'
,
type
:
'POST'
,
maxChunkSize
:
100
*
1000
*
1000
,
// 100 MB
autoUpload
:
true
,
progressall
:
function
(
e
,
data
)
{
var
percentComplete
=
parseInt
((
100
*
data
.
loaded
)
/
data
.
total
,
10
);
showUploadFeedback
(
e
,
percentComplete
);
},
maxFileSize
:
100
*
1000
*
1000
,
// 100 MB
maxNumberofFiles
:
100
,
add
:
function
(
e
,
data
)
{
data
.
process
().
done
(
function
()
{
data
.
submit
();
});
},
done
:
function
(
e
,
data
)
{
displayFinishedUpload
(
data
.
result
);
}
});
$modalCover
.
show
();
};
var
showFileSelectionMenu
=
function
(
e
)
{
e
.
preventDefault
();
$
(
'.file-input'
).
click
();
};
var
startUpload
=
function
(
e
)
{
var
file
=
e
.
target
.
value
;
$
(
'.upload-modal h1'
).
html
(
gettext
(
'Uploading…'
));
$
(
'.upload-modal .file-name'
).
html
(
file
.
substring
(
file
.
lastIndexOf
(
"
\
\"
) + 1));
$('.upload-modal .choose-file-button').hide();
$('.upload-modal .progress-bar').removeClass('loaded').show();
};
var resetUploadModal = function () {
$('.file-input').unbind('change', startUpload);
// Reset modal so it no longer displays information about previously
// completed uploads.
var percentVal = '0%';
$('.upload-modal .progress-fill').width(percentVal);
$('.upload-modal .progress-fill').html(percentVal);
$('.upload-modal .progress-bar').hide();
$('.upload-modal .file-name').show();
$('.upload-modal .file-name').html('');
$('.upload-modal .choose-file-button').html(gettext('Choose File'));
$('.upload-modal .embeddable-xml-input').val('');
$('.upload-modal .embeddable').hide();
};
var showUploadFeedback = function (event, percentComplete) {
var percentVal = percentComplete + '%';
$('.upload-modal .progress-fill').width(percentVal);
$('.upload-modal .progress-fill').html(percentVal);
};
var displayFinishedUpload = function (resp) {
var asset = resp.asset;
$('.upload-modal h1').html(gettext('Upload New File'));
$('.upload-modal .embeddable-xml-input').val(asset.portable_url);
$('.upload-modal .embeddable').show();
$('.upload-modal .file-name').hide();
$('.upload-modal .progress-fill').html(resp.msg);
$('.upload-modal .choose-file-button').html(gettext('Load Another File')).show();
$('.upload-modal .progress-fill').width('100%');
// TODO remove setting on window object after RequireJS.
window.assetsView.addAsset(new CMS.Models.Asset(asset));
};
cms/templates/asset_index.html
View file @
ab6af2b5
...
@@ -20,96 +20,8 @@
...
@@ -20,96 +20,8 @@
<script
type=
"text/javascript"
>
<script
type=
"text/javascript"
>
var
assets
=
new
CMS
.
Models
.
AssetCollection
(
$
{
asset_list
});
var
assets
=
new
CMS
.
Models
.
AssetCollection
(
$
{
asset_list
});
assets
.
url
=
"${update_asset_callback_url}"
;
assets
.
url
=
"${update_asset_callback_url}"
;
var
assetsView
=
new
CMS
.
Views
.
Assets
({
collection
:
assets
,
el
:
$
(
'#asset_table_body'
)});
// TODO remove setting on window object after RequireJS.
window
.
assetsView
=
new
CMS
.
Views
.
Assets
({
collection
:
assets
,
el
:
$
(
'#asset_table_body'
)});
$
(
document
).
ready
(
function
()
{
$
(
'.uploads .upload-button'
).
bind
(
'click'
,
showUploadModal
);
$
(
'.upload-modal .close-button'
).
bind
(
'click'
,
hideModal
);
$
(
'.upload-modal .choose-file-button'
).
bind
(
'click'
,
showFileSelectionMenu
);
});
var
showUploadModal
=
function
(
e
)
{
e
.
preventDefault
();
resetUploadModal
();
// $modal has to be global for hideModal to work.
$modal
=
$
(
'.upload-modal'
).
show
();
$
(
'.file-input'
).
bind
(
'change'
,
startUpload
);
$
(
'.upload-modal .file-chooser'
).
fileupload
({
dataType
:
'json'
,
type
:
'POST'
,
maxChunkSize
:
100
*
1000
*
1000
,
// 100 MB
autoUpload
:
true
,
progressall
:
function
(
e
,
data
)
{
var
percentComplete
=
parseInt
((
100
*
data
.
loaded
)
/
data
.
total
,
10
);
showUploadFeedback
(
e
,
percentComplete
);
},
maxFileSize
:
100
*
1000
*
1000
,
// 100 MB
maxNumberofFiles
:
100
,
add
:
function
(
e
,
data
)
{
data
.
process
().
done
(
function
()
{
data
.
submit
();
});
},
done
:
function
(
e
,
data
)
{
displayFinishedUpload
(
data
.
result
);
}
});
$modalCover
.
show
();
};
var
showFileSelectionMenu
=
function
(
e
)
{
e
.
preventDefault
();
$
(
'.file-input'
).
click
();
};
var
startUpload
=
function
(
e
)
{
var
file
=
e
.
target
.
value
;
$
(
'.upload-modal h1'
).
html
(
gettext
(
'Uploading…'
));
$
(
'.upload-modal .file-name'
).
html
(
file
.
substring
(
file
.
lastIndexOf
(
"
\
\"
) + 1));
$('.upload-modal .choose-file-button').hide();
$('.upload-modal .progress-bar').removeClass('loaded').show();
};
var resetUploadModal = function () {
$('.file-input').unbind('change', startUpload);
// Reset modal so it no longer displays information about previously
// completed uploads.
var percentVal = '0%';
$('.upload-modal .progress-fill').width(percentVal);
$('.upload-modal .progress-fill').html(percentVal);
$('.upload-modal .progress-bar').hide();
$('.upload-modal .file-name').show();
$('.upload-modal .file-name').html('');
$('.upload-modal .choose-file-button').html(gettext('Choose File'));
$('.upload-modal .embeddable-xml-input').val('');
$('.upload-modal .embeddable').hide();
};
var showUploadFeedback = function (event, percentComplete) {
var percentVal = percentComplete + '%';
$('.upload-modal .progress-fill').width(percentVal);
$('.upload-modal .progress-fill').html(percentVal);
};
var displayFinishedUpload = function (resp) {
var asset = resp.asset;
$('.upload-modal h1').html(gettext('Upload New File'));
$('.upload-modal .embeddable-xml-input').val(asset.portable_url);
$('.upload-modal .embeddable').show();
$('.upload-modal .file-name').hide();
$('.upload-modal .progress-fill').html(resp.msg);
$('.upload-modal .choose-file-button').html(gettext('Load Another File')).show();
$('.upload-modal .progress-fill').width('100%');
assetsView.addAsset(new CMS.Models.Asset(asset));
};
</script>
</script>
</
%
block>
</
%
block>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment