diff options
| author | Moritz Strohm <strohm@data-quest.de> | 2025-10-14 12:15:14 +0200 |
|---|---|---|
| committer | Moritz Strohm <strohm@data-quest.de> | 2025-10-14 12:15:14 +0200 |
| commit | 036dbc857f26783abf55bb55e8528979b676344b (patch) | |
| tree | af6111b2d17a9d8c71dd757c9951e8f8be4ec8e7 | |
| parent | 361d08355a6630b9080f976cb1e4215b41a9622d (diff) | |
added "add contact" buttontic-05940
| -rw-r--r-- | resources/vue/components/UserAvatar.vue | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/resources/vue/components/UserAvatar.vue b/resources/vue/components/UserAvatar.vue index 91153e9..915fb03 100644 --- a/resources/vue/components/UserAvatar.vue +++ b/resources/vue/components/UserAvatar.vue @@ -13,6 +13,8 @@ const isOpen = defineModel({ default: false }); const AUTH_ID = STUDIP.USER_ID; const vCardDownloadURL = STUDIP.URLHelper.getURL('dispatch.php/contact/vcard', {'user[]': props.user.username}); const userProfileURL = STUDIP.URLHelper.getURL('dispatch.php/profile', {username: props.user.username}); +const addContactURL = STUDIP.URLHelper.getURL('dispatch.php/profile/add_buddy', {username: props.user.username}); +const removeContactURL = STUDIP.URLHelper.getURL('dispatch.php/profile/remove_buddy', {username: props.user.username}); const writeMessage = () => { STUDIP.Dialog.fromURL( @@ -39,6 +41,18 @@ const openBlubberChat = () => { isOpen.value = false; } + +const addContact = () => { + $.post(addContactURL).done(() => { + isOpen.value = false; + }); +} + +const removeContact = () => { + $.post(removeContactURL).done(() => { + isOpen.value = false; + }); +} </script> <template> <div class="user-avatar"> @@ -87,6 +101,18 @@ const openBlubberChat = () => { </button> </li> <li> + <button + v-if="user.id !== AUTH_ID" + class="action-item button-base" + :title="$gettext('Kontakt hinzufügen')" + :aria-label="$gettext('Kontakt hinzufügen')" + @click="addContact()" + > + <StudipIcon shape="add" :size="18" aria-hidden="ture" /> + {{ $gettext('Kontakt hinzufügen') }} + </button> + </li> + <li> <a class="action-item" :href="vCardDownloadURL" |
