Skip to content

Commit

Permalink
✨ Expand collapse section from context menu (#660)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lissy93 committed May 19, 2022
1 parent 0ed084c commit 7e547e7
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/assets/interface-icons/section-expand-collapse.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/assets/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@
"section": {
"open-section": "Open Section",
"edit-section": "Edit",
"expand-collapse": "Expand / Collapse",
"move-section": "Move To",
"remove-section": "Remove"
}
Expand Down
7 changes: 7 additions & 0 deletions src/components/LinkItems/Section.vue
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
v-click-outside="closeContextMenu"
@openEditSection="openEditSection"
@navigateToSection="navigateToSection"
@expandCollapseSection="expandCollapseSection"
@removeSection="removeSection"
/>
</Collapsable>
Expand Down Expand Up @@ -250,6 +251,12 @@ export default {
router.push({ path: `/home/${sectionIdentifier}` });
this.closeContextMenu();
},
/* Toggle sections collapse state */
expandCollapseSection() {
const secElem = this.$refs[this.sectionRef];
if (secElem) secElem.toggle();
this.closeContextMenu();
},
/* Open the Section Edit Menu */
openEditSection() {
this.editMenuOpen = true;
Expand Down
9 changes: 9 additions & 0 deletions src/components/LinkItems/SectionContextMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
<EditIcon />
<span>{{ $t('context-menus.section.edit-section') }}</span>
</li>
<li @click="expandCollapseSection">
<ExpandCollapseIcon />
<span>{{ $t('context-menus.section.expand-collapse') }}</span>
</li>
<li v-if="isEditMode" @click="removeSection">
<BinIcon />
<span>{{ $t('context-menus.section.remove-section') }}</span>
Expand All @@ -26,13 +30,15 @@
import EditIcon from '@/assets/interface-icons/config-edit-json.svg';
import BinIcon from '@/assets/interface-icons/interactive-editor-remove.svg';
import SameTabOpenIcon from '@/assets/interface-icons/open-current-tab.svg';
import ExpandCollapseIcon from '@/assets/interface-icons/section-expand-collapse.svg';
export default {
name: 'ContextMenu',
components: {
EditIcon,
BinIcon,
SameTabOpenIcon,
ExpandCollapseIcon,
},
props: {
posX: Number, // The X coordinate for positioning
Expand All @@ -56,6 +62,9 @@ export default {
openEditSectionMenu() {
this.$emit('openEditSection');
},
expandCollapseSection() {
this.$emit('expandCollapseSection');
},
removeSection() {
this.$emit('removeSection');
},
Expand Down

0 comments on commit 7e547e7

Please sign in to comment.