Support custom placeholder on recipients input
This commit is contained in:
parent
9795b26bc1
commit
23db5802cf
3 changed files with 12 additions and 3 deletions
|
@ -194,7 +194,7 @@
|
||||||
<script type='text/x-tmpl-mustache' id='recipients-input'>
|
<script type='text/x-tmpl-mustache' id='recipients-input'>
|
||||||
<div class='recipients-container'>
|
<div class='recipients-container'>
|
||||||
<span class='recipients'></span>
|
<span class='recipients'></span>
|
||||||
<input type='text' class='search' placeholder="Name or phone number" />
|
<input type='text' class='search' placeholder="{{ placeholder }}" />
|
||||||
</div>
|
</div>
|
||||||
<div class='results'>
|
<div class='results'>
|
||||||
<div class='new-contact contact hide'></div>
|
<div class='new-contact contact hide'></div>
|
||||||
|
|
|
@ -28,7 +28,9 @@
|
||||||
window: options.window
|
window: options.window
|
||||||
});
|
});
|
||||||
|
|
||||||
this.recipients_view = new Whisper.RecipientsInputView();
|
this.recipients_view = new Whisper.RecipientsInputView({
|
||||||
|
placeholder: "Add member"
|
||||||
|
});
|
||||||
this.$('.scrollable').append(this.recipients_view.el);
|
this.$('.scrollable').append(this.recipients_view.el);
|
||||||
this.$('.avatar').addClass('default');
|
this.$('.avatar').addClass('default');
|
||||||
},
|
},
|
||||||
|
|
|
@ -58,7 +58,10 @@
|
||||||
Whisper.RecipientsInputView = Whisper.View.extend({
|
Whisper.RecipientsInputView = Whisper.View.extend({
|
||||||
className: 'recipients-input',
|
className: 'recipients-input',
|
||||||
template: $('#recipients-input').html(),
|
template: $('#recipients-input').html(),
|
||||||
initialize: function() {
|
initialize: function(options) {
|
||||||
|
if (options) {
|
||||||
|
this.placeholder = options.placeholder;
|
||||||
|
}
|
||||||
this.render();
|
this.render();
|
||||||
this.$input = this.$('input.search');
|
this.$input = this.$('input.search');
|
||||||
this.$new_contact = this.$('.new-contact');
|
this.$new_contact = this.$('.new-contact');
|
||||||
|
@ -89,6 +92,10 @@
|
||||||
this.initNewContact();
|
this.initNewContact();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
render_attributes: function() {
|
||||||
|
return { placeholder: this.placeholder || "Name or phone number" };
|
||||||
|
},
|
||||||
|
|
||||||
events: {
|
events: {
|
||||||
'change input.search': 'filterContacts',
|
'change input.search': 'filterContacts',
|
||||||
'keyup input.search': 'filterContacts',
|
'keyup input.search': 'filterContacts',
|
||||||
|
|
Loading…
Reference in a new issue