--- a/integration/js/edition.js Thu Jun 06 15:48:09 2013 +0200
+++ b/integration/js/edition.js Thu Jun 06 16:13:09 2013 +0200
@@ -301,7 +301,8 @@
//var newEnd = new IriSP.Model.Time(chapter.end)
chapterModify.setEnd(chapter.end);
}
- chapters = _(chapters).reject(function(c) { return c.id == idChapter; });
+ chapters.removeId(idChapter);
+ myProject.getAnnotations().removeId(idChapter, true);
renderChapter();
//si le formulaire est visible
if($('#form-chapter-edit-'+idChapter).length){
@@ -325,6 +326,7 @@
chapter.color = getRandomColor();
chapters.push(chapter);
+ myProject.getAnnotations().push(chapter);
renderChapter();
loadFormChapter(chapter.id);
}
@@ -366,7 +368,7 @@
wChapterSegmentWrap = chapterSegmentWrap.width(),
chapterList = $('.list-chapter-rows-wrap');
- chapters = _.sortBy(chapters, function(c){
+ chapters = chapters.sortBy(function(c){
return c.begin;
});
@@ -412,6 +414,7 @@
annotation.keywords = dataAnnotation.keywords;
annotation.content = getContentAnnotationByType(dataAnnotation.type);
+ myProject.getAnnotations().push(annotation);
annotations.push(annotation);
return annotation;
@@ -424,7 +427,7 @@
wTimeline = timeline.width(),
annotationList = $('#list-annotations-rows');
- annotations = _.sortBy(annotations, function(c){
+ annotations = annotations.sortBy(function(c){
return c.begin;
});
@@ -521,7 +524,8 @@
function deleteAnnotation(idAnnotation){
disabledPreview();
$("#modal-confirm").modal('hide');
- annotations = _(annotations).reject(function(c) { return c.id == idAnnotation; });
+ annotations.removeId(idAnnotation);
+ myProject.getAnnotations().removeId(idAnnotation, true);
closeTab(idAnnotation);
renderAnnotation();
}
@@ -891,7 +895,7 @@
$('.btn-save-project').bind('click', function(e){
$('.btn-apercu-projet').removeClass('disabled');
- console.log(myProject.serialize());
+ console.log(JSON.parse(myProject.serialize()));
/*
$.ajax({
type: "POST",