Skip to content
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

adjust configuration menu for list items, fixes #892 #943

Merged
merged 4 commits into from
Mar 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,6 @@
:accordion-item="context.component.slots && context.component.slots.accordion && !config.divider && !context.editmode"
:link="(config.action !== undefined && config.action !== '' && !context.editmode) ? true : undefined"
@click="performAction">
<f7-menu v-if="context.editmode" slot="content-start" class="configure-layout-menu">
<f7-menu-item icon-f7="list_bullet" dropdown>
<f7-menu-dropdown>
<f7-menu-dropdown-item @click="context.editmode.configureWidget(context.component, context.parent)" href="#" text="Configure Item" />
<f7-menu-dropdown-item @click="context.editmode.editWidgetCode(context.component, context.parent)" href="#" text="Edit YAML" />
<f7-menu-dropdown-item v-if="context.parent.component.config.accordionList" @click="context.editmode.editWidgetCode(context.component, context.parent, 'accordion')" href="#" text="Edit Accordion Code" />
<f7-menu-dropdown-item divider />
<f7-menu-dropdown-item @click="context.editmode.cutWidget(context.component, context.parent)" href="#" text="Cut" />
<f7-menu-dropdown-item @click="context.editmode.copyWidget(context.component, context.parent)" href="#" text="Copy" />
<f7-menu-dropdown-item divider />
<f7-menu-dropdown-item @click="context.editmode.moveWidgetUp(context.component, context.parent)" href="#" text="Move Up" />
<f7-menu-dropdown-item @click="context.editmode.moveWidgetDown(context.component, context.parent)" href="#" text="Move Down" />
<f7-menu-dropdown-item divider />
<f7-menu-dropdown-item @click="context.editmode.removeWidget(context.component, context.parent)" href="#" text="Remove Item" />
</f7-menu-dropdown>
</f7-menu-item>
</f7-menu>
<slot name="inner" #inner />
<slot name="after" #after />
<slot name="content" #content />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<f7-list v-bind="config" :title="null">
<f7-list v-bind="config" :title="null" :style="{ 'z-index': context.editmode ? 'inherit' : undefined }">
<f7-menu v-if="context.editmode" slot="before-list" class="configure-layout-menu margin-vertical padding-left">
<f7-menu-item @click="context.editmode.addWidget(context.component)" icon-f7="plus" />
<f7-menu-item style="margin-left: auto" icon-f7="square_list" dropdown>
Expand All @@ -11,7 +11,26 @@
</f7-menu-item>
</f7-menu>
<ul v-if="context.component.slots && context.component.slots.default">
<generic-widget-component :context="childContext(slotComponent)" v-for="(slotComponent, idx) in context.component.slots.default" :key="idx" v-on="$listeners" />
<template v-for="(slotComponent, idx) in context.component.slots.default">
<f7-menu v-if="context.editmode" style="float:left" :key="idx">
<f7-menu-item icon-f7="list_bullet" class="margin-left configure-layout-menu" dropdown>
<f7-menu-dropdown>
<f7-menu-dropdown-item @click="context.editmode.configureWidget(context.component.slots.default[idx], context)" href="#" text="Configure Item" />
<f7-menu-dropdown-item @click="context.editmode.editWidgetCode(context.component.slots.default[idx], context)" href="#" text="Edit YAML" />
<f7-menu-dropdown-item v-if="context.parent.component.config.accordionList" @click="context.editmode.editWidgetCode(context.component.slots.default[idx], context, 'accordion')" href="#" text="Edit Accordion Code" />
<f7-menu-dropdown-item divider />
<f7-menu-dropdown-item @click="context.editmode.cutWidget(context.component.slots.default[idx], context)" href="#" text="Cut" />
<f7-menu-dropdown-item @click="context.editmode.copyWidget(context.component.slots.default[idx], context)" href="#" text="Copy" />
<f7-menu-dropdown-item v-if="idx > 0 || idx < context.component.slots.default.length - 1" divider />
<f7-menu-dropdown-item v-if="idx > 0" @click="context.editmode.moveWidgetUp(context.component.slots.default[idx], context)" href="#" text="Move Up" />
<f7-menu-dropdown-item v-if="idx < context.component.slots.default.length - 1" @click="context.editmode.moveWidgetDown(context.component.slots.default[idx], context)" href="#" text="Move Down" />
<f7-menu-dropdown-item divider />
<f7-menu-dropdown-item @click="context.editmode.removeWidget(context.component.slots.default[idx], context)" href="#" text="Remove Item" />
</f7-menu-dropdown>
</f7-menu-item>
</f7-menu>
<generic-widget-component :context="childContext(slotComponent)" :key="idx" v-on="$listeners" />
</template>
</ul>
</f7-list>
</template>
Expand Down