Pre-merge.

This commit is contained in:
cahrens
2013-03-14 13:37:22 -04:00
parent 564374048e
commit 017fd06bfc
3 changed files with 70 additions and 101 deletions

View File

@@ -1,18 +1,49 @@
if (!CMS.Views['Checklists']) CMS.Views.Checklists = {};
CMS.Views.Checklists = Backbone.View.extend({
// takes CMS.Models.CourseInfo as model
tagName: 'div',
// takes CMS.Models.Checklists as model
render: function() {
// instantiate the ClassInfoUpdateView and delegate the proper dom to it
new CMS.Views.ClassInfoUpdateView({
el: $('body.updates'),
collection: this.model.get('updates')
});
events : {
'click .course-checklist .checklist-title' : "toggleChecklist",
'click .course-checklist .task label' : "toggleTask",
'click .demo-checklistviz' : "demoUpdateProgress"
},
new CMS.Views.ClassInfoHandoutsView({
el: this.$('#course-handouts-view'),
model: this.model.get('handouts')
});
return this;
initialize : function() {
// adding class and title needs to happen in HTML
// $('.course-checklist .checklist-title').each(function(e){
// $(this).addClass('is-selectable').attr('title','Collapse/Expand this Checklist').bind('click', this.toggleChecklist);
// });
},
toggleChecklist : function(e) {
(e).preventDefault();
$(e.target).closest('.course-checklist').toggleClass('is-collapsed');
},
toggleTask : function (e) {
(e).preventDefault();
$(e.target).closest('.task').toggleClass('is-completed');
},
// TODO: remove
demoUpdateProgress : function(e) {
(e).preventDefault();
$('#course-checklist0 .viz-checklist-status .viz-checklist-status-value').css('width','25%');
},
// TODO: not used. In-progress update checklist progress (based on checkbox check/uncheck events)
updateChecklistProgress : function(e) {
var $statusCount = this.$el.closest('.course-checklist').find('.status-count');
var $statusAmount = this.$el.closest('.course-checklist').find('.status-amount');
if (this.$el.attr('checked')) {
console.log('adding');
}
else {
console.log('subtracting');
}
}
});