diff --git a/js/views/whisper_view.js b/js/views/whisper_view.js index 3f3d8997e..c70f22d8c 100644 --- a/js/views/whisper_view.js +++ b/js/views/whisper_view.js @@ -26,9 +26,7 @@ return _.result(this.model, 'attributes', {}); }, render_partials: function() { - return { - avatar: this.avatar_template - }; + return Whisper.View.Templates; }, render: function() { var attrs = _.result(this, 'render_attributes', {}); @@ -37,7 +35,6 @@ this.$el.html(Mustache.render(template, attrs, partials)); return this; }, - avatar_template: $('#avatar').html(), confirm: function(message) { return new Promise(function(resolve, reject) { var dialog = new Whisper.ConfirmationDialogView({ @@ -48,5 +45,16 @@ this.$el.append(dialog.el); }.bind(this)); } + },{ + // Class attributes + Templates: (function() { + var templates = {}; + $('script[type="text/x-tmpl-mustache"]').each(function(i, el) { + var $el = $(el); + var id = $el.attr('id').replace('-','_'); + templates[id] = $el.html(); + }); + return templates; + }()) }); })();