-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding context menu to discussion posts (#156)
* added actions to the discussion post context menus * Changed the backend user object to send back the clientId in the basic user object, this is used to check if the user made a post and present a context menu * new ContextMenu.vue duplicates the DropDownMenu.vue functionality and turns it from hover to click. This is not quite right * lots of changes: swapped dropdown and contextmenu icons, contextmenu will now open on click and close when unfocused or an action is taken on the menu. ContextMenu styling changes * Fixed frontend test * Lots of fixes, trying to figure out how to test this * Frontend linting * Removed a .only in front end test
- Loading branch information
Showing
12 changed files
with
263 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<template> | ||
<li tabindex="1" ref="contextRef"> | ||
<slot></slot> | ||
<ul class="grey-rounded-menu drop-down-content"> | ||
<li v-for="action in actions" :key="action.text" @click="this.runAction(action.operation)"> | ||
<span> {{ action.text }} </span> | ||
<font-awesome-icon v-if="action.icon" :icon="action.icon" size="lg" class="right-side-icon" /> | ||
</li> | ||
</ul> | ||
</li> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
name: 'context-menu', | ||
props: { | ||
actions: { | ||
type: Array, | ||
validator: (prop) => prop.every( | ||
(action) => action.text !== undefined || action.divider, | ||
), | ||
}, | ||
context_id: String, | ||
}, | ||
methods: { | ||
runAction(actionOperation) { | ||
actionOperation(this.context_id); | ||
this.closeContext(); | ||
}, | ||
closeContext() { | ||
this.$refs.contextRef.blur(); | ||
}, | ||
}, | ||
}; | ||
</script> | ||
|
||
<style scoped> | ||
hr { | ||
border: 1px solid var(--rosalution-grey-100); | ||
} | ||
.grey-rounded-menu { | ||
border-radius: var(--content-border-radius); | ||
background-color: var(--rosalution-white); | ||
border: 3px solid var(--rosalution-grey-000); | ||
width: 175px; | ||
padding: .75rem; | ||
margin-right: var(--p-16) | ||
} | ||
ul li ul { | ||
visibility: hidden; | ||
opacity: 0; | ||
position: absolute; | ||
transition: all 0.5s ease; | ||
right: 0; | ||
display: none; | ||
} | ||
ul li ul:hover li:hover { | ||
color: var(--rosalution-purple-300); | ||
background-color: var(--rosalution-purple-100); | ||
} | ||
ul li ul li { | ||
clear: both; | ||
width: 100%; | ||
line-height: 2rem; | ||
} | ||
li:focus ul { | ||
visibility: visible; | ||
opacity: 1; | ||
display: block; | ||
} | ||
.drop-down-content { | ||
text-align: right; | ||
} | ||
.right-side-icon { | ||
margin-left: var(--p-8); | ||
margin-bottom: 0.12rem; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.