|
|
|
@ -39,18 +39,17 @@
|
|
|
|
|
<div style="display: flex; width: 100%"> |
|
|
|
|
<p style="width: 9rem;">Add link:</p> |
|
|
|
|
<div v-for="link_type in link_types" :key="link_type" class="link-type" @click="addLink(link_type)"> |
|
|
|
|
<i class="link-type-icon add" :class="link_icons[link_type]" |
|
|
|
|
@click="constructor_params.link_type = link_type"></i> |
|
|
|
|
<i class="link-type-icon add" :class="link_icons[link_type]"></i> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
<!-- The links themselves (editing constructor_params.contacts[link_type] for each key) --> |
|
|
|
|
<div v-for="link_type in Object.keys(constructor_params.contacts)" :key="link_type" class="link-type"> |
|
|
|
|
<div v-for="contact in contacts" :key="contact[0]" class="link-type"> |
|
|
|
|
<div style="display: flex; width: 100%"> |
|
|
|
|
<!-- the icon as a label --> |
|
|
|
|
<i style="width: 9rem;" class="link-type-icon" :class="link_icons[link_type]"></i> |
|
|
|
|
<i style="width: 9rem;" class="link-type-icon" :class="link_icons[contact[0]]"></i> |
|
|
|
|
<!-- editing the link - constructor_params.contacts[link_type] --> |
|
|
|
|
<contenteditable class="record-inp" tag="div" :no-hl="true" :no-html="true" spellcheck="false" |
|
|
|
|
v-model="constructor_params.contacts[link_type]"></contenteditable> |
|
|
|
|
v-model="constructor_params.contacts[contact[0]]"></contenteditable> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
<div class="save_container center"> |
|
|
|
@ -103,6 +102,7 @@ export default {
|
|
|
|
|
constructor_site, |
|
|
|
|
constructor_params: new SiteConstructorParams(''), |
|
|
|
|
saved_constructor_params: new SiteConstructorParams(''), |
|
|
|
|
contacts: [] |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
watch: { |
|
|
|
@ -119,6 +119,16 @@ export default {
|
|
|
|
|
handler: function (newVal, oldVal) { |
|
|
|
|
if (newVal === oldVal) return; |
|
|
|
|
this.constructor_params = newVal.copy(); |
|
|
|
|
this.contacts = Object.entries(newVal.contacts); |
|
|
|
|
}, |
|
|
|
|
deep: true |
|
|
|
|
}, |
|
|
|
|
contacts: { |
|
|
|
|
handler: function (newVal) { |
|
|
|
|
this.constructor_params.contacts = new Map(); |
|
|
|
|
for (let contact of newVal) { |
|
|
|
|
this.constructor_params.contacts[contact[0]] = contact[1]; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
deep: true |
|
|
|
|
}, |
|
|
|
@ -137,13 +147,20 @@ export default {
|
|
|
|
|
}, |
|
|
|
|
link_icons() { |
|
|
|
|
return link_icons; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// used_link_types() { |
|
|
|
|
// return Object.keys(this.constructor_params.contacts); |
|
|
|
|
// }, |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
set_site_rec(site_rec) { |
|
|
|
|
this.site_rec = site_rec; |
|
|
|
|
}, |
|
|
|
|
addLink(link_type) { |
|
|
|
|
console.log('adding link', link_type); |
|
|
|
|
// If there's already a link of this type, don't add it |
|
|
|
|
if (link_type in this.constructor_params.contacts) return; |
|
|
|
|
this.contacts.push([link_type, default_links[link_type]]) |
|
|
|
|
this.constructor_params.contacts[link_type] = default_links[link_type]; |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|