diff -r 50e3c4ba168a -r 5b770cf1a6e3 timeline/js/timeline.js --- a/timeline/js/timeline.js Tue Aug 13 16:46:38 2013 +0200 +++ b/timeline/js/timeline.js Tue Aug 13 17:25:20 2013 +0200 @@ -180,7 +180,9 @@ Tlns.Templates.Univers = '
{{formatted_date}} — {{translated_status}} — {{#jt}}Au JT{{/jt}}{{^jt}}Hors JT{{/jt}}{{#format}} — {{format}}{{/format}}
' + '{{description}}
' @@ -451,11 +453,11 @@ _occ.y = _occ.univers.y; }); var _visible = _(this.occurrences).filter(function(_occ) { - return (_occ.date >= _this.start_time && _occ.date <= _this.end_time && _occ.status); + return (_occ.date >= _this.start_time && _occ.date <= _this.end_time && _occ.status); }); var _moved = true, l = 0; - while (_moved && l < 200) { + while (_moved && l < 10) { l++; _moved = false; for (var _i = 0; _i < _visible.length; _i++) { @@ -465,7 +467,7 @@ && delta < this.grid_spacing ) { var sign = _visible[_i].x < _visible[_j].x ? 1 : -1, - add = sign * (this.cluster_spacing - delta) / 2; + add = sign * (this.grid_spacing - delta) / 2; _moved = true; _visible[_i].x -= add; _visible[_j].x += add; @@ -501,8 +503,9 @@ if (typeof _id !== "undefined") { var _occurrence = _this.getOccurrence(_id); if (!_this.is_dragging) { - var _html = Mustache.to_html(Tlns.Templates.OccurrenceTooltip, _occurrence); - _this.showTooltip(_occurrence.x, _occurrence.y, _html, (_event.pageY - _this.dragging_bounds.top) >= (.4 * _this.main_height) ); + var _html = Mustache.to_html(Tlns.Templates.OccurrenceTooltip, _occurrence), + isup = (_event.pageY - _this.dragging_bounds.top) >= (.4 * _this.main_height); + _this.showTooltip(_occurrence.x + 42, _occurrence.y + (isup ? 10 : 20), _html, isup); } } }).mouseout(function() { @@ -557,7 +560,7 @@ this.date = new Date(1000 * (_data.dateFirstPublication || _data.dateCreate) || Date.now); this.formatted_date = Tlns.Utils.dateFormat(this.date,Tlns.Defaults.Timeline.tooltip_date_format); this.title = _data.title; - this.univers_id = this.timeline.univers[0].id; + this.univers_id = this.timeline.univers[Math.floor(Math.random() * this.timeline.univers.length)].id; this.univers = this.timeline.getUnivers(this.univers_id); this.type = "publication"; if (typeof _data.statut !== "undefined" || typeof this.status === "undefined") { @@ -579,6 +582,10 @@ if (typeof _data.typeOccurrencePublication !== "undefined" || typeof this.format === "undefined") { this.format = _data.typeOccurrencePublication || 'Format non défini'; } + console.log(_data, _data.contentHasMedias); + if (_data.contentHasMedias && _data.contentHasMedias.length) { + this.image = _data.contentHasMedias[0].media.cinema.replace(/cinema\/[\d]+\/[\d]+/,'cinema/85/38'); + } this.translated_status = Tlns.Defaults.Timeline.statuses[this.status]; // this.published = (_data.publication && _data.publication == "En ligne"); // this.locked = _data.verrouille || false;