diff --git a/js/views/attachment_preview_view.js b/js/views/attachment_preview_view.js index ce72f1b1..9daf06b8 100644 --- a/js/views/attachment_preview_view.js +++ b/js/views/attachment_preview_view.js @@ -20,7 +20,7 @@ Whisper.AttachmentPreviewView = Whisper.View.extend({ className: 'attachment-preview', template: $('#attachment-preview').html(), - attributes: function() { + render_attributes: function() { return {source: this.src}; } }); diff --git a/js/views/conversation_view.js b/js/views/conversation_view.js index 28019b26..88c9d08a 100644 --- a/js/views/conversation_view.js +++ b/js/views/conversation_view.js @@ -22,7 +22,7 @@ return [ 'conversation', this.model.get('type') ].join(' '); }, template: $('#conversation').html(), - attributes: function() { + render_attributes: function() { return { group: this.model.get('type') === 'group' }; }, initialize: function() { diff --git a/js/views/key_verification_view.js b/js/views/key_verification_view.js index 66971ef9..1fbd966d 100644 --- a/js/views/key_verification_view.js +++ b/js/views/key_verification_view.js @@ -33,7 +33,7 @@ }); }, - attributes: function() { + render_attributes: function() { return { your_key: this.splitKey(this.model.your_key), their_key: this.splitKey(this.model.their_key) diff --git a/js/views/new_conversation_view.js b/js/views/new_conversation_view.js index 059b3084..43343669 100644 --- a/js/views/new_conversation_view.js +++ b/js/views/new_conversation_view.js @@ -46,7 +46,7 @@ this.$el.trigger('remove', {modelId: this.model.id}); this.remove(); }, - attributes: function() { + render_attributes: function() { return { name: this.model.getTitle() }; } }); diff --git a/js/views/whisper_view.js b/js/views/whisper_view.js index 9f49a1dc..dce3661c 100644 --- a/js/views/whisper_view.js +++ b/js/views/whisper_view.js @@ -22,11 +22,11 @@ Backbone.View.apply(this, arguments); Mustache.parse(_.result(this, 'template')); }, - attributes: function() { + render_attributes: function() { return _.result(this.model, 'attributes', {}); }, render: function() { - var attrs = _.result(this, 'attributes', {}); + var attrs = _.result(this, 'render_attributes', {}); var template = _.result(this, 'template', ''); this.$el.html(Mustache.render(template, attrs)); return this; diff --git a/test/views/whisper_view_test.js b/test/views/whisper_view_test.js index 0676a0b9..26296c09 100644 --- a/test/views/whisper_view_test.js +++ b/test/views/whisper_view_test.js @@ -1,8 +1,8 @@ describe('Whisper.View', function() { - it('renders a template with attributes', function() { + it('renders a template with render_attributes', function() { var viewClass = Whisper.View.extend({ template: '
{{ variable }}
', - attributes: { + render_attributes: { variable: 'value' } }); @@ -11,7 +11,7 @@ describe('Whisper.View', function() { view.render(); assert.strictEqual(view.$el.html(), '
value
'); }); - it('renders a template with no attributes', function() { + it('renders a template with no render_attributes', function() { var viewClass = Whisper.View.extend({ template: '
static text
' }); @@ -20,10 +20,10 @@ describe('Whisper.View', function() { view.render(); assert.strictEqual(view.$el.html(), '
static text
'); }); - it('renders a template function with attributes function', function() { + it('renders a template function with render_attributes function', function() { var viewClass = Whisper.View.extend({ template: function() { return '
{{ variable }}
'; }, - attributes: function() { + render_attributes: function() { return { variable: 'value' }; } });