--- a/timeline/js/timeline.js Thu Jul 19 14:09:23 2012 +0200
+++ b/timeline/js/timeline.js Thu Jul 19 17:30:02 2012 +0200
@@ -237,7 +237,7 @@
+ '{{#occurrences}}<div class="Tl-Occurrence Tl-OccInCluster Tl-Occ{{type}} Tl-Occ{{status}}{{#editing}} Tl-Editing{{/editing}}" occurrence-id="{{id}}">'
+ '{{#locked}}<div class="Tl-Locked"></div>{{/locked}}<div class="Tl-Link"{{#editing}} style="display: block"{{/editing}}></div></div>{{/occurrences}}</div>{{/open_cluster}}';
-Tlns.Templates.Occurrence_List = '{{#occurrences}}<li class="Ls-Occurrence"><div class="Ls-OccIcon Tl-Occ{{type}} Tl-Occ{{status}}"></div><h4 class="Ls-Occurrence-Title">{{title}}</h4>'
+Tlns.Templates.Occurrence_List = '{{#occurrences}}<li class="Ls-Occurrence" data-id="{{id}}"><div class="Ls-OccIcon Tl-Occ{{type}} Tl-Occ{{status}}"></div><h4 class="Ls-Occurrence-Title"><a href="#">{{title}}</a></h4>'
+ '<p class="Ls-Occ-More">{{formatted_date}} — {{univers.title}} — {{translated_status}} — {{#jt}}Au JT{{/jt}}{{^jt}}Hors JT{{/jt}}</p><div style="clear:both;"></div></li>{{/occurrences}}';
Tlns.Templates.OccurrenceTooltip = '<h3 class="Tl-Tooltip-Title">{{title}}</h3><p class="Tl-Tooltip-Date">{{formatted_date}} — {{translated_status}}</p>'
@@ -259,6 +259,7 @@
height : this.height + "px"
});
this.main_height = this.height - this.$.find('.Tl-TopBar').outerHeight();
+ //this.main_height = this.height - 27;
this.$.find('.Tl-BottomPart').css("height", this.main_height + "px");
this.$.find('.Tl-MainPart').css("width", this.main_width + "px");
this.$.find('.Tl-Overlay-Container').css("left", (this.$.find('.Tl-BottomPart').outerWidth() - this.main_width) + "px");
@@ -436,28 +437,30 @@
/* BINDING MEDIADATA EVENTS */
$("body").bind("AjoutOccurrenceEditeur MiseAJourOccurrenceEditeur", function(_event, _data) {
- var _type = _data.typeOccurrence.replace(/^occurrence/i,'').toLowerCase();
+ var _type = _data.typeOccurrence.replace(/^Occurrence/i,'').toLowerCase();
_this.createOrUpdateOccurrence(_type, _data);
_this.throttledDrawGrid();
+ _this.throttledDrawList();
});
$("body").bind("SuppressionOccurrenceEditeur", function(_event, _data) {
- var _id = _data.typeOccurrence.replace(/^occurrence/i,'').toLowerCase() + '_' + _data.id;
+ var _id = _data.typeOccurrence.replace(/^Occurrence/i,'').toLowerCase() + '_' + _data.id;
_this.deleteOccurrence(_id);
_this.throttledDrawGrid();
+ _this.throttledDrawList();
});
$("body").bind("AjoutDependanceEditeur", function(_event, _data) {
- var _sourceId = _data.typeOccurrence.replace(/^occurrence/i,'').toLowerCase() + '_' + _data.id,
- _targetId = _data.typeOccurrenceCible.replace(/^occurrence/i,'').toLowerCase() + '_' + _data.idCible;
+ var _sourceId = _data.typeOccurrence.replace(/^Occurrence/i,'').toLowerCase() + '_' + _data.id,
+ _targetId = _data.typeOccurrenceCible.replace(/^Occurrence/i,'').toLowerCase() + '_' + _data.idCible;
_this.getOccurrence(_sourceId).addDependency(_targetId);
_this.throttledDrawGrid();
});
$("body").bind("SuppressionDependanceEditeur", function(_event, _data) {
- var _sourceId = _data.typeOccurrence.replace(/^occurrence/i,'').toLowerCase() + '_' + _data.id,
- _targetId = _data.typeOccurrenceCible.replace(/^occurrence/i,'').toLowerCase() + '_' + _data.idCible;
- _this.getOccurrence(_sourceId).addDependency(_targetId);
+ var _sourceId = _data.typeOccurrence.replace(/^Occurrence/i,'').toLowerCase() + '_' + _data.id,
+ _targetId = _data.typeOccurrenceCible.replace(/^Occurrence/i,'').toLowerCase() + '_' + _data.idCible;
+ _this.getOccurrence(_sourceId).removeDependency(_targetId);
_this.throttledDrawGrid();
});
@@ -484,7 +487,7 @@
var _event = ( this.editing_occurrence.just_created ? "Ajout" : "MiseAJour" ) + "OccurrenceTimeline",
_data = {
id: this.editing_occurrence.original_id,
- typeOccurrence: "occurrence" + this.editing_occurrence.type.replace(/^./,function(_l) { return _l.toUpperCase()}),
+ typeOccurrence: "Occurrence" + this.editing_occurrence.type.replace(/^./,function(_l) { return _l.toUpperCase()}),
datePublication : Math.floor(this.editing_occurrence.date / 1000),
titre : this.editing_occurrence.title,
idUnivers: this.editing_occurrence.univers_id,
@@ -511,7 +514,7 @@
} else {
var _data = {
id: this.editing_occurrence.original_id,
- typeOccurrence: "occurrence" + this.editing_occurrence.type.replace(/^./,function(_l) { return _l.toUpperCase()})
+ typeOccurrence: "Occurrence" + this.editing_occurrence.type.replace(/^./,function(_l) { return _l.toUpperCase()})
}
$("body").trigger("SelectionOccurrenceTimeline", _data);
}
@@ -871,9 +874,9 @@
$("body").trigger("AjoutDependanceTimeline",
{
id: _this.editing_occurrence.original_id,
- typeOccurrence: "occurrence" + _this.editing_occurrence.type.replace(/^./,function(_l) { return _l.toUpperCase()}),
+ typeOccurrence: "Occurrence" + _this.editing_occurrence.type.replace(/^./,function(_l) { return _l.toUpperCase()}),
idCible: _target.replace(/^.*_/,''),
- typeOccurrenceCible: "occurrence" + _target.replace(/_.*$/,'').replace(/^./,function(_l) { return _l.toUpperCase()})
+ typeOccurrenceCible: "Occurrence" + _target.replace(/_.*$/,'').replace(/^./,function(_l) { return _l.toUpperCase()})
}
);
}
@@ -948,6 +951,15 @@
$(this).html($(this).text().replace(_titleregexp, "<span style='background:yellow'>$1</span>"));
});
}
+ this.$.find(".Ls-Occurrence").click(function() {
+ var _id = $(this).attr("data-id"),
+ _data = {
+ id: _id.replace(/^.*_/,''),
+ typeOccurrence: "Occurrence" + _id.replace(/_.*$/,'').replace(/^./,function(_l) { return _l.toUpperCase()})
+ }
+ $("body").trigger("SelectionOccurrenceTimeline", _data);
+ return false;
+ });
}
Tlns.Classes.Timeline.prototype.getUnivers = function(_id) {
--- a/timeline/timeline.html Thu Jul 19 14:09:23 2012 +0200
+++ b/timeline/timeline.html Thu Jul 19 17:30:02 2012 +0200
@@ -38,8 +38,8 @@
sync_now: false,
central_time: Date.parse("2012-07-26T00:00:00Z")
});
- $("body").bind("AjoutOccurrenceEditeur MiseAJourOccurrenceEditeur SuppressionOccurrenceEditeur AjoutDependanceEditeur SuppressionDependanceEditeur AjoutDependanceTimeline AjoutOccurrenceTimeline MiseAJourOccurrenceTimeline SelectionOccurrenceTimeline SelectionOccurrenceMediadata", function(_event, _data) {
- console.log(_event.type + " called with data " + JSON.stringify(_data));
+ $("body").bind("AjoutOccurrenceEditeur MiseAJourOccurrenceEditeur SuppressionOccurrenceEditeur AjoutDependanceEditeur SuppressionDependanceEditeur AjoutDependanceTimeline AjoutOccurrenceTimeline MiseAJourOccurrenceTimeline SelectionOccurrenceTimeline SelectionOccurrenceMediadata", function(_event, data) {
+ console.log(_event.type + " called with data " + JSON.stringify(data));
});
});
</script>