diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2018-11-13 17:42:52 +0100 |
---|---|---|
committer | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2018-11-13 17:46:17 +0100 |
commit | 5f5801e11eae0ad190a08a59d12db433935d097c (patch) | |
tree | 1b35d57a3dc1a3800a4b3720cfe09527caf8d9ad /src | |
parent | 91d64916333490b70c636a5a25627e8d6b39db5d (diff) |
Select the fullname field if it is still set to New contact
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/components/ContactDetails.vue | 22 | ||||
-rw-r--r-- | src/views/Contacts.vue | 4 |
2 files changed, 18 insertions, 8 deletions
diff --git a/src/components/ContactDetails.vue b/src/components/ContactDetails.vue index 05a4d483..c4c0554c 100644 --- a/src/components/ContactDetails.vue +++ b/src/components/ContactDetails.vue @@ -48,20 +48,21 @@ <!-- fullname, org, title --> <div id="contact-header-infos"> <h2> - <input id="contact-fullname" v-model="contact.fullName" :readonly="contact.addressbook.readOnly" - :placeholder="t('contacts', 'Name')" type="text" autocomplete="off" - autocorrect="off" spellcheck="false" name="fullname" - value="" @input="debounceUpdateContact"> + <input id="contact-fullname" ref="fullname" v-model="contact.fullName" + :readonly="contact.addressbook.readOnly" :placeholder="t('contacts', 'Name')" type="text" + autocomplete="off" autocorrect="off" spellcheck="false" + name="fullname" + @input="debounceUpdateContact" @click="selectInput"> </h2> <div id="details-org-container"> <input id="contact-org" v-model="contact.org" :readonly="contact.addressbook.readOnly" :placeholder="t('contacts', 'Company')" type="text" autocomplete="off" autocorrect="off" spellcheck="false" name="org" - value="" @input="debounceUpdateContact"> + @input="debounceUpdateContact"> <input id="contact-title" v-model="contact.title" :readonly="contact.addressbook.readOnly" :placeholder="t('contacts', 'Title')" type="text" autocomplete="off" autocorrect="off" spellcheck="false" name="title" - value="" @input="debounceUpdateContact"> + @input="debounceUpdateContact"> </div> </div> @@ -350,6 +351,15 @@ export default { }, /** + * Select the text in the input if it is still set to 'new Contact' + */ + selectInput() { + if (this.$refs.fullname && this.$refs.fullname.value === t('contacts', 'New contact')) { + this.$refs.fullname.select() + } + }, + + /** * Select a contac, and update the localContact * Fetch updated data if necessary * Scroll to the selected contact if exists diff --git a/src/views/Contacts.vue b/src/views/Contacts.vue index 14395b89..dd95f4c2 100644 --- a/src/views/Contacts.vue +++ b/src/views/Contacts.vue @@ -108,7 +108,7 @@ export default { importState() { return this.$store.getters.getImportState }, - + // first enabled addressbook of the list defaultAddressbook() { return this.addressbooks.find(addressbook => !addressbook.readOnly && addressbook.enabled) @@ -239,7 +239,7 @@ export default { methods: { newContact() { let contact = new Contact('BEGIN:VCARD\nVERSION:4.0\nEND:VCARD', this.defaultAddressbook) - contact.fullName = 'New contact' + contact.fullName = t('contacts', 'New contact') // itterate over all properties (filter is not usable on objects and we need the key of the property) for (let name in rfcProps.properties) { if (rfcProps.properties[name].default) { |