Skip to content

Commit

Permalink
Reorganise component folder structure
Browse files Browse the repository at this point in the history
  • Loading branch information
duncanmcclean committed Aug 14, 2024
1 parent 5ac0604 commit 65c47a8
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
<template>

<!--
This component is *mostly* the same as the one in Statamic Core, however with one difference:
it swaps out the 'fields' string with 'runway-fields' to avoid breaking the Fields filter on Entry Listing Tables.
See https://github.com/statamic-rad-pack/runway/pull/292 for more info.
-->

<div class="shadow-inner bg-gray-300 dark:bg-dark-600">
<div class="flex items-center flex-wrap px-3 border-b dark:border-dark-900 pt-2">

<!-- Field filter (requires custom selection UI) -->
<popover v-if="fieldFilter" placement="bottom-start" @closed="fieldFilterClosed">
<template slot="trigger">
<button class="filter-badge filter-badge-control mr-2 mb-2" @click="resetFilterPopover">
<button class="filter-badge filter-badge-control rtl:ml-2 ltr:mr-2 mb-2" @click="resetFilterPopover">
{{ fieldFilter.title }}
<svg-icon name="micro/chevron-down-xs" class="w-2 h-2 mx-2" />
</button>
</template>
<template #default="{ close: closePopover }">
<div class="flex flex-col text-left min-w-[18rem]">
<div class="flex flex-col rtl:text-right ltr:text-left min-w-[18rem]">
<div class="filter-fields text-sm">
<field-filter
ref="fieldFilter"
Expand All @@ -30,7 +38,7 @@
<!-- Standard pinned filters -->
<popover v-if="pinnedFilters.length" v-for="filter in pinnedFilters" :key="filter.handle" placement="bottom-start" :stop-propagation="false">
<template slot="trigger">
<button class="filter-badge filter-badge-control mr-2 mb-2">
<button class="filter-badge filter-badge-control rtl:ml-2 ltr:mr-2 mb-2">
{{ filter.title }}
<svg-icon name="micro/chevron-down-xs" class="w-2 h-2 mx-2" />
</button>
Expand All @@ -51,7 +59,7 @@
<!-- Standard unpinned filters -->
<popover v-if="unpinnedFilters.length" placement="bottom-start" :stop-propagation="false">
<template slot="trigger">
<button class="filter-badge filter-badge-control mr-2 mb-2" @click="resetFilterPopover">
<button class="filter-badge filter-badge-control rtl:ml-2 ltr:mr-2 mb-2" @click="resetFilterPopover">
{{ __('Filter') }}
<svg-icon name="micro/chevron-down-xs" class="w-2 h-2 mx-2" />
</button>
Expand Down Expand Up @@ -85,11 +93,11 @@
</popover>

<!-- Active filter badges -->
<div class="filter-badge mr-2 mb-2" v-for="(badge, handle) in fieldFilterBadges">
<div class="filter-badge rtl:ml-2 ltr:mr-2 mb-2" v-for="(badge, handle) in fieldFilterBadges">
<span>{{ badge }}</span>
<button @click="removeFieldFilter(handle)" v-tooltip="__('Remove Filter')">&times;</button>
</div>
<div class="filter-badge mr-2 mb-2" v-for="(badge, handle) in standardBadges">
<div class="filter-badge rtl:ml-2 ltr:mr-2 mb-2" v-for="(badge, handle) in standardBadges">
<span>{{ badge }}</span>
<button @click="removeStandardFilter(handle)" v-tooltip="__('Remove Filter')">&times;</button>
</div>
Expand Down Expand Up @@ -208,7 +216,7 @@ export default {
},
savingPresetHandle() {
return this.$slugify(this.savingPresetName, '_');
return snake_case(this.savingPresetName);
},
isUpdatingPreset() {
Expand Down Expand Up @@ -255,15 +263,15 @@ export default {
delete fields[handle];
this.$emit('changed', {handle: 'runway-fields', values: fields});
this.$emit('changed', { handle: 'runway-fields', values: fields });
},
removeStandardFilter(handle) {
this.$emit('changed', {handle: handle, values: null});
this.$emit('changed', { handle: handle, values: null });
},
save() {
if (! this.canSave || ! this.preferencesPayload) return;
if (!this.canSave || !this.preferencesPayload) return;
this.saving = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@

<script>
import Listing from '../../../../vendor/statamic/cms/resources/js/components/Listing.vue'
import DataListFilters from './DataListFilters.vue'
import DataListFilters from '../data-list/Filters.vue'
export default {
mixins: [Listing],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</template>

<script>
import RunwayListing from './Listing/RunwayListing.vue'
import RunwayListing from './Listing.vue'
export default {
components: {
Expand Down
6 changes: 2 additions & 4 deletions resources/js/cp.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import PublishForm from './components/Publish/PublishForm.vue'
import ResourceView from './components/ResourceView.vue'
import HasManyFieldtypeIndex from '../../vendor/statamic/cms/resources/js/components/fieldtypes/relationship/RelationshipIndexFieldtype.vue'
import PublishForm from './components/resources/PublishForm.vue'
import ResourceView from './components/resources/View.vue'

Statamic.$components.register('runway-publish-form', PublishForm)
Statamic.$components.register('resource-view', ResourceView)
Statamic.$components.register('has_many-fieldtype-index', HasManyFieldtypeIndex)
2 changes: 2 additions & 0 deletions src/Fieldtypes/HasManyFieldtype.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

class HasManyFieldtype extends BaseFieldtype
{
protected $indexComponent = 'relationship';

protected function configFieldItems(): array
{
$config = [
Expand Down

0 comments on commit 65c47a8

Please sign in to comment.