-
Notifications
You must be signed in to change notification settings - Fork 158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[full-ci] Show sharees as avatars #5758
Changes from 6 commits
cbd54fe
679b2ca
2e90b87
a3d26a7
c83bfc4
446eaa1
d3214d4
476e55c
f2f8587
dc440b3
ea82d90
19fad05
787124c
a046251
ca95441
51ec2ce
98e5ec6
160fc69
3a529ab
9b96c9c
38aab1a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,45 +24,64 @@ | |
data-testid="files-collaborators-no-reshare-permissions-message" | ||
v-text="noResharePermsMessage" | ||
/> | ||
<template v-if="$_ownerAsCollaborator"> | ||
<p id="original-sharing-user" v-translate class="oc-invisible-sr">File owner</p> | ||
<show-collaborator | ||
:collaborator="$_ownerAsCollaborator" | ||
aria-describedby="original-sharing-user" | ||
/> | ||
<hr /> | ||
<show-collaborator :collaborator="$_currentUserAsCollaborator" /> | ||
</template> | ||
<template v-else> | ||
<p id="collaborator-as-fileowner" v-translate class="oc-invisible-sr"> | ||
You are the file owner | ||
</p> | ||
<show-collaborator | ||
:collaborator="$_currentUserAsCollaborator" | ||
aria-describedby="collaborator-as-fileowner" | ||
/> | ||
</template> | ||
<hr v-if="collaborators.length > 0" class="oc-mt-s oc-mb-s" /> | ||
<transition-group | ||
id="files-collaborators-list" | ||
class="uk-list uk-list-divider uk-overflow-hidden oc-m-rm" | ||
:enter-active-class="$_transitionGroupEnter" | ||
:leave-active-class="$_transitionGroupLeave" | ||
name="custom-classes-transition" | ||
tag="ul" | ||
:aria-label="$gettext('Share receivers')" | ||
<div | ||
class="avatars-wrapper" | ||
:aria-label="sharedWithTooltip" | ||
data-testid="shared-with-avatars" | ||
@click="sharedWithClick" | ||
> | ||
<li v-for="collaborator in collaborators" :key="collaborator.key"> | ||
<h2 class="shared-with-label" v-text="sharedWithLabel" /> | ||
<oc-avatars | ||
v-oc-tooltip="sharedWithTooltip" | ||
:items="collaborators_avatar" | ||
accessible-description="This resource is shared with many users." | ||
:stacked="true" | ||
:is-tooltip-displayed="false" | ||
class="oc-mb debug-avatar" | ||
lookacat marked this conversation as resolved.
Show resolved
Hide resolved
|
||
/> | ||
</div> | ||
<template v-if="showShareesList"> | ||
<template v-if="$_ownerAsCollaborator"> | ||
<p id="original-sharing-user" v-translate class="oc-invisible-sr">File owner</p> | ||
<show-collaborator | ||
:collaborator="collaborator" | ||
:modifiable="!collaborator.indirect" | ||
@onDelete="$_ocCollaborators_deleteShare" | ||
@onEdit="$_ocCollaborators_editShare" | ||
:collaborator="$_ownerAsCollaborator" | ||
aria-describedby="original-sharing-user" | ||
/> | ||
</li> | ||
</transition-group> | ||
<hr /> | ||
<show-collaborator :collaborator="$_currentUserAsCollaborator" /> | ||
</template> | ||
<template v-else> | ||
<p id="collaborator-as-fileowner" v-translate class="oc-invisible-sr"> | ||
You are the file owner | ||
</p> | ||
<show-collaborator | ||
:collaborator="$_currentUserAsCollaborator" | ||
aria-describedby="collaborator-as-fileowner" | ||
/> | ||
</template> | ||
<hr v-if="collaborators.length > 0" class="oc-mt-s oc-mb-s" /> | ||
<transition-group | ||
id="files-collaborators-list" | ||
class="uk-list uk-list-divider uk-overflow-hidden oc-m-rm" | ||
:enter-active-class="$_transitionGroupEnter" | ||
:leave-active-class="$_transitionGroupLeave" | ||
name="custom-classes-transition" | ||
tag="ul" | ||
:aria-label="$gettext('Share receivers')" | ||
> | ||
<li v-for="collaborator in collaborators" :key="collaborator.key"> | ||
<show-collaborator | ||
:collaborator="collaborator" | ||
:modifiable="!collaborator.indirect" | ||
@onDelete="$_ocCollaborators_deleteShare" | ||
@onEdit="$_ocCollaborators_editShare" | ||
/> | ||
</li> | ||
</transition-group> | ||
</template> | ||
</template> | ||
</div> | ||
|
||
<new-collaborator | ||
v-if="$_ocCollaborators_canShare && currentView === VIEW_NEW" | ||
key="new-collaborator" | ||
|
@@ -117,7 +136,8 @@ export default { | |
VIEW_SHOW, | ||
VIEW_EDIT, | ||
VIEW_NEW, | ||
currentView: VIEW_SHOW | ||
currentView: VIEW_SHOW, | ||
showShareesList: false | ||
} | ||
}, | ||
computed: { | ||
|
@@ -145,6 +165,14 @@ export default { | |
: '' | ||
}, | ||
|
||
sharedWithLabel() { | ||
return this.$gettext('Shared with') | ||
}, | ||
|
||
sharedWithTooltip() { | ||
return this.$gettext('Click to show all') | ||
lookacat marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}, | ||
|
||
sharesLoading() { | ||
return ( | ||
this.currentFileOutgoingSharesLoading || | ||
|
@@ -176,6 +204,12 @@ export default { | |
role | ||
} | ||
}, | ||
collaborators_avatar() { | ||
const result = [] | ||
console.log(this.collaborators) | ||
lookacat marked this conversation as resolved.
Show resolved
Hide resolved
|
||
this.collaborators.forEach(c => result.push({ ...c.collaborator, shareType: c.shareType })) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of building a result in a const, you can just
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nope the '...' doesnt work on map There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why? The following works fine: collaborators_avatar() {
return this.collaborators.map(c => {
return {
...c.collaborator,
shareType: c.shareType
}
})
}, Why is the computed prop name in snake case by the way? 🤔 |
||
return result | ||
}, | ||
|
||
$_ownerAsCollaborator() { | ||
if (!this.$_allIncomingShares.length) { | ||
|
@@ -322,6 +356,9 @@ export default { | |
'loadIncomingShares', | ||
'incomingSharesClearState' | ||
]), | ||
sharedWithClick() { | ||
lookacat marked this conversation as resolved.
Show resolved
Hide resolved
|
||
this.showShareesList = true | ||
}, | ||
$_isCollaboratorShare(collaborator) { | ||
return userShareTypes.includes(collaborator.shareType) | ||
}, | ||
|
@@ -413,6 +450,33 @@ export default { | |
</script> | ||
|
||
<style> | ||
.avatars-wrapper { | ||
display: flex; | ||
justify-content: space-between; | ||
align-content: center; | ||
align-items: center; | ||
width: 100%; | ||
} | ||
.shared-with-label { | ||
font-size: 0.9rem; | ||
font-weight: 600; | ||
} | ||
.debug-avatar { | ||
justify-self: flex-end; | ||
} | ||
.avatar-sharees-table { | ||
width: 100%; | ||
text-align: left; | ||
|
||
tr { | ||
height: 1.5rem; | ||
text-align: right; | ||
} | ||
|
||
th { | ||
font-weight: 600; | ||
} | ||
} | ||
/* TODO: Move to design system */ | ||
.oc-app-side-bar .oc-label { | ||
display: block; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No clue how the CI got that green if you're referencing a component the current version of ODS doesn't even know about 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh that is true lol