Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
141 commits
Select commit Hold shift + click to select a range
18555ac
Editing entries gets a collection url ...
jasonvarga Feb 18, 2020
fe11a91
Only list "nav" structures. 404 when accessing collection structures.
jasonvarga Feb 18, 2020
6d0c018
Tests for not being able to edit or see collection structures
jasonvarga Feb 18, 2020
e38f907
Bring back and fix collection listing test
jasonvarga Feb 18, 2020
b68e381
Bring back and fix delete collection test
jasonvarga Feb 18, 2020
c57679c
Basic test for regular collection show page (entry listing)
jasonvarga Feb 18, 2020
4f07064
Remove empty state from view. It has a dedicated empty view.
jasonvarga Feb 19, 2020
e5e6ecf
Wrapper class is now bound in vue so we can change it on the fly
jasonvarga Feb 20, 2020
6ec1293
Bunch of collection/structure tweaks ...
jasonvarga Feb 20, 2020
9b33b22
Nav only shows non-collection structures
jasonvarga Feb 20, 2020
a6a6eff
Remove old unused imported components
jasonvarga Feb 20, 2020
9cae342
Initial renaming of structures to navigation
jasonvarga Feb 20, 2020
9230a27
Change first page to first link
jasonvarga Feb 20, 2020
eb662d5
Remove collection-structure specific fields and logic from edit and u…
jasonvarga Feb 20, 2020
46e7b3f
Change structure wizard to create form, and just store title and handle.
jasonvarga Feb 21, 2020
f5d807d
Add link dropdown only appears if collections have been provided. Oth…
jasonvarga Feb 21, 2020
172b946
Validate integer as one
jasonvarga Feb 21, 2020
b332142
Prop was renamed
jasonvarga Feb 21, 2020
9320ca3
Include max depth in form
jasonvarga Feb 21, 2020
9436c17
Adjust header
jasonvarga Feb 21, 2020
9594bc5
Make it a select
jasonvarga Feb 21, 2020
2f087fb
Remove icon
jasonvarga Feb 21, 2020
9e5220b
Use selects
jasonvarga Feb 21, 2020
d9c9ff0
Move structure inline
jasonvarga Feb 24, 2020
9aaf2dc
No route necessary in non-collection structures
jasonvarga Feb 24, 2020
70da200
Collection structures are stored on the collection ...
jasonvarga Feb 24, 2020
7995cdc
Move the Facades\Nav class, used to modify the CP's side navigation, …
jasonvarga Feb 25, 2020
df64acf
Root is now part of the tree ...
jasonvarga Feb 25, 2020
38cdbf2
Nav and structure tweaks ...
jasonvarga Feb 26, 2020
6bf964f
Nav tag without params defaults to the pages collection structure
jasonvarga Feb 26, 2020
64db75c
Structure and nav tags can specify collections when using shorthand
jasonvarga Feb 26, 2020
8dc1272
Nav/structure tweakies ...
jasonvarga Feb 27, 2020
9e84a1e
Saving a collection structure saves it into the collection
jasonvarga Feb 27, 2020
b3e639c
Structure pages can be saved
jasonvarga Feb 27, 2020
6be12e9
Adjust permissions
jasonvarga Feb 27, 2020
876fef6
Hook up max depth
jasonvarga Feb 27, 2020
a024091
Only show the tree view option when there's a structure and max depth…
jasonvarga Feb 27, 2020
1ae79b2
Entries can be reordered using the structure
jasonvarga Mar 2, 2020
06a78ba
The orderability of a collection comes from its structure ...
jasonvarga Mar 2, 2020
b554c17
Adjust collection crud ...
jasonvarga Mar 2, 2020
e164d0f
Collection structures will automatically add entries not in the tree.…
jasonvarga Mar 2, 2020
5561bf6
Require version of blink that fixed numeric keys issue
jasonvarga Mar 2, 2020
49daccd
Remove old logic to add missing entries to the tree yaml
jasonvarga Mar 2, 2020
19783bb
Create first link button instead of entry
jasonvarga Mar 2, 2020
00bcd3b
Set the initial view when mounted. The 'immediate' watcher was kickin…
jasonvarga Mar 2, 2020
e4e7b18
Adjust breadcrumbs to not use old structure urls
jasonvarga Mar 2, 2020
2121e37
Blink the collection's structure
jasonvarga Mar 2, 2020
5a86c01
Pages forward calls onto the entry
jasonvarga Mar 4, 2020
633b4d0
Pages can redirect to their first child
jasonvarga Mar 4, 2020
0c36dd9
Initial redirect fieldtype
jasonvarga Mar 4, 2020
6f9f71a
If it's required, don't show the toggle
jasonvarga Mar 4, 2020
e9213cc
Entry can get its corresponding page
jasonvarga Mar 4, 2020
acae134
Redirects can be resolved through entries
jasonvarga Mar 4, 2020
82cade4
Handle nulls and 404 as an integer
jasonvarga Mar 4, 2020
bdb10a1
Redirect tag allows wildcard syntax, and accept Redirect fieldtype va…
jasonvarga Mar 4, 2020
63d40c8
Use mockery directly to make a partial mock ...
jasonvarga Mar 4, 2020
4a1b565
Dupe partialMock so its available in earlier Laravel versions for CI
jasonvarga Mar 4, 2020
c98a9a0
Entry link blueprint is appended on the fly so users can create redir…
jasonvarga Mar 4, 2020
c3db410
Revert forwarding calls. (5a86c01e) Instead, manually get from the en…
jasonvarga Mar 5, 2020
5d28aa8
Move nav and collection specific stuff outside into their respective …
jasonvarga Mar 5, 2020
704707e
Use the handle, not the whole blueprint
jasonvarga Mar 5, 2020
48cdaf9
Merge branch 'master' into feature/structure-redux
jasonvarga Mar 5, 2020
f53079f
Remove the entry from the structure when its deleted.
jasonvarga Mar 5, 2020
f970009
Separate route for updating a collection's structure. Entry deletion …
jasonvarga Mar 5, 2020
d83e2b6
Tests for f9700099 and add authorization
jasonvarga Mar 5, 2020
e97c332
Fix class
jasonvarga Mar 5, 2020
cfa7960
Needs a collection in here now
jasonvarga Mar 5, 2020
6d9d4ec
Merge branch 'master' into feature/structure-redux
jasonvarga Mar 5, 2020
9afb03c
Option to delete or orphan child entries when deleting an entry.
jasonvarga Mar 6, 2020
3c4e597
Extract to a method to tidy it up
jasonvarga Mar 6, 2020
be95b88
When deleting an entry, its child pages should be moved to the top le…
jasonvarga Mar 6, 2020
a85557b
Use v-if so changing views triggers fresh data ...
jasonvarga Mar 6, 2020
d74cfc8
Adjust messaging for the number of children
jasonvarga Mar 6, 2020
04798c9
Add remove page confirmation to navs
jasonvarga Mar 6, 2020
245376f
Orphaned pages go to the parent instead of all the way to the top (wi…
jasonvarga Mar 6, 2020
9aa3e54
no fancy pee haetch pees
jasonvarga Mar 6, 2020
c3d046e
Update structure when an entry is deleted by hand ...
jasonvarga Mar 9, 2020
e65037b
Remove temp var
jasonvarga Mar 9, 2020
38ca9d9
Fix editing of branches
jasonvarga Mar 9, 2020
24365b7
Revert the revert (c3db4109) and allow forwarding calls to the entry …
jasonvarga Mar 9, 2020
74b2f77
URL handling on routable/entries for redirects
jasonvarga Mar 9, 2020
7bb6959
Redirect handling on pages
jasonvarga Mar 9, 2020
54e2dbb
Populate root and max depth
jasonvarga Mar 9, 2020
d28b6f3
Collection tag will filter out links/redirects by default and provide…
jasonvarga Mar 9, 2020
a6f04e3
Make isRedirect work for non entries
jasonvarga Mar 10, 2020
2e263cc
Adjust path
jasonvarga Mar 10, 2020
60b8d73
Root doesnt need to be set on the tree anymore
jasonvarga Mar 10, 2020
ce71554
The sites now just come from whether the files exist. No need for a v…
jasonvarga Mar 10, 2020
0205497
The key is tree, regardless of whether it's multisite. If its a singl…
jasonvarga Mar 10, 2020
ec3a3dc
Update multisite command to handle updated nav location
jasonvarga Mar 10, 2020
d6c03fb
Params should have been on showUrl, not editUrl
jasonvarga Mar 10, 2020
97d47d6
Site selector for navs
jasonvarga Mar 10, 2020
2205da9
Remove unnecessary stuff
jasonvarga Mar 10, 2020
575b134
Bring up to speed with the collection edit form ui
jasonvarga Mar 10, 2020
9653ae7
Sites fieldtype
jasonvarga Mar 10, 2020
9a39717
Structure sites are unnecessary. A nav's sites are determined by whet…
jasonvarga Mar 10, 2020
dc2fb11
Nav sites tweaks ...
jasonvarga Mar 10, 2020
47e4a58
Only show the selector when there's more than 1 site.
jasonvarga Mar 10, 2020
f236d5e
Collection route and site tweaks ...
jasonvarga Mar 11, 2020
287c20e
Collection edit tweaks ...
jasonvarga Mar 11, 2020
f0c1acb
Remove unused structure sites fieldtype
jasonvarga Mar 11, 2020
4bb18df
Allow site switching on collection structures
jasonvarga Mar 11, 2020
ef53dc8
Tidy
jasonvarga Mar 11, 2020
fceaf3d
Tree tweaks ...
jasonvarga Mar 11, 2020
1b65df1
Fix structure box on getting started widget. Empty the translation so…
jasonvarga Mar 12, 2020
3f53408
Link to the nav's showUrl ...
jasonvarga Mar 12, 2020
de77f9f
window isnt available there
jasonvarga Mar 12, 2020
5f14dce
Move empty state to a slot
jasonvarga Mar 12, 2020
1644a5f
Remove old stuff
jasonvarga Mar 12, 2020
e08e1c9
Support the "from" parameter on the nav tag when using a collection
jasonvarga Mar 12, 2020
a9cda49
Reset the structure appropriately when setting
jasonvarga Mar 12, 2020
010ccc4
Remove the fix ...
jasonvarga Mar 12, 2020
84281e4
A collection with multiple sites, but only one tree defined in the ya…
jasonvarga Mar 12, 2020
afff09e
Merge branch 'master' into feature/structure-redux
jasonvarga Mar 12, 2020
7600348
Redirect field can select entry
jasonvarga Mar 12, 2020
032fbc5
Remove the entry value when changing option
jasonvarga Mar 12, 2020
6fcbbd2
Automatically open the selector when changing to entries
jasonvarga Mar 12, 2020
c856f3d
Save null when no entry is selected
jasonvarga Mar 12, 2020
4d1ea7a
Make it a regular test case to fix facades
jasonvarga Mar 12, 2020
ca47f56
Use new btn-group style
jasonvarga Mar 13, 2020
aaf1162
Uniform padding
jasonvarga Mar 13, 2020
c97f65e
Bring back old store class, deprecated, to prevent an error to ease m…
jasonvarga Mar 13, 2020
905f74c
Remove old routes fieldtype
jasonvarga Mar 13, 2020
8bd21f7
Set sites where necessary
jasonvarga Mar 13, 2020
870a084
Prevent error when not using multisite
jasonvarga Mar 13, 2020
f0775ef
Bring back update collection test basics
jasonvarga Mar 16, 2020
00f165c
Collection structure trees just come from the sites
jasonvarga Mar 16, 2020
5126245
Tidy. There will always be a value.
jasonvarga Mar 16, 2020
8eebd48
Conditionally show them
jasonvarga Mar 16, 2020
5958f00
Remove outdated method
jasonvarga Mar 16, 2020
4ba76e1
Increase width to fit "first child" option
jasonvarga Mar 16, 2020
215f1fd
Populate the data using the value if an entry has been selected
jasonvarga Mar 16, 2020
7a2c88a
Update the meta where necessary ...
jasonvarga Mar 16, 2020
be49de8
Merge branch 'master' into feature/structure-redux
jasonvarga Mar 16, 2020
71990cd
Add chevron to imply there are options
jasonvarga Mar 16, 2020
067b47e
:lipstick: Fix button specificicicicity
jackmcdade Mar 16, 2020
785c07c
Add chevron to imply there are options
jasonvarga Mar 16, 2020
a6eb93a
:lipstick: Replace flat togglers with clicky togglers
jackmcdade Mar 16, 2020
b10a6a0
:lipstick: Wangjangle some margins
jackmcdade Mar 17, 2020
5576daa
:lipstick: Add title header to the blueprint picker
jackmcdade Mar 17, 2020
84a16f9
Support cmd+clicking to open new entry in a new window
jasonvarga Mar 17, 2020
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
2 changes: 1 addition & 1 deletion composer.json
Original file line numberDiff line numberDiff line change
Expand Up@@ -20,7 +20,7 @@
"pixelfear/composer-dist-plugin": "^0.1.0",
"scrumpy/html-to-prosemirror": "^0.6.0",
"scrumpy/prosemirror-to-html": "^0.8.0",
"spatie/blink": "^1.1",
"spatie/blink": "^1.1.2",
"statamic/stringy": "^3.1",
"symfony/var-exporter": "^4.3",
"symfony/yaml": "^4.1@dev",
Expand Down
6 changes: 3 additions & 3 deletions config/stache.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -48,9 +48,9 @@
'directory' => base_path('content/collections'),
],

