[model,bugfix][s]: correction for change introduced in last commit to move summary method from Record to Dataset.recordSummary.

This commit is contained in:
Rufus Pollock
2012-07-03 15:35:40 +01:00
parent 40ed25c7b2
commit 202ca2dce0
3 changed files with 6 additions and 5 deletions

View File

@@ -256,12 +256,13 @@ my.Dataset = Backbone.Model.extend({
// //
// Get a simple html summary of a Dataset record in form of key/value list // Get a simple html summary of a Dataset record in form of key/value list
recordSummary: function(record) { recordSummary: function(record) {
var html = ''; var html = '<div class="recline-record-summary">';
this.fields.each(function(field) { this.fields.each(function(field) {
if (field.id != 'id') { if (field.id != 'id') {
html += '<div><strong span="key">' + field.get('label') + '</strong>: ' + record.getFieldValue(field) + '</div>'; html += '<div class="' + field.id + '"><strong>' + field.get('label') + '</strong>: ' + record.getFieldValue(field) + '</div>';
} }
}); });
html += '</div>';
return html; return html;
}, },

View File

@@ -102,7 +102,7 @@ my.Timeline = Backbone.View.extend({
"startDate": start, "startDate": start,
"endDate": end, "endDate": end,
"headline": String(record.get('title') || ''), "headline": String(record.get('title') || ''),
"text": record.get('description') || record.summary() "text": record.get('description') || this.model.recordSummary(record)
}; };
return tlEntry; return tlEntry;
} else { } else {

View File

@@ -22,13 +22,13 @@ test('extract dates and timelineJSON', function () {
'startDate': new Date('2012-03-20'), 'startDate': new Date('2012-03-20'),
'endDate': null, 'endDate': null,
'headline': '1', 'headline': '1',
'text': '<div><strong>Date</strong>: 2012-03-20</div><div><strong>title</strong>: 1</div>' 'text': '<div class="recline-record-summary"><div class="Date"><strong>Date</strong>: 2012-03-20</div><div class="title"><strong>title</strong>: 1</div></div>'
}, },
{ {
'startDate': new Date('2012-03-25'), 'startDate': new Date('2012-03-25'),
'endDate': null, 'endDate': null,
'headline': '2', 'headline': '2',
'text': '<div><strong>Date</strong>: 2012-03-25</div><div><strong>title</strong>: 2</div>' 'text': '<div class="recline-record-summary"><div class="Date"><strong>Date</strong>: 2012-03-25</div><div class="title"><strong>title</strong>: 2</div></div>'
} }
] ]
} }