Files
edx-platform/cms/static/js/views/active_video_upload.js
Greg Price 5f341423a3 Add progress bars for Studio video uploads
The CSS is also restructured a bit to style both the progress bar and
the status text based on the state of the upload using a single class
on the parent element.
2015-01-26 16:13:45 -05:00

38 lines
1.2 KiB
JavaScript

define(
["js/models/active_video_upload", "js/views/baseview"],
function(ActiveVideoUpload, BaseView) {
"use strict";
var STATUS_CLASSES = [
{status: ActiveVideoUpload.STATUS_QUEUED, cls: "queued"},
{status: ActiveVideoUpload.STATUS_COMPLETED, cls: "success"},
{status: ActiveVideoUpload.STATUS_FAILED, cls: "error"}
];
var ActiveVideoUploadView = BaseView.extend({
tagName: "li",
className: "active-video-upload",
initialize: function() {
this.template = this.loadTemplate("active-video-upload");
this.listenTo(this.model, "change", this.render);
},
render: function() {
var $el = this.$el;
$el.html(this.template(this.model.attributes));
var status = this.model.get("status");
_.each(
STATUS_CLASSES,
function(statusClass) {
$el.toggleClass(statusClass.cls, status == statusClass.status);
}
);
return this;
},
});
return ActiveVideoUploadView;
}
);