'structures' => [
'class' => Stores\StructuresStore::class,
'directory' => base_path('content/structures'),
'navigation' => [
'class' => Stores\NavigationStore::class,
'directory' => base_path('content/navigation'),
],

'globals' => [
Expand Down
11 changes: 11 additions & 0 deletions resources/blueprints/entry_link.yaml
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
title: Link
fields:
-
handle: title
field:
type: text
-
handle: redirect
field:
type: redirect
required: true
13 changes: 9 additions & 4 deletions resources/js/app.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -103,7 +103,6 @@ Statamic.app({
components: {
GlobalSearch: require('./components/GlobalSearch.vue').default,
SiteSelector: require('./components/SiteSelector.vue').default,
PageTree: require('./components/structures/PageTree.vue').default,
Login: require('./components/login/login'),
LoginModal: require('./components/login/LoginModal.vue').default,
BaseEntryCreateForm: require('./components/entries/BaseCreateForm.vue').default,
Expand All@@ -128,10 +127,12 @@ Statamic.app({
CollectionCreateForm: require('./components/collections/CreateForm.vue').default,
CollectionScaffolder: require('./components/collections/Scaffolder.vue').default,
CollectionEditForm: require('./components/collections/EditForm.vue').default,
CollectionView: require('./components/collections/View.vue').default,
SessionExpiry: require('./components/SessionExpiry.vue').default,
StructureWizard: require('./components/structures/Wizard.vue').default,
StructureListing: require('./components/structures/Listing.vue').default,
StructureEditForm: require('./components/structures/EditForm.vue').default,
NavigationListing: require('./components/navigation/Listing.vue').default,
NavigationCreateForm: require('./components/navigation/CreateForm.vue').default,
NavigationEditForm: require('./components/navigation/EditForm.vue').default,
NavigationView: require('./components/navigation/View.vue').default,
Stacks: require('./components/stacks/Stacks.vue').default,
TaxonomyWizard: require('./components/taxonomies/Wizard.vue').default,
TaxonomyEditForm: require('./components/taxonomies/EditForm.vue').default,
Expand DownExpand Up@@ -163,6 +164,10 @@ Statamic.app({

stackCount() {
return this.$stacks.count();
},

wrapperClass() {
return this.$config.get('wrapperClass', 'max-w-xl');
}

},
Expand Down
5 changes: 2 additions & 3 deletions resources/js/bootstrap/fieldtypes.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,7 +13,6 @@ Vue.component('slug-fieldtype', require('../components/fieldtypes/SlugFieldtype.
// Fieldtypes
import FieldsetFieldtype from '../components/fieldtypes/FieldsetFieldtype.vue'
import RevealerFieldtype from '../components/fieldtypes/RevealerFieldtype.vue'
import RoutesFieldtype from '../components/fieldtypes/RoutesFieldtype.vue'
import StatusFieldtype from '../components/fieldtypes/StatusFieldtype.vue'
import TemplateFieldtype from '../components/fieldtypes/TemplateFieldtype.vue'

Expand All@@ -25,6 +24,7 @@ Vue.component('bard-fieldtype', require('../components/fieldtypes/bard/BardField
Vue.component('bard_buttons_setting-fieldtype', require('../components/fieldtypes/bard/BardButtonsSettingFieldtype.vue').default);
Vue.component('checkboxes-fieldtype', require('../components/fieldtypes/CheckboxesFieldtype.vue').default);
Vue.component('code-fieldtype', require('../components/fieldtypes/CodeFieldtype.vue').default);
Vue.component('collection_routes-fieldtype', require('../components/collections/Routes.vue').default);
Vue.component('color-fieldtype', require('../components/fieldtypes/ColorFieldtype.vue').default);
Vue.component('date-fieldtype', require('../components/fieldtypes/DateFieldtype.vue').default);
Vue.component('fieldset-fieldtype', FieldsetFieldtype);
Expand All@@ -37,17 +37,16 @@ Vue.component('list-fieldtype', require('../components/fieldtypes/ListFieldtype.
Vue.component('markdown-fieldtype', require('../components/fieldtypes/MarkdownFieldtype.vue').default);
Vue.component('radio-fieldtype', require('../components/fieldtypes/RadioFieldtype.vue').default);
Vue.component('range-fieldtype', require('../components/fieldtypes/RangeFieldtype.vue').default);
Vue.component('redirect-fieldtype', require('../components/fieldtypes/RedirectFieldtype.vue').default);
Vue.component('relationship-fieldtype', require('../components/fieldtypes/relationship/RelationshipFieldtype.vue').default);
Vue.component('relationship-fieldtype-index', require('../components/fieldtypes/relationship/RelationshipIndexFieldtype.vue').default);
Vue.component('replicator-fieldtype', require('../components/fieldtypes/replicator/Replicator.vue').default);
Vue.component('replicator-fieldtype-index', require('../components/fieldtypes/replicator/ReplicatorIndex.vue').default);
Vue.component('revealer-fieldtype', RevealerFieldtype);
Vue.component('routes-fieldtype', RoutesFieldtype);
Vue.component('section-fieldtype', require('../components/fieldtypes/SectionFieldtype.vue').default);
Vue.component('select-fieldtype', require('../components/fieldtypes/SelectFieldtype.vue').default);
Vue.component('sets-fieldtype', require('../components/fieldtypes/replicator/SetsFieldtype.vue').default);
Vue.component('status-fieldtype', StatusFieldtype);
Vue.component('structure_sites-fieldtype', require('../components/structures/Sites.vue').default);
Vue.component('table-fieldtype', require('../components/fieldtypes/TableFieldtype.vue').default);
Vue.component('tags-fieldtype', require('../components/fieldtypes/TagsFieldtype.vue').default);
Vue.component('tags-fieldtype-index', require('../components/fieldtypes/TagsIndexFieldtype.vue').default);
Expand Down
4 changes: 2 additions & 2 deletions resources/js/components/DropdownItem.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,7 +12,7 @@ export default {
props: ['text', 'redirect', 'externalLink'],

methods: {
selectAndClose() {
selectAndClose($event) {
if (this.redirect) {
location.href = this.redirect;
return;
Expand All@@ -23,7 +23,7 @@ export default {
return;
}

this.$emit('click');
this.$emit('click', $event);

this.$parent.close();
}
Expand Down
42 changes: 42 additions & 0 deletions resources/js/components/collections/DeleteEntryConfirmation.vue
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
<template>

<modal name="delete-entry-confirmation" :pivotY="0.1" :overflow="false">
<div class="confirmation-modal flex flex-col h-full">
<div class="text-lg font-medium p-2 pb-0">
{{ __('Delete Entry') }}
</div>
<div class="flex-1 px-2 py-3 text-grey">
<p class="mb-2">Are you sure you want to delete this entry?</p>
<label class="flex items-center" v-if="children">
<input type="checkbox" class="mr-1" v-model="shouldDeleteChildren" />
{{ __n('Delete child entry|Delete :count child entries', children) }}
</label>
</div>
<div class="p-2 bg-grey-20 border-t flex items-center justify-end text-sm">
<button class="text-grey hover:text-grey-90"
@click="$emit('cancel')"
v-text="__('Cancel')" />
<button class="btn ml-2 btn-danger"
@click="$emit('confirm', shouldDeleteChildren)"
v-text="__('Delete')" />
</div>
</div>
</modal>

</template>

<script>
export default {

props: {
children: Number
},

data() {
return {
shouldDeleteChildren: false
}
}

}
</script>
6 changes: 1 addition & 5 deletions resources/js/components/collections/EditForm.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -33,14 +33,11 @@ export default {
blueprint: Object,
initialValues: Object,
meta: Object,
initialTitle: String,
url: String,
listingUrl: String,
url: String
},

data() {
return {
title: this.initialTitle,
values: this.initialValues,
error: null,
errors: {},
Expand All@@ -60,7 +57,6 @@ export default {

this.$axios.patch(this.url, this.values).then(response => {
this.saving = false;
this.title = response.data.title;
this.$toast.success(__('Saved'));
this.$refs.container.saved();
}).catch(e => this.handleAxiosError(e));
Expand Down
118 changes: 118 additions & 0 deletions resources/js/components/collections/Routes.vue
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
<template>

<div>
<div v-if="hasMultipleSites">
<div class="radio-fieldtype mb-1">
<radio-fieldtype handle="route_mode" v-model="routeMode" :config="{
inline: true,
options: {
single: 'Single route',
multiple: 'Separate route for each site',
}
}" />
</div>
<table class="grid-table" v-if="perSiteRouting">
<thead>
<tr>
<th>Site</th>
<th class="w-2/3">Route</th>
</tr>
</thead>
<tbody>
<tr v-for="site in sites" :key="site.handle">
<td class="align-middle" v-text="site.name" />
<td>
<text-input
class="font-mono text-xs"
:value="value[site.handle]"
@input="updateSiteRoute(site.handle, $event)" />
</td>
</tr>
</tbody>
</table>
</div>

<div v-if="!hasMultipleSites || !perSiteRouting">
<text-input v-model="singleRoute" class="font-mono text-xs" />
</div>
</div>

</template>

<script>
export default {

mixins: [Fieldtype],

inject: ['storeName'],

data() {
return {
routeMode: null,
singleRoute: null,
}
},

created() {
this.routeMode = this.identicalRoutes ? 'single' : 'multiple';
},

computed: {

sites() {
let state = this.$store.state.publish[this.storeName];

if (!state.values.sites) return [];

return state.values.sites.map((handle, i) => {
return {
handle,
name: state.meta.sites.data[i].title
}
});
},

hasMultipleSites() {
return this.sites.length > 1;
},

perSiteRouting() {
return this.routeMode === 'multiple';
},

identicalRoutes() {
return _.uniq(Object.values(this.value)).length === 1;
}

},

watch: {

singleRoute(route) {
this.update(route);
},

routeMode(mode) {
if (mode === 'single') {
this.singleRoute = Object.values(this.value)[0];
} else {
let value = {};
this.sites.forEach(site => value[site.handle] = '');
this.update(value);
}
}

},

methods: {

updateSiteRoute(site, route) {
let value = this.value;
value[site] = route;
this.update(value);
}

}

}
</script>
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Re-structuring by jasonvarga · Pull Request #1445 · statamic/cms · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
141 commits
Select commit Hold shift + click to select a range
18555ac
Editing entries gets a collection url ...
jasonvarga Feb 18, 2020
fe11a91
Only list "nav" structures. 404 when accessing collection structures.
jasonvarga Feb 18, 2020
6d0c018
Tests for not being able to edit or see collection structures
jasonvarga Feb 18, 2020
e38f907
Bring back and fix collection listing test
jasonvarga Feb 18, 2020
b68e381
Bring back and fix delete collection test
jasonvarga Feb 18, 2020
c57679c
Basic test for regular collection show page (entry listing)
jasonvarga Feb 18, 2020
4f07064
Remove empty state from view. It has a dedicated empty view.
jasonvarga Feb 19, 2020
e5e6ecf
Wrapper class is now bound in vue so we can change it on the fly
jasonvarga Feb 20, 2020
6ec1293
Bunch of collection/structure tweaks ...
jasonvarga Feb 20, 2020
9b33b22
Nav only shows non-collection structures
jasonvarga Feb 20, 2020
a6a6eff
Remove old unused imported components
jasonvarga Feb 20, 2020
9cae342
Initial renaming of structures to navigation
jasonvarga Feb 20, 2020
9230a27
Change first page to first link
jasonvarga Feb 20, 2020
eb662d5
Remove collection-structure specific fields and logic from edit and u…
jasonvarga Feb 20, 2020
46e7b3f
Change structure wizard to create form, and just store title and handle.
jasonvarga Feb 21, 2020
f5d807d
Add link dropdown only appears if collections have been provided. Oth…
jasonvarga Feb 21, 2020
172b946
Validate integer as one
jasonvarga Feb 21, 2020
b332142
Prop was renamed
jasonvarga Feb 21, 2020
9320ca3
Include max depth in form
jasonvarga Feb 21, 2020
9436c17
Adjust header
jasonvarga Feb 21, 2020
9594bc5
Make it a select
jasonvarga Feb 21, 2020
2f087fb
Remove icon
jasonvarga Feb 21, 2020
9e5220b
Use selects
jasonvarga Feb 21, 2020
d9c9ff0
Move structure inline
jasonvarga Feb 24, 2020
9aaf2dc
No route necessary in non-collection structures
jasonvarga Feb 24, 2020
70da200
Collection structures are stored on the collection ...
jasonvarga Feb 24, 2020
7995cdc
Move the Facades\Nav class, used to modify the CP's side navigation, …
jasonvarga Feb 25, 2020
df64acf
Root is now part of the tree ...
jasonvarga Feb 25, 2020
38cdbf2
Nav and structure tweaks ...
jasonvarga Feb 26, 2020
6bf964f
Nav tag without params defaults to the pages collection structure
jasonvarga Feb 26, 2020
64db75c
Structure and nav tags can specify collections when using shorthand
jasonvarga Feb 26, 2020
8dc1272
Nav/structure tweakies ...
jasonvarga Feb 27, 2020
9e84a1e
Saving a collection structure saves it into the collection
jasonvarga Feb 27, 2020
b3e639c
Structure pages can be saved
jasonvarga Feb 27, 2020
6be12e9
Adjust permissions
jasonvarga Feb 27, 2020
876fef6
Hook up max depth
jasonvarga Feb 27, 2020
a024091
Only show the tree view option when there's a structure and max depth…
jasonvarga Feb 27, 2020
1ae79b2
Entries can be reordered using the structure
jasonvarga Mar 2, 2020
06a78ba
The orderability of a collection comes from its structure ...
jasonvarga Mar 2, 2020
b554c17
Adjust collection crud ...
jasonvarga Mar 2, 2020
e164d0f
Collection structures will automatically add entries not in the tree.…
jasonvarga Mar 2, 2020
5561bf6
Require version of blink that fixed numeric keys issue
jasonvarga Mar 2, 2020
49daccd
Remove old logic to add missing entries to the tree yaml
jasonvarga Mar 2, 2020
19783bb
Create first link button instead of entry
jasonvarga Mar 2, 2020
00bcd3b
Set the initial view when mounted. The 'immediate' watcher was kickin…
jasonvarga Mar 2, 2020
e4e7b18
Adjust breadcrumbs to not use old structure urls
jasonvarga Mar 2, 2020
2121e37
Blink the collection's structure
jasonvarga Mar 2, 2020
5a86c01
Pages forward calls onto the entry
jasonvarga Mar 4, 2020
633b4d0
Pages can redirect to their first child
jasonvarga Mar 4, 2020
0c36dd9
Initial redirect fieldtype
jasonvarga Mar 4, 2020
6f9f71a
If it's required, don't show the toggle
jasonvarga Mar 4, 2020
e9213cc
Entry can get its corresponding page
jasonvarga Mar 4, 2020
acae134
Redirects can be resolved through entries
jasonvarga Mar 4, 2020
82cade4
Handle nulls and 404 as an integer
jasonvarga Mar 4, 2020
bdb10a1
Redirect tag allows wildcard syntax, and accept Redirect fieldtype va…
jasonvarga Mar 4, 2020
63d40c8
Use mockery directly to make a partial mock ...
jasonvarga Mar 4, 2020
4a1b565
Dupe partialMock so its available in earlier Laravel versions for CI
jasonvarga Mar 4, 2020
c98a9a0
Entry link blueprint is appended on the fly so users can create redir…
jasonvarga Mar 4, 2020
c3db410
Revert forwarding calls. (5a86c01e) Instead, manually get from the en…
jasonvarga Mar 5, 2020
5d28aa8
Move nav and collection specific stuff outside into their respective …
jasonvarga Mar 5, 2020
704707e
Use the handle, not the whole blueprint
jasonvarga Mar 5, 2020
48cdaf9
Merge branch 'master' into feature/structure-redux
jasonvarga Mar 5, 2020
f53079f
Remove the entry from the structure when its deleted.
jasonvarga Mar 5, 2020
f970009
Separate route for updating a collection's structure. Entry deletion …
jasonvarga Mar 5, 2020
d83e2b6
Tests for f9700099 and add authorization
jasonvarga Mar 5, 2020
e97c332
Fix class
jasonvarga Mar 5, 2020
cfa7960
Needs a collection in here now
jasonvarga Mar 5, 2020
6d9d4ec
Merge branch 'master' into feature/structure-redux
jasonvarga Mar 5, 2020
9afb03c
Option to delete or orphan child entries when deleting an entry.
jasonvarga Mar 6, 2020
3c4e597
Extract to a method to tidy it up
jasonvarga Mar 6, 2020
be95b88
When deleting an entry, its child pages should be moved to the top le…
jasonvarga Mar 6, 2020
a85557b
Use v-if so changing views triggers fresh data ...
jasonvarga Mar 6, 2020
d74cfc8
Adjust messaging for the number of children
jasonvarga Mar 6, 2020
04798c9
Add remove page confirmation to navs
jasonvarga Mar 6, 2020
245376f
Orphaned pages go to the parent instead of all the way to the top (wi…
jasonvarga Mar 6, 2020
9aa3e54
no fancy pee haetch pees
jasonvarga Mar 6, 2020
c3d046e
Update structure when an entry is deleted by hand ...
jasonvarga Mar 9, 2020
e65037b
Remove temp var
jasonvarga Mar 9, 2020
38ca9d9
Fix editing of branches
jasonvarga Mar 9, 2020
24365b7
Revert the revert (c3db4109) and allow forwarding calls to the entry …
jasonvarga Mar 9, 2020
74b2f77
URL handling on routable/entries for redirects
jasonvarga Mar 9, 2020
7bb6959
Redirect handling on pages
jasonvarga Mar 9, 2020
54e2dbb
Populate root and max depth
jasonvarga Mar 9, 2020
d28b6f3
Collection tag will filter out links/redirects by default and provide…
jasonvarga Mar 9, 2020
a6f04e3
Make isRedirect work for non entries
jasonvarga Mar 10, 2020
2e263cc
Adjust path
jasonvarga Mar 10, 2020
60b8d73
Root doesnt need to be set on the tree anymore
jasonvarga Mar 10, 2020
ce71554
The sites now just come from whether the files exist. No need for a v…
jasonvarga Mar 10, 2020
0205497
The key is tree, regardless of whether it's multisite. If its a singl…
jasonvarga Mar 10, 2020
ec3a3dc
Update multisite command to handle updated nav location
jasonvarga Mar 10, 2020
d6c03fb
Params should have been on showUrl, not editUrl
jasonvarga Mar 10, 2020
97d47d6
Site selector for navs
jasonvarga Mar 10, 2020
2205da9
Remove unnecessary stuff
jasonvarga Mar 10, 2020
575b134
Bring up to speed with the collection edit form ui
jasonvarga Mar 10, 2020
9653ae7
Sites fieldtype
jasonvarga Mar 10, 2020
9a39717
Structure sites are unnecessary. A nav's sites are determined by whet…
jasonvarga Mar 10, 2020
dc2fb11
Nav sites tweaks ...
jasonvarga Mar 10, 2020
47e4a58
Only show the selector when there's more than 1 site.
jasonvarga Mar 10, 2020
f236d5e
Collection route and site tweaks ...
jasonvarga Mar 11, 2020
287c20e
Collection edit tweaks ...
jasonvarga Mar 11, 2020
f0c1acb
Remove unused structure sites fieldtype
jasonvarga Mar 11, 2020
4bb18df
Allow site switching on collection structures
jasonvarga Mar 11, 2020
ef53dc8
Tidy
jasonvarga Mar 11, 2020
fceaf3d
Tree tweaks ...
jasonvarga Mar 11, 2020
1b65df1
Fix structure box on getting started widget. Empty the translation so…
jasonvarga Mar 12, 2020
3f53408
Link to the nav's showUrl ...
jasonvarga Mar 12, 2020
de77f9f
window isnt available there
jasonvarga Mar 12, 2020
5f14dce
Move empty state to a slot
jasonvarga Mar 12, 2020
1644a5f
Remove old stuff
jasonvarga Mar 12, 2020
e08e1c9
Support the "from" parameter on the nav tag when using a collection
jasonvarga Mar 12, 2020
a9cda49
Reset the structure appropriately when setting
jasonvarga Mar 12, 2020
010ccc4
Remove the fix ...
jasonvarga Mar 12, 2020
84281e4
A collection with multiple sites, but only one tree defined in the ya…
jasonvarga Mar 12, 2020
afff09e
Merge branch 'master' into feature/structure-redux
jasonvarga Mar 12, 2020
7600348
Redirect field can select entry
jasonvarga Mar 12, 2020
032fbc5
Remove the entry value when changing option
jasonvarga Mar 12, 2020
6fcbbd2
Automatically open the selector when changing to entries
jasonvarga Mar 12, 2020
c856f3d
Save null when no entry is selected
jasonvarga Mar 12, 2020
4d1ea7a
Make it a regular test case to fix facades
jasonvarga Mar 12, 2020
ca47f56
Use new btn-group style
jasonvarga Mar 13, 2020
aaf1162
Uniform padding
jasonvarga Mar 13, 2020
c97f65e
Bring back old store class, deprecated, to prevent an error to ease m…
jasonvarga Mar 13, 2020
905f74c
Remove old routes fieldtype
jasonvarga Mar 13, 2020
8bd21f7
Set sites where necessary
jasonvarga Mar 13, 2020
870a084
Prevent error when not using multisite
jasonvarga Mar 13, 2020
f0775ef
Bring back update collection test basics
jasonvarga Mar 16, 2020
00f165c
Collection structure trees just come from the sites
jasonvarga Mar 16, 2020
5126245
Tidy. There will always be a value.
jasonvarga Mar 16, 2020
8eebd48
Conditionally show them
jasonvarga Mar 16, 2020
5958f00
Remove outdated method
jasonvarga Mar 16, 2020
4ba76e1
Increase width to fit "first child" option
jasonvarga Mar 16, 2020
215f1fd
Populate the data using the value if an entry has been selected
jasonvarga Mar 16, 2020
7a2c88a
Update the meta where necessary ...
jasonvarga Mar 16, 2020
be49de8
Merge branch 'master' into feature/structure-redux
jasonvarga Mar 16, 2020
71990cd
Add chevron to imply there are options
jasonvarga Mar 16, 2020
067b47e
:lipstick: Fix button specificicicicity
jackmcdade Mar 16, 2020
785c07c
Add chevron to imply there are options
jasonvarga Mar 16, 2020
a6eb93a
:lipstick: Replace flat togglers with clicky togglers
jackmcdade Mar 16, 2020
b10a6a0
:lipstick: Wangjangle some margins
jackmcdade Mar 17, 2020
5576daa
:lipstick: Add title header to the blueprint picker
jackmcdade Mar 17, 2020
84a16f9
Support cmd+clicking to open new entry in a new window
jasonvarga Mar 17, 2020
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
2 changes: 1 addition & 1 deletion composer.json
Original file line numberDiff line numberDiff line change
Expand Up@@ -20,7 +20,7 @@
"pixelfear/composer-dist-plugin": "^0.1.0",
"scrumpy/html-to-prosemirror": "^0.6.0",
"scrumpy/prosemirror-to-html": "^0.8.0",
"spatie/blink": "^1.1",
"spatie/blink": "^1.1.2",
"statamic/stringy": "^3.1",
"symfony/var-exporter": "^4.3",
"symfony/yaml": "^4.1@dev",
Expand Down
6 changes: 3 additions & 3 deletions config/stache.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -48,9 +48,9 @@
'directory' => base_path('content/collections'),
],

'structures' => [
'class' => Stores\StructuresStore::class,
'directory' => base_path('content/structures'),
'navigation' => [
'class' => Stores\NavigationStore::class,
'directory' => base_path('content/navigation'),
],

'globals' => [
Expand Down
11 changes: 11 additions & 0 deletions resources/blueprints/entry_link.yaml
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
title: Link
fields:
-
handle: title
field:
type: text
-
handle: redirect
field:
type: redirect
required: true
13 changes: 9 additions & 4 deletions resources/js/app.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -103,7 +103,6 @@ Statamic.app({
components: {
GlobalSearch: require('./components/GlobalSearch.vue').default,
SiteSelector: require('./components/SiteSelector.vue').default,
PageTree: require('./components/structures/PageTree.vue').default,
Login: require('./components/login/login'),
LoginModal: require('./components/login/LoginModal.vue').default,
BaseEntryCreateForm: require('./components/entries/BaseCreateForm.vue').default,
Expand All@@ -128,10 +127,12 @@ Statamic.app({
CollectionCreateForm: require('./components/collections/CreateForm.vue').default,
CollectionScaffolder: require('./components/collections/Scaffolder.vue').default,
CollectionEditForm: require('./components/collections/EditForm.vue').default,
CollectionView: require('./components/collections/View.vue').default,
SessionExpiry: require('./components/SessionExpiry.vue').default,
StructureWizard: require('./components/structures/Wizard.vue').default,
StructureListing: require('./components/structures/Listing.vue').default,
StructureEditForm: require('./components/structures/EditForm.vue').default,
NavigationListing: require('./components/navigation/Listing.vue').default,
NavigationCreateForm: require('./components/navigation/CreateForm.vue').default,
NavigationEditForm: require('./components/navigation/EditForm.vue').default,
NavigationView: require('./components/navigation/View.vue').default,
Stacks: require('./components/stacks/Stacks.vue').default,
TaxonomyWizard: require('./components/taxonomies/Wizard.vue').default,
TaxonomyEditForm: require('./components/taxonomies/EditForm.vue').default,
Expand DownExpand Up@@ -163,6 +164,10 @@ Statamic.app({

stackCount() {
return this.$stacks.count();
},

wrapperClass() {
return this.$config.get('wrapperClass', 'max-w-xl');
}

},
Expand Down
5 changes: 2 additions & 3 deletions resources/js/bootstrap/fieldtypes.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,7 +13,6 @@ Vue.component('slug-fieldtype', require('../components/fieldtypes/SlugFieldtype.
// Fieldtypes
import FieldsetFieldtype from '../components/fieldtypes/FieldsetFieldtype.vue'
import RevealerFieldtype from '../components/fieldtypes/RevealerFieldtype.vue'
import RoutesFieldtype from '../components/fieldtypes/RoutesFieldtype.vue'
import StatusFieldtype from '../components/fieldtypes/StatusFieldtype.vue'
import TemplateFieldtype from '../components/fieldtypes/TemplateFieldtype.vue'

Expand All@@ -25,6 +24,7 @@ Vue.component('bard-fieldtype', require('../components/fieldtypes/bard/BardField
Vue.component('bard_buttons_setting-fieldtype', require('../components/fieldtypes/bard/BardButtonsSettingFieldtype.vue').default);
Vue.component('checkboxes-fieldtype', require('../components/fieldtypes/CheckboxesFieldtype.vue').default);
Vue.component('code-fieldtype', require('../components/fieldtypes/CodeFieldtype.vue').default);
Vue.component('collection_routes-fieldtype', require('../components/collections/Routes.vue').default);
Vue.component('color-fieldtype', require('../components/fieldtypes/ColorFieldtype.vue').default);
Vue.component('date-fieldtype', require('../components/fieldtypes/DateFieldtype.vue').default);
Vue.component('fieldset-fieldtype', FieldsetFieldtype);
Expand All@@ -37,17 +37,16 @@ Vue.component('list-fieldtype', require('../components/fieldtypes/ListFieldtype.
Vue.component('markdown-fieldtype', require('../components/fieldtypes/MarkdownFieldtype.vue').default);
Vue.component('radio-fieldtype', require('../components/fieldtypes/RadioFieldtype.vue').default);
Vue.component('range-fieldtype', require('../components/fieldtypes/RangeFieldtype.vue').default);
Vue.component('redirect-fieldtype', require('../components/fieldtypes/RedirectFieldtype.vue').default);
Vue.component('relationship-fieldtype', require('../components/fieldtypes/relationship/RelationshipFieldtype.vue').default);
Vue.component('relationship-fieldtype-index', require('../components/fieldtypes/relationship/RelationshipIndexFieldtype.vue').default);
Vue.component('replicator-fieldtype', require('../components/fieldtypes/replicator/Replicator.vue').default);
Vue.component('replicator-fieldtype-index', require('../components/fieldtypes/replicator/ReplicatorIndex.vue').default);
Vue.component('revealer-fieldtype', RevealerFieldtype);
Vue.component('routes-fieldtype', RoutesFieldtype);
Vue.component('section-fieldtype', require('../components/fieldtypes/SectionFieldtype.vue').default);
Vue.component('select-fieldtype', require('../components/fieldtypes/SelectFieldtype.vue').default);
Vue.component('sets-fieldtype', require('../components/fieldtypes/replicator/SetsFieldtype.vue').default);
Vue.component('status-fieldtype', StatusFieldtype);
Vue.component('structure_sites-fieldtype', require('../components/structures/Sites.vue').default);
Vue.component('table-fieldtype', require('../components/fieldtypes/TableFieldtype.vue').default);
Vue.component('tags-fieldtype', require('../components/fieldtypes/TagsFieldtype.vue').default);
Vue.component('tags-fieldtype-index', require('../components/fieldtypes/TagsIndexFieldtype.vue').default);
Expand Down
4 changes: 2 additions & 2 deletions resources/js/components/DropdownItem.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,7 +12,7 @@ export default {
props: ['text', 'redirect', 'externalLink'],

methods: {
selectAndClose() {
selectAndClose($event) {
if (this.redirect) {
location.href = this.redirect;
return;
Expand All@@ -23,7 +23,7 @@ export default {
return;
}

this.$emit('click');
this.$emit('click', $event);

this.$parent.close();
}
Expand Down
42 changes: 42 additions & 0 deletions resources/js/components/collections/DeleteEntryConfirmation.vue
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
<template>

<modal name="delete-entry-confirmation" :pivotY="0.1" :overflow="false">
<div class="confirmation-modal flex flex-col h-full">
<div class="text-lg font-medium p-2 pb-0">
{{ __('Delete Entry') }}
</div>
<div class="flex-1 px-2 py-3 text-grey">
<p class="mb-2">Are you sure you want to delete this entry?</p>
<label class="flex items-center" v-if="children">
<input type="checkbox" class="mr-1" v-model="shouldDeleteChildren" />
{{ __n('Delete child entry|Delete :count child entries', children) }}
</label>
</div>
<div class="p-2 bg-grey-20 border-t flex items-center justify-end text-sm">
<button class="text-grey hover:text-grey-90"
@click="$emit('cancel')"
v-text="__('Cancel')" />
<button class="btn ml-2 btn-danger"
@click="$emit('confirm', shouldDeleteChildren)"
v-text="__('Delete')" />
</div>
</div>
</modal>

</template>

<script>
export default {

props: {
children: Number
},

data() {
return {
shouldDeleteChildren: false
}
}

}
</script>
6 changes: 1 addition & 5 deletions resources/js/components/collections/EditForm.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -33,14 +33,11 @@ export default {
blueprint: Object,
initialValues: Object,
meta: Object,
initialTitle: String,
url: String,
listingUrl: String,
url: String
},

data() {
return {
title: this.initialTitle,
values: this.initialValues,
error: null,
errors: {},
Expand All@@ -60,7 +57,6 @@ export default {

this.$axios.patch(this.url, this.values).then(response => {
this.saving = false;
this.title = response.data.title;
this.$toast.success(__('Saved'));
this.$refs.container.saved();
}).catch(e => this.handleAxiosError(e));
Expand Down
118 changes: 118 additions & 0 deletions resources/js/components/collections/Routes.vue
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
<template>

<div>
<div v-if="hasMultipleSites">
<div class="radio-fieldtype mb-1">
<radio-fieldtype handle="route_mode" v-model="routeMode" :config="{
inline: true,
options: {
single: 'Single route',
multiple: 'Separate route for each site',
}
}" />
</div>
<table class="grid-table" v-if="perSiteRouting">
<thead>
<tr>
<th>Site</th>
<th class="w-2/3">Route</th>
</tr>
</thead>
<tbody>
<tr v-for="site in sites" :key="site.handle">
<td class="align-middle" v-text="site.name" />
<td>
<text-input
class="font-mono text-xs"
:value="value[site.handle]"
@input="updateSiteRoute(site.handle, $event)" />
</td>
</tr>
</tbody>
</table>
</div>

<div v-if="!hasMultipleSites || !perSiteRouting">
<text-input v-model="singleRoute" class="font-mono text-xs" />
</div>
</div>

</template>

<script>
export default {

mixins: [Fieldtype],

inject: ['storeName'],

data() {
return {
routeMode: null,
singleRoute: null,
}
},

created() {
this.routeMode = this.identicalRoutes ? 'single' : 'multiple';
},

computed: {

sites() {
let state = this.$store.state.publish[this.storeName];

if (!state.values.sites) return [];

return state.values.sites.map((handle, i) => {
return {
handle,
name: state.meta.sites.data[i].title
}
});
},

hasMultipleSites() {
return this.sites.length > 1;
},

perSiteRouting() {
return this.routeMode === 'multiple';
},

identicalRoutes() {
return _.uniq(Object.values(this.value)).length === 1;
}

},

watch: {

singleRoute(route) {
this.update(route);
},

routeMode(mode) {
if (mode === 'single') {
this.singleRoute = Object.values(this.value)[0];
} else {
let value = {};
this.sites.forEach(site => value[site.handle] = '');
this.update(value);
}
}

},

methods: {

updateSiteRoute(site, route) {
let value = this.value;
value[site] = route;
this.update(value);
}

}

}
</script>
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' Re-structuring by jasonvarga · Pull Request #1445 · statamic/cms · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
141 commits
Select commit Hold shift + click to select a range
18555ac
Editing entries gets a collection url ...
jasonvarga Feb 18, 2020
fe11a91
Only list "nav" structures. 404 when accessing collection structures.
jasonvarga Feb 18, 2020
6d0c018
Tests for not being able to edit or see collection structures
jasonvarga Feb 18, 2020
e38f907
Bring back and fix collection listing test
jasonvarga Feb 18, 2020
b68e381
Bring back and fix delete collection test
jasonvarga Feb 18, 2020
c57679c
Basic test for regular collection show page (entry listing)
jasonvarga Feb 18, 2020
4f07064
Remove empty state from view. It has a dedicated empty view.
jasonvarga Feb 19, 2020
e5e6ecf
Wrapper class is now bound in vue so we can change it on the fly
jasonvarga Feb 20, 2020
6ec1293
Bunch of collection/structure tweaks ...
jasonvarga Feb 20, 2020
9b33b22
Nav only shows non-collection structures
jasonvarga Feb 20, 2020
a6a6eff
Remove old unused imported components
jasonvarga Feb 20, 2020
9cae342
Initial renaming of structures to navigation
jasonvarga Feb 20, 2020
9230a27
Change first page to first link
jasonvarga Feb 20, 2020
eb662d5
Remove collection-structure specific fields and logic from edit and u…
jasonvarga Feb 20, 2020
46e7b3f
Change structure wizard to create form, and just store title and handle.
jasonvarga Feb 21, 2020
f5d807d
Add link dropdown only appears if collections have been provided. Oth…
jasonvarga Feb 21, 2020
172b946
Validate integer as one
jasonvarga Feb 21, 2020
b332142
Prop was renamed
jasonvarga Feb 21, 2020
9320ca3
Include max depth in form
jasonvarga Feb 21, 2020
9436c17
Adjust header
jasonvarga Feb 21, 2020
9594bc5
Make it a select
jasonvarga Feb 21, 2020
2f087fb
Remove icon
jasonvarga Feb 21, 2020
9e5220b
Use selects
jasonvarga Feb 21, 2020
d9c9ff0
Move structure inline
jasonvarga Feb 24, 2020
9aaf2dc
No route necessary in non-collection structures
jasonvarga Feb 24, 2020
70da200
Collection structures are stored on the collection ...
jasonvarga Feb 24, 2020
7995cdc
Move the Facades\Nav class, used to modify the CP's side navigation, …
jasonvarga Feb 25, 2020
df64acf
Root is now part of the tree ...
jasonvarga Feb 25, 2020
38cdbf2
Nav and structure tweaks ...
jasonvarga Feb 26, 2020
6bf964f
Nav tag without params defaults to the pages collection structure
jasonvarga Feb 26, 2020
64db75c
Structure and nav tags can specify collections when using shorthand
jasonvarga Feb 26, 2020
8dc1272
Nav/structure tweakies ...
jasonvarga Feb 27, 2020
9e84a1e
Saving a collection structure saves it into the collection
jasonvarga Feb 27, 2020
b3e639c
Structure pages can be saved
jasonvarga Feb 27, 2020
6be12e9
Adjust permissions
jasonvarga Feb 27, 2020
876fef6
Hook up max depth
jasonvarga Feb 27, 2020
a024091
Only show the tree view option when there's a structure and max depth…
jasonvarga Feb 27, 2020
1ae79b2
Entries can be reordered using the structure
jasonvarga Mar 2, 2020
06a78ba
The orderability of a collection comes from its structure ...
jasonvarga Mar 2, 2020
b554c17
Adjust collection crud ...
jasonvarga Mar 2, 2020
e164d0f
Collection structures will automatically add entries not in the tree.…
jasonvarga Mar 2, 2020
5561bf6
Require version of blink that fixed numeric keys issue
jasonvarga Mar 2, 2020
49daccd
Remove old logic to add missing entries to the tree yaml
jasonvarga Mar 2, 2020
19783bb
Create first link button instead of entry
jasonvarga Mar 2, 2020
00bcd3b
Set the initial view when mounted. The 'immediate' watcher was kickin…
jasonvarga Mar 2, 2020
e4e7b18
Adjust breadcrumbs to not use old structure urls
jasonvarga Mar 2, 2020
2121e37
Blink the collection's structure
jasonvarga Mar 2, 2020
5a86c01
Pages forward calls onto the entry
jasonvarga Mar 4, 2020
633b4d0
Pages can redirect to their first child
jasonvarga Mar 4, 2020
0c36dd9
Initial redirect fieldtype
jasonvarga Mar 4, 2020
6f9f71a
If it's required, don't show the toggle
jasonvarga Mar 4, 2020
e9213cc
Entry can get its corresponding page
jasonvarga Mar 4, 2020
acae134
Redirects can be resolved through entries
jasonvarga Mar 4, 2020
82cade4
Handle nulls and 404 as an integer
jasonvarga Mar 4, 2020
bdb10a1
Redirect tag allows wildcard syntax, and accept Redirect fieldtype va…
jasonvarga Mar 4, 2020
63d40c8
Use mockery directly to make a partial mock ...
jasonvarga Mar 4, 2020
4a1b565
Dupe partialMock so its available in earlier Laravel versions for CI
jasonvarga Mar 4, 2020
c98a9a0
Entry link blueprint is appended on the fly so users can create redir…
jasonvarga Mar 4, 2020
c3db410
Revert forwarding calls. (5a86c01e) Instead, manually get from the en…
jasonvarga Mar 5, 2020
5d28aa8
Move nav and collection specific stuff outside into their respective …
jasonvarga Mar 5, 2020
704707e
Use the handle, not the whole blueprint
jasonvarga Mar 5, 2020
48cdaf9
Merge branch 'master' into feature/structure-redux
jasonvarga Mar 5, 2020
f53079f
Remove the entry from the structure when its deleted.
jasonvarga Mar 5, 2020
f970009
Separate route for updating a collection's structure. Entry deletion …
jasonvarga Mar 5, 2020
d83e2b6
Tests for f9700099 and add authorization
jasonvarga Mar 5, 2020
e97c332
Fix class
jasonvarga Mar 5, 2020
cfa7960
Needs a collection in here now
jasonvarga Mar 5, 2020
6d9d4ec
Merge branch 'master' into feature/structure-redux
jasonvarga Mar 5, 2020
9afb03c
Option to delete or orphan child entries when deleting an entry.
jasonvarga Mar 6, 2020
3c4e597
Extract to a method to tidy it up
jasonvarga Mar 6, 2020
be95b88
When deleting an entry, its child pages should be moved to the top le…
jasonvarga Mar 6, 2020
a85557b
Use v-if so changing views triggers fresh data ...
jasonvarga Mar 6, 2020
d74cfc8
Adjust messaging for the number of children
jasonvarga Mar 6, 2020
04798c9
Add remove page confirmation to navs
jasonvarga Mar 6, 2020
245376f
Orphaned pages go to the parent instead of all the way to the top (wi…
jasonvarga Mar 6, 2020
9aa3e54
no fancy pee haetch pees
jasonvarga Mar 6, 2020
c3d046e
Update structure when an entry is deleted by hand ...
jasonvarga Mar 9, 2020
e65037b
Remove temp var
jasonvarga Mar 9, 2020
38ca9d9
Fix editing of branches
jasonvarga Mar 9, 2020
24365b7
Revert the revert (c3db4109) and allow forwarding calls to the entry …
jasonvarga Mar 9, 2020
74b2f77
URL handling on routable/entries for redirects
jasonvarga Mar 9, 2020
7bb6959
Redirect handling on pages
jasonvarga Mar 9, 2020
54e2dbb
Populate root and max depth
jasonvarga Mar 9, 2020
d28b6f3
Collection tag will filter out links/redirects by default and provide…
jasonvarga Mar 9, 2020
a6f04e3
Make isRedirect work for non entries
jasonvarga Mar 10, 2020
2e263cc
Adjust path
jasonvarga Mar 10, 2020
60b8d73
Root doesnt need to be set on the tree anymore
jasonvarga Mar 10, 2020
ce71554
The sites now just come from whether the files exist. No need for a v…
jasonvarga Mar 10, 2020
0205497
The key is tree, regardless of whether it's multisite. If its a singl…
jasonvarga Mar 10, 2020
ec3a3dc
Update multisite command to handle updated nav location
jasonvarga Mar 10, 2020
d6c03fb
Params should have been on showUrl, not editUrl
jasonvarga Mar 10, 2020
97d47d6
Site selector for navs
jasonvarga Mar 10, 2020
2205da9
Remove unnecessary stuff
jasonvarga Mar 10, 2020
575b134
Bring up to speed with the collection edit form ui
jasonvarga Mar 10, 2020
9653ae7
Sites fieldtype
jasonvarga Mar 10, 2020
9a39717
Structure sites are unnecessary. A nav's sites are determined by whet…
jasonvarga Mar 10, 2020
dc2fb11
Nav sites tweaks ...
jasonvarga Mar 10, 2020
47e4a58
Only show the selector when there's more than 1 site.
jasonvarga Mar 10, 2020
f236d5e
Collection route and site tweaks ...
jasonvarga Mar 11, 2020
287c20e
Collection edit tweaks ...
jasonvarga Mar 11, 2020
f0c1acb
Remove unused structure sites fieldtype
jasonvarga Mar 11, 2020
4bb18df
Allow site switching on collection structures
jasonvarga Mar 11, 2020
ef53dc8
Tidy
jasonvarga Mar 11, 2020
fceaf3d
Tree tweaks ...
jasonvarga Mar 11, 2020
1b65df1
Fix structure box on getting started widget. Empty the translation so…
jasonvarga Mar 12, 2020
3f53408
Link to the nav's showUrl ...
jasonvarga Mar 12, 2020
de77f9f
window isnt available there
jasonvarga Mar 12, 2020
5f14dce
Move empty state to a slot
jasonvarga Mar 12, 2020
1644a5f
Remove old stuff
jasonvarga Mar 12, 2020
e08e1c9
Support the "from" parameter on the nav tag when using a collection
jasonvarga Mar 12, 2020
a9cda49
Reset the structure appropriately when setting
jasonvarga Mar 12, 2020
010ccc4
Remove the fix ...
jasonvarga Mar 12, 2020
84281e4
A collection with multiple sites, but only one tree defined in the ya…
jasonvarga Mar 12, 2020
afff09e
Merge branch 'master' into feature/structure-redux
jasonvarga Mar 12, 2020
7600348
Redirect field can select entry
jasonvarga Mar 12, 2020
032fbc5
Remove the entry value when changing option
jasonvarga Mar 12, 2020
6fcbbd2
Automatically open the selector when changing to entries
jasonvarga Mar 12, 2020
c856f3d
Save null when no entry is selected
jasonvarga Mar 12, 2020
4d1ea7a
Make it a regular test case to fix facades
jasonvarga Mar 12, 2020
ca47f56
Use new btn-group style
jasonvarga Mar 13, 2020
aaf1162
Uniform padding
jasonvarga Mar 13, 2020
c97f65e
Bring back old store class, deprecated, to prevent an error to ease m…
jasonvarga Mar 13, 2020
905f74c
Remove old routes fieldtype
jasonvarga Mar 13, 2020
8bd21f7
Set sites where necessary
jasonvarga Mar 13, 2020
870a084
Prevent error when not using multisite
jasonvarga Mar 13, 2020
f0775ef
Bring back update collection test basics
jasonvarga Mar 16, 2020
00f165c
Collection structure trees just come from the sites
jasonvarga Mar 16, 2020
5126245
Tidy. There will always be a value.
jasonvarga Mar 16, 2020
8eebd48
Conditionally show them
jasonvarga Mar 16, 2020
5958f00
Remove outdated method
jasonvarga Mar 16, 2020
4ba76e1
Increase width to fit "first child" option
jasonvarga Mar 16, 2020
215f1fd
Populate the data using the value if an entry has been selected
jasonvarga Mar 16, 2020
7a2c88a
Update the meta where necessary ...
jasonvarga Mar 16, 2020
be49de8
Merge branch 'master' into feature/structure-redux
jasonvarga Mar 16, 2020
71990cd
Add chevron to imply there are options
jasonvarga Mar 16, 2020
067b47e
:lipstick: Fix button specificicicicity
jackmcdade Mar 16, 2020
785c07c
Add chevron to imply there are options
jasonvarga Mar 16, 2020
a6eb93a
:lipstick: Replace flat togglers with clicky togglers
jackmcdade Mar 16, 2020
b10a6a0
:lipstick: Wangjangle some margins
jackmcdade Mar 17, 2020
5576daa
:lipstick: Add title header to the blueprint picker
jackmcdade Mar 17, 2020
84a16f9
Support cmd+clicking to open new entry in a new window
jasonvarga Mar 17, 2020
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
2 changes: 1 addition & 1 deletion composer.json
Original file line numberDiff line numberDiff line change
Expand Up@@ -20,7 +20,7 @@
"pixelfear/composer-dist-plugin": "^0.1.0",
"scrumpy/html-to-prosemirror": "^0.6.0",
"scrumpy/prosemirror-to-html": "^0.8.0",
"spatie/blink": "^1.1",
"spatie/blink": "^1.1.2",
"statamic/stringy": "^3.1",
"symfony/var-exporter": "^4.3",
"symfony/yaml": "^4.1@dev",
Expand Down
6 changes: 3 additions & 3 deletions config/stache.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -48,9 +48,9 @@
'directory' => base_path('content/collections'),
],

'structures' => [
'class' => Stores\StructuresStore::class,
'directory' => base_path('content/structures'),
'navigation' => [
'class' => Stores\NavigationStore::class,
'directory' => base_path('content/navigation'),
],

'globals' => [
Expand Down
11 changes: 11 additions & 0 deletions resources/blueprints/entry_link.yaml
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
title: Link
fields:
-
handle: title
field:
type: text
-
handle: redirect
field:
type: redirect
required: true
13 changes: 9 additions & 4 deletions resources/js/app.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -103,7 +103,6 @@ Statamic.app({
components: {
GlobalSearch: require('./components/GlobalSearch.vue').default,
SiteSelector: require('./components/SiteSelector.vue').default,
PageTree: require('./components/structures/PageTree.vue').default,
Login: require('./components/login/login'),
LoginModal: require('./components/login/LoginModal.vue').default,
BaseEntryCreateForm: require('./components/entries/BaseCreateForm.vue').default,
Expand All@@ -128,10 +127,12 @@ Statamic.app({
CollectionCreateForm: require('./components/collections/CreateForm.vue').default,
CollectionScaffolder: require('./components/collections/Scaffolder.vue').default,
CollectionEditForm: require('./components/collections/EditForm.vue').default,
CollectionView: require('./components/collections/View.vue').default,
SessionExpiry: require('./components/SessionExpiry.vue').default,
StructureWizard: require('./components/structures/Wizard.vue').default,
StructureListing: require('./components/structures/Listing.vue').default,
StructureEditForm: require('./components/structures/EditForm.vue').default,
NavigationListing: require('./components/navigation/Listing.vue').default,
NavigationCreateForm: require('./components/navigation/CreateForm.vue').default,
NavigationEditForm: require('./components/navigation/EditForm.vue').default,
NavigationView: require('./components/navigation/View.vue').default,
Stacks: require('./components/stacks/Stacks.vue').default,
TaxonomyWizard: require('./components/taxonomies/Wizard.vue').default,
TaxonomyEditForm: require('./components/taxonomies/EditForm.vue').default,
Expand DownExpand Up@@ -163,6 +164,10 @@ Statamic.app({

stackCount() {
return this.$stacks.count();
},

wrapperClass() {
return this.$config.get('wrapperClass', 'max-w-xl');
}

},
Expand Down
5 changes: 2 additions & 3 deletions resources/js/bootstrap/fieldtypes.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,7 +13,6 @@ Vue.component('slug-fieldtype', require('../components/fieldtypes/SlugFieldtype.
// Fieldtypes
import FieldsetFieldtype from '../components/fieldtypes/FieldsetFieldtype.vue'
import RevealerFieldtype from '../components/fieldtypes/RevealerFieldtype.vue'
import RoutesFieldtype from '../components/fieldtypes/RoutesFieldtype.vue'
import StatusFieldtype from '../components/fieldtypes/StatusFieldtype.vue'
import TemplateFieldtype from '../components/fieldtypes/TemplateFieldtype.vue'

Expand All@@ -25,6 +24,7 @@ Vue.component('bard-fieldtype', require('../components/fieldtypes/bard/BardField
Vue.component('bard_buttons_setting-fieldtype', require('../components/fieldtypes/bard/BardButtonsSettingFieldtype.vue').default);
Vue.component('checkboxes-fieldtype', require('../components/fieldtypes/CheckboxesFieldtype.vue').default);
Vue.component('code-fieldtype', require('../components/fieldtypes/CodeFieldtype.vue').default);
Vue.component('collection_routes-fieldtype', require('../components/collections/Routes.vue').default);
Vue.component('color-fieldtype', require('../components/fieldtypes/ColorFieldtype.vue').default);
Vue.component('date-fieldtype', require('../components/fieldtypes/DateFieldtype.vue').default);
Vue.component('fieldset-fieldtype', FieldsetFieldtype);
Expand All@@ -37,17 +37,16 @@ Vue.component('list-fieldtype', require('../components/fieldtypes/ListFieldtype.
Vue.component('markdown-fieldtype', require('../components/fieldtypes/MarkdownFieldtype.vue').default);
Vue.component('radio-fieldtype', require('../components/fieldtypes/RadioFieldtype.vue').default);
Vue.component('range-fieldtype', require('../components/fieldtypes/RangeFieldtype.vue').default);
Vue.component('redirect-fieldtype', require('../components/fieldtypes/RedirectFieldtype.vue').default);
Vue.component('relationship-fieldtype', require('../components/fieldtypes/relationship/RelationshipFieldtype.vue').default);
Vue.component('relationship-fieldtype-index', require('../components/fieldtypes/relationship/RelationshipIndexFieldtype.vue').default);
Vue.component('replicator-fieldtype', require('../components/fieldtypes/replicator/Replicator.vue').default);
Vue.component('replicator-fieldtype-index', require('../components/fieldtypes/replicator/ReplicatorIndex.vue').default);
Vue.component('revealer-fieldtype', RevealerFieldtype);
Vue.component('routes-fieldtype', RoutesFieldtype);
Vue.component('section-fieldtype', require('../components/fieldtypes/SectionFieldtype.vue').default);
Vue.component('select-fieldtype', require('../components/fieldtypes/SelectFieldtype.vue').default);
Vue.component('sets-fieldtype', require('../components/fieldtypes/replicator/SetsFieldtype.vue').default);
Vue.component('status-fieldtype', StatusFieldtype);
Vue.component('structure_sites-fieldtype', require('../components/structures/Sites.vue').default);
Vue.component('table-fieldtype', require('../components/fieldtypes/TableFieldtype.vue').default);
Vue.component('tags-fieldtype', require('../components/fieldtypes/TagsFieldtype.vue').default);
Vue.component('tags-fieldtype-index', require('../components/fieldtypes/TagsIndexFieldtype.vue').default);
Expand Down
4 changes: 2 additions & 2 deletions resources/js/components/DropdownItem.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,7 +12,7 @@ export default {
props: ['text', 'redirect', 'externalLink'],

methods: {
selectAndClose() {
selectAndClose($event) {
if (this.redirect) {
location.href = this.redirect;
return;
Expand All@@ -23,7 +23,7 @@ export default {
return;
}

this.$emit('click');
this.$emit('click', $event);

this.$parent.close();
}
Expand Down
42 changes: 42 additions & 0 deletions resources/js/components/collections/DeleteEntryConfirmation.vue
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
<template>

<modal name="delete-entry-confirmation" :pivotY="0.1" :overflow="false">
<div class="confirmation-modal flex flex-col h-full">
<div class="text-lg font-medium p-2 pb-0">
{{ __('Delete Entry') }}
</div>
<div class="flex-1 px-2 py-3 text-grey">
<p class="mb-2">Are you sure you want to delete this entry?</p>
<label class="flex items-center" v-if="children">
<input type="checkbox" class="mr-1" v-model="shouldDeleteChildren" />
{{ __n('Delete child entry|Delete :count child entries', children) }}
</label>
</div>
<div class="p-2 bg-grey-20 border-t flex items-center justify-end text-sm">
<button class="text-grey hover:text-grey-90"
@click="$emit('cancel')"
v-text="__('Cancel')" />
<button class="btn ml-2 btn-danger"
@click="$emit('confirm', shouldDeleteChildren)"
v-text="__('Delete')" />
</div>
</div>
</modal>

</template>

<script>
export default {

props: {
children: Number
},

data() {
return {
shouldDeleteChildren: false
}
}

}
</script>
6 changes: 1 addition & 5 deletions resources/js/components/collections/EditForm.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -33,14 +33,11 @@ export default {
blueprint: Object,
initialValues: Object,
meta: Object,
initialTitle: String,
url: String,
listingUrl: String,
url: String
},

data() {
return {
title: this.initialTitle,
values: this.initialValues,
error: null,
errors: {},
Expand All@@ -60,7 +57,6 @@ export default {

this.$axios.patch(this.url, this.values).then(response => {
this.saving = false;
this.title = response.data.title;
this.$toast.success(__('Saved'));
this.$refs.container.saved();
}).catch(e => this.handleAxiosError(e));
Expand Down
118 changes: 118 additions & 0 deletions resources/js/components/collections/Routes.vue
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
<template>

<div>
<div v-if="hasMultipleSites">
<div class="radio-fieldtype mb-1">
<radio-fieldtype handle="route_mode" v-model="routeMode" :config="{
inline: true,
options: {
single: 'Single route',
multiple: 'Separate route for each site',
}
}" />
</div>
<table class="grid-table" v-if="perSiteRouting">
<thead>
<tr>
<th>Site</th>
<th class="w-2/3">Route</th>
</tr>
</thead>
<tbody>
<tr v-for="site in sites" :key="site.handle">
<td class="align-middle" v-text="site.name" />
<td>
<text-input
class="font-mono text-xs"
:value="value[site.handle]"
@input="updateSiteRoute(site.handle, $event)" />
</td>
</tr>
</tbody>
</table>
</div>

<div v-if="!hasMultipleSites || !perSiteRouting">
<text-input v-model="singleRoute" class="font-mono text-xs" />
</div>
</div>

</template>

<script>
export default {

mixins: [Fieldtype],

inject: ['storeName'],

data() {
return {
routeMode: null,
singleRoute: null,
}
},

created() {
this.routeMode = this.identicalRoutes ? 'single' : 'multiple';
},

computed: {

sites() {
let state = this.$store.state.publish[this.storeName];

if (!state.values.sites) return [];

return state.values.sites.map((handle, i) => {
return {
handle,
name: state.meta.sites.data[i].title
}
});
},

hasMultipleSites() {
return this.sites.length > 1;
},

perSiteRouting() {
return this.routeMode === 'multiple';
},

identicalRoutes() {
return _.uniq(Object.values(this.value)).length === 1;
}

},

watch: {

singleRoute(route) {
this.update(route);
},

routeMode(mode) {
if (mode === 'single') {
this.singleRoute = Object.values(this.value)[0];
} else {
let value = {};
this.sites.forEach(site => value[site.handle] = '');
this.update(value);
}
}

},

methods: {

updateSiteRoute(site, route) {
let value = this.value;
value[site] = route;
this.update(value);
}

}

}
</script>
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' Re-structuring by jasonvarga · Pull Request #1445 · statamic/cms · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
141 commits
Select commit Hold shift + click to select a range
18555ac
Editing entries gets a collection url ...
jasonvarga Feb 18, 2020
fe11a91
Only list "nav" structures. 404 when accessing collection structures.
jasonvarga Feb 18, 2020
6d0c018
Tests for not being able to edit or see collection structures
jasonvarga Feb 18, 2020
e38f907
Bring back and fix collection listing test
jasonvarga Feb 18, 2020
b68e381
Bring back and fix delete collection test
jasonvarga Feb 18, 2020
c57679c
Basic test for regular collection show page (entry listing)
jasonvarga Feb 18, 2020
4f07064
Remove empty state from view. It has a dedicated empty view.
jasonvarga Feb 19, 2020
e5e6ecf
Wrapper class is now bound in vue so we can change it on the fly
jasonvarga Feb 20, 2020
6ec1293
Bunch of collection/structure tweaks ...
jasonvarga Feb 20, 2020
9b33b22
Nav only shows non-collection structures
jasonvarga Feb 20, 2020
a6a6eff
Remove old unused imported components
jasonvarga Feb 20, 2020
9cae342
Initial renaming of structures to navigation
jasonvarga Feb 20, 2020
9230a27
Change first page to first link
jasonvarga Feb 20, 2020
eb662d5
Remove collection-structure specific fields and logic from edit and u…
jasonvarga Feb 20, 2020
46e7b3f
Change structure wizard to create form, and just store title and handle.
jasonvarga Feb 21, 2020
f5d807d
Add link dropdown only appears if collections have been provided. Oth…
jasonvarga Feb 21, 2020
172b946
Validate integer as one
jasonvarga Feb 21, 2020
b332142
Prop was renamed
jasonvarga Feb 21, 2020
9320ca3
Include max depth in form
jasonvarga Feb 21, 2020
9436c17
Adjust header
jasonvarga Feb 21, 2020
9594bc5
Make it a select
jasonvarga Feb 21, 2020
2f087fb
Remove icon
jasonvarga Feb 21, 2020
9e5220b
Use selects
jasonvarga Feb 21, 2020
d9c9ff0
Move structure inline
jasonvarga Feb 24, 2020
9aaf2dc
No route necessary in non-collection structures
jasonvarga Feb 24, 2020
70da200
Collection structures are stored on the collection ...
jasonvarga Feb 24, 2020
7995cdc
Move the Facades\Nav class, used to modify the CP's side navigation, …
jasonvarga Feb 25, 2020
df64acf
Root is now part of the tree ...
jasonvarga Feb 25, 2020
38cdbf2
Nav and structure tweaks ...
jasonvarga Feb 26, 2020
6bf964f
Nav tag without params defaults to the pages collection structure
jasonvarga Feb 26, 2020
64db75c
Structure and nav tags can specify collections when using shorthand
jasonvarga Feb 26, 2020
8dc1272
Nav/structure tweakies ...
jasonvarga Feb 27, 2020
9e84a1e
Saving a collection structure saves it into the collection
jasonvarga Feb 27, 2020
b3e639c
Structure pages can be saved
jasonvarga Feb 27, 2020
6be12e9
Adjust permissions
jasonvarga Feb 27, 2020
876fef6
Hook up max depth
jasonvarga Feb 27, 2020
a024091
Only show the tree view option when there's a structure and max depth…
jasonvarga Feb 27, 2020
1ae79b2
Entries can be reordered using the structure
jasonvarga Mar 2, 2020
06a78ba
The orderability of a collection comes from its structure ...
jasonvarga Mar 2, 2020
b554c17
Adjust collection crud ...
jasonvarga Mar 2, 2020
e164d0f
Collection structures will automatically add entries not in the tree.…
jasonvarga Mar 2, 2020
5561bf6
Require version of blink that fixed numeric keys issue
jasonvarga Mar 2, 2020
49daccd
Remove old logic to add missing entries to the tree yaml
jasonvarga Mar 2, 2020
19783bb
Create first link button instead of entry
jasonvarga Mar 2, 2020
00bcd3b
Set the initial view when mounted. The 'immediate' watcher was kickin…
jasonvarga Mar 2, 2020
e4e7b18
Adjust breadcrumbs to not use old structure urls
jasonvarga Mar 2, 2020
2121e37
Blink the collection's structure
jasonvarga Mar 2, 2020
5a86c01
Pages forward calls onto the entry
jasonvarga Mar 4, 2020
633b4d0
Pages can redirect to their first child
jasonvarga Mar 4, 2020
0c36dd9
Initial redirect fieldtype
jasonvarga Mar 4, 2020
6f9f71a
If it's required, don't show the toggle
jasonvarga Mar 4, 2020
e9213cc
Entry can get its corresponding page
jasonvarga Mar 4, 2020
acae134
Redirects can be resolved through entries
jasonvarga Mar 4, 2020
82cade4
Handle nulls and 404 as an integer
jasonvarga Mar 4, 2020
bdb10a1
Redirect tag allows wildcard syntax, and accept Redirect fieldtype va…
jasonvarga Mar 4, 2020
63d40c8
Use mockery directly to make a partial mock ...
jasonvarga Mar 4, 2020
4a1b565
Dupe partialMock so its available in earlier Laravel versions for CI
jasonvarga Mar 4, 2020
c98a9a0
Entry link blueprint is appended on the fly so users can create redir…
jasonvarga Mar 4, 2020
c3db410
Revert forwarding calls. (5a86c01e) Instead, manually get from the en…
jasonvarga Mar 5, 2020
5d28aa8
Move nav and collection specific stuff outside into their respective …
jasonvarga Mar 5, 2020
704707e
Use the handle, not the whole blueprint
jasonvarga Mar 5, 2020
48cdaf9
Merge branch 'master' into feature/structure-redux
jasonvarga Mar 5, 2020
f53079f
Remove the entry from the structure when its deleted.
jasonvarga Mar 5, 2020
f970009
Separate route for updating a collection's structure. Entry deletion …
jasonvarga Mar 5, 2020
d83e2b6
Tests for f9700099 and add authorization
jasonvarga Mar 5, 2020
e97c332
Fix class
jasonvarga Mar 5, 2020
cfa7960
Needs a collection in here now
jasonvarga Mar 5, 2020
6d9d4ec
Merge branch 'master' into feature/structure-redux
jasonvarga Mar 5, 2020
9afb03c
Option to delete or orphan child entries when deleting an entry.
jasonvarga Mar 6, 2020
3c4e597
Extract to a method to tidy it up
jasonvarga Mar 6, 2020
be95b88
When deleting an entry, its child pages should be moved to the top le…
jasonvarga Mar 6, 2020
a85557b
Use v-if so changing views triggers fresh data ...
jasonvarga Mar 6, 2020
d74cfc8
Adjust messaging for the number of children
jasonvarga Mar 6, 2020
04798c9
Add remove page confirmation to navs
jasonvarga Mar 6, 2020
245376f
Orphaned pages go to the parent instead of all the way to the top (wi…
jasonvarga Mar 6, 2020
9aa3e54
no fancy pee haetch pees
jasonvarga Mar 6, 2020
c3d046e
Update structure when an entry is deleted by hand ...
jasonvarga Mar 9, 2020
e65037b
Remove temp var
jasonvarga Mar 9, 2020
38ca9d9
Fix editing of branches
jasonvarga Mar 9, 2020
24365b7
Revert the revert (c3db4109) and allow forwarding calls to the entry …
jasonvarga Mar 9, 2020
74b2f77
URL handling on routable/entries for redirects
jasonvarga Mar 9, 2020
7bb6959
Redirect handling on pages
jasonvarga Mar 9, 2020
54e2dbb
Populate root and max depth
jasonvarga Mar 9, 2020
d28b6f3
Collection tag will filter out links/redirects by default and provide…
jasonvarga Mar 9, 2020
a6f04e3
Make isRedirect work for non entries
jasonvarga Mar 10, 2020
2e263cc
Adjust path
jasonvarga Mar 10, 2020
60b8d73
Root doesnt need to be set on the tree anymore
jasonvarga Mar 10, 2020
ce71554
The sites now just come from whether the files exist. No need for a v…
jasonvarga Mar 10, 2020
0205497
The key is tree, regardless of whether it's multisite. If its a singl…
jasonvarga Mar 10, 2020
ec3a3dc
Update multisite command to handle updated nav location
jasonvarga Mar 10, 2020
d6c03fb
Params should have been on showUrl, not editUrl
jasonvarga Mar 10, 2020
97d47d6
Site selector for navs
jasonvarga Mar 10, 2020
2205da9
Remove unnecessary stuff
jasonvarga Mar 10, 2020
575b134
Bring up to speed with the collection edit form ui
jasonvarga Mar 10, 2020
9653ae7
Sites fieldtype
jasonvarga Mar 10, 2020
9a39717
Structure sites are unnecessary. A nav's sites are determined by whet…
jasonvarga Mar 10, 2020
dc2fb11
Nav sites tweaks ...
jasonvarga Mar 10, 2020
47e4a58
Only show the selector when there's more than 1 site.
jasonvarga Mar 10, 2020
f236d5e
Collection route and site tweaks ...
jasonvarga Mar 11, 2020
287c20e
Collection edit tweaks ...
jasonvarga Mar 11, 2020
f0c1acb
Remove unused structure sites fieldtype
jasonvarga Mar 11, 2020
4bb18df
Allow site switching on collection structures
jasonvarga Mar 11, 2020
ef53dc8
Tidy
jasonvarga Mar 11, 2020
fceaf3d
Tree tweaks ...
jasonvarga Mar 11, 2020
1b65df1
Fix structure box on getting started widget. Empty the translation so…
jasonvarga Mar 12, 2020
3f53408
Link to the nav's showUrl ...
jasonvarga Mar 12, 2020
de77f9f
window isnt available there
jasonvarga Mar 12, 2020
5f14dce
Move empty state to a slot
jasonvarga Mar 12, 2020
1644a5f
Remove old stuff
jasonvarga Mar 12, 2020
e08e1c9
Support the "from" parameter on the nav tag when using a collection
jasonvarga Mar 12, 2020
a9cda49
Reset the structure appropriately when setting
jasonvarga Mar 12, 2020
010ccc4
Remove the fix ...
jasonvarga Mar 12, 2020
84281e4
A collection with multiple sites, but only one tree defined in the ya…
jasonvarga Mar 12, 2020
afff09e
Merge branch 'master' into feature/structure-redux
jasonvarga Mar 12, 2020
7600348
Redirect field can select entry
jasonvarga Mar 12, 2020
032fbc5
Remove the entry value when changing option
jasonvarga Mar 12, 2020
6fcbbd2
Automatically open the selector when changing to entries
jasonvarga Mar 12, 2020
c856f3d
Save null when no entry is selected
jasonvarga Mar 12, 2020
4d1ea7a
Make it a regular test case to fix facades
jasonvarga Mar 12, 2020
ca47f56
Use new btn-group style
jasonvarga Mar 13, 2020
aaf1162
Uniform padding
jasonvarga Mar 13, 2020
c97f65e
Bring back old store class, deprecated, to prevent an error to ease m…
jasonvarga Mar 13, 2020
905f74c
Remove old routes fieldtype
jasonvarga Mar 13, 2020
8bd21f7
Set sites where necessary
jasonvarga Mar 13, 2020
870a084
Prevent error when not using multisite
jasonvarga Mar 13, 2020
f0775ef
Bring back update collection test basics
jasonvarga Mar 16, 2020
00f165c
Collection structure trees just come from the sites
jasonvarga Mar 16, 2020
5126245
Tidy. There will always be a value.
jasonvarga Mar 16, 2020
8eebd48
Conditionally show them
jasonvarga Mar 16, 2020
5958f00
Remove outdated method
jasonvarga Mar 16, 2020
4ba76e1
Increase width to fit "first child" option
jasonvarga Mar 16, 2020
215f1fd
Populate the data using the value if an entry has been selected
jasonvarga Mar 16, 2020
7a2c88a
Update the meta where necessary ...
jasonvarga Mar 16, 2020
be49de8
Merge branch 'master' into feature/structure-redux
jasonvarga Mar 16, 2020
71990cd
Add chevron to imply there are options
jasonvarga Mar 16, 2020
067b47e
:lipstick: Fix button specificicicicity
jackmcdade Mar 16, 2020
785c07c
Add chevron to imply there are options
jasonvarga Mar 16, 2020
a6eb93a
:lipstick: Replace flat togglers with clicky togglers
jackmcdade Mar 16, 2020
b10a6a0
:lipstick: Wangjangle some margins
jackmcdade Mar 17, 2020
5576daa
:lipstick: Add title header to the blueprint picker
jackmcdade Mar 17, 2020
84a16f9
Support cmd+clicking to open new entry in a new window
jasonvarga Mar 17, 2020
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
2 changes: 1 addition & 1 deletion composer.json
Original file line numberDiff line numberDiff line change
Expand Up@@ -20,7 +20,7 @@
"pixelfear/composer-dist-plugin": "^0.1.0",
"scrumpy/html-to-prosemirror": "^0.6.0",
"scrumpy/prosemirror-to-html": "^0.8.0",
"spatie/blink": "^1.1",
"spatie/blink": "^1.1.2",
"statamic/stringy": "^3.1",
"symfony/var-exporter": "^4.3",
"symfony/yaml": "^4.1@dev",
Expand Down
6 changes: 3 additions & 3 deletions config/stache.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -48,9 +48,9 @@
'directory' => base_path('content/collections'),
],

'structures' => [
'class' => Stores\StructuresStore::class,
'directory' => base_path('content/structures'),
'navigation' => [
'class' => Stores\NavigationStore::class,
'directory' => base_path('content/navigation'),
],

'globals' => [
Expand Down
11 changes: 11 additions & 0 deletions resources/blueprints/entry_link.yaml
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
title: Link
fields:
-
handle: title
field:
type: text
-
handle: redirect
field:
type: redirect
required: true
13 changes: 9 additions & 4 deletions resources/js/app.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -103,7 +103,6 @@ Statamic.app({
components: {
GlobalSearch: require('./components/GlobalSearch.vue').default,
SiteSelector: require('./components/SiteSelector.vue').default,
PageTree: require('./components/structures/PageTree.vue').default,
Login: require('./components/login/login'),
LoginModal: require('./components/login/LoginModal.vue').default,
BaseEntryCreateForm: require('./components/entries/BaseCreateForm.vue').default,
Expand All@@ -128,10 +127,12 @@ Statamic.app({
CollectionCreateForm: require('./components/collections/CreateForm.vue').default,
CollectionScaffolder: require('./components/collections/Scaffolder.vue').default,
CollectionEditForm: require('./components/collections/EditForm.vue').default,
CollectionView: require('./components/collections/View.vue').default,
SessionExpiry: require('./components/SessionExpiry.vue').default,
StructureWizard: require('./components/structures/Wizard.vue').default,
StructureListing: require('./components/structures/Listing.vue').default,
StructureEditForm: require('./components/structures/EditForm.vue').default,
NavigationListing: require('./components/navigation/Listing.vue').default,
NavigationCreateForm: require('./components/navigation/CreateForm.vue').default,
NavigationEditForm: require('./components/navigation/EditForm.vue').default,
NavigationView: require('./components/navigation/View.vue').default,
Stacks: require('./components/stacks/Stacks.vue').default,
TaxonomyWizard: require('./components/taxonomies/Wizard.vue').default,
TaxonomyEditForm: require('./components/taxonomies/EditForm.vue').default,
Expand DownExpand Up@@ -163,6 +164,10 @@ Statamic.app({

stackCount() {
return this.$stacks.count();
},

wrapperClass() {
return this.$config.get('wrapperClass', 'max-w-xl');
}

},
Expand Down
5 changes: 2 additions & 3 deletions resources/js/bootstrap/fieldtypes.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,7 +13,6 @@ Vue.component('slug-fieldtype', require('../components/fieldtypes/SlugFieldtype.
// Fieldtypes
import FieldsetFieldtype from '../components/fieldtypes/FieldsetFieldtype.vue'
import RevealerFieldtype from '../components/fieldtypes/RevealerFieldtype.vue'
import RoutesFieldtype from '../components/fieldtypes/RoutesFieldtype.vue'
import StatusFieldtype from '../components/fieldtypes/StatusFieldtype.vue'
import TemplateFieldtype from '../components/fieldtypes/TemplateFieldtype.vue'

Expand All@@ -25,6 +24,7 @@ Vue.component('bard-fieldtype', require('../components/fieldtypes/bard/BardField
Vue.component('bard_buttons_setting-fieldtype', require('../components/fieldtypes/bard/BardButtonsSettingFieldtype.vue').default);
Vue.component('checkboxes-fieldtype', require('../components/fieldtypes/CheckboxesFieldtype.vue').default);
Vue.component('code-fieldtype', require('../components/fieldtypes/CodeFieldtype.vue').default);
Vue.component('collection_routes-fieldtype', require('../components/collections/Routes.vue').default);
Vue.component('color-fieldtype', require('../components/fieldtypes/ColorFieldtype.vue').default);
Vue.component('date-fieldtype', require('../components/fieldtypes/DateFieldtype.vue').default);
Vue.component('fieldset-fieldtype', FieldsetFieldtype);
Expand All@@ -37,17 +37,16 @@ Vue.component('list-fieldtype', require('../components/fieldtypes/ListFieldtype.
Vue.component('markdown-fieldtype', require('../components/fieldtypes/MarkdownFieldtype.vue').default);
Vue.component('radio-fieldtype', require('../components/fieldtypes/RadioFieldtype.vue').default);
Vue.component('range-fieldtype', require('../components/fieldtypes/RangeFieldtype.vue').default);
Vue.component('redirect-fieldtype', require('../components/fieldtypes/RedirectFieldtype.vue').default);
Vue.component('relationship-fieldtype', require('../components/fieldtypes/relationship/RelationshipFieldtype.vue').default);
Vue.component('relationship-fieldtype-index', require('../components/fieldtypes/relationship/RelationshipIndexFieldtype.vue').default);
Vue.component('replicator-fieldtype', require('../components/fieldtypes/replicator/Replicator.vue').default);
Vue.component('replicator-fieldtype-index', require('../components/fieldtypes/replicator/ReplicatorIndex.vue').default);
Vue.component('revealer-fieldtype', RevealerFieldtype);
Vue.component('routes-fieldtype', RoutesFieldtype);
Vue.component('section-fieldtype', require('../components/fieldtypes/SectionFieldtype.vue').default);
Vue.component('select-fieldtype', require('../components/fieldtypes/SelectFieldtype.vue').default);
Vue.component('sets-fieldtype', require('../components/fieldtypes/replicator/SetsFieldtype.vue').default);
Vue.component('status-fieldtype', StatusFieldtype);
Vue.component('structure_sites-fieldtype', require('../components/structures/Sites.vue').default);
Vue.component('table-fieldtype', require('../components/fieldtypes/TableFieldtype.vue').default);
Vue.component('tags-fieldtype', require('../components/fieldtypes/TagsFieldtype.vue').default);
Vue.component('tags-fieldtype-index', require('../components/fieldtypes/TagsIndexFieldtype.vue').default);
Expand Down
4 changes: 2 additions & 2 deletions resources/js/components/DropdownItem.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,7 +12,7 @@ export default {
props: ['text', 'redirect', 'externalLink'],

methods: {
selectAndClose() {
selectAndClose($event) {
if (this.redirect) {
location.href = this.redirect;
return;
Expand All@@ -23,7 +23,7 @@ export default {
return;
}

this.$emit('click');
this.$emit('click', $event);

this.$parent.close();
}
Expand Down
42 changes: 42 additions & 0 deletions resources/js/components/collections/DeleteEntryConfirmation.vue
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
<template>

<modal name="delete-entry-confirmation" :pivotY="0.1" :overflow="false">
<div class="confirmation-modal flex flex-col h-full">
<div class="text-lg font-medium p-2 pb-0">
{{ __('Delete Entry') }}
</div>
<div class="flex-1 px-2 py-3 text-grey">
<p class="mb-2">Are you sure you want to delete this entry?</p>
<label class="flex items-center" v-if="children">
<input type="checkbox" class="mr-1" v-model="shouldDeleteChildren" />
{{ __n('Delete child entry|Delete :count child entries', children) }}
</label>
</div>
<div class="p-2 bg-grey-20 border-t flex items-center justify-end text-sm">
<button class="text-grey hover:text-grey-90"
@click="$emit('cancel')"
v-text="__('Cancel')" />
<button class="btn ml-2 btn-danger"
@click="$emit('confirm', shouldDeleteChildren)"
v-text="__('Delete')" />
</div>
</div>
</modal>

</template>

<script>
export default {

props: {
children: Number
},

data() {
return {
shouldDeleteChildren: false
}
}

}
</script>
6 changes: 1 addition & 5 deletions resources/js/components/collections/EditForm.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -33,14 +33,11 @@ export default {
blueprint: Object,
initialValues: Object,
meta: Object,
initialTitle: String,
url: String,
listingUrl: String,
url: String
},

data() {
return {
title: this.initialTitle,
values: this.initialValues,
error: null,
errors: {},
Expand All@@ -60,7 +57,6 @@ export default {

this.$axios.patch(this.url, this.values).then(response => {
this.saving = false;
this.title = response.data.title;
this.$toast.success(__('Saved'));
this.$refs.container.saved();
}).catch(e => this.handleAxiosError(e));
Expand Down
118 changes: 118 additions & 0 deletions resources/js/components/collections/Routes.vue
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
<template>

<div>
<div v-if="hasMultipleSites">
<div class="radio-fieldtype mb-1">
<radio-fieldtype handle="route_mode" v-model="routeMode" :config="{
inline: true,
options: {
single: 'Single route',
multiple: 'Separate route for each site',
}
}" />
</div>
<table class="grid-table" v-if="perSiteRouting">
<thead>
<tr>
<th>Site</th>
<th class="w-2/3">Route</th>
</tr>
</thead>
<tbody>
<tr v-for="site in sites" :key="site.handle">
<td class="align-middle" v-text="site.name" />
<td>
<text-input
class="font-mono text-xs"
:value="value[site.handle]"
@input="updateSiteRoute(site.handle, $event)" />
</td>
</tr>
</tbody>
</table>
</div>

<div v-if="!hasMultipleSites || !perSiteRouting">
<text-input v-model="singleRoute" class="font-mono text-xs" />
</div>
</div>

</template>

<script>
export default {

mixins: [Fieldtype],

inject: ['storeName'],

data() {
return {
routeMode: null,
singleRoute: null,
}
},

created() {
this.routeMode = this.identicalRoutes ? 'single' : 'multiple';
},

computed: {

sites() {
let state = this.$store.state.publish[this.storeName];

if (!state.values.sites) return [];

return state.values.sites.map((handle, i) => {
return {
handle,
name: state.meta.sites.data[i].title
}
});
},

hasMultipleSites() {
return this.sites.length > 1;
},

perSiteRouting() {
return this.routeMode === 'multiple';
},

identicalRoutes() {
return _.uniq(Object.values(this.value)).length === 1;
}

},

watch: {

singleRoute(route) {
this.update(route);
},

routeMode(mode) {
if (mode === 'single') {
this.singleRoute = Object.values(this.value)[0];
} else {
let value = {};
this.sites.forEach(site => value[site.handle] = '');
this.update(value);
}
}

},

methods: {

updateSiteRoute(site, route) {
let value = this.value;
value[site] = route;
this.update(value);
}

}

}
</script>
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ' Re-structuring by jasonvarga · Pull Request #1445 · statamic/cms · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
141 commits
Select commit Hold shift + click to select a range
18555ac
Editing entries gets a collection url ...
jasonvarga Feb 18, 2020
fe11a91
Only list "nav" structures. 404 when accessing collection structures.
jasonvarga Feb 18, 2020
6d0c018
Tests for not being able to edit or see collection structures
jasonvarga Feb 18, 2020
e38f907
Bring back and fix collection listing test
jasonvarga Feb 18, 2020
b68e381
Bring back and fix delete collection test
jasonvarga Feb 18, 2020
c57679c
Basic test for regular collection show page (entry listing)
jasonvarga Feb 18, 2020
4f07064
Remove empty state from view. It has a dedicated empty view.
jasonvarga Feb 19, 2020
e5e6ecf
Wrapper class is now bound in vue so we can change it on the fly
jasonvarga Feb 20, 2020
6ec1293
Bunch of collection/structure tweaks ...
jasonvarga Feb 20, 2020
9b33b22
Nav only shows non-collection structures
jasonvarga Feb 20, 2020
a6a6eff
Remove old unused imported components
jasonvarga Feb 20, 2020
9cae342
Initial renaming of structures to navigation
jasonvarga Feb 20, 2020
9230a27
Change first page to first link
jasonvarga Feb 20, 2020
eb662d5
Remove collection-structure specific fields and logic from edit and u…
jasonvarga Feb 20, 2020
46e7b3f
Change structure wizard to create form, and just store title and handle.
jasonvarga Feb 21, 2020
f5d807d
Add link dropdown only appears if collections have been provided. Oth…
jasonvarga Feb 21, 2020
172b946
Validate integer as one
jasonvarga Feb 21, 2020
b332142
Prop was renamed
jasonvarga Feb 21, 2020
9320ca3
Include max depth in form
jasonvarga Feb 21, 2020
9436c17
Adjust header
jasonvarga Feb 21, 2020
9594bc5
Make it a select
jasonvarga Feb 21, 2020
2f087fb
Remove icon
jasonvarga Feb 21, 2020
9e5220b
Use selects
jasonvarga Feb 21, 2020
d9c9ff0
Move structure inline
jasonvarga Feb 24, 2020
9aaf2dc
No route necessary in non-collection structures
jasonvarga Feb 24, 2020
70da200
Collection structures are stored on the collection ...
jasonvarga Feb 24, 2020
7995cdc
Move the Facades\Nav class, used to modify the CP's side navigation, …
jasonvarga Feb 25, 2020
df64acf
Root is now part of the tree ...
jasonvarga Feb 25, 2020
38cdbf2
Nav and structure tweaks ...
jasonvarga Feb 26, 2020
6bf964f
Nav tag without params defaults to the pages collection structure
jasonvarga Feb 26, 2020
64db75c
Structure and nav tags can specify collections when using shorthand
jasonvarga Feb 26, 2020
8dc1272
Nav/structure tweakies ...
jasonvarga Feb 27, 2020
9e84a1e
Saving a collection structure saves it into the collection
jasonvarga Feb 27, 2020
b3e639c
Structure pages can be saved
jasonvarga Feb 27, 2020
6be12e9
Adjust permissions
jasonvarga Feb 27, 2020
876fef6
Hook up max depth
jasonvarga Feb 27, 2020
a024091
Only show the tree view option when there's a structure and max depth…
jasonvarga Feb 27, 2020
1ae79b2
Entries can be reordered using the structure
jasonvarga Mar 2, 2020
06a78ba
The orderability of a collection comes from its structure ...
jasonvarga Mar 2, 2020
b554c17
Adjust collection crud ...
jasonvarga Mar 2, 2020
e164d0f
Collection structures will automatically add entries not in the tree.…
jasonvarga Mar 2, 2020
5561bf6
Require version of blink that fixed numeric keys issue
jasonvarga Mar 2, 2020
49daccd
Remove old logic to add missing entries to the tree yaml
jasonvarga Mar 2, 2020
19783bb
Create first link button instead of entry
jasonvarga Mar 2, 2020
00bcd3b
Set the initial view when mounted. The 'immediate' watcher was kickin…
jasonvarga Mar 2, 2020
e4e7b18
Adjust breadcrumbs to not use old structure urls
jasonvarga Mar 2, 2020
2121e37
Blink the collection's structure
jasonvarga Mar 2, 2020
5a86c01
Pages forward calls onto the entry
jasonvarga Mar 4, 2020
633b4d0
Pages can redirect to their first child
jasonvarga Mar 4, 2020
0c36dd9
Initial redirect fieldtype
jasonvarga Mar 4, 2020
6f9f71a
If it's required, don't show the toggle
jasonvarga Mar 4, 2020
e9213cc
Entry can get its corresponding page
jasonvarga Mar 4, 2020
acae134
Redirects can be resolved through entries
jasonvarga Mar 4, 2020
82cade4
Handle nulls and 404 as an integer
jasonvarga Mar 4, 2020
bdb10a1
Redirect tag allows wildcard syntax, and accept Redirect fieldtype va…
jasonvarga Mar 4, 2020
63d40c8
Use mockery directly to make a partial mock ...
jasonvarga Mar 4, 2020
4a1b565
Dupe partialMock so its available in earlier Laravel versions for CI
jasonvarga Mar 4, 2020
c98a9a0
Entry link blueprint is appended on the fly so users can create redir…
jasonvarga Mar 4, 2020
c3db410
Revert forwarding calls. (5a86c01e) Instead, manually get from the en…
jasonvarga Mar 5, 2020
5d28aa8
Move nav and collection specific stuff outside into their respective …
jasonvarga Mar 5, 2020
704707e
Use the handle, not the whole blueprint
jasonvarga Mar 5, 2020
48cdaf9
Merge branch 'master' into feature/structure-redux
jasonvarga Mar 5, 2020
f53079f
Remove the entry from the structure when its deleted.
jasonvarga Mar 5, 2020
f970009
Separate route for updating a collection's structure. Entry deletion …
jasonvarga Mar 5, 2020
d83e2b6
Tests for f9700099 and add authorization
jasonvarga Mar 5, 2020
e97c332
Fix class
jasonvarga Mar 5, 2020
cfa7960
Needs a collection in here now
jasonvarga Mar 5, 2020
6d9d4ec
Merge branch 'master' into feature/structure-redux
jasonvarga Mar 5, 2020
9afb03c
Option to delete or orphan child entries when deleting an entry.
jasonvarga Mar 6, 2020
3c4e597
Extract to a method to tidy it up
jasonvarga Mar 6, 2020
be95b88
When deleting an entry, its child pages should be moved to the top le…
jasonvarga Mar 6, 2020
a85557b
Use v-if so changing views triggers fresh data ...
jasonvarga Mar 6, 2020
d74cfc8
Adjust messaging for the number of children
jasonvarga Mar 6, 2020
04798c9
Add remove page confirmation to navs
jasonvarga Mar 6, 2020
245376f
Orphaned pages go to the parent instead of all the way to the top (wi…
jasonvarga Mar 6, 2020
9aa3e54
no fancy pee haetch pees
jasonvarga Mar 6, 2020
c3d046e
Update structure when an entry is deleted by hand ...
jasonvarga Mar 9, 2020
e65037b
Remove temp var
jasonvarga Mar 9, 2020
38ca9d9
Fix editing of branches
jasonvarga Mar 9, 2020
24365b7
Revert the revert (c3db4109) and allow forwarding calls to the entry …
jasonvarga Mar 9, 2020
74b2f77
URL handling on routable/entries for redirects
jasonvarga Mar 9, 2020
7bb6959
Redirect handling on pages
jasonvarga Mar 9, 2020
54e2dbb
Populate root and max depth
jasonvarga Mar 9, 2020
d28b6f3
Collection tag will filter out links/redirects by default and provide…
jasonvarga Mar 9, 2020
a6f04e3
Make isRedirect work for non entries
jasonvarga Mar 10, 2020
2e263cc
Adjust path
jasonvarga Mar 10, 2020
60b8d73
Root doesnt need to be set on the tree anymore
jasonvarga Mar 10, 2020
ce71554
The sites now just come from whether the files exist. No need for a v…
jasonvarga Mar 10, 2020
0205497
The key is tree, regardless of whether it's multisite. If its a singl…
jasonvarga Mar 10, 2020
ec3a3dc
Update multisite command to handle updated nav location
jasonvarga Mar 10, 2020
d6c03fb
Params should have been on showUrl, not editUrl
jasonvarga Mar 10, 2020
97d47d6
Site selector for navs
jasonvarga Mar 10, 2020
2205da9
Remove unnecessary stuff
jasonvarga Mar 10, 2020
575b134
Bring up to speed with the collection edit form ui
jasonvarga Mar 10, 2020
9653ae7
Sites fieldtype
jasonvarga Mar 10, 2020
9a39717
Structure sites are unnecessary. A nav's sites are determined by whet…
jasonvarga Mar 10, 2020
dc2fb11
Nav sites tweaks ...
jasonvarga Mar 10, 2020
47e4a58
Only show the selector when there's more than 1 site.
jasonvarga Mar 10, 2020
f236d5e
Collection route and site tweaks ...
jasonvarga Mar 11, 2020
287c20e
Collection edit tweaks ...
jasonvarga Mar 11, 2020
f0c1acb
Remove unused structure sites fieldtype
jasonvarga Mar 11, 2020
4bb18df
Allow site switching on collection structures
jasonvarga Mar 11, 2020
ef53dc8
Tidy
jasonvarga Mar 11, 2020
fceaf3d
Tree tweaks ...
jasonvarga Mar 11, 2020
1b65df1
Fix structure box on getting started widget. Empty the translation so…
jasonvarga Mar 12, 2020
3f53408
Link to the nav's showUrl ...
jasonvarga Mar 12, 2020
de77f9f
window isnt available there
jasonvarga Mar 12, 2020
5f14dce
Move empty state to a slot
jasonvarga Mar 12, 2020
1644a5f
Remove old stuff
jasonvarga Mar 12, 2020
e08e1c9
Support the "from" parameter on the nav tag when using a collection
jasonvarga Mar 12, 2020
a9cda49
Reset the structure appropriately when setting
jasonvarga Mar 12, 2020
010ccc4
Remove the fix ...
jasonvarga Mar 12, 2020
84281e4
A collection with multiple sites, but only one tree defined in the ya…
jasonvarga Mar 12, 2020
afff09e
Merge branch 'master' into feature/structure-redux
jasonvarga Mar 12, 2020
7600348
Redirect field can select entry
jasonvarga Mar 12, 2020
032fbc5
Remove the entry value when changing option
jasonvarga Mar 12, 2020
6fcbbd2
Automatically open the selector when changing to entries
jasonvarga Mar 12, 2020
c856f3d
Save null when no entry is selected
jasonvarga Mar 12, 2020
4d1ea7a
Make it a regular test case to fix facades
jasonvarga Mar 12, 2020
ca47f56
Use new btn-group style
jasonvarga Mar 13, 2020
aaf1162
Uniform padding
jasonvarga Mar 13, 2020
c97f65e
Bring back old store class, deprecated, to prevent an error to ease m…
jasonvarga Mar 13, 2020
905f74c
Remove old routes fieldtype
jasonvarga Mar 13, 2020
8bd21f7
Set sites where necessary
jasonvarga Mar 13, 2020
870a084
Prevent error when not using multisite
jasonvarga Mar 13, 2020
f0775ef
Bring back update collection test basics
jasonvarga Mar 16, 2020
00f165c
Collection structure trees just come from the sites
jasonvarga Mar 16, 2020
5126245
Tidy. There will always be a value.
jasonvarga Mar 16, 2020
8eebd48
Conditionally show them
jasonvarga Mar 16, 2020
5958f00
Remove outdated method
jasonvarga Mar 16, 2020
4ba76e1
Increase width to fit "first child" option
jasonvarga Mar 16, 2020
215f1fd
Populate the data using the value if an entry has been selected
jasonvarga Mar 16, 2020
7a2c88a
Update the meta where necessary ...
jasonvarga Mar 16, 2020
be49de8
Merge branch 'master' into feature/structure-redux
jasonvarga Mar 16, 2020
71990cd
Add chevron to imply there are options
jasonvarga Mar 16, 2020
067b47e
:lipstick: Fix button specificicicicity
jackmcdade Mar 16, 2020
785c07c
Add chevron to imply there are options
jasonvarga Mar 16, 2020
a6eb93a
:lipstick: Replace flat togglers with clicky togglers
jackmcdade Mar 16, 2020
b10a6a0
:lipstick: Wangjangle some margins
jackmcdade Mar 17, 2020
5576daa
:lipstick: Add title header to the blueprint picker
jackmcdade Mar 17, 2020
84a16f9
Support cmd+clicking to open new entry in a new window
jasonvarga Mar 17, 2020
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
2 changes: 1 addition & 1 deletion composer.json
Original file line numberDiff line numberDiff line change
Expand Up@@ -20,7 +20,7 @@
"pixelfear/composer-dist-plugin": "^0.1.0",
"scrumpy/html-to-prosemirror": "^0.6.0",
"scrumpy/prosemirror-to-html": "^0.8.0",
"spatie/blink": "^1.1",
"spatie/blink": "^1.1.2",
"statamic/stringy": "^3.1",
"symfony/var-exporter": "^4.3",
"symfony/yaml": "^4.1@dev",
Expand Down
6 changes: 3 additions & 3 deletions config/stache.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -48,9 +48,9 @@
'directory' => base_path('content/collections'),
],

'structures' => [
'class' => Stores\StructuresStore::class,
'directory' => base_path('content/structures'),
'navigation' => [
'class' => Stores\NavigationStore::class,
'directory' => base_path('content/navigation'),
],

'globals' => [
Expand Down
11 changes: 11 additions & 0 deletions resources/blueprints/entry_link.yaml
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
title: Link
fields:
-
handle: title
field:
type: text
-
handle: redirect
field:
type: redirect
required: true
13 changes: 9 additions & 4 deletions resources/js/app.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -103,7 +103,6 @@ Statamic.app({
components: {
GlobalSearch: require('./components/GlobalSearch.vue').default,
SiteSelector: require('./components/SiteSelector.vue').default,
PageTree: require('./components/structures/PageTree.vue').default,
Login: require('./components/login/login'),
LoginModal: require('./components/login/LoginModal.vue').default,
BaseEntryCreateForm: require('./components/entries/BaseCreateForm.vue').default,
Expand All@@ -128,10 +127,12 @@ Statamic.app({
CollectionCreateForm: require('./components/collections/CreateForm.vue').default,
CollectionScaffolder: require('./components/collections/Scaffolder.vue').default,
CollectionEditForm: require('./components/collections/EditForm.vue').default,
CollectionView: require('./components/collections/View.vue').default,
SessionExpiry: require('./components/SessionExpiry.vue').default,
StructureWizard: require('./components/structures/Wizard.vue').default,
StructureListing: require('./components/structures/Listing.vue').default,
StructureEditForm: require('./components/structures/EditForm.vue').default,
NavigationListing: require('./components/navigation/Listing.vue').default,
NavigationCreateForm: require('./components/navigation/CreateForm.vue').default,
NavigationEditForm: require('./components/navigation/EditForm.vue').default,
NavigationView: require('./components/navigation/View.vue').default,
Stacks: require('./components/stacks/Stacks.vue').default,
TaxonomyWizard: require('./components/taxonomies/Wizard.vue').default,
TaxonomyEditForm: require('./components/taxonomies/EditForm.vue').default,
Expand DownExpand Up@@ -163,6 +164,10 @@ Statamic.app({

stackCount() {
return this.$stacks.count();
},

wrapperClass() {
return this.$config.get('wrapperClass', 'max-w-xl');
}

},
Expand Down
5 changes: 2 additions & 3 deletions resources/js/bootstrap/fieldtypes.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,7 +13,6 @@ Vue.component('slug-fieldtype', require('../components/fieldtypes/SlugFieldtype.
// Fieldtypes
import FieldsetFieldtype from '../components/fieldtypes/FieldsetFieldtype.vue'
import RevealerFieldtype from '../components/fieldtypes/RevealerFieldtype.vue'
import RoutesFieldtype from '../components/fieldtypes/RoutesFieldtype.vue'
import StatusFieldtype from '../components/fieldtypes/StatusFieldtype.vue'
import TemplateFieldtype from '../components/fieldtypes/TemplateFieldtype.vue'

Expand All@@ -25,6 +24,7 @@ Vue.component('bard-fieldtype', require('../components/fieldtypes/bard/BardField
Vue.component('bard_buttons_setting-fieldtype', require('../components/fieldtypes/bard/BardButtonsSettingFieldtype.vue').default);
Vue.component('checkboxes-fieldtype', require('../components/fieldtypes/CheckboxesFieldtype.vue').default);
Vue.component('code-fieldtype', require('../components/fieldtypes/CodeFieldtype.vue').default);
Vue.component('collection_routes-fieldtype', require('../components/collections/Routes.vue').default);
Vue.component('color-fieldtype', require('../components/fieldtypes/ColorFieldtype.vue').default);
Vue.component('date-fieldtype', require('../components/fieldtypes/DateFieldtype.vue').default);
Vue.component('fieldset-fieldtype', FieldsetFieldtype);
Expand All@@ -37,17 +37,16 @@ Vue.component('list-fieldtype', require('../components/fieldtypes/ListFieldtype.
Vue.component('markdown-fieldtype', require('../components/fieldtypes/MarkdownFieldtype.vue').default);
Vue.component('radio-fieldtype', require('../components/fieldtypes/RadioFieldtype.vue').default);
Vue.component('range-fieldtype', require('../components/fieldtypes/RangeFieldtype.vue').default);
Vue.component('redirect-fieldtype', require('../components/fieldtypes/RedirectFieldtype.vue').default);
Vue.component('relationship-fieldtype', require('../components/fieldtypes/relationship/RelationshipFieldtype.vue').default);
Vue.component('relationship-fieldtype-index', require('../components/fieldtypes/relationship/RelationshipIndexFieldtype.vue').default);
Vue.component('replicator-fieldtype', require('../components/fieldtypes/replicator/Replicator.vue').default);
Vue.component('replicator-fieldtype-index', require('../components/fieldtypes/replicator/ReplicatorIndex.vue').default);
Vue.component('revealer-fieldtype', RevealerFieldtype);
Vue.component('routes-fieldtype', RoutesFieldtype);
Vue.component('section-fieldtype', require('../components/fieldtypes/SectionFieldtype.vue').default);
Vue.component('select-fieldtype', require('../components/fieldtypes/SelectFieldtype.vue').default);
Vue.component('sets-fieldtype', require('../components/fieldtypes/replicator/SetsFieldtype.vue').default);
Vue.component('status-fieldtype', StatusFieldtype);
Vue.component('structure_sites-fieldtype', require('../components/structures/Sites.vue').default);
Vue.component('table-fieldtype', require('../components/fieldtypes/TableFieldtype.vue').default);
Vue.component('tags-fieldtype', require('../components/fieldtypes/TagsFieldtype.vue').default);
Vue.component('tags-fieldtype-index', require('../components/fieldtypes/TagsIndexFieldtype.vue').default);
Expand Down
4 changes: 2 additions & 2 deletions resources/js/components/DropdownItem.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,7 +12,7 @@ export default {
props: ['text', 'redirect', 'externalLink'],

methods: {
selectAndClose() {
selectAndClose($event) {
if (this.redirect) {
location.href = this.redirect;
return;
Expand All@@ -23,7 +23,7 @@ export default {
return;
}

this.$emit('click');
this.$emit('click', $event);

this.$parent.close();
}
Expand Down
42 changes: 42 additions & 0 deletions resources/js/components/collections/DeleteEntryConfirmation.vue
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
<template>

<modal name="delete-entry-confirmation" :pivotY="0.1" :overflow="false">
<div class="confirmation-modal flex flex-col h-full">
<div class="text-lg font-medium p-2 pb-0">
{{ __('Delete Entry') }}
</div>
<div class="flex-1 px-2 py-3 text-grey">
<p class="mb-2">Are you sure you want to delete this entry?</p>
<label class="flex items-center" v-if="children">
<input type="checkbox" class="mr-1" v-model="shouldDeleteChildren" />
{{ __n('Delete child entry|Delete :count child entries', children) }}
</label>
</div>
<div class="p-2 bg-grey-20 border-t flex items-center justify-end text-sm">
<button class="text-grey hover:text-grey-90"
@click="$emit('cancel')"
v-text="__('Cancel')" />
<button class="btn ml-2 btn-danger"
@click="$emit('confirm', shouldDeleteChildren)"
v-text="__('Delete')" />
</div>
</div>
</modal>

</template>

<script>
export default {

props: {
children: Number
},

data() {
return {
shouldDeleteChildren: false
}
}

}
</script>
6 changes: 1 addition & 5 deletions resources/js/components/collections/EditForm.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -33,14 +33,11 @@ export default {
blueprint: Object,
initialValues: Object,
meta: Object,
initialTitle: String,
url: String,
listingUrl: String,
url: String
},

data() {
return {
title: this.initialTitle,
values: this.initialValues,
error: null,
errors: {},
Expand All@@ -60,7 +57,6 @@ export default {

this.$axios.patch(this.url, this.values).then(response => {
this.saving = false;
this.title = response.data.title;
this.$toast.success(__('Saved'));
this.$refs.container.saved();
}).catch(e => this.handleAxiosError(e));
Expand Down
118 changes: 118 additions & 0 deletions resources/js/components/collections/Routes.vue
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
<template>

<div>
<div v-if="hasMultipleSites">
<div class="radio-fieldtype mb-1">
<radio-fieldtype handle="route_mode" v-model="routeMode" :config="{
inline: true,
options: {
single: 'Single route',
multiple: 'Separate route for each site',
}
}" />
</div>
<table class="grid-table" v-if="perSiteRouting">
<thead>
<tr>
<th>Site</th>
<th class="w-2/3">Route</th>
</tr>
</thead>
<tbody>
<tr v-for="site in sites" :key="site.handle">
<td class="align-middle" v-text="site.name" />
<td>
<text-input
class="font-mono text-xs"
:value="value[site.handle]"
@input="updateSiteRoute(site.handle, $event)" />
</td>
</tr>
</tbody>
</table>
</div>

<div v-if="!hasMultipleSites || !perSiteRouting">
<text-input v-model="singleRoute" class="font-mono text-xs" />
</div>
</div>

</template>

<script>
export default {

mixins: [Fieldtype],

inject: ['storeName'],

data() {
return {
routeMode: null,
singleRoute: null,
}
},

created() {
this.routeMode = this.identicalRoutes ? 'single' : 'multiple';
},

computed: {

sites() {
let state = this.$store.state.publish[this.storeName];

if (!state.values.sites) return [];

return state.values.sites.map((handle, i) => {
return {
handle,
name: state.meta.sites.data[i].title
}
});
},

hasMultipleSites() {
return this.sites.length > 1;
},

perSiteRouting() {
return this.routeMode === 'multiple';
},

identicalRoutes() {
return _.uniq(Object.values(this.value)).length === 1;
}

},

watch: {

singleRoute(route) {
this.update(route);
},

routeMode(mode) {
if (mode === 'single') {
this.singleRoute = Object.values(this.value)[0];
} else {
let value = {};
this.sites.forEach(site => value[site.handle] = '');
this.update(value);
}
}

},

methods: {

updateSiteRoute(site, route) {
let value = this.value;
value[site] = route;
this.update(value);
}

}

}
</script>
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' Re-structuring by jasonvarga · Pull Request #1445 · statamic/cms · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
141 commits
Select commit Hold shift + click to select a range
18555ac
Editing entries gets a collection url ...
jasonvarga Feb 18, 2020
fe11a91
Only list "nav" structures. 404 when accessing collection structures.
jasonvarga Feb 18, 2020
6d0c018
Tests for not being able to edit or see collection structures
jasonvarga Feb 18, 2020
e38f907
Bring back and fix collection listing test
jasonvarga Feb 18, 2020
b68e381
Bring back and fix delete collection test
jasonvarga Feb 18, 2020
c57679c
Basic test for regular collection show page (entry listing)
jasonvarga Feb 18, 2020
4f07064
Remove empty state from view. It has a dedicated empty view.
jasonvarga Feb 19, 2020
e5e6ecf
Wrapper class is now bound in vue so we can change it on the fly
jasonvarga Feb 20, 2020
6ec1293
Bunch of collection/structure tweaks ...
jasonvarga Feb 20, 2020
9b33b22
Nav only shows non-collection structures
jasonvarga Feb 20, 2020
a6a6eff
Remove old unused imported components
jasonvarga Feb 20, 2020
9cae342
Initial renaming of structures to navigation
jasonvarga Feb 20, 2020
9230a27
Change first page to first link
jasonvarga Feb 20, 2020
eb662d5
Remove collection-structure specific fields and logic from edit and u…
jasonvarga Feb 20, 2020
46e7b3f
Change structure wizard to create form, and just store title and handle.
jasonvarga Feb 21, 2020
f5d807d
Add link dropdown only appears if collections have been provided. Oth…
jasonvarga Feb 21, 2020
172b946
Validate integer as one
jasonvarga Feb 21, 2020
b332142
Prop was renamed
jasonvarga Feb 21, 2020
9320ca3
Include max depth in form
jasonvarga Feb 21, 2020
9436c17
Adjust header
jasonvarga Feb 21, 2020
9594bc5
Make it a select
jasonvarga Feb 21, 2020
2f087fb
Remove icon
jasonvarga Feb 21, 2020
9e5220b
Use selects
jasonvarga Feb 21, 2020
d9c9ff0
Move structure inline
jasonvarga Feb 24, 2020
9aaf2dc
No route necessary in non-collection structures
jasonvarga Feb 24, 2020
70da200
Collection structures are stored on the collection ...
jasonvarga Feb 24, 2020
7995cdc
Move the Facades\Nav class, used to modify the CP's side navigation, …
jasonvarga Feb 25, 2020
df64acf
Root is now part of the tree ...
jasonvarga Feb 25, 2020
38cdbf2
Nav and structure tweaks ...
jasonvarga Feb 26, 2020
6bf964f
Nav tag without params defaults to the pages collection structure
jasonvarga Feb 26, 2020
64db75c
Structure and nav tags can specify collections when using shorthand
jasonvarga Feb 26, 2020
8dc1272
Nav/structure tweakies ...
jasonvarga Feb 27, 2020
9e84a1e
Saving a collection structure saves it into the collection
jasonvarga Feb 27, 2020
b3e639c
Structure pages can be saved
jasonvarga Feb 27, 2020
6be12e9
Adjust permissions
jasonvarga Feb 27, 2020
876fef6
Hook up max depth
jasonvarga Feb 27, 2020
a024091
Only show the tree view option when there's a structure and max depth…
jasonvarga Feb 27, 2020
1ae79b2
Entries can be reordered using the structure
jasonvarga Mar 2, 2020
06a78ba
The orderability of a collection comes from its structure ...
jasonvarga Mar 2, 2020
b554c17
Adjust collection crud ...
jasonvarga Mar 2, 2020
e164d0f
Collection structures will automatically add entries not in the tree.…
jasonvarga Mar 2, 2020
5561bf6
Require version of blink that fixed numeric keys issue
jasonvarga Mar 2, 2020
49daccd
Remove old logic to add missing entries to the tree yaml
jasonvarga Mar 2, 2020
19783bb
Create first link button instead of entry
jasonvarga Mar 2, 2020
00bcd3b
Set the initial view when mounted. The 'immediate' watcher was kickin…
jasonvarga Mar 2, 2020
e4e7b18
Adjust breadcrumbs to not use old structure urls
jasonvarga Mar 2, 2020
2121e37
Blink the collection's structure
jasonvarga Mar 2, 2020
5a86c01
Pages forward calls onto the entry
jasonvarga Mar 4, 2020
633b4d0
Pages can redirect to their first child
jasonvarga Mar 4, 2020
0c36dd9
Initial redirect fieldtype
jasonvarga Mar 4, 2020
6f9f71a
If it's required, don't show the toggle
jasonvarga Mar 4, 2020
e9213cc
Entry can get its corresponding page
jasonvarga Mar 4, 2020
acae134
Redirects can be resolved through entries
jasonvarga Mar 4, 2020
82cade4
Handle nulls and 404 as an integer
jasonvarga Mar 4, 2020
bdb10a1
Redirect tag allows wildcard syntax, and accept Redirect fieldtype va…
jasonvarga Mar 4, 2020
63d40c8
Use mockery directly to make a partial mock ...
jasonvarga Mar 4, 2020
4a1b565
Dupe partialMock so its available in earlier Laravel versions for CI
jasonvarga Mar 4, 2020
c98a9a0
Entry link blueprint is appended on the fly so users can create redir…
jasonvarga Mar 4, 2020
c3db410
Revert forwarding calls. (5a86c01e) Instead, manually get from the en…
jasonvarga Mar 5, 2020
5d28aa8
Move nav and collection specific stuff outside into their respective …
jasonvarga Mar 5, 2020
704707e
Use the handle, not the whole blueprint
jasonvarga Mar 5, 2020
48cdaf9
Merge branch 'master' into feature/structure-redux
jasonvarga Mar 5, 2020
f53079f
Remove the entry from the structure when its deleted.
jasonvarga Mar 5, 2020
f970009
Separate route for updating a collection's structure. Entry deletion …
jasonvarga Mar 5, 2020
d83e2b6
Tests for f9700099 and add authorization
jasonvarga Mar 5, 2020
e97c332
Fix class
jasonvarga Mar 5, 2020
cfa7960
Needs a collection in here now
jasonvarga Mar 5, 2020
6d9d4ec
Merge branch 'master' into feature/structure-redux
jasonvarga Mar 5, 2020
9afb03c
Option to delete or orphan child entries when deleting an entry.
jasonvarga Mar 6, 2020
3c4e597
Extract to a method to tidy it up
jasonvarga Mar 6, 2020
be95b88
When deleting an entry, its child pages should be moved to the top le…
jasonvarga Mar 6, 2020
a85557b
Use v-if so changing views triggers fresh data ...
jasonvarga Mar 6, 2020
d74cfc8
Adjust messaging for the number of children
jasonvarga Mar 6, 2020
04798c9
Add remove page confirmation to navs
jasonvarga Mar 6, 2020
245376f
Orphaned pages go to the parent instead of all the way to the top (wi…
jasonvarga Mar 6, 2020
9aa3e54
no fancy pee haetch pees
jasonvarga Mar 6, 2020
c3d046e
Update structure when an entry is deleted by hand ...
jasonvarga Mar 9, 2020
e65037b
Remove temp var
jasonvarga Mar 9, 2020
38ca9d9
Fix editing of branches
jasonvarga Mar 9, 2020
24365b7
Revert the revert (c3db4109) and allow forwarding calls to the entry …
jasonvarga Mar 9, 2020
74b2f77
URL handling on routable/entries for redirects
jasonvarga Mar 9, 2020
7bb6959
Redirect handling on pages
jasonvarga Mar 9, 2020
54e2dbb
Populate root and max depth
jasonvarga Mar 9, 2020
d28b6f3
Collection tag will filter out links/redirects by default and provide…
jasonvarga Mar 9, 2020
a6f04e3
Make isRedirect work for non entries
jasonvarga Mar 10, 2020
2e263cc
Adjust path
jasonvarga Mar 10, 2020
60b8d73
Root doesnt need to be set on the tree anymore
jasonvarga Mar 10, 2020
ce71554
The sites now just come from whether the files exist. No need for a v…
jasonvarga Mar 10, 2020
0205497
The key is tree, regardless of whether it's multisite. If its a singl…
jasonvarga Mar 10, 2020
ec3a3dc
Update multisite command to handle updated nav location
jasonvarga Mar 10, 2020
d6c03fb
Params should have been on showUrl, not editUrl
jasonvarga Mar 10, 2020
97d47d6
Site selector for navs
jasonvarga Mar 10, 2020
2205da9
Remove unnecessary stuff
jasonvarga Mar 10, 2020
575b134
Bring up to speed with the collection edit form ui
jasonvarga Mar 10, 2020
9653ae7
Sites fieldtype
jasonvarga Mar 10, 2020
9a39717
Structure sites are unnecessary. A nav's sites are determined by whet…
jasonvarga Mar 10, 2020
dc2fb11
Nav sites tweaks ...
jasonvarga Mar 10, 2020
47e4a58
Only show the selector when there's more than 1 site.
jasonvarga Mar 10, 2020
f236d5e
Collection route and site tweaks ...
jasonvarga Mar 11, 2020
287c20e
Collection edit tweaks ...
jasonvarga Mar 11, 2020
f0c1acb
Remove unused structure sites fieldtype
jasonvarga Mar 11, 2020
4bb18df
Allow site switching on collection structures
jasonvarga Mar 11, 2020
ef53dc8
Tidy
jasonvarga Mar 11, 2020
fceaf3d
Tree tweaks ...
jasonvarga Mar 11, 2020
1b65df1
Fix structure box on getting started widget. Empty the translation so…
jasonvarga Mar 12, 2020
3f53408
Link to the nav's showUrl ...
jasonvarga Mar 12, 2020
de77f9f
window isnt available there
jasonvarga Mar 12, 2020
5f14dce
Move empty state to a slot
jasonvarga Mar 12, 2020
1644a5f
Remove old stuff
jasonvarga Mar 12, 2020
e08e1c9
Support the "from" parameter on the nav tag when using a collection
jasonvarga Mar 12, 2020
a9cda49
Reset the structure appropriately when setting
jasonvarga Mar 12, 2020
010ccc4
Remove the fix ...
jasonvarga Mar 12, 2020
84281e4
A collection with multiple sites, but only one tree defined in the ya…
jasonvarga Mar 12, 2020
afff09e
Merge branch 'master' into feature/structure-redux
jasonvarga Mar 12, 2020
7600348
Redirect field can select entry
jasonvarga Mar 12, 2020
032fbc5
Remove the entry value when changing option
jasonvarga Mar 12, 2020
6fcbbd2
Automatically open the selector when changing to entries
jasonvarga Mar 12, 2020
c856f3d
Save null when no entry is selected
jasonvarga Mar 12, 2020
4d1ea7a
Make it a regular test case to fix facades
jasonvarga Mar 12, 2020
ca47f56
Use new btn-group style
jasonvarga Mar 13, 2020
aaf1162
Uniform padding
jasonvarga Mar 13, 2020
c97f65e
Bring back old store class, deprecated, to prevent an error to ease m…
jasonvarga Mar 13, 2020
905f74c
Remove old routes fieldtype
jasonvarga Mar 13, 2020
8bd21f7
Set sites where necessary
jasonvarga Mar 13, 2020
870a084
Prevent error when not using multisite
jasonvarga Mar 13, 2020
f0775ef
Bring back update collection test basics
jasonvarga Mar 16, 2020
00f165c
Collection structure trees just come from the sites
jasonvarga Mar 16, 2020
5126245
Tidy. There will always be a value.
jasonvarga Mar 16, 2020
8eebd48
Conditionally show them
jasonvarga Mar 16, 2020
5958f00
Remove outdated method
jasonvarga Mar 16, 2020
4ba76e1
Increase width to fit "first child" option
jasonvarga Mar 16, 2020
215f1fd
Populate the data using the value if an entry has been selected
jasonvarga Mar 16, 2020
7a2c88a
Update the meta where necessary ...
jasonvarga Mar 16, 2020
be49de8
Merge branch 'master' into feature/structure-redux
jasonvarga Mar 16, 2020
71990cd
Add chevron to imply there are options
jasonvarga Mar 16, 2020
067b47e
:lipstick: Fix button specificicicicity
jackmcdade Mar 16, 2020
785c07c
Add chevron to imply there are options
jasonvarga Mar 16, 2020
a6eb93a
:lipstick: Replace flat togglers with clicky togglers
jackmcdade Mar 16, 2020
b10a6a0
:lipstick: Wangjangle some margins
jackmcdade Mar 17, 2020
5576daa
:lipstick: Add title header to the blueprint picker
jackmcdade Mar 17, 2020
84a16f9
Support cmd+clicking to open new entry in a new window
jasonvarga Mar 17, 2020
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
2 changes: 1 addition & 1 deletion composer.json
Original file line numberDiff line numberDiff line change
Expand Up@@ -20,7 +20,7 @@
"pixelfear/composer-dist-plugin": "^0.1.0",
"scrumpy/html-to-prosemirror": "^0.6.0",
"scrumpy/prosemirror-to-html": "^0.8.0",
"spatie/blink": "^1.1",
"spatie/blink": "^1.1.2",
"statamic/stringy": "^3.1",
"symfony/var-exporter": "^4.3",
"symfony/yaml": "^4.1@dev",
Expand Down
6 changes: 3 additions & 3 deletions config/stache.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -48,9 +48,9 @@
'directory' => base_path('content/collections'),
],

'structures' => [
'class' => Stores\StructuresStore::class,
'directory' => base_path('content/structures'),
'navigation' => [
'class' => Stores\NavigationStore::class,
'directory' => base_path('content/navigation'),
],

'globals' => [
Expand Down
11 changes: 11 additions & 0 deletions resources/blueprints/entry_link.yaml
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
title: Link
fields:
-
handle: title
field:
type: text
-
handle: redirect
field:
type: redirect
required: true
13 changes: 9 additions & 4 deletions resources/js/app.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -103,7 +103,6 @@ Statamic.app({
components: {
GlobalSearch: require('./components/GlobalSearch.vue').default,
SiteSelector: require('./components/SiteSelector.vue').default,
PageTree: require('./components/structures/PageTree.vue').default,
Login: require('./components/login/login'),
LoginModal: require('./components/login/LoginModal.vue').default,
BaseEntryCreateForm: require('./components/entries/BaseCreateForm.vue').default,
Expand All@@ -128,10 +127,12 @@ Statamic.app({
CollectionCreateForm: require('./components/collections/CreateForm.vue').default,
CollectionScaffolder: require('./components/collections/Scaffolder.vue').default,
CollectionEditForm: require('./components/collections/EditForm.vue').default,
CollectionView: require('./components/collections/View.vue').default,
SessionExpiry: require('./components/SessionExpiry.vue').default,
StructureWizard: require('./components/structures/Wizard.vue').default,
StructureListing: require('./components/structures/Listing.vue').default,
StructureEditForm: require('./components/structures/EditForm.vue').default,
NavigationListing: require('./components/navigation/Listing.vue').default,
NavigationCreateForm: require('./components/navigation/CreateForm.vue').default,
NavigationEditForm: require('./components/navigation/EditForm.vue').default,
NavigationView: require('./components/navigation/View.vue').default,
Stacks: require('./components/stacks/Stacks.vue').default,
TaxonomyWizard: require('./components/taxonomies/Wizard.vue').default,
TaxonomyEditForm: require('./components/taxonomies/EditForm.vue').default,
Expand DownExpand Up@@ -163,6 +164,10 @@ Statamic.app({

stackCount() {
return this.$stacks.count();
},

wrapperClass() {
return this.$config.get('wrapperClass', 'max-w-xl');
}

},
Expand Down
5 changes: 2 additions & 3 deletions resources/js/bootstrap/fieldtypes.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,7 +13,6 @@ Vue.component('slug-fieldtype', require('../components/fieldtypes/SlugFieldtype.
// Fieldtypes
import FieldsetFieldtype from '../components/fieldtypes/FieldsetFieldtype.vue'
import RevealerFieldtype from '../components/fieldtypes/RevealerFieldtype.vue'
import RoutesFieldtype from '../components/fieldtypes/RoutesFieldtype.vue'
import StatusFieldtype from '../components/fieldtypes/StatusFieldtype.vue'
import TemplateFieldtype from '../components/fieldtypes/TemplateFieldtype.vue'

Expand All@@ -25,6 +24,7 @@ Vue.component('bard-fieldtype', require('../components/fieldtypes/bard/BardField
Vue.component('bard_buttons_setting-fieldtype', require('../components/fieldtypes/bard/BardButtonsSettingFieldtype.vue').default);
Vue.component('checkboxes-fieldtype', require('../components/fieldtypes/CheckboxesFieldtype.vue').default);
Vue.component('code-fieldtype', require('../components/fieldtypes/CodeFieldtype.vue').default);
Vue.component('collection_routes-fieldtype', require('../components/collections/Routes.vue').default);
Vue.component('color-fieldtype', require('../components/fieldtypes/ColorFieldtype.vue').default);
Vue.component('date-fieldtype', require('../components/fieldtypes/DateFieldtype.vue').default);
Vue.component('fieldset-fieldtype', FieldsetFieldtype);
Expand All@@ -37,17 +37,16 @@ Vue.component('list-fieldtype', require('../components/fieldtypes/ListFieldtype.
Vue.component('markdown-fieldtype', require('../components/fieldtypes/MarkdownFieldtype.vue').default);
Vue.component('radio-fieldtype', require('../components/fieldtypes/RadioFieldtype.vue').default);
Vue.component('range-fieldtype', require('../components/fieldtypes/RangeFieldtype.vue').default);
Vue.component('redirect-fieldtype', require('../components/fieldtypes/RedirectFieldtype.vue').default);
Vue.component('relationship-fieldtype', require('../components/fieldtypes/relationship/RelationshipFieldtype.vue').default);
Vue.component('relationship-fieldtype-index', require('../components/fieldtypes/relationship/RelationshipIndexFieldtype.vue').default);
Vue.component('replicator-fieldtype', require('../components/fieldtypes/replicator/Replicator.vue').default);
Vue.component('replicator-fieldtype-index', require('../components/fieldtypes/replicator/ReplicatorIndex.vue').default);
Vue.component('revealer-fieldtype', RevealerFieldtype);
Vue.component('routes-fieldtype', RoutesFieldtype);
Vue.component('section-fieldtype', require('../components/fieldtypes/SectionFieldtype.vue').default);
Vue.component('select-fieldtype', require('../components/fieldtypes/SelectFieldtype.vue').default);
Vue.component('sets-fieldtype', require('../components/fieldtypes/replicator/SetsFieldtype.vue').default);
Vue.component('status-fieldtype', StatusFieldtype);
Vue.component('structure_sites-fieldtype', require('../components/structures/Sites.vue').default);
Vue.component('table-fieldtype', require('../components/fieldtypes/TableFieldtype.vue').default);
Vue.component('tags-fieldtype', require('../components/fieldtypes/TagsFieldtype.vue').default);
Vue.component('tags-fieldtype-index', require('../components/fieldtypes/TagsIndexFieldtype.vue').default);
Expand Down
4 changes: 2 additions & 2 deletions resources/js/components/DropdownItem.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,7 +12,7 @@ export default {
props: ['text', 'redirect', 'externalLink'],

methods: {
selectAndClose() {
selectAndClose($event) {
if (this.redirect) {
location.href = this.redirect;
return;
Expand All@@ -23,7 +23,7 @@ export default {
return;
}

this.$emit('click');
this.$emit('click', $event);

this.$parent.close();
}
Expand Down
42 changes: 42 additions & 0 deletions resources/js/components/collections/DeleteEntryConfirmation.vue
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
<template>

<modal name="delete-entry-confirmation" :pivotY="0.1" :overflow="false">
<div class="confirmation-modal flex flex-col h-full">
<div class="text-lg font-medium p-2 pb-0">
{{ __('Delete Entry') }}
</div>
<div class="flex-1 px-2 py-3 text-grey">
<p class="mb-2">Are you sure you want to delete this entry?</p>
<label class="flex items-center" v-if="children">
<input type="checkbox" class="mr-1" v-model="shouldDeleteChildren" />
{{ __n('Delete child entry|Delete :count child entries', children) }}
</label>
</div>
<div class="p-2 bg-grey-20 border-t flex items-center justify-end text-sm">
<button class="text-grey hover:text-grey-90"
@click="$emit('cancel')"
v-text="__('Cancel')" />
<button class="btn ml-2 btn-danger"
@click="$emit('confirm', shouldDeleteChildren)"
v-text="__('Delete')" />
</div>
</div>
</modal>

</template>

<script>
export default {

props: {
children: Number
},

data() {
return {
shouldDeleteChildren: false
}
}

}
</script>
6 changes: 1 addition & 5 deletions resources/js/components/collections/EditForm.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -33,14 +33,11 @@ export default {
blueprint: Object,
initialValues: Object,
meta: Object,
initialTitle: String,
url: String,
listingUrl: String,
url: String
},

data() {
return {
title: this.initialTitle,
values: this.initialValues,
error: null,
errors: {},
Expand All@@ -60,7 +57,6 @@ export default {

this.$axios.patch(this.url, this.values).then(response => {
this.saving = false;
this.title = response.data.title;
this.$toast.success(__('Saved'));
this.$refs.container.saved();
}).catch(e => this.handleAxiosError(e));
Expand Down
118 changes: 118 additions & 0 deletions resources/js/components/collections/Routes.vue
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
<template>

<div>
<div v-if="hasMultipleSites">
<div class="radio-fieldtype mb-1">
<radio-fieldtype handle="route_mode" v-model="routeMode" :config="{
inline: true,
options: {
single: 'Single route',
multiple: 'Separate route for each site',
}
}" />
</div>
<table class="grid-table" v-if="perSiteRouting">
<thead>
<tr>
<th>Site</th>
<th class="w-2/3">Route</th>
</tr>
</thead>
<tbody>
<tr v-for="site in sites" :key="site.handle">
<td class="align-middle" v-text="site.name" />
<td>
<text-input
class="font-mono text-xs"
:value="value[site.handle]"
@input="updateSiteRoute(site.handle, $event)" />
</td>
</tr>
</tbody>
</table>
</div>

<div v-if="!hasMultipleSites || !perSiteRouting">
<text-input v-model="singleRoute" class="font-mono text-xs" />
</div>
</div>

</template>

<script>
export default {

mixins: [Fieldtype],

inject: ['storeName'],

data() {
return {
routeMode: null,
singleRoute: null,
}
},

created() {
this.routeMode = this.identicalRoutes ? 'single' : 'multiple';
},

computed: {

sites() {
let state = this.$store.state.publish[this.storeName];

if (!state.values.sites) return [];

return state.values.sites.map((handle, i) => {
return {
handle,
name: state.meta.sites.data[i].title
}
});
},

hasMultipleSites() {
return this.sites.length > 1;
},

perSiteRouting() {
return this.routeMode === 'multiple';
},

identicalRoutes() {
return _.uniq(Object.values(this.value)).length === 1;
}

},

watch: {

singleRoute(route) {
this.update(route);
},

routeMode(mode) {
if (mode === 'single') {
this.singleRoute = Object.values(this.value)[0];
} else {
let value = {};
this.sites.forEach(site => value[site.handle] = '');
this.update(value);
}
}

},

methods: {

updateSiteRoute(site, route) {
let value = this.value;
value[site] = route;
this.update(value);
}

}

}
</script>
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' Re-structuring by jasonvarga · Pull Request #1445 · statamic/cms · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
141 commits
Select commit Hold shift + click to select a range
18555ac
Editing entries gets a collection url ...
jasonvarga Feb 18, 2020
fe11a91
Only list "nav" structures. 404 when accessing collection structures.
jasonvarga Feb 18, 2020
6d0c018
Tests for not being able to edit or see collection structures
jasonvarga Feb 18, 2020
e38f907
Bring back and fix collection listing test
jasonvarga Feb 18, 2020
b68e381
Bring back and fix delete collection test
jasonvarga Feb 18, 2020
c57679c
Basic test for regular collection show page (entry listing)
jasonvarga Feb 18, 2020
4f07064
Remove empty state from view. It has a dedicated empty view.
jasonvarga Feb 19, 2020
e5e6ecf
Wrapper class is now bound in vue so we can change it on the fly
jasonvarga Feb 20, 2020
6ec1293
Bunch of collection/structure tweaks ...
jasonvarga Feb 20, 2020
9b33b22
Nav only shows non-collection structures
jasonvarga Feb 20, 2020
a6a6eff
Remove old unused imported components
jasonvarga Feb 20, 2020
9cae342
Initial renaming of structures to navigation
jasonvarga Feb 20, 2020
9230a27
Change first page to first link
jasonvarga Feb 20, 2020
eb662d5
Remove collection-structure specific fields and logic from edit and u…
jasonvarga Feb 20, 2020
46e7b3f
Change structure wizard to create form, and just store title and handle.
jasonvarga Feb 21, 2020
f5d807d
Add link dropdown only appears if collections have been provided. Oth…
jasonvarga Feb 21, 2020
172b946
Validate integer as one
jasonvarga Feb 21, 2020
b332142
Prop was renamed
jasonvarga Feb 21, 2020
9320ca3
Include max depth in form
jasonvarga Feb 21, 2020
9436c17
Adjust header
jasonvarga Feb 21, 2020
9594bc5
Make it a select
jasonvarga Feb 21, 2020
2f087fb
Remove icon
jasonvarga Feb 21, 2020
9e5220b
Use selects
jasonvarga Feb 21, 2020
d9c9ff0
Move structure inline
jasonvarga Feb 24, 2020
9aaf2dc
No route necessary in non-collection structures
jasonvarga Feb 24, 2020
70da200
Collection structures are stored on the collection ...
jasonvarga Feb 24, 2020
7995cdc
Move the Facades\Nav class, used to modify the CP's side navigation, …
jasonvarga Feb 25, 2020
df64acf
Root is now part of the tree ...
jasonvarga Feb 25, 2020
38cdbf2
Nav and structure tweaks ...
jasonvarga Feb 26, 2020
6bf964f
Nav tag without params defaults to the pages collection structure
jasonvarga Feb 26, 2020
64db75c
Structure and nav tags can specify collections when using shorthand
jasonvarga Feb 26, 2020
8dc1272
Nav/structure tweakies ...
jasonvarga Feb 27, 2020
9e84a1e
Saving a collection structure saves it into the collection
jasonvarga Feb 27, 2020
b3e639c
Structure pages can be saved
jasonvarga Feb 27, 2020
6be12e9
Adjust permissions
jasonvarga Feb 27, 2020
876fef6
Hook up max depth
jasonvarga Feb 27, 2020
a024091
Only show the tree view option when there's a structure and max depth…
jasonvarga Feb 27, 2020
1ae79b2
Entries can be reordered using the structure
jasonvarga Mar 2, 2020
06a78ba
The orderability of a collection comes from its structure ...
jasonvarga Mar 2, 2020
b554c17
Adjust collection crud ...
jasonvarga Mar 2, 2020
e164d0f
Collection structures will automatically add entries not in the tree.…
jasonvarga Mar 2, 2020
5561bf6
Require version of blink that fixed numeric keys issue
jasonvarga Mar 2, 2020
49daccd
Remove old logic to add missing entries to the tree yaml
jasonvarga Mar 2, 2020
19783bb
Create first link button instead of entry
jasonvarga Mar 2, 2020
00bcd3b
Set the initial view when mounted. The 'immediate' watcher was kickin…
jasonvarga Mar 2, 2020
e4e7b18
Adjust breadcrumbs to not use old structure urls
jasonvarga Mar 2, 2020
2121e37
Blink the collection's structure
jasonvarga Mar 2, 2020
5a86c01
Pages forward calls onto the entry
jasonvarga Mar 4, 2020
633b4d0
Pages can redirect to their first child
jasonvarga Mar 4, 2020
0c36dd9
Initial redirect fieldtype
jasonvarga Mar 4, 2020
6f9f71a
If it's required, don't show the toggle
jasonvarga Mar 4, 2020
e9213cc
Entry can get its corresponding page
jasonvarga Mar 4, 2020
acae134
Redirects can be resolved through entries
jasonvarga Mar 4, 2020
82cade4
Handle nulls and 404 as an integer
jasonvarga Mar 4, 2020
bdb10a1
Redirect tag allows wildcard syntax, and accept Redirect fieldtype va…
jasonvarga Mar 4, 2020
63d40c8
Use mockery directly to make a partial mock ...
jasonvarga Mar 4, 2020
4a1b565
Dupe partialMock so its available in earlier Laravel versions for CI
jasonvarga Mar 4, 2020
c98a9a0
Entry link blueprint is appended on the fly so users can create redir…
jasonvarga Mar 4, 2020
c3db410
Revert forwarding calls. (5a86c01e) Instead, manually get from the en…
jasonvarga Mar 5, 2020
5d28aa8
Move nav and collection specific stuff outside into their respective …
jasonvarga Mar 5, 2020
704707e
Use the handle, not the whole blueprint
jasonvarga Mar 5, 2020
48cdaf9
Merge branch 'master' into feature/structure-redux
jasonvarga Mar 5, 2020
f53079f
Remove the entry from the structure when its deleted.
jasonvarga Mar 5, 2020
f970009
Separate route for updating a collection's structure. Entry deletion …
jasonvarga Mar 5, 2020
d83e2b6
Tests for f9700099 and add authorization
jasonvarga Mar 5, 2020
e97c332
Fix class
jasonvarga Mar 5, 2020
cfa7960
Needs a collection in here now
jasonvarga Mar 5, 2020
6d9d4ec
Merge branch 'master' into feature/structure-redux
jasonvarga Mar 5, 2020
9afb03c
Option to delete or orphan child entries when deleting an entry.
jasonvarga Mar 6, 2020
3c4e597
Extract to a method to tidy it up
jasonvarga Mar 6, 2020
be95b88
When deleting an entry, its child pages should be moved to the top le…
jasonvarga Mar 6, 2020
a85557b
Use v-if so changing views triggers fresh data ...
jasonvarga Mar 6, 2020
d74cfc8
Adjust messaging for the number of children
jasonvarga Mar 6, 2020
04798c9
Add remove page confirmation to navs
jasonvarga Mar 6, 2020
245376f
Orphaned pages go to the parent instead of all the way to the top (wi…
jasonvarga Mar 6, 2020
9aa3e54
no fancy pee haetch pees
jasonvarga Mar 6, 2020
c3d046e
Update structure when an entry is deleted by hand ...
jasonvarga Mar 9, 2020
e65037b
Remove temp var
jasonvarga Mar 9, 2020
38ca9d9
Fix editing of branches
jasonvarga Mar 9, 2020
24365b7
Revert the revert (c3db4109) and allow forwarding calls to the entry …
jasonvarga Mar 9, 2020
74b2f77
URL handling on routable/entries for redirects
jasonvarga Mar 9, 2020
7bb6959
Redirect handling on pages
jasonvarga Mar 9, 2020
54e2dbb
Populate root and max depth
jasonvarga Mar 9, 2020
d28b6f3
Collection tag will filter out links/redirects by default and provide…
jasonvarga Mar 9, 2020
a6f04e3
Make isRedirect work for non entries
jasonvarga Mar 10, 2020
2e263cc
Adjust path
jasonvarga Mar 10, 2020
60b8d73
Root doesnt need to be set on the tree anymore
jasonvarga Mar 10, 2020
ce71554
The sites now just come from whether the files exist. No need for a v…
jasonvarga Mar 10, 2020
0205497
The key is tree, regardless of whether it's multisite. If its a singl…
jasonvarga Mar 10, 2020
ec3a3dc
Update multisite command to handle updated nav location
jasonvarga Mar 10, 2020
d6c03fb
Params should have been on showUrl, not editUrl
jasonvarga Mar 10, 2020
97d47d6
Site selector for navs
jasonvarga Mar 10, 2020
2205da9
Remove unnecessary stuff
jasonvarga Mar 10, 2020
575b134
Bring up to speed with the collection edit form ui
jasonvarga Mar 10, 2020
9653ae7
Sites fieldtype
jasonvarga Mar 10, 2020
9a39717
Structure sites are unnecessary. A nav's sites are determined by whet…
jasonvarga Mar 10, 2020
dc2fb11
Nav sites tweaks ...
jasonvarga Mar 10, 2020
47e4a58
Only show the selector when there's more than 1 site.
jasonvarga Mar 10, 2020
f236d5e
Collection route and site tweaks ...
jasonvarga Mar 11, 2020
287c20e
Collection edit tweaks ...
jasonvarga Mar 11, 2020
f0c1acb
Remove unused structure sites fieldtype
jasonvarga Mar 11, 2020
4bb18df
Allow site switching on collection structures
jasonvarga Mar 11, 2020
ef53dc8
Tidy
jasonvarga Mar 11, 2020
fceaf3d
Tree tweaks ...
jasonvarga Mar 11, 2020
1b65df1
Fix structure box on getting started widget. Empty the translation so…
jasonvarga Mar 12, 2020
3f53408
Link to the nav's showUrl ...
jasonvarga Mar 12, 2020
de77f9f
window isnt available there
jasonvarga Mar 12, 2020
5f14dce
Move empty state to a slot
jasonvarga Mar 12, 2020
1644a5f
Remove old stuff
jasonvarga Mar 12, 2020
e08e1c9
Support the "from" parameter on the nav tag when using a collection
jasonvarga Mar 12, 2020
a9cda49
Reset the structure appropriately when setting
jasonvarga Mar 12, 2020
010ccc4
Remove the fix ...
jasonvarga Mar 12, 2020
84281e4
A collection with multiple sites, but only one tree defined in the ya…
jasonvarga Mar 12, 2020
afff09e
Merge branch 'master' into feature/structure-redux
jasonvarga Mar 12, 2020
7600348
Redirect field can select entry
jasonvarga Mar 12, 2020
032fbc5
Remove the entry value when changing option
jasonvarga Mar 12, 2020
6fcbbd2
Automatically open the selector when changing to entries
jasonvarga Mar 12, 2020
c856f3d
Save null when no entry is selected
jasonvarga Mar 12, 2020
4d1ea7a
Make it a regular test case to fix facades
jasonvarga Mar 12, 2020
ca47f56
Use new btn-group style
jasonvarga Mar 13, 2020
aaf1162
Uniform padding
jasonvarga Mar 13, 2020
c97f65e
Bring back old store class, deprecated, to prevent an error to ease m…
jasonvarga Mar 13, 2020
905f74c
Remove old routes fieldtype
jasonvarga Mar 13, 2020
8bd21f7
Set sites where necessary
jasonvarga Mar 13, 2020
870a084
Prevent error when not using multisite
jasonvarga Mar 13, 2020
f0775ef
Bring back update collection test basics
jasonvarga Mar 16, 2020
00f165c
Collection structure trees just come from the sites
jasonvarga Mar 16, 2020
5126245
Tidy. There will always be a value.
jasonvarga Mar 16, 2020
8eebd48
Conditionally show them
jasonvarga Mar 16, 2020
5958f00
Remove outdated method
jasonvarga Mar 16, 2020
4ba76e1
Increase width to fit "first child" option
jasonvarga Mar 16, 2020
215f1fd
Populate the data using the value if an entry has been selected
jasonvarga Mar 16, 2020
7a2c88a
Update the meta where necessary ...
jasonvarga Mar 16, 2020
be49de8
Merge branch 'master' into feature/structure-redux
jasonvarga Mar 16, 2020
71990cd
Add chevron to imply there are options
jasonvarga Mar 16, 2020
067b47e
:lipstick: Fix button specificicicicity
jackmcdade Mar 16, 2020
785c07c
Add chevron to imply there are options
jasonvarga Mar 16, 2020
a6eb93a
:lipstick: Replace flat togglers with clicky togglers
jackmcdade Mar 16, 2020
b10a6a0
:lipstick: Wangjangle some margins
jackmcdade Mar 17, 2020
5576daa
:lipstick: Add title header to the blueprint picker
jackmcdade Mar 17, 2020
84a16f9
Support cmd+clicking to open new entry in a new window
jasonvarga Mar 17, 2020
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
2 changes: 1 addition & 1 deletion composer.json
Original file line numberDiff line numberDiff line change
Expand Up@@ -20,7 +20,7 @@
"pixelfear/composer-dist-plugin": "^0.1.0",
"scrumpy/html-to-prosemirror": "^0.6.0",
"scrumpy/prosemirror-to-html": "^0.8.0",
"spatie/blink": "^1.1",
"spatie/blink": "^1.1.2",
"statamic/stringy": "^3.1",
"symfony/var-exporter": "^4.3",
"symfony/yaml": "^4.1@dev",
Expand Down
6 changes: 3 additions & 3 deletions config/stache.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -48,9 +48,9 @@
'directory' => base_path('content/collections'),
],

'structures' => [
'class' => Stores\StructuresStore::class,
'directory' => base_path('content/structures'),
'navigation' => [
'class' => Stores\NavigationStore::class,
'directory' => base_path('content/navigation'),
],

'globals' => [
Expand Down
11 changes: 11 additions & 0 deletions resources/blueprints/entry_link.yaml
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
title: Link
fields:
-
handle: title
field:
type: text
-
handle: redirect
field:
type: redirect
required: true
13 changes: 9 additions & 4 deletions resources/js/app.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -103,7 +103,6 @@ Statamic.app({
components: {
GlobalSearch: require('./components/GlobalSearch.vue').default,
SiteSelector: require('./components/SiteSelector.vue').default,
PageTree: require('./components/structures/PageTree.vue').default,
Login: require('./components/login/login'),
LoginModal: require('./components/login/LoginModal.vue').default,
BaseEntryCreateForm: require('./components/entries/BaseCreateForm.vue').default,
Expand All@@ -128,10 +127,12 @@ Statamic.app({
CollectionCreateForm: require('./components/collections/CreateForm.vue').default,
CollectionScaffolder: require('./components/collections/Scaffolder.vue').default,
CollectionEditForm: require('./components/collections/EditForm.vue').default,
CollectionView: require('./components/collections/View.vue').default,
SessionExpiry: require('./components/SessionExpiry.vue').default,
StructureWizard: require('./components/structures/Wizard.vue').default,
StructureListing: require('./components/structures/Listing.vue').default,
StructureEditForm: require('./components/structures/EditForm.vue').default,
NavigationListing: require('./components/navigation/Listing.vue').default,
NavigationCreateForm: require('./components/navigation/CreateForm.vue').default,
NavigationEditForm: require('./components/navigation/EditForm.vue').default,
NavigationView: require('./components/navigation/View.vue').default,
Stacks: require('./components/stacks/Stacks.vue').default,
TaxonomyWizard: require('./components/taxonomies/Wizard.vue').default,
TaxonomyEditForm: require('./components/taxonomies/EditForm.vue').default,
Expand DownExpand Up@@ -163,6 +164,10 @@ Statamic.app({

stackCount() {
return this.$stacks.count();
},

wrapperClass() {
return this.$config.get('wrapperClass', 'max-w-xl');
}

},
Expand Down
5 changes: 2 additions & 3 deletions resources/js/bootstrap/fieldtypes.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,7 +13,6 @@ Vue.component('slug-fieldtype', require('../components/fieldtypes/SlugFieldtype.
// Fieldtypes
import FieldsetFieldtype from '../components/fieldtypes/FieldsetFieldtype.vue'
import RevealerFieldtype from '../components/fieldtypes/RevealerFieldtype.vue'
import RoutesFieldtype from '../components/fieldtypes/RoutesFieldtype.vue'
import StatusFieldtype from '../components/fieldtypes/StatusFieldtype.vue'
import TemplateFieldtype from '../components/fieldtypes/TemplateFieldtype.vue'

Expand All@@ -25,6 +24,7 @@ Vue.component('bard-fieldtype', require('../components/fieldtypes/bard/BardField
Vue.component('bard_buttons_setting-fieldtype', require('../components/fieldtypes/bard/BardButtonsSettingFieldtype.vue').default);
Vue.component('checkboxes-fieldtype', require('../components/fieldtypes/CheckboxesFieldtype.vue').default);
Vue.component('code-fieldtype', require('../components/fieldtypes/CodeFieldtype.vue').default);
Vue.component('collection_routes-fieldtype', require('../components/collections/Routes.vue').default);
Vue.component('color-fieldtype', require('../components/fieldtypes/ColorFieldtype.vue').default);
Vue.component('date-fieldtype', require('../components/fieldtypes/DateFieldtype.vue').default);
Vue.component('fieldset-fieldtype', FieldsetFieldtype);
Expand All@@ -37,17 +37,16 @@ Vue.component('list-fieldtype', require('../components/fieldtypes/ListFieldtype.
Vue.component('markdown-fieldtype', require('../components/fieldtypes/MarkdownFieldtype.vue').default);
Vue.component('radio-fieldtype', require('../components/fieldtypes/RadioFieldtype.vue').default);
Vue.component('range-fieldtype', require('../components/fieldtypes/RangeFieldtype.vue').default);
Vue.component('redirect-fieldtype', require('../components/fieldtypes/RedirectFieldtype.vue').default);
Vue.component('relationship-fieldtype', require('../components/fieldtypes/relationship/RelationshipFieldtype.vue').default);
Vue.component('relationship-fieldtype-index', require('../components/fieldtypes/relationship/RelationshipIndexFieldtype.vue').default);
Vue.component('replicator-fieldtype', require('../components/fieldtypes/replicator/Replicator.vue').default);
Vue.component('replicator-fieldtype-index', require('../components/fieldtypes/replicator/ReplicatorIndex.vue').default);
Vue.component('revealer-fieldtype', RevealerFieldtype);
Vue.component('routes-fieldtype', RoutesFieldtype);
Vue.component('section-fieldtype', require('../components/fieldtypes/SectionFieldtype.vue').default);
Vue.component('select-fieldtype', require('../components/fieldtypes/SelectFieldtype.vue').default);
Vue.component('sets-fieldtype', require('../components/fieldtypes/replicator/SetsFieldtype.vue').default);
Vue.component('status-fieldtype', StatusFieldtype);
Vue.component('structure_sites-fieldtype', require('../components/structures/Sites.vue').default);
Vue.component('table-fieldtype', require('../components/fieldtypes/TableFieldtype.vue').default);
Vue.component('tags-fieldtype', require('../components/fieldtypes/TagsFieldtype.vue').default);
Vue.component('tags-fieldtype-index', require('../components/fieldtypes/TagsIndexFieldtype.vue').default);
Expand Down
4 changes: 2 additions & 2 deletions resources/js/components/DropdownItem.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,7 +12,7 @@ export default {
props: ['text', 'redirect', 'externalLink'],

methods: {
selectAndClose() {
selectAndClose($event) {
if (this.redirect) {
location.href = this.redirect;
return;
Expand All@@ -23,7 +23,7 @@ export default {
return;
}

this.$emit('click');
this.$emit('click', $event);

this.$parent.close();
}
Expand Down
42 changes: 42 additions & 0 deletions resources/js/components/collections/DeleteEntryConfirmation.vue
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
<template>

<modal name="delete-entry-confirmation" :pivotY="0.1" :overflow="false">
<div class="confirmation-modal flex flex-col h-full">
<div class="text-lg font-medium p-2 pb-0">
{{ __('Delete Entry') }}
</div>
<div class="flex-1 px-2 py-3 text-grey">
<p class="mb-2">Are you sure you want to delete this entry?</p>
<label class="flex items-center" v-if="children">
<input type="checkbox" class="mr-1" v-model="shouldDeleteChildren" />
{{ __n('Delete child entry|Delete :count child entries', children) }}
</label>
</div>
<div class="p-2 bg-grey-20 border-t flex items-center justify-end text-sm">
<button class="text-grey hover:text-grey-90"
@click="$emit('cancel')"
v-text="__('Cancel')" />
<button class="btn ml-2 btn-danger"
@click="$emit('confirm', shouldDeleteChildren)"
v-text="__('Delete')" />
</div>
</div>
</modal>

</template>

<script>
export default {

props: {
children: Number
},

data() {
return {
shouldDeleteChildren: false
}
}

}
</script>
6 changes: 1 addition & 5 deletions resources/js/components/collections/EditForm.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -33,14 +33,11 @@ export default {
blueprint: Object,
initialValues: Object,
meta: Object,
initialTitle: String,
url: String,
listingUrl: String,
url: String
},

data() {
return {
title: this.initialTitle,
values: this.initialValues,
error: null,
errors: {},
Expand All@@ -60,7 +57,6 @@ export default {

this.$axios.patch(this.url, this.values).then(response => {
this.saving = false;
this.title = response.data.title;
this.$toast.success(__('Saved'));
this.$refs.container.saved();
}).catch(e => this.handleAxiosError(e));
Expand Down
118 changes: 118 additions & 0 deletions resources/js/components/collections/Routes.vue
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
<template>

<div>
<div v-if="hasMultipleSites">
<div class="radio-fieldtype mb-1">
<radio-fieldtype handle="route_mode" v-model="routeMode" :config="{
inline: true,
options: {
single: 'Single route',
multiple: 'Separate route for each site',
}
}" />
</div>
<table class="grid-table" v-if="perSiteRouting">
<thead>
<tr>
<th>Site</th>
<th class="w-2/3">Route</th>
</tr>
</thead>
<tbody>
<tr v-for="site in sites" :key="site.handle">
<td class="align-middle" v-text="site.name" />
<td>
<text-input
class="font-mono text-xs"
:value="value[site.handle]"
@input="updateSiteRoute(site.handle, $event)" />
</td>
</tr>
</tbody>
</table>
</div>

<div v-if="!hasMultipleSites || !perSiteRouting">
<text-input v-model="singleRoute" class="font-mono text-xs" />
</div>
</div>

</template>

<script>
export default {

mixins: [Fieldtype],

inject: ['storeName'],

data() {
return {
routeMode: null,
singleRoute: null,
}
},

created() {
this.routeMode = this.identicalRoutes ? 'single' : 'multiple';
},

computed: {

sites() {
let state = this.$store.state.publish[this.storeName];

if (!state.values.sites) return [];

return state.values.sites.map((handle, i) => {
return {
handle,
name: state.meta.sites.data[i].title
}
});
},

hasMultipleSites() {
return this.sites.length > 1;
},

perSiteRouting() {
return this.routeMode === 'multiple';
},

identicalRoutes() {
return _.uniq(Object.values(this.value)).length === 1;
}

},

watch: {

singleRoute(route) {
this.update(route);
},

routeMode(mode) {
if (mode === 'single') {
this.singleRoute = Object.values(this.value)[0];
} else {
let value = {};
this.sites.forEach(site => value[site.handle] = '');
this.update(value);
}
}

},

methods: {

updateSiteRoute(site, route) {
let value = this.value;
value[site] = route;
this.update(value);
}

}

}
</script>
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Universal Dark Mode - works on any site (function() { var enabled = true; function applyDarkMode() { if (!enabled) return; // Create style element if it doesn't exist var style = document.getElementById('universal-dark-mode-style'); if (!style) { style = document.createElement('style'); style.id = 'universal-dark-mode-style'; document.head.appendChild(style); } // Dark mode CSS - inverts colors but preserves images/video style.textContent = ' /* Invert everything except media */ html { filter: invert(1) hue-rotate(180deg) !important; background: #1a1a2e !important; } /* Restore images, videos, iframes, canvas */ img, video, iframe, canvas, svg, picture, [style*="background-image"] { filter: invert(1) hue-rotate(180deg) !important; } /* Preserve specific elements that should not be inverted */ .no-dark-mode, .no-dark-mode *, [data-theme="light"], [data-theme="light"], .ace_editor, .ace_editor *, .CodeMirror, .CodeMirror *, .monaco-editor, .monaco-editor *, .markdown-body pre, .markdown-body pre *, .highlight, .highlight *, pre code, pre code * { filter: none !important; } /* Fix common UI elements */ .modal, .popup, .dropdown-menu, .tooltip, .popover { filter: invert(1) hue-rotate(180deg) !important; background: #2d2d44 !important; border-color: #444 !important; } /* Scrollbars */ ::-webkit-scrollbar { background: #1a1a2e !important; } ::-webkit-scrollbar-thumb { background: #444 !important; } ::-webkit-scrollbar-thumb:hover { background: #555 !important; } /* Selection */ ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; } ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; } '; } function removeDarkMode() { var style = document.getElementById('universal-dark-mode-style'); if (style) style.remove(); } // Toggle with Alt+Shift+D document.addEventListener('keydown', function(e) { if (e.altKey && e.shiftKey && e.key === 'D') { e.preventDefault(); enabled = !enabled; if (enabled) { applyDarkMode(); console.log('[Universal Dark Mode] Enabled'); } else { removeDarkMode(); console.log('[Universal Dark Mode] Disabled'); } } }); // Apply on load applyDarkMode(); // Re-apply on dynamic content var observer = new MutationObserver(function(mutations) { if (enabled && !document.getElementById('universal-dark-mode-style')) { applyDarkMode(); } }); observer.observe(document.head, { childList: true }); console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle'); })(); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })(); Re-structuring by jasonvarga · Pull Request #1445 · statamic/cms · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
141 commits
Select commit Hold shift + click to select a range
18555ac
Editing entries gets a collection url ...
jasonvarga Feb 18, 2020
fe11a91
Only list "nav" structures. 404 when accessing collection structures.
jasonvarga Feb 18, 2020
6d0c018
Tests for not being able to edit or see collection structures
jasonvarga Feb 18, 2020
e38f907
Bring back and fix collection listing test
jasonvarga Feb 18, 2020
b68e381
Bring back and fix delete collection test
jasonvarga Feb 18, 2020
c57679c
Basic test for regular collection show page (entry listing)
jasonvarga Feb 18, 2020
4f07064
Remove empty state from view. It has a dedicated empty view.
jasonvarga Feb 19, 2020
e5e6ecf
Wrapper class is now bound in vue so we can change it on the fly
jasonvarga Feb 20, 2020
6ec1293
Bunch of collection/structure tweaks ...
jasonvarga Feb 20, 2020
9b33b22
Nav only shows non-collection structures
jasonvarga Feb 20, 2020
a6a6eff
Remove old unused imported components
jasonvarga Feb 20, 2020
9cae342
Initial renaming of structures to navigation
jasonvarga Feb 20, 2020
9230a27
Change first page to first link
jasonvarga Feb 20, 2020
eb662d5
Remove collection-structure specific fields and logic from edit and u…
jasonvarga Feb 20, 2020
46e7b3f
Change structure wizard to create form, and just store title and handle.
jasonvarga Feb 21, 2020
f5d807d
Add link dropdown only appears if collections have been provided. Oth…
jasonvarga Feb 21, 2020
172b946
Validate integer as one
jasonvarga Feb 21, 2020
b332142
Prop was renamed
jasonvarga Feb 21, 2020
9320ca3
Include max depth in form
jasonvarga Feb 21, 2020
9436c17
Adjust header
jasonvarga Feb 21, 2020
9594bc5
Make it a select
jasonvarga Feb 21, 2020
2f087fb
Remove icon
jasonvarga Feb 21, 2020
9e5220b
Use selects
jasonvarga Feb 21, 2020
d9c9ff0
Move structure inline
jasonvarga Feb 24, 2020
9aaf2dc
No route necessary in non-collection structures
jasonvarga Feb 24, 2020
70da200
Collection structures are stored on the collection ...
jasonvarga Feb 24, 2020
7995cdc
Move the Facades\Nav class, used to modify the CP's side navigation, …
jasonvarga Feb 25, 2020
df64acf
Root is now part of the tree ...
jasonvarga Feb 25, 2020
38cdbf2
Nav and structure tweaks ...
jasonvarga Feb 26, 2020
6bf964f
Nav tag without params defaults to the pages collection structure
jasonvarga Feb 26, 2020
64db75c
Structure and nav tags can specify collections when using shorthand
jasonvarga Feb 26, 2020
8dc1272
Nav/structure tweakies ...
jasonvarga Feb 27, 2020
9e84a1e
Saving a collection structure saves it into the collection
jasonvarga Feb 27, 2020
b3e639c
Structure pages can be saved
jasonvarga Feb 27, 2020
6be12e9
Adjust permissions
jasonvarga Feb 27, 2020
876fef6
Hook up max depth
jasonvarga Feb 27, 2020
a024091
Only show the tree view option when there's a structure and max depth…
jasonvarga Feb 27, 2020
1ae79b2
Entries can be reordered using the structure
jasonvarga Mar 2, 2020
06a78ba
The orderability of a collection comes from its structure ...
jasonvarga Mar 2, 2020
b554c17
Adjust collection crud ...
jasonvarga Mar 2, 2020
e164d0f
Collection structures will automatically add entries not in the tree.…
jasonvarga Mar 2, 2020
5561bf6
Require version of blink that fixed numeric keys issue
jasonvarga Mar 2, 2020
49daccd
Remove old logic to add missing entries to the tree yaml
jasonvarga Mar 2, 2020
19783bb
Create first link button instead of entry
jasonvarga Mar 2, 2020
00bcd3b
Set the initial view when mounted. The 'immediate' watcher was kickin…
jasonvarga Mar 2, 2020
e4e7b18
Adjust breadcrumbs to not use old structure urls
jasonvarga Mar 2, 2020
2121e37
Blink the collection's structure
jasonvarga Mar 2, 2020
5a86c01
Pages forward calls onto the entry
jasonvarga Mar 4, 2020
633b4d0
Pages can redirect to their first child
jasonvarga Mar 4, 2020
0c36dd9
Initial redirect fieldtype
jasonvarga Mar 4, 2020
6f9f71a
If it's required, don't show the toggle
jasonvarga Mar 4, 2020
e9213cc
Entry can get its corresponding page
jasonvarga Mar 4, 2020
acae134
Redirects can be resolved through entries
jasonvarga Mar 4, 2020
82cade4
Handle nulls and 404 as an integer
jasonvarga Mar 4, 2020
bdb10a1
Redirect tag allows wildcard syntax, and accept Redirect fieldtype va…
jasonvarga Mar 4, 2020
63d40c8
Use mockery directly to make a partial mock ...
jasonvarga Mar 4, 2020
4a1b565
Dupe partialMock so its available in earlier Laravel versions for CI
jasonvarga Mar 4, 2020
c98a9a0
Entry link blueprint is appended on the fly so users can create redir…
jasonvarga Mar 4, 2020
c3db410
Revert forwarding calls. (5a86c01e) Instead, manually get from the en…
jasonvarga Mar 5, 2020
5d28aa8
Move nav and collection specific stuff outside into their respective …
jasonvarga Mar 5, 2020
704707e
Use the handle, not the whole blueprint
jasonvarga Mar 5, 2020
48cdaf9
Merge branch 'master' into feature/structure-redux
jasonvarga Mar 5, 2020
f53079f
Remove the entry from the structure when its deleted.
jasonvarga Mar 5, 2020
f970009
Separate route for updating a collection's structure. Entry deletion …
jasonvarga Mar 5, 2020
d83e2b6
Tests for f9700099 and add authorization
jasonvarga Mar 5, 2020
e97c332
Fix class
jasonvarga Mar 5, 2020
cfa7960
Needs a collection in here now
jasonvarga Mar 5, 2020
6d9d4ec
Merge branch 'master' into feature/structure-redux
jasonvarga Mar 5, 2020
9afb03c
Option to delete or orphan child entries when deleting an entry.
jasonvarga Mar 6, 2020
3c4e597
Extract to a method to tidy it up
jasonvarga Mar 6, 2020
be95b88
When deleting an entry, its child pages should be moved to the top le…
jasonvarga Mar 6, 2020
a85557b
Use v-if so changing views triggers fresh data ...
jasonvarga Mar 6, 2020
d74cfc8
Adjust messaging for the number of children
jasonvarga Mar 6, 2020
04798c9
Add remove page confirmation to navs
jasonvarga Mar 6, 2020
245376f
Orphaned pages go to the parent instead of all the way to the top (wi…
jasonvarga Mar 6, 2020
9aa3e54
no fancy pee haetch pees
jasonvarga Mar 6, 2020
c3d046e
Update structure when an entry is deleted by hand ...
jasonvarga Mar 9, 2020
e65037b
Remove temp var
jasonvarga Mar 9, 2020
38ca9d9
Fix editing of branches
jasonvarga Mar 9, 2020
24365b7
Revert the revert (c3db4109) and allow forwarding calls to the entry …
jasonvarga Mar 9, 2020
74b2f77
URL handling on routable/entries for redirects
jasonvarga Mar 9, 2020
7bb6959
Redirect handling on pages
jasonvarga Mar 9, 2020
54e2dbb
Populate root and max depth
jasonvarga Mar 9, 2020
d28b6f3
Collection tag will filter out links/redirects by default and provide…
jasonvarga Mar 9, 2020
a6f04e3
Make isRedirect work for non entries
jasonvarga Mar 10, 2020
2e263cc
Adjust path
jasonvarga Mar 10, 2020
60b8d73
Root doesnt need to be set on the tree anymore
jasonvarga Mar 10, 2020
ce71554
The sites now just come from whether the files exist. No need for a v…
jasonvarga Mar 10, 2020
0205497
The key is tree, regardless of whether it's multisite. If its a singl…
jasonvarga Mar 10, 2020
ec3a3dc
Update multisite command to handle updated nav location
jasonvarga Mar 10, 2020
d6c03fb
Params should have been on showUrl, not editUrl
jasonvarga Mar 10, 2020
97d47d6
Site selector for navs
jasonvarga Mar 10, 2020
2205da9
Remove unnecessary stuff
jasonvarga Mar 10, 2020
575b134
Bring up to speed with the collection edit form ui
jasonvarga Mar 10, 2020
9653ae7
Sites fieldtype
jasonvarga Mar 10, 2020
9a39717
Structure sites are unnecessary. A nav's sites are determined by whet…
jasonvarga Mar 10, 2020
dc2fb11
Nav sites tweaks ...
jasonvarga Mar 10, 2020
47e4a58
Only show the selector when there's more than 1 site.
jasonvarga Mar 10, 2020
f236d5e
Collection route and site tweaks ...
jasonvarga Mar 11, 2020
287c20e
Collection edit tweaks ...
jasonvarga Mar 11, 2020
f0c1acb
Remove unused structure sites fieldtype
jasonvarga Mar 11, 2020
4bb18df
Allow site switching on collection structures
jasonvarga Mar 11, 2020
ef53dc8
Tidy
jasonvarga Mar 11, 2020
fceaf3d
Tree tweaks ...
jasonvarga Mar 11, 2020
1b65df1
Fix structure box on getting started widget. Empty the translation so…
jasonvarga Mar 12, 2020
3f53408
Link to the nav's showUrl ...
jasonvarga Mar 12, 2020
de77f9f
window isnt available there
jasonvarga Mar 12, 2020
5f14dce
Move empty state to a slot
jasonvarga Mar 12, 2020
1644a5f
Remove old stuff
jasonvarga Mar 12, 2020
e08e1c9
Support the "from" parameter on the nav tag when using a collection
jasonvarga Mar 12, 2020
a9cda49
Reset the structure appropriately when setting
jasonvarga Mar 12, 2020
010ccc4
Remove the fix ...
jasonvarga Mar 12, 2020
84281e4
A collection with multiple sites, but only one tree defined in the ya…
jasonvarga Mar 12, 2020
afff09e
Merge branch 'master' into feature/structure-redux
jasonvarga Mar 12, 2020
7600348
Redirect field can select entry
jasonvarga Mar 12, 2020
032fbc5
Remove the entry value when changing option
jasonvarga Mar 12, 2020
6fcbbd2
Automatically open the selector when changing to entries
jasonvarga Mar 12, 2020
c856f3d
Save null when no entry is selected
jasonvarga Mar 12, 2020
4d1ea7a
Make it a regular test case to fix facades
jasonvarga Mar 12, 2020
ca47f56
Use new btn-group style
jasonvarga Mar 13, 2020
aaf1162
Uniform padding
jasonvarga Mar 13, 2020
c97f65e
Bring back old store class, deprecated, to prevent an error to ease m…
jasonvarga Mar 13, 2020
905f74c
Remove old routes fieldtype
jasonvarga Mar 13, 2020
8bd21f7
Set sites where necessary
jasonvarga Mar 13, 2020
870a084
Prevent error when not using multisite
jasonvarga Mar 13, 2020
f0775ef
Bring back update collection test basics
jasonvarga Mar 16, 2020
00f165c
Collection structure trees just come from the sites
jasonvarga Mar 16, 2020
5126245
Tidy. There will always be a value.
jasonvarga Mar 16, 2020
8eebd48
Conditionally show them
jasonvarga Mar 16, 2020
5958f00
Remove outdated method
jasonvarga Mar 16, 2020
4ba76e1
Increase width to fit "first child" option
jasonvarga Mar 16, 2020
215f1fd
Populate the data using the value if an entry has been selected
jasonvarga Mar 16, 2020
7a2c88a
Update the meta where necessary ...
jasonvarga Mar 16, 2020
be49de8
Merge branch 'master' into feature/structure-redux
jasonvarga Mar 16, 2020
71990cd
Add chevron to imply there are options
jasonvarga Mar 16, 2020
067b47e
:lipstick: Fix button specificicicicity
jackmcdade Mar 16, 2020
785c07c
Add chevron to imply there are options
jasonvarga Mar 16, 2020
a6eb93a
:lipstick: Replace flat togglers with clicky togglers
jackmcdade Mar 16, 2020
b10a6a0
:lipstick: Wangjangle some margins
jackmcdade Mar 17, 2020
5576daa
:lipstick: Add title header to the blueprint picker
jackmcdade Mar 17, 2020
84a16f9
Support cmd+clicking to open new entry in a new window
jasonvarga Mar 17, 2020
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
2 changes: 1 addition & 1 deletion composer.json
Original file line numberDiff line numberDiff line change
Expand Up@@ -20,7 +20,7 @@
"pixelfear/composer-dist-plugin": "^0.1.0",
"scrumpy/html-to-prosemirror": "^0.6.0",
"scrumpy/prosemirror-to-html": "^0.8.0",
"spatie/blink": "^1.1",
"spatie/blink": "^1.1.2",
"statamic/stringy": "^3.1",
"symfony/var-exporter": "^4.3",
"symfony/yaml": "^4.1@dev",
Expand Down
6 changes: 3 additions & 3 deletions config/stache.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -48,9 +48,9 @@
'directory' => base_path('content/collections'),
],

'structures' => [
'class' => Stores\StructuresStore::class,
'directory' => base_path('content/structures'),
'navigation' => [
'class' => Stores\NavigationStore::class,
'directory' => base_path('content/navigation'),
],

'globals' => [
Expand Down
11 changes: 11 additions & 0 deletions resources/blueprints/entry_link.yaml
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
title: Link
fields:
-
handle: title
field:
type: text
-
handle: redirect
field:
type: redirect
required: true
13 changes: 9 additions & 4 deletions resources/js/app.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -103,7 +103,6 @@ Statamic.app({
components: {
GlobalSearch: require('./components/GlobalSearch.vue').default,
SiteSelector: require('./components/SiteSelector.vue').default,
PageTree: require('./components/structures/PageTree.vue').default,
Login: require('./components/login/login'),
LoginModal: require('./components/login/LoginModal.vue').default,
BaseEntryCreateForm: require('./components/entries/BaseCreateForm.vue').default,
Expand All@@ -128,10 +127,12 @@ Statamic.app({
CollectionCreateForm: require('./components/collections/CreateForm.vue').default,
CollectionScaffolder: require('./components/collections/Scaffolder.vue').default,
CollectionEditForm: require('./components/collections/EditForm.vue').default,
CollectionView: require('./components/collections/View.vue').default,
SessionExpiry: require('./components/SessionExpiry.vue').default,
StructureWizard: require('./components/structures/Wizard.vue').default,
StructureListing: require('./components/structures/Listing.vue').default,
StructureEditForm: require('./components/structures/EditForm.vue').default,
NavigationListing: require('./components/navigation/Listing.vue').default,
NavigationCreateForm: require('./components/navigation/CreateForm.vue').default,
NavigationEditForm: require('./components/navigation/EditForm.vue').default,
NavigationView: require('./components/navigation/View.vue').default,
Stacks: require('./components/stacks/Stacks.vue').default,
TaxonomyWizard: require('./components/taxonomies/Wizard.vue').default,
TaxonomyEditForm: require('./components/taxonomies/EditForm.vue').default,
Expand DownExpand Up@@ -163,6 +164,10 @@ Statamic.app({

stackCount() {
return this.$stacks.count();
},

wrapperClass() {
return this.$config.get('wrapperClass', 'max-w-xl');
}

},
Expand Down
5 changes: 2 additions & 3 deletions resources/js/bootstrap/fieldtypes.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,7 +13,6 @@ Vue.component('slug-fieldtype', require('../components/fieldtypes/SlugFieldtype.
// Fieldtypes
import FieldsetFieldtype from '../components/fieldtypes/FieldsetFieldtype.vue'
import RevealerFieldtype from '../components/fieldtypes/RevealerFieldtype.vue'
import RoutesFieldtype from '../components/fieldtypes/RoutesFieldtype.vue'
import StatusFieldtype from '../components/fieldtypes/StatusFieldtype.vue'
import TemplateFieldtype from '../components/fieldtypes/TemplateFieldtype.vue'

Expand All@@ -25,6 +24,7 @@ Vue.component('bard-fieldtype', require('../components/fieldtypes/bard/BardField
Vue.component('bard_buttons_setting-fieldtype', require('../components/fieldtypes/bard/BardButtonsSettingFieldtype.vue').default);
Vue.component('checkboxes-fieldtype', require('../components/fieldtypes/CheckboxesFieldtype.vue').default);
Vue.component('code-fieldtype', require('../components/fieldtypes/CodeFieldtype.vue').default);
Vue.component('collection_routes-fieldtype', require('../components/collections/Routes.vue').default);
Vue.component('color-fieldtype', require('../components/fieldtypes/ColorFieldtype.vue').default);
Vue.component('date-fieldtype', require('../components/fieldtypes/DateFieldtype.vue').default);
Vue.component('fieldset-fieldtype', FieldsetFieldtype);
Expand All@@ -37,17 +37,16 @@ Vue.component('list-fieldtype', require('../components/fieldtypes/ListFieldtype.
Vue.component('markdown-fieldtype', require('../components/fieldtypes/MarkdownFieldtype.vue').default);
Vue.component('radio-fieldtype', require('../components/fieldtypes/RadioFieldtype.vue').default);
Vue.component('range-fieldtype', require('../components/fieldtypes/RangeFieldtype.vue').default);
Vue.component('redirect-fieldtype', require('../components/fieldtypes/RedirectFieldtype.vue').default);
Vue.component('relationship-fieldtype', require('../components/fieldtypes/relationship/RelationshipFieldtype.vue').default);
Vue.component('relationship-fieldtype-index', require('../components/fieldtypes/relationship/RelationshipIndexFieldtype.vue').default);
Vue.component('replicator-fieldtype', require('../components/fieldtypes/replicator/Replicator.vue').default);
Vue.component('replicator-fieldtype-index', require('../components/fieldtypes/replicator/ReplicatorIndex.vue').default);
Vue.component('revealer-fieldtype', RevealerFieldtype);
Vue.component('routes-fieldtype', RoutesFieldtype);
Vue.component('section-fieldtype', require('../components/fieldtypes/SectionFieldtype.vue').default);
Vue.component('select-fieldtype', require('../components/fieldtypes/SelectFieldtype.vue').default);
Vue.component('sets-fieldtype', require('../components/fieldtypes/replicator/SetsFieldtype.vue').default);
Vue.component('status-fieldtype', StatusFieldtype);
Vue.component('structure_sites-fieldtype', require('../components/structures/Sites.vue').default);
Vue.component('table-fieldtype', require('../components/fieldtypes/TableFieldtype.vue').default);
Vue.component('tags-fieldtype', require('../components/fieldtypes/TagsFieldtype.vue').default);
Vue.component('tags-fieldtype-index', require('../components/fieldtypes/TagsIndexFieldtype.vue').default);
Expand Down
4 changes: 2 additions & 2 deletions resources/js/components/DropdownItem.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,7 +12,7 @@ export default {
props: ['text', 'redirect', 'externalLink'],

methods: {
selectAndClose() {
selectAndClose($event) {
if (this.redirect) {
location.href = this.redirect;
return;
Expand All@@ -23,7 +23,7 @@ export default {
return;
}

this.$emit('click');
this.$emit('click', $event);

this.$parent.close();
}
Expand Down
42 changes: 42 additions & 0 deletions resources/js/components/collections/DeleteEntryConfirmation.vue
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
<template>

<modal name="delete-entry-confirmation" :pivotY="0.1" :overflow="false">
<div class="confirmation-modal flex flex-col h-full">
<div class="text-lg font-medium p-2 pb-0">
{{ __('Delete Entry') }}
</div>
<div class="flex-1 px-2 py-3 text-grey">
<p class="mb-2">Are you sure you want to delete this entry?</p>
<label class="flex items-center" v-if="children">
<input type="checkbox" class="mr-1" v-model="shouldDeleteChildren" />
{{ __n('Delete child entry|Delete :count child entries', children) }}
</label>
</div>
<div class="p-2 bg-grey-20 border-t flex items-center justify-end text-sm">
<button class="text-grey hover:text-grey-90"
@click="$emit('cancel')"
v-text="__('Cancel')" />
<button class="btn ml-2 btn-danger"
@click="$emit('confirm', shouldDeleteChildren)"
v-text="__('Delete')" />
</div>
</div>
</modal>

</template>

<script>
export default {

props: {
children: Number
},

data() {
return {
shouldDeleteChildren: false
}
}

}
</script>
6 changes: 1 addition & 5 deletions resources/js/components/collections/EditForm.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -33,14 +33,11 @@ export default {
blueprint: Object,
initialValues: Object,
meta: Object,
initialTitle: String,
url: String,
listingUrl: String,
url: String
},

data() {
return {
title: this.initialTitle,
values: this.initialValues,
error: null,
errors: {},
Expand All@@ -60,7 +57,6 @@ export default {

this.$axios.patch(this.url, this.values).then(response => {
this.saving = false;
this.title = response.data.title;
this.$toast.success(__('Saved'));
this.$refs.container.saved();
}).catch(e => this.handleAxiosError(e));
Expand Down
118 changes: 118 additions & 0 deletions resources/js/components/collections/Routes.vue
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
<template>

<div>
<div v-if="hasMultipleSites">
<div class="radio-fieldtype mb-1">
<radio-fieldtype handle="route_mode" v-model="routeMode" :config="{
inline: true,
options: {
single: 'Single route',
multiple: 'Separate route for each site',
}
}" />
</div>
<table class="grid-table" v-if="perSiteRouting">
<thead>
<tr>
<th>Site</th>
<th class="w-2/3">Route</th>
</tr>
</thead>
<tbody>
<tr v-for="site in sites" :key="site.handle">
<td class="align-middle" v-text="site.name" />
<td>
<text-input
class="font-mono text-xs"
:value="value[site.handle]"
@input="updateSiteRoute(site.handle, $event)" />
</td>
</tr>
</tbody>
</table>
</div>

<div v-if="!hasMultipleSites || !perSiteRouting">
<text-input v-model="singleRoute" class="font-mono text-xs" />
</div>
</div>

</template>

<script>
export default {

mixins: [Fieldtype],

inject: ['storeName'],

data() {
return {
routeMode: null,
singleRoute: null,
}
},

created() {
this.routeMode = this.identicalRoutes ? 'single' : 'multiple';
},

computed: {

sites() {
let state = this.$store.state.publish[this.storeName];

if (!state.values.sites) return [];

return state.values.sites.map((handle, i) => {
return {
handle,
name: state.meta.sites.data[i].title
}
});
},

hasMultipleSites() {
return this.sites.length > 1;
},

perSiteRouting() {
return this.routeMode === 'multiple';
},

identicalRoutes() {
return _.uniq(Object.values(this.value)).length === 1;
}

},

watch: {

singleRoute(route) {
this.update(route);
},

routeMode(mode) {
if (mode === 'single') {
this.singleRoute = Object.values(this.value)[0];
} else {
let value = {};
this.sites.forEach(site => value[site.handle] = '');
this.update(value);
}
}

},

methods: {

updateSiteRoute(site, route) {
let value = this.value;
value[site] = route;
this.update(value);
}

}

}
</script>
Loading