mirror of
https://github.com/oxen-io/session-desktop.git
synced 2023-12-14 02:12:57 +01:00
Make all mustache templates available as partials
// FREEBIE
This commit is contained in:
parent
9566f10ca4
commit
5d9965a60e
1 changed files with 12 additions and 4 deletions
|
@ -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;
|
||||
}())
|
||||
});
|
||||
})();
|
||||
|
|
Loading…
Reference in a new issue