Add names to link shares when creating them (#456)

Co-authored-by: kolaente <k@knt.li>
Reviewed-on: vikunja/frontend#456
Co-authored-by: konrad <konrad@kola-entertainments.de>
Co-committed-by: konrad <konrad@kola-entertainments.de>
This commit is contained in:
konrad 2021-04-07 12:44:54 +00:00
parent a8893f80c2
commit b35c2d6f2c
2 changed files with 31 additions and 13 deletions

View File

@ -5,6 +5,14 @@
<div class="p-4"> <div class="p-4">
<p>Share with a link:</p> <p>Share with a link:</p>
<div class="field has-addons"> <div class="field has-addons">
<div class="control">
<input
class="input"
placeholder="Name"
v-tooltip="'All actions done by this link share will show up with the name.'"
v-model="name"
/>
</div>
<div class="control"> <div class="control">
<div class="select"> <div class="select">
<select v-model="selectedRight"> <select v-model="selectedRight">
@ -28,7 +36,8 @@
<thead> <thead>
<tr> <tr>
<th>Link</th> <th>Link</th>
<th>Shared by</th> <th>Name</th>
<th>Shared&nbsp;by</th>
<th>Right</th> <th>Right</th>
<th>Delete</th> <th>Delete</th>
</tr> </tr>
@ -51,33 +60,39 @@
:shadow="false" :shadow="false"
v-tooltip="'Copy to clipboard'" v-tooltip="'Copy to clipboard'"
> >
<span class="icon"> <span class="icon">
<icon icon="paste"/> <icon icon="paste"/>
</span> </span>
</x-button> </x-button>
</div> </div>
</div> </div>
</td> </td>
<td>
<template v-if="s.name !== ''">
{{ s.name }}
</template>
<i v-else>No name set</i>
</td>
<td> <td>
{{ s.sharedBy.getDisplayName() }} {{ s.sharedBy.getDisplayName() }}
</td> </td>
<td class="type"> <td class="type">
<template v-if="s.right === rights.ADMIN"> <template v-if="s.right === rights.ADMIN">
<span class="icon is-small"> <span class="icon is-small">
<icon icon="lock"/> <icon icon="lock"/>
</span> </span>&nbsp;
Admin Admin
</template> </template>
<template v-else-if="s.right === rights.READ_WRITE"> <template v-else-if="s.right === rights.READ_WRITE">
<span class="icon is-small"> <span class="icon is-small">
<icon icon="pen"/> <icon icon="pen"/>
</span> </span>&nbsp;
Write Write
</template> </template>
<template v-else> <template v-else>
<span class="icon is-small"> <span class="icon is-small">
<icon icon="users"/> <icon icon="users"/>
</span> </span>&nbsp;
Read-only Read-only
</template> </template>
</td> </td>
@ -140,6 +155,7 @@ export default {
newLinkShare: LinkShareModel, newLinkShare: LinkShareModel,
rights: rights, rights: rights,
selectedRight: rights.READ, selectedRight: rights.READ,
name: '',
showDeleteModal: false, showDeleteModal: false,
linkIdToDelete: 0, linkIdToDelete: 0,
} }
@ -180,6 +196,7 @@ export default {
let newLinkShare = new LinkShareModel({ let newLinkShare = new LinkShareModel({
right: this.selectedRight, right: this.selectedRight,
listId: this.listId, listId: this.listId,
name: this.name,
}) })
this.linkShareService this.linkShareService
.create(newLinkShare) .create(newLinkShare)

View File

@ -22,6 +22,7 @@ export default class ListModel extends AbstractModel {
sharedBy: UserModel, sharedBy: UserModel,
sharingType: 0, sharingType: 0,
listId: 0, listId: 0,
name: '',
created: null, created: null,
updated: null, updated: null,