Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
d3b38e5
Initial Blueprints revamp ...
jasonvarga Jul 14, 2020
75dd755
Remove Blueprints fieldtype
jasonvarga Jul 14, 2020
ccd2354
Fix blueprint method
jasonvarga Jul 15, 2020
0ca90d2
Unnecessary
jasonvarga Jul 15, 2020
b748578
Apply blueprint changes to taxonomies
jasonvarga Jul 15, 2020
cbea3c0
Fix fields filter not working on taxonomy term listing
jasonvarga Jul 15, 2020
e383356
Support blueprint filter on taxonomy term listing
jasonvarga Jul 15, 2020
fb41342
Compose on any blueprint edit view, now that it could be in collectio…
jasonvarga Jul 15, 2020
e77ac09
Adjust some tests
jasonvarga Jul 15, 2020
2bcf33c
Adjust key
jasonvarga Jul 15, 2020
da16be6
Don't find it, get it from the collection
jasonvarga Jul 15, 2020
e8429d4
Apply blueprint changes to globals ...
jasonvarga Jul 15, 2020
ee397dd
Don't need to save the blueprint to file
jasonvarga Jul 15, 2020
9e4e3ff
Apply blueprint changes to assets ...
jasonvarga Jul 15, 2020
8b318d9
Fix test
jasonvarga Jul 15, 2020
eea6435
Apply blueprint changes to forms
jasonvarga Jul 15, 2020
0b5a323
Mark incomplete
jasonvarga Jul 15, 2020
7b3d37a
Just need the index
jasonvarga Jul 15, 2020
6fa49ce
Tidy
jasonvarga Jul 15, 2020
de4fe70
Blueprint index
jasonvarga Jul 15, 2020
cc72f70
Adjust link
jasonvarga Jul 15, 2020
efc27da
Apply blueprint changes to users
jasonvarga Jul 15, 2020
271f02c
Move breadcrumbs out of vue component
jasonvarga Jul 16, 2020
30574f8
Static title
jasonvarga Jul 16, 2020
de6cd12
Opt in for title field
jasonvarga Jul 16, 2020
9915261
Sections are optional (but used by default) and not used in forms and…
jasonvarga Jul 16, 2020
f4d0861
Add docs links
jasonvarga Jul 16, 2020
7a0bd62
Add blueprint link on users index
jasonvarga Jul 16, 2020
d401f1c
Add edit blueprint dropdown link to user edit form
jasonvarga Jul 16, 2020
7121463
More blueprint tweaks ...
jasonvarga Jul 20, 2020
5ca7928
Collection blueprints can be reordered
jasonvarga Jul 20, 2020
bd5eda8
Taxonomy blueprints can be reordered
jasonvarga Jul 20, 2020
5b3fbd1
Merge branch 'master' into feature/blueprints
jasonvarga Jul 20, 2020
b96ef99
BlueprintFound events
jasonvarga Jul 20, 2020
f9b3247
Apply fixes from StyleCI (#2107)
jasonvarga Jul 20, 2020
156a4e7
Pass items into method
jasonvarga Jul 20, 2020
c7f977a
Merge branch 'master' into feature/blueprints
jasonvarga Jul 20, 2020
0ff2381
Save the default blueprint when you opt for links and there are no bl…
jasonvarga Jul 21, 2020
44ff384
Simple html fieldtype, which is used to display links to edit bluepri…
jasonvarga Jul 21, 2020
ab850da
Prevent error when scaffolding blueprint
jasonvarga Jul 21, 2020
d22dedc
Apply fixes from StyleCI (#2108)
jasonvarga Jul 21, 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
7 changes: 0 additions & 7 deletions resources/blueprints/asset.yaml

This file was deleted.

8 changes: 0 additions & 8 deletions resources/blueprints/default.yaml

This file was deleted.

11 changes: 0 additions & 11 deletions resources/blueprints/entry_link.yaml

This file was deleted.

25 changes: 0 additions & 25 deletions resources/blueprints/user.yaml

This file was deleted.

2 changes: 2 additions & 0 deletions resources/js/app.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -130,6 +130,7 @@ Statamic.app({
CollectionScaffolder: require('./components/collections/Scaffolder.vue').default,
CollectionEditForm: require('./components/collections/EditForm.vue').default,
CollectionView: require('./components/collections/View.vue').default,
CollectionBlueprintListing: require('./components/collections/BlueprintListing.vue').default,
SessionExpiry: require('./components/SessionExpiry.vue').default,
NavigationListing: require('./components/navigation/Listing.vue').default,
NavigationCreateForm: require('./components/navigation/CreateForm.vue').default,
Expand All@@ -138,6 +139,7 @@ Statamic.app({
Stacks: require('./components/stacks/Stacks.vue').default,
TaxonomyCreateForm: require('./components/taxonomies/CreateForm.vue').default,
TaxonomyEditForm: require('./components/taxonomies/EditForm.vue').default,
TaxonomyBlueprintListing: require('./components/taxonomies/BlueprintListing.vue').default,
AssetContainerCreateForm: require('./components/asset-containers/CreateForm.vue').default,
AssetContainerEditForm: require('./components/asset-containers/EditForm.vue').default,
Updater: require('./components/updater/Updater.vue').default,
Expand Down
1 change: 1 addition & 0 deletions resources/js/bootstrap/fieldtypes.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -34,6 +34,7 @@ Vue.component('global_set_sites-fieldtype', require('../components/globals/Sites
Vue.component('grid-fieldtype', require('../components/fieldtypes/grid/Grid.vue').default);
Vue.component('grid-fieldtype-index', require('../components/fieldtypes/grid/GridIndex.vue').default);
Vue.component('hidden-fieldtype', require('../components/fieldtypes/HiddenFieldtype.vue').default);
Vue.component('html-fieldtype', require('../components/fieldtypes/HtmlFieldtype.vue').default);
Vue.component('integer-fieldtype', require('../components/fieldtypes/IntegerFieldtype.vue').default);
Vue.component('link-fieldtype', require('../components/fieldtypes/LinkFieldtype.vue').default);
Vue.component('list-fieldtype', require('../components/fieldtypes/ListFieldtype.vue').default);
Expand Down
4 changes: 4 additions & 0 deletions resources/js/components/assets/AssetManager.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,6 +11,10 @@
v-text="__('Edit Container')"
:redirect="container.edit_url">
</dropdown-item>
<dropdown-item
v-text="__('Edit Blueprint')"
:redirect="container.blueprint_url">
</dropdown-item>
<dropdown-item
v-if="container.can_delete"
v-text="__('Delete Container')"
Expand Down
14 changes: 1 addition & 13 deletions resources/js/components/assets/Editor/Editor.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -259,20 +259,8 @@ export default {
this.meta = data.meta;
this.runActionUrl = data.runActionUrl;
this.actions = data.actions;
this.getFieldset();
});
},

/**
* Load the fieldset
*/
getFieldset() {
const url = cp_url(`fields/publish-blueprints/${this.asset.blueprint}`);

this.$axios.get(url).then(response => {
this.fieldset = response.data;

// Flatten fields from all sections into one array.
this.fieldset = data.blueprint;
this.fields = _.chain(this.fieldset.sections)
.map(section => section.fields)
.flatten(true)
Expand Down
27 changes: 19 additions & 8 deletions resources/js/components/blueprints/Builder.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,15 +3,13 @@
<div class="blueprint-builder">

<header class="mb-3">
<breadcrumb :url="breadcrumbUrl" :title="__('Blueprints')" />

<div class="flex items-center justify-between">
<h1>{{ initialTitle }}</h1>
<h1 v-text="__('Edit Blueprint')" />
<button type="submit" class="btn-primary" @click.prevent="save" v-text="__('Save')" />
</div>
</header>

<div class="publish-form card p-0">
<div class="publish-form card p-0" v-if="showTitle">
<div class="form-group">
<label class="block">{{ __('Title') }}</label>
<small class="help-block">{{ __('messages.blueprints_title_instructions') }}</small>
Expand All@@ -22,12 +20,13 @@
</div>
</div>

<div class="content mt-5 mb-2">
<div class="content mt-5 mb-2" v-if="useSections">
<h2>{{ __('Tab Sections') }}</h2>
<p class="max-w-lg">{{ __('messages.tab_sections_instructions') }}</p>
</div>

<sections
:single-section="!useSections"
:initial-sections="blueprint.sections"
@updated="sectionsUpdated"
/>
Expand All@@ -45,13 +44,17 @@ export default {
Sections,
},

props: ['action', 'initialBlueprint', 'breadcrumbUrl'],
props: {
action: String,
initialBlueprint: Object,
showTitle: Boolean,
useSections: { type: Boolean, default: true }
},

data() {
return {
blueprint: clone(this.initialBlueprint),
blueprint: this.initializeBlueprint(),
sections: [],
initialTitle: this.initialBlueprint.title,
errors: {}
}
},
Expand DownExpand Up@@ -80,6 +83,14 @@ export default {

methods: {

initializeBlueprint() {
let blueprint = clone(this.initialBlueprint);

if (! this.showTitle) delete blueprint.title;

return blueprint;
},

sectionsUpdated(sections) {
this.sections = sections;
},
Expand Down
17 changes: 14 additions & 3 deletions resources/js/components/blueprints/Listing.vue
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
<template>
<data-list :visible-columns="columns" :columns="columns" :rows="rows">
<data-list :visible-columns="columns" :columns="columns" :rows="rows" :sort="false">
<div class="card p-0" slot-scope="{ filteredRows: rows }">
<data-list-table>
<data-list-table
:reorderable="reorderable"
@reordered="$emit('reordered', $event)"
>
<template slot="cell-title" slot-scope="{ row: blueprint }">
<a :href="blueprint.edit_url">{{ blueprint.title }}</a>
</template>
Expand DownExpand Up@@ -36,7 +39,7 @@ export default {

mixins: [Listing],

props: ['initialRows'],
props: ['initialRows', 'reorderable'],

data() {
return {
Expand All@@ -47,6 +50,14 @@ export default {
{ label: __('Fields'), field: 'fields' },
]
}
},

watch: {

initialRows(rows) {
this.rows = rows;
}

}

}
Expand Down
15 changes: 12 additions & 3 deletions resources/js/components/blueprints/Section.vue
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
<template>

<div class="blueprint-section w-full md:w-1/2 2xl:w-1/3" :class="{ 'w-full': isEditing }">
<div class="blueprint-section"
:class="{
'w-full md:w-1/2 2xl:w-1/3': !isEditing && !isSingle,
'w-full': isEditing || isSingle
}"
>
<div class="blueprint-section-card card p-0 h-full flex flex-col">

<div class="bg-grey-20 border-b text-sm flex rounded-t;">
<div class="bg-grey-20 border-b text-sm flex rounded-t;" v-if="!isSingle">
<div class="blueprint-drag-handle blueprint-section-drag-handle w-4 border-r"></div>
<div class="p-1.5 py-1 flex-1">
<span class="font-medium mr-1">
Expand All@@ -25,7 +30,7 @@
class="p-2"
:fields="section.fields"
:editing-field="editingField"
:is-section-expanded="isEditing"
:is-section-expanded="isEditing || isSingle"
:suggestable-condition-fields="suggestableConditionFields"
@field-created="fieldCreated"
@field-updated="fieldUpdated"
Expand DownExpand Up@@ -60,6 +65,10 @@ export default {
section: {
type: Object,
required: true
},
isSingle: {
type: Boolean,
default: false
}
},

Expand Down
10 changes: 8 additions & 2 deletions resources/js/components/blueprints/Sections.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,11 +9,12 @@
v-for="(section, i) in sections"
:key="section._id"
:section="section"
:is-single="singleSection"
@updated="updateSection(i, $event)"
@deleted="deleteSection(i)"
/>

<div class="blueprint-add-section-container w-full md:w-1/2 2xl:w-1/3">
<div class="blueprint-add-section-container w-full md:w-1/2 2xl:w-1/3" v-if="!singleSection">
<button class="blueprint-add-section-button outline-none" @click="addSection">
<div class="text-center flex items-center leading-none">
<div class="text-2xl mr-1">+</div>
Expand DownExpand Up@@ -55,6 +56,10 @@ export default {
newSectionText: {
type: String,
default: () => __('New Section')
},
singleSection: {
type: Boolean,
default: false
}
},

Expand All@@ -80,7 +85,8 @@ export default {
methods: {

makeSortable() {
this.makeSectionsSortable();
if (! this.singleSection) this.makeSectionsSortable();

this.makeFieldsSortable();
},

Expand Down
39 changes: 39 additions & 0 deletions resources/js/components/collections/BlueprintListing.vue
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
<script>
import BlueprintListing from '../blueprints/Listing.vue';

export default {

components: {
BlueprintListing
},

props: {
initialRows: Array,
reorderUrl: String
},

data() {
return {
rows: this.initialRows,
hasBeenReordered: false
}
},

methods: {
reordered(rows) {
this.rows = rows;
this.hasBeenReordered = true;
},

saveOrder() {
let order = this.rows.map(blueprint => blueprint.handle);

this.$axios
.post(this.reorderUrl, { order })
.then(response => this.$toast.success(__('Blueprints successfully reordered')))
.catch(error => this.$toast.error(__('Something went wrong')))
}
}

}
</script>
1 change: 1 addition & 0 deletions resources/js/components/collections/Listing.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,6 +8,7 @@
<template slot="actions" slot-scope="{ row: collection, index }">
<dropdown-list>
<dropdown-item :text="__('Edit Collection')" :redirect="collection.edit_url" />
<dropdown-item :text="__('Edit Blueprints')" :redirect="collection.blueprints_url" />
<dropdown-item :text="__('Scaffold Resources')" :redirect="collection.scaffold_url" />
<dropdown-item
v-if="collection.deleteable"
Expand Down
9 changes: 9 additions & 0 deletions resources/js/components/fieldtypes/HtmlFieldtype.vue
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
<template>
<div v-html="config.html" />
</template>

<script>
export default {
mixins: [Fieldtype]
};
</script>
1 change: 1 addition & 0 deletions resources/js/components/forms/Listing.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,6 +8,7 @@
<template slot="actions" slot-scope="{ row: form, index }">
<dropdown-list>
<dropdown-item :text="__('Edit')" :redirect="form.edit_url" />
<dropdown-item :text="__('Edit Blueprint')" :redirect="form.blueprint_url" />
<dropdown-item
v-if="form.deleteable"
:text="__('Delete')"
Expand Down
39 changes: 39 additions & 0 deletions resources/js/components/taxonomies/BlueprintListing.vue
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
<script>
import BlueprintListing from '../blueprints/Listing.vue';

export default {

components: {
BlueprintListing
},

props: {
initialRows: Array,
reorderUrl: String
},

data() {
return {
rows: this.initialRows,
hasBeenReordered: false
}
},

methods: {
reordered(rows) {
this.rows = rows;
this.hasBeenReordered = true;
},

saveOrder() {
let order = this.rows.map(blueprint => blueprint.handle);

this.$axios
.post(this.reorderUrl, { order })
.then(response => this.$toast.success(__('Blueprints successfully reordered')))
.catch(error => this.$toast.error(__('Something went wrong')))
}
}

}
</script>
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n 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;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
d3b38e5
Initial Blueprints revamp ...
jasonvarga Jul 14, 2020
75dd755
Remove Blueprints fieldtype
jasonvarga Jul 14, 2020
ccd2354
Fix blueprint method
jasonvarga Jul 15, 2020
0ca90d2
Unnecessary
jasonvarga Jul 15, 2020
b748578
Apply blueprint changes to taxonomies
jasonvarga Jul 15, 2020
cbea3c0
Fix fields filter not working on taxonomy term listing
jasonvarga Jul 15, 2020
e383356
Support blueprint filter on taxonomy term listing
jasonvarga Jul 15, 2020
fb41342
Compose on any blueprint edit view, now that it could be in collectio…
jasonvarga Jul 15, 2020
e77ac09
Adjust some tests
jasonvarga Jul 15, 2020
2bcf33c
Adjust key
jasonvarga Jul 15, 2020
da16be6
Don't find it, get it from the collection
jasonvarga Jul 15, 2020
e8429d4
Apply blueprint changes to globals ...
jasonvarga Jul 15, 2020
ee397dd
Don't need to save the blueprint to file
jasonvarga Jul 15, 2020
9e4e3ff
Apply blueprint changes to assets ...
jasonvarga Jul 15, 2020
8b318d9
Fix test
jasonvarga Jul 15, 2020
eea6435
Apply blueprint changes to forms
jasonvarga Jul 15, 2020
0b5a323
Mark incomplete
jasonvarga Jul 15, 2020
7b3d37a
Just need the index
jasonvarga Jul 15, 2020
6fa49ce
Tidy
jasonvarga Jul 15, 2020
de4fe70
Blueprint index
jasonvarga Jul 15, 2020
cc72f70
Adjust link
jasonvarga Jul 15, 2020
efc27da
Apply blueprint changes to users
jasonvarga Jul 15, 2020
271f02c
Move breadcrumbs out of vue component
jasonvarga Jul 16, 2020
30574f8
Static title
jasonvarga Jul 16, 2020
de6cd12
Opt in for title field
jasonvarga Jul 16, 2020
9915261
Sections are optional (but used by default) and not used in forms and…
jasonvarga Jul 16, 2020
f4d0861
Add docs links
jasonvarga Jul 16, 2020
7a0bd62
Add blueprint link on users index
jasonvarga Jul 16, 2020
d401f1c
Add edit blueprint dropdown link to user edit form
jasonvarga Jul 16, 2020
7121463
More blueprint tweaks ...
jasonvarga Jul 20, 2020
5ca7928
Collection blueprints can be reordered
jasonvarga Jul 20, 2020
bd5eda8
Taxonomy blueprints can be reordered
jasonvarga Jul 20, 2020
5b3fbd1
Merge branch 'master' into feature/blueprints
jasonvarga Jul 20, 2020
b96ef99
BlueprintFound events
jasonvarga Jul 20, 2020
f9b3247
Apply fixes from StyleCI (#2107)
jasonvarga Jul 20, 2020
156a4e7
Pass items into method
jasonvarga Jul 20, 2020
c7f977a
Merge branch 'master' into feature/blueprints
jasonvarga Jul 20, 2020
0ff2381
Save the default blueprint when you opt for links and there are no bl…
jasonvarga Jul 21, 2020
44ff384
Simple html fieldtype, which is used to display links to edit bluepri…
jasonvarga Jul 21, 2020
ab850da
Prevent error when scaffolding blueprint
jasonvarga Jul 21, 2020
d22dedc
Apply fixes from StyleCI (#2108)
jasonvarga Jul 21, 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
7 changes: 0 additions & 7 deletions resources/blueprints/asset.yaml

This file was deleted.

8 changes: 0 additions & 8 deletions resources/blueprints/default.yaml

This file was deleted.

11 changes: 0 additions & 11 deletions resources/blueprints/entry_link.yaml

This file was deleted.

25 changes: 0 additions & 25 deletions resources/blueprints/user.yaml

This file was deleted.

2 changes: 2 additions & 0 deletions resources/js/app.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -130,6 +130,7 @@ Statamic.app({
CollectionScaffolder: require('./components/collections/Scaffolder.vue').default,
CollectionEditForm: require('./components/collections/EditForm.vue').default,
CollectionView: require('./components/collections/View.vue').default,
CollectionBlueprintListing: require('./components/collections/BlueprintListing.vue').default,
SessionExpiry: require('./components/SessionExpiry.vue').default,
NavigationListing: require('./components/navigation/Listing.vue').default,
NavigationCreateForm: require('./components/navigation/CreateForm.vue').default,
Expand All@@ -138,6 +139,7 @@ Statamic.app({
Stacks: require('./components/stacks/Stacks.vue').default,
TaxonomyCreateForm: require('./components/taxonomies/CreateForm.vue').default,
TaxonomyEditForm: require('./components/taxonomies/EditForm.vue').default,
TaxonomyBlueprintListing: require('./components/taxonomies/BlueprintListing.vue').default,
AssetContainerCreateForm: require('./components/asset-containers/CreateForm.vue').default,
AssetContainerEditForm: require('./components/asset-containers/EditForm.vue').default,
Updater: require('./components/updater/Updater.vue').default,
Expand Down
1 change: 1 addition & 0 deletions resources/js/bootstrap/fieldtypes.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -34,6 +34,7 @@ Vue.component('global_set_sites-fieldtype', require('../components/globals/Sites
Vue.component('grid-fieldtype', require('../components/fieldtypes/grid/Grid.vue').default);
Vue.component('grid-fieldtype-index', require('../components/fieldtypes/grid/GridIndex.vue').default);
Vue.component('hidden-fieldtype', require('../components/fieldtypes/HiddenFieldtype.vue').default);
Vue.component('html-fieldtype', require('../components/fieldtypes/HtmlFieldtype.vue').default);
Vue.component('integer-fieldtype', require('../components/fieldtypes/IntegerFieldtype.vue').default);
Vue.component('link-fieldtype', require('../components/fieldtypes/LinkFieldtype.vue').default);
Vue.component('list-fieldtype', require('../components/fieldtypes/ListFieldtype.vue').default);
Expand Down
4 changes: 4 additions & 0 deletions resources/js/components/assets/AssetManager.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,6 +11,10 @@
v-text="__('Edit Container')"
:redirect="container.edit_url">
</dropdown-item>
<dropdown-item
v-text="__('Edit Blueprint')"
:redirect="container.blueprint_url">
</dropdown-item>
<dropdown-item
v-if="container.can_delete"
v-text="__('Delete Container')"
Expand Down
14 changes: 1 addition & 13 deletions resources/js/components/assets/Editor/Editor.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -259,20 +259,8 @@ export default {
this.meta = data.meta;
this.runActionUrl = data.runActionUrl;
this.actions = data.actions;
this.getFieldset();
});
},

/**
* Load the fieldset
*/
getFieldset() {
const url = cp_url(`fields/publish-blueprints/${this.asset.blueprint}`);

this.$axios.get(url).then(response => {
this.fieldset = response.data;

// Flatten fields from all sections into one array.
this.fieldset = data.blueprint;
this.fields = _.chain(this.fieldset.sections)
.map(section => section.fields)
.flatten(true)
Expand Down
27 changes: 19 additions & 8 deletions resources/js/components/blueprints/Builder.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,15 +3,13 @@
<div class="blueprint-builder">

<header class="mb-3">
<breadcrumb :url="breadcrumbUrl" :title="__('Blueprints')" />

<div class="flex items-center justify-between">
<h1>{{ initialTitle }}</h1>
<h1 v-text="__('Edit Blueprint')" />
<button type="submit" class="btn-primary" @click.prevent="save" v-text="__('Save')" />
</div>
</header>

<div class="publish-form card p-0">
<div class="publish-form card p-0" v-if="showTitle">
<div class="form-group">
<label class="block">{{ __('Title') }}</label>
<small class="help-block">{{ __('messages.blueprints_title_instructions') }}</small>
Expand All@@ -22,12 +20,13 @@
</div>
</div>

<div class="content mt-5 mb-2">
<div class="content mt-5 mb-2" v-if="useSections">
<h2>{{ __('Tab Sections') }}</h2>
<p class="max-w-lg">{{ __('messages.tab_sections_instructions') }}</p>
</div>

<sections
:single-section="!useSections"
:initial-sections="blueprint.sections"
@updated="sectionsUpdated"
/>
Expand All@@ -45,13 +44,17 @@ export default {
Sections,
},

props: ['action', 'initialBlueprint', 'breadcrumbUrl'],
props: {
action: String,
initialBlueprint: Object,
showTitle: Boolean,
useSections: { type: Boolean, default: true }
},

data() {
return {
blueprint: clone(this.initialBlueprint),
blueprint: this.initializeBlueprint(),
sections: [],
initialTitle: this.initialBlueprint.title,
errors: {}
}
},
Expand DownExpand Up@@ -80,6 +83,14 @@ export default {

methods: {

initializeBlueprint() {
let blueprint = clone(this.initialBlueprint);

if (! this.showTitle) delete blueprint.title;

return blueprint;
},

sectionsUpdated(sections) {
this.sections = sections;
},
Expand Down
17 changes: 14 additions & 3 deletions resources/js/components/blueprints/Listing.vue
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
<template>
<data-list :visible-columns="columns" :columns="columns" :rows="rows">
<data-list :visible-columns="columns" :columns="columns" :rows="rows" :sort="false">
<div class="card p-0" slot-scope="{ filteredRows: rows }">
<data-list-table>
<data-list-table
:reorderable="reorderable"
@reordered="$emit('reordered', $event)"
>
<template slot="cell-title" slot-scope="{ row: blueprint }">
<a :href="blueprint.edit_url">{{ blueprint.title }}</a>
</template>
Expand DownExpand Up@@ -36,7 +39,7 @@ export default {

mixins: [Listing],

props: ['initialRows'],
props: ['initialRows', 'reorderable'],

data() {
return {
Expand All@@ -47,6 +50,14 @@ export default {
{ label: __('Fields'), field: 'fields' },
]
}
},

watch: {

initialRows(rows) {
this.rows = rows;
}

}

}
Expand Down
15 changes: 12 additions & 3 deletions resources/js/components/blueprints/Section.vue
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
<template>

<div class="blueprint-section w-full md:w-1/2 2xl:w-1/3" :class="{ 'w-full': isEditing }">
<div class="blueprint-section"
:class="{
'w-full md:w-1/2 2xl:w-1/3': !isEditing && !isSingle,
'w-full': isEditing || isSingle
}"
>
<div class="blueprint-section-card card p-0 h-full flex flex-col">

<div class="bg-grey-20 border-b text-sm flex rounded-t;">
<div class="bg-grey-20 border-b text-sm flex rounded-t;" v-if="!isSingle">
<div class="blueprint-drag-handle blueprint-section-drag-handle w-4 border-r"></div>
<div class="p-1.5 py-1 flex-1">
<span class="font-medium mr-1">
Expand All@@ -25,7 +30,7 @@
class="p-2"
:fields="section.fields"
:editing-field="editingField"
:is-section-expanded="isEditing"
:is-section-expanded="isEditing || isSingle"
:suggestable-condition-fields="suggestableConditionFields"
@field-created="fieldCreated"
@field-updated="fieldUpdated"
Expand DownExpand Up@@ -60,6 +65,10 @@ export default {
section: {
type: Object,
required: true
},
isSingle: {
type: Boolean,
default: false
}
},

Expand Down
10 changes: 8 additions & 2 deletions resources/js/components/blueprints/Sections.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,11 +9,12 @@
v-for="(section, i) in sections"
:key="section._id"
:section="section"
:is-single="singleSection"
@updated="updateSection(i, $event)"
@deleted="deleteSection(i)"
/>

<div class="blueprint-add-section-container w-full md:w-1/2 2xl:w-1/3">
<div class="blueprint-add-section-container w-full md:w-1/2 2xl:w-1/3" v-if="!singleSection">
<button class="blueprint-add-section-button outline-none" @click="addSection">
<div class="text-center flex items-center leading-none">
<div class="text-2xl mr-1">+</div>
Expand DownExpand Up@@ -55,6 +56,10 @@ export default {
newSectionText: {
type: String,
default: () => __('New Section')
},
singleSection: {
type: Boolean,
default: false
}
},

Expand All@@ -80,7 +85,8 @@ export default {
methods: {

makeSortable() {
this.makeSectionsSortable();
if (! this.singleSection) this.makeSectionsSortable();

this.makeFieldsSortable();
},

Expand Down
39 changes: 39 additions & 0 deletions resources/js/components/collections/BlueprintListing.vue
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
<script>
import BlueprintListing from '../blueprints/Listing.vue';

export default {

components: {
BlueprintListing
},

props: {
initialRows: Array,
reorderUrl: String
},

data() {
return {
rows: this.initialRows,
hasBeenReordered: false
}
},

methods: {
reordered(rows) {
this.rows = rows;
this.hasBeenReordered = true;
},

saveOrder() {
let order = this.rows.map(blueprint => blueprint.handle);

this.$axios
.post(this.reorderUrl, { order })
.then(response => this.$toast.success(__('Blueprints successfully reordered')))
.catch(error => this.$toast.error(__('Something went wrong')))
}
}

}
</script>
1 change: 1 addition & 0 deletions resources/js/components/collections/Listing.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,6 +8,7 @@
<template slot="actions" slot-scope="{ row: collection, index }">
<dropdown-list>
<dropdown-item :text="__('Edit Collection')" :redirect="collection.edit_url" />
<dropdown-item :text="__('Edit Blueprints')" :redirect="collection.blueprints_url" />
<dropdown-item :text="__('Scaffold Resources')" :redirect="collection.scaffold_url" />
<dropdown-item
v-if="collection.deleteable"
Expand Down
9 changes: 9 additions & 0 deletions resources/js/components/fieldtypes/HtmlFieldtype.vue
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
<template>
<div v-html="config.html" />
</template>

<script>
export default {
mixins: [Fieldtype]
};
</script>
1 change: 1 addition & 0 deletions resources/js/components/forms/Listing.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,6 +8,7 @@
<template slot="actions" slot-scope="{ row: form, index }">
<dropdown-list>
<dropdown-item :text="__('Edit')" :redirect="form.edit_url" />
<dropdown-item :text="__('Edit Blueprint')" :redirect="form.blueprint_url" />
<dropdown-item
v-if="form.deleteable"
:text="__('Delete')"
Expand Down
39 changes: 39 additions & 0 deletions resources/js/components/taxonomies/BlueprintListing.vue
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
<script>
import BlueprintListing from '../blueprints/Listing.vue';

export default {

components: {
BlueprintListing
},

props: {
initialRows: Array,
reorderUrl: String
},

data() {
return {
rows: this.initialRows,
hasBeenReordered: false
}
},

methods: {
reordered(rows) {
this.rows = rows;
this.hasBeenReordered = true;
},

saveOrder() {
let order = this.rows.map(blueprint => blueprint.handle);

this.$axios
.post(this.reorderUrl, { order })
.then(response => this.$toast.success(__('Blueprints successfully reordered')))
.catch(error => this.$toast.error(__('Something went wrong')))
}
}

}
</script>
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
d3b38e5
Initial Blueprints revamp ...
jasonvarga Jul 14, 2020
75dd755
Remove Blueprints fieldtype
jasonvarga Jul 14, 2020
ccd2354
Fix blueprint method
jasonvarga Jul 15, 2020
0ca90d2
Unnecessary
jasonvarga Jul 15, 2020
b748578
Apply blueprint changes to taxonomies
jasonvarga Jul 15, 2020
cbea3c0
Fix fields filter not working on taxonomy term listing
jasonvarga Jul 15, 2020
e383356
Support blueprint filter on taxonomy term listing
jasonvarga Jul 15, 2020
fb41342
Compose on any blueprint edit view, now that it could be in collectio…
jasonvarga Jul 15, 2020
e77ac09
Adjust some tests
jasonvarga Jul 15, 2020
2bcf33c
Adjust key
jasonvarga Jul 15, 2020
da16be6
Don't find it, get it from the collection
jasonvarga Jul 15, 2020
e8429d4
Apply blueprint changes to globals ...
jasonvarga Jul 15, 2020
ee397dd
Don't need to save the blueprint to file
jasonvarga Jul 15, 2020
9e4e3ff
Apply blueprint changes to assets ...
jasonvarga Jul 15, 2020
8b318d9
Fix test
jasonvarga Jul 15, 2020
eea6435
Apply blueprint changes to forms
jasonvarga Jul 15, 2020
0b5a323
Mark incomplete
jasonvarga Jul 15, 2020
7b3d37a
Just need the index
jasonvarga Jul 15, 2020
6fa49ce
Tidy
jasonvarga Jul 15, 2020
de4fe70
Blueprint index
jasonvarga Jul 15, 2020
cc72f70
Adjust link
jasonvarga Jul 15, 2020
efc27da
Apply blueprint changes to users
jasonvarga Jul 15, 2020
271f02c
Move breadcrumbs out of vue component
jasonvarga Jul 16, 2020
30574f8
Static title
jasonvarga Jul 16, 2020
de6cd12
Opt in for title field
jasonvarga Jul 16, 2020
9915261
Sections are optional (but used by default) and not used in forms and…
jasonvarga Jul 16, 2020
f4d0861
Add docs links
jasonvarga Jul 16, 2020
7a0bd62
Add blueprint link on users index
jasonvarga Jul 16, 2020
d401f1c
Add edit blueprint dropdown link to user edit form
jasonvarga Jul 16, 2020
7121463
More blueprint tweaks ...
jasonvarga Jul 20, 2020
5ca7928
Collection blueprints can be reordered
jasonvarga Jul 20, 2020
bd5eda8
Taxonomy blueprints can be reordered
jasonvarga Jul 20, 2020
5b3fbd1
Merge branch 'master' into feature/blueprints
jasonvarga Jul 20, 2020
b96ef99
BlueprintFound events
jasonvarga Jul 20, 2020
f9b3247
Apply fixes from StyleCI (#2107)
jasonvarga Jul 20, 2020
156a4e7
Pass items into method
jasonvarga Jul 20, 2020
c7f977a
Merge branch 'master' into feature/blueprints
jasonvarga Jul 20, 2020
0ff2381
Save the default blueprint when you opt for links and there are no bl…
jasonvarga Jul 21, 2020
44ff384
Simple html fieldtype, which is used to display links to edit bluepri…
jasonvarga Jul 21, 2020
ab850da
Prevent error when scaffolding blueprint
jasonvarga Jul 21, 2020
d22dedc
Apply fixes from StyleCI (#2108)
jasonvarga Jul 21, 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
7 changes: 0 additions & 7 deletions resources/blueprints/asset.yaml

This file was deleted.

8 changes: 0 additions & 8 deletions resources/blueprints/default.yaml

This file was deleted.

11 changes: 0 additions & 11 deletions resources/blueprints/entry_link.yaml

This file was deleted.

25 changes: 0 additions & 25 deletions resources/blueprints/user.yaml

This file was deleted.

2 changes: 2 additions & 0 deletions resources/js/app.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -130,6 +130,7 @@ Statamic.app({
CollectionScaffolder: require('./components/collections/Scaffolder.vue').default,
CollectionEditForm: require('./components/collections/EditForm.vue').default,
CollectionView: require('./components/collections/View.vue').default,
CollectionBlueprintListing: require('./components/collections/BlueprintListing.vue').default,
SessionExpiry: require('./components/SessionExpiry.vue').default,
NavigationListing: require('./components/navigation/Listing.vue').default,
NavigationCreateForm: require('./components/navigation/CreateForm.vue').default,
Expand All@@ -138,6 +139,7 @@ Statamic.app({
Stacks: require('./components/stacks/Stacks.vue').default,
TaxonomyCreateForm: require('./components/taxonomies/CreateForm.vue').default,
TaxonomyEditForm: require('./components/taxonomies/EditForm.vue').default,
TaxonomyBlueprintListing: require('./components/taxonomies/BlueprintListing.vue').default,
AssetContainerCreateForm: require('./components/asset-containers/CreateForm.vue').default,
AssetContainerEditForm: require('./components/asset-containers/EditForm.vue').default,
Updater: require('./components/updater/Updater.vue').default,
Expand Down
1 change: 1 addition & 0 deletions resources/js/bootstrap/fieldtypes.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -34,6 +34,7 @@ Vue.component('global_set_sites-fieldtype', require('../components/globals/Sites
Vue.component('grid-fieldtype', require('../components/fieldtypes/grid/Grid.vue').default);
Vue.component('grid-fieldtype-index', require('../components/fieldtypes/grid/GridIndex.vue').default);
Vue.component('hidden-fieldtype', require('../components/fieldtypes/HiddenFieldtype.vue').default);
Vue.component('html-fieldtype', require('../components/fieldtypes/HtmlFieldtype.vue').default);
Vue.component('integer-fieldtype', require('../components/fieldtypes/IntegerFieldtype.vue').default);
Vue.component('link-fieldtype', require('../components/fieldtypes/LinkFieldtype.vue').default);
Vue.component('list-fieldtype', require('../components/fieldtypes/ListFieldtype.vue').default);
Expand Down
4 changes: 4 additions & 0 deletions resources/js/components/assets/AssetManager.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,6 +11,10 @@
v-text="__('Edit Container')"
:redirect="container.edit_url">
</dropdown-item>
<dropdown-item
v-text="__('Edit Blueprint')"
:redirect="container.blueprint_url">
</dropdown-item>
<dropdown-item
v-if="container.can_delete"
v-text="__('Delete Container')"
Expand Down
14 changes: 1 addition & 13 deletions resources/js/components/assets/Editor/Editor.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -259,20 +259,8 @@ export default {
this.meta = data.meta;
this.runActionUrl = data.runActionUrl;
this.actions = data.actions;
this.getFieldset();
});
},

/**
* Load the fieldset
*/
getFieldset() {
const url = cp_url(`fields/publish-blueprints/${this.asset.blueprint}`);

this.$axios.get(url).then(response => {
this.fieldset = response.data;

// Flatten fields from all sections into one array.
this.fieldset = data.blueprint;
this.fields = _.chain(this.fieldset.sections)
.map(section => section.fields)
.flatten(true)
Expand Down
27 changes: 19 additions & 8 deletions resources/js/components/blueprints/Builder.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,15 +3,13 @@
<div class="blueprint-builder">

<header class="mb-3">
<breadcrumb :url="breadcrumbUrl" :title="__('Blueprints')" />

<div class="flex items-center justify-between">
<h1>{{ initialTitle }}</h1>
<h1 v-text="__('Edit Blueprint')" />
<button type="submit" class="btn-primary" @click.prevent="save" v-text="__('Save')" />
</div>
</header>

<div class="publish-form card p-0">
<div class="publish-form card p-0" v-if="showTitle">
<div class="form-group">
<label class="block">{{ __('Title') }}</label>
<small class="help-block">{{ __('messages.blueprints_title_instructions') }}</small>
Expand All@@ -22,12 +20,13 @@
</div>
</div>

<div class="content mt-5 mb-2">
<div class="content mt-5 mb-2" v-if="useSections">
<h2>{{ __('Tab Sections') }}</h2>
<p class="max-w-lg">{{ __('messages.tab_sections_instructions') }}</p>
</div>

<sections
:single-section="!useSections"
:initial-sections="blueprint.sections"
@updated="sectionsUpdated"
/>
Expand All@@ -45,13 +44,17 @@ export default {
Sections,
},

props: ['action', 'initialBlueprint', 'breadcrumbUrl'],
props: {
action: String,
initialBlueprint: Object,
showTitle: Boolean,
useSections: { type: Boolean, default: true }
},

data() {
return {
blueprint: clone(this.initialBlueprint),
blueprint: this.initializeBlueprint(),
sections: [],
initialTitle: this.initialBlueprint.title,
errors: {}
}
},
Expand DownExpand Up@@ -80,6 +83,14 @@ export default {

methods: {

initializeBlueprint() {
let blueprint = clone(this.initialBlueprint);

if (! this.showTitle) delete blueprint.title;

return blueprint;
},

sectionsUpdated(sections) {
this.sections = sections;
},
Expand Down
17 changes: 14 additions & 3 deletions resources/js/components/blueprints/Listing.vue
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
<template>
<data-list :visible-columns="columns" :columns="columns" :rows="rows">
<data-list :visible-columns="columns" :columns="columns" :rows="rows" :sort="false">
<div class="card p-0" slot-scope="{ filteredRows: rows }">
<data-list-table>
<data-list-table
:reorderable="reorderable"
@reordered="$emit('reordered', $event)"
>
<template slot="cell-title" slot-scope="{ row: blueprint }">
<a :href="blueprint.edit_url">{{ blueprint.title }}</a>
</template>
Expand DownExpand Up@@ -36,7 +39,7 @@ export default {

mixins: [Listing],

props: ['initialRows'],
props: ['initialRows', 'reorderable'],

data() {
return {
Expand All@@ -47,6 +50,14 @@ export default {
{ label: __('Fields'), field: 'fields' },
]
}
},

watch: {

initialRows(rows) {
this.rows = rows;
}

}

}
Expand Down
15 changes: 12 additions & 3 deletions resources/js/components/blueprints/Section.vue
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
<template>

<div class="blueprint-section w-full md:w-1/2 2xl:w-1/3" :class="{ 'w-full': isEditing }">
<div class="blueprint-section"
:class="{
'w-full md:w-1/2 2xl:w-1/3': !isEditing && !isSingle,
'w-full': isEditing || isSingle
}"
>
<div class="blueprint-section-card card p-0 h-full flex flex-col">

<div class="bg-grey-20 border-b text-sm flex rounded-t;">
<div class="bg-grey-20 border-b text-sm flex rounded-t;" v-if="!isSingle">
<div class="blueprint-drag-handle blueprint-section-drag-handle w-4 border-r"></div>
<div class="p-1.5 py-1 flex-1">
<span class="font-medium mr-1">
Expand All@@ -25,7 +30,7 @@
class="p-2"
:fields="section.fields"
:editing-field="editingField"
:is-section-expanded="isEditing"
:is-section-expanded="isEditing || isSingle"
:suggestable-condition-fields="suggestableConditionFields"
@field-created="fieldCreated"
@field-updated="fieldUpdated"
Expand DownExpand Up@@ -60,6 +65,10 @@ export default {
section: {
type: Object,
required: true
},
isSingle: {
type: Boolean,
default: false
}
},

Expand Down
10 changes: 8 additions & 2 deletions resources/js/components/blueprints/Sections.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,11 +9,12 @@
v-for="(section, i) in sections"
:key="section._id"
:section="section"
:is-single="singleSection"
@updated="updateSection(i, $event)"
@deleted="deleteSection(i)"
/>

<div class="blueprint-add-section-container w-full md:w-1/2 2xl:w-1/3">
<div class="blueprint-add-section-container w-full md:w-1/2 2xl:w-1/3" v-if="!singleSection">
<button class="blueprint-add-section-button outline-none" @click="addSection">
<div class="text-center flex items-center leading-none">
<div class="text-2xl mr-1">+</div>
Expand DownExpand Up@@ -55,6 +56,10 @@ export default {
newSectionText: {
type: String,
default: () => __('New Section')
},
singleSection: {
type: Boolean,
default: false
}
},

Expand All@@ -80,7 +85,8 @@ export default {
methods: {

makeSortable() {
this.makeSectionsSortable();
if (! this.singleSection) this.makeSectionsSortable();

this.makeFieldsSortable();
},

Expand Down
39 changes: 39 additions & 0 deletions resources/js/components/collections/BlueprintListing.vue
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
<script>
import BlueprintListing from '../blueprints/Listing.vue';

export default {

components: {
BlueprintListing
},

props: {
initialRows: Array,
reorderUrl: String
},

data() {
return {
rows: this.initialRows,
hasBeenReordered: false
}
},

methods: {
reordered(rows) {
this.rows = rows;
this.hasBeenReordered = true;
},

saveOrder() {
let order = this.rows.map(blueprint => blueprint.handle);

this.$axios
.post(this.reorderUrl, { order })
.then(response => this.$toast.success(__('Blueprints successfully reordered')))
.catch(error => this.$toast.error(__('Something went wrong')))
}
}

}
</script>
1 change: 1 addition & 0 deletions resources/js/components/collections/Listing.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,6 +8,7 @@
<template slot="actions" slot-scope="{ row: collection, index }">
<dropdown-list>
<dropdown-item :text="__('Edit Collection')" :redirect="collection.edit_url" />
<dropdown-item :text="__('Edit Blueprints')" :redirect="collection.blueprints_url" />
<dropdown-item :text="__('Scaffold Resources')" :redirect="collection.scaffold_url" />
<dropdown-item
v-if="collection.deleteable"
Expand Down
9 changes: 9 additions & 0 deletions resources/js/components/fieldtypes/HtmlFieldtype.vue
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
<template>
<div v-html="config.html" />
</template>

<script>
export default {
mixins: [Fieldtype]
};
</script>
1 change: 1 addition & 0 deletions resources/js/components/forms/Listing.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,6 +8,7 @@
<template slot="actions" slot-scope="{ row: form, index }">
<dropdown-list>
<dropdown-item :text="__('Edit')" :redirect="form.edit_url" />
<dropdown-item :text="__('Edit Blueprint')" :redirect="form.blueprint_url" />
<dropdown-item
v-if="form.deleteable"
:text="__('Delete')"
Expand Down
39 changes: 39 additions & 0 deletions resources/js/components/taxonomies/BlueprintListing.vue
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
<script>
import BlueprintListing from '../blueprints/Listing.vue';

export default {

components: {
BlueprintListing
},

props: {
initialRows: Array,
reorderUrl: String
},

data() {
return {
rows: this.initialRows,
hasBeenReordered: false
}
},

methods: {
reordered(rows) {
this.rows = rows;
this.hasBeenReordered = true;
},

saveOrder() {
let order = this.rows.map(blueprint => blueprint.handle);

this.$axios
.post(this.reorderUrl, { order })
.then(response => this.$toast.success(__('Blueprints successfully reordered')))
.catch(error => this.$toast.error(__('Something went wrong')))
}
}

}
</script>
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
d3b38e5
Initial Blueprints revamp ...
jasonvarga Jul 14, 2020
75dd755
Remove Blueprints fieldtype
jasonvarga Jul 14, 2020
ccd2354
Fix blueprint method
jasonvarga Jul 15, 2020
0ca90d2
Unnecessary
jasonvarga Jul 15, 2020
b748578
Apply blueprint changes to taxonomies
jasonvarga Jul 15, 2020
cbea3c0
Fix fields filter not working on taxonomy term listing
jasonvarga Jul 15, 2020
e383356
Support blueprint filter on taxonomy term listing
jasonvarga Jul 15, 2020
fb41342
Compose on any blueprint edit view, now that it could be in collectio…
jasonvarga Jul 15, 2020
e77ac09
Adjust some tests
jasonvarga Jul 15, 2020
2bcf33c
Adjust key
jasonvarga Jul 15, 2020
da16be6
Don't find it, get it from the collection
jasonvarga Jul 15, 2020
e8429d4
Apply blueprint changes to globals ...
jasonvarga Jul 15, 2020
ee397dd
Don't need to save the blueprint to file
jasonvarga Jul 15, 2020
9e4e3ff
Apply blueprint changes to assets ...
jasonvarga Jul 15, 2020
8b318d9
Fix test
jasonvarga Jul 15, 2020
eea6435
Apply blueprint changes to forms
jasonvarga Jul 15, 2020
0b5a323
Mark incomplete
jasonvarga Jul 15, 2020
7b3d37a
Just need the index
jasonvarga Jul 15, 2020
6fa49ce
Tidy
jasonvarga Jul 15, 2020
de4fe70
Blueprint index
jasonvarga Jul 15, 2020
cc72f70
Adjust link
jasonvarga Jul 15, 2020
efc27da
Apply blueprint changes to users
jasonvarga Jul 15, 2020
271f02c
Move breadcrumbs out of vue component
jasonvarga Jul 16, 2020
30574f8
Static title
jasonvarga Jul 16, 2020
de6cd12
Opt in for title field
jasonvarga Jul 16, 2020
9915261
Sections are optional (but used by default) and not used in forms and…
jasonvarga Jul 16, 2020
f4d0861
Add docs links
jasonvarga Jul 16, 2020
7a0bd62
Add blueprint link on users index
jasonvarga Jul 16, 2020
d401f1c
Add edit blueprint dropdown link to user edit form
jasonvarga Jul 16, 2020
7121463
More blueprint tweaks ...
jasonvarga Jul 20, 2020
5ca7928
Collection blueprints can be reordered
jasonvarga Jul 20, 2020
bd5eda8
Taxonomy blueprints can be reordered
jasonvarga Jul 20, 2020
5b3fbd1
Merge branch 'master' into feature/blueprints
jasonvarga Jul 20, 2020
b96ef99
BlueprintFound events
jasonvarga Jul 20, 2020
f9b3247
Apply fixes from StyleCI (#2107)
jasonvarga Jul 20, 2020
156a4e7
Pass items into method
jasonvarga Jul 20, 2020
c7f977a
Merge branch 'master' into feature/blueprints
jasonvarga Jul 20, 2020
0ff2381
Save the default blueprint when you opt for links and there are no bl…
jasonvarga Jul 21, 2020
44ff384
Simple html fieldtype, which is used to display links to edit bluepri…
jasonvarga Jul 21, 2020
ab850da
Prevent error when scaffolding blueprint
jasonvarga Jul 21, 2020
d22dedc
Apply fixes from StyleCI (#2108)
jasonvarga Jul 21, 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
7 changes: 0 additions & 7 deletions resources/blueprints/asset.yaml

This file was deleted.

8 changes: 0 additions & 8 deletions resources/blueprints/default.yaml

This file was deleted.

11 changes: 0 additions & 11 deletions resources/blueprints/entry_link.yaml

This file was deleted.

25 changes: 0 additions & 25 deletions resources/blueprints/user.yaml

This file was deleted.

2 changes: 2 additions & 0 deletions resources/js/app.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -130,6 +130,7 @@ Statamic.app({
CollectionScaffolder: require('./components/collections/Scaffolder.vue').default,
CollectionEditForm: require('./components/collections/EditForm.vue').default,
CollectionView: require('./components/collections/View.vue').default,
CollectionBlueprintListing: require('./components/collections/BlueprintListing.vue').default,
SessionExpiry: require('./components/SessionExpiry.vue').default,
NavigationListing: require('./components/navigation/Listing.vue').default,
NavigationCreateForm: require('./components/navigation/CreateForm.vue').default,
Expand All@@ -138,6 +139,7 @@ Statamic.app({
Stacks: require('./components/stacks/Stacks.vue').default,
TaxonomyCreateForm: require('./components/taxonomies/CreateForm.vue').default,
TaxonomyEditForm: require('./components/taxonomies/EditForm.vue').default,
TaxonomyBlueprintListing: require('./components/taxonomies/BlueprintListing.vue').default,
AssetContainerCreateForm: require('./components/asset-containers/CreateForm.vue').default,
AssetContainerEditForm: require('./components/asset-containers/EditForm.vue').default,
Updater: require('./components/updater/Updater.vue').default,
Expand Down
1 change: 1 addition & 0 deletions resources/js/bootstrap/fieldtypes.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -34,6 +34,7 @@ Vue.component('global_set_sites-fieldtype', require('../components/globals/Sites
Vue.component('grid-fieldtype', require('../components/fieldtypes/grid/Grid.vue').default);
Vue.component('grid-fieldtype-index', require('../components/fieldtypes/grid/GridIndex.vue').default);
Vue.component('hidden-fieldtype', require('../components/fieldtypes/HiddenFieldtype.vue').default);
Vue.component('html-fieldtype', require('../components/fieldtypes/HtmlFieldtype.vue').default);
Vue.component('integer-fieldtype', require('../components/fieldtypes/IntegerFieldtype.vue').default);
Vue.component('link-fieldtype', require('../components/fieldtypes/LinkFieldtype.vue').default);
Vue.component('list-fieldtype', require('../components/fieldtypes/ListFieldtype.vue').default);
Expand Down
4 changes: 4 additions & 0 deletions resources/js/components/assets/AssetManager.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,6 +11,10 @@
v-text="__('Edit Container')"
:redirect="container.edit_url">
</dropdown-item>
<dropdown-item
v-text="__('Edit Blueprint')"
:redirect="container.blueprint_url">
</dropdown-item>
<dropdown-item
v-if="container.can_delete"
v-text="__('Delete Container')"
Expand Down
14 changes: 1 addition & 13 deletions resources/js/components/assets/Editor/Editor.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -259,20 +259,8 @@ export default {
this.meta = data.meta;
this.runActionUrl = data.runActionUrl;
this.actions = data.actions;
this.getFieldset();
});
},

/**
* Load the fieldset
*/
getFieldset() {
const url = cp_url(`fields/publish-blueprints/${this.asset.blueprint}`);

this.$axios.get(url).then(response => {
this.fieldset = response.data;

// Flatten fields from all sections into one array.
this.fieldset = data.blueprint;
this.fields = _.chain(this.fieldset.sections)
.map(section => section.fields)
.flatten(true)
Expand Down
27 changes: 19 additions & 8 deletions resources/js/components/blueprints/Builder.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,15 +3,13 @@
<div class="blueprint-builder">

<header class="mb-3">
<breadcrumb :url="breadcrumbUrl" :title="__('Blueprints')" />

<div class="flex items-center justify-between">
<h1>{{ initialTitle }}</h1>
<h1 v-text="__('Edit Blueprint')" />
<button type="submit" class="btn-primary" @click.prevent="save" v-text="__('Save')" />
</div>
</header>

<div class="publish-form card p-0">
<div class="publish-form card p-0" v-if="showTitle">
<div class="form-group">
<label class="block">{{ __('Title') }}</label>
<small class="help-block">{{ __('messages.blueprints_title_instructions') }}</small>
Expand All@@ -22,12 +20,13 @@
</div>
</div>

<div class="content mt-5 mb-2">
<div class="content mt-5 mb-2" v-if="useSections">
<h2>{{ __('Tab Sections') }}</h2>
<p class="max-w-lg">{{ __('messages.tab_sections_instructions') }}</p>
</div>

<sections
:single-section="!useSections"
:initial-sections="blueprint.sections"
@updated="sectionsUpdated"
/>
Expand All@@ -45,13 +44,17 @@ export default {
Sections,
},

props: ['action', 'initialBlueprint', 'breadcrumbUrl'],
props: {
action: String,
initialBlueprint: Object,
showTitle: Boolean,
useSections: { type: Boolean, default: true }
},

data() {
return {
blueprint: clone(this.initialBlueprint),
blueprint: this.initializeBlueprint(),
sections: [],
initialTitle: this.initialBlueprint.title,
errors: {}
}
},
Expand DownExpand Up@@ -80,6 +83,14 @@ export default {

methods: {

initializeBlueprint() {
let blueprint = clone(this.initialBlueprint);

if (! this.showTitle) delete blueprint.title;

return blueprint;
},

sectionsUpdated(sections) {
this.sections = sections;
},
Expand Down
17 changes: 14 additions & 3 deletions resources/js/components/blueprints/Listing.vue
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
<template>
<data-list :visible-columns="columns" :columns="columns" :rows="rows">
<data-list :visible-columns="columns" :columns="columns" :rows="rows" :sort="false">
<div class="card p-0" slot-scope="{ filteredRows: rows }">
<data-list-table>
<data-list-table
:reorderable="reorderable"
@reordered="$emit('reordered', $event)"
>
<template slot="cell-title" slot-scope="{ row: blueprint }">
<a :href="blueprint.edit_url">{{ blueprint.title }}</a>
</template>
Expand DownExpand Up@@ -36,7 +39,7 @@ export default {

mixins: [Listing],

props: ['initialRows'],
props: ['initialRows', 'reorderable'],

data() {
return {
Expand All@@ -47,6 +50,14 @@ export default {
{ label: __('Fields'), field: 'fields' },
]
}
},

watch: {

initialRows(rows) {
this.rows = rows;
}

}

}
Expand Down
15 changes: 12 additions & 3 deletions resources/js/components/blueprints/Section.vue
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
<template>

<div class="blueprint-section w-full md:w-1/2 2xl:w-1/3" :class="{ 'w-full': isEditing }">
<div class="blueprint-section"
:class="{
'w-full md:w-1/2 2xl:w-1/3': !isEditing && !isSingle,
'w-full': isEditing || isSingle
}"
>
<div class="blueprint-section-card card p-0 h-full flex flex-col">

<div class="bg-grey-20 border-b text-sm flex rounded-t;">
<div class="bg-grey-20 border-b text-sm flex rounded-t;" v-if="!isSingle">
<div class="blueprint-drag-handle blueprint-section-drag-handle w-4 border-r"></div>
<div class="p-1.5 py-1 flex-1">
<span class="font-medium mr-1">
Expand All@@ -25,7 +30,7 @@
class="p-2"
:fields="section.fields"
:editing-field="editingField"
:is-section-expanded="isEditing"
:is-section-expanded="isEditing || isSingle"
:suggestable-condition-fields="suggestableConditionFields"
@field-created="fieldCreated"
@field-updated="fieldUpdated"
Expand DownExpand Up@@ -60,6 +65,10 @@ export default {
section: {
type: Object,
required: true
},
isSingle: {
type: Boolean,
default: false
}
},

Expand Down
10 changes: 8 additions & 2 deletions resources/js/components/blueprints/Sections.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,11 +9,12 @@
v-for="(section, i) in sections"
:key="section._id"
:section="section"
:is-single="singleSection"
@updated="updateSection(i, $event)"
@deleted="deleteSection(i)"
/>

<div class="blueprint-add-section-container w-full md:w-1/2 2xl:w-1/3">
<div class="blueprint-add-section-container w-full md:w-1/2 2xl:w-1/3" v-if="!singleSection">
<button class="blueprint-add-section-button outline-none" @click="addSection">
<div class="text-center flex items-center leading-none">
<div class="text-2xl mr-1">+</div>
Expand DownExpand Up@@ -55,6 +56,10 @@ export default {
newSectionText: {
type: String,
default: () => __('New Section')
},
singleSection: {
type: Boolean,
default: false
}
},

Expand All@@ -80,7 +85,8 @@ export default {
methods: {

makeSortable() {
this.makeSectionsSortable();
if (! this.singleSection) this.makeSectionsSortable();

this.makeFieldsSortable();
},

Expand Down
39 changes: 39 additions & 0 deletions resources/js/components/collections/BlueprintListing.vue
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
<script>
import BlueprintListing from '../blueprints/Listing.vue';

export default {

components: {
BlueprintListing
},

props: {
initialRows: Array,
reorderUrl: String
},

data() {
return {
rows: this.initialRows,
hasBeenReordered: false
}
},

methods: {
reordered(rows) {
this.rows = rows;
this.hasBeenReordered = true;
},

saveOrder() {
let order = this.rows.map(blueprint => blueprint.handle);

this.$axios
.post(this.reorderUrl, { order })
.then(response => this.$toast.success(__('Blueprints successfully reordered')))
.catch(error => this.$toast.error(__('Something went wrong')))
}
}

}
</script>
1 change: 1 addition & 0 deletions resources/js/components/collections/Listing.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,6 +8,7 @@
<template slot="actions" slot-scope="{ row: collection, index }">
<dropdown-list>
<dropdown-item :text="__('Edit Collection')" :redirect="collection.edit_url" />
<dropdown-item :text="__('Edit Blueprints')" :redirect="collection.blueprints_url" />
<dropdown-item :text="__('Scaffold Resources')" :redirect="collection.scaffold_url" />
<dropdown-item
v-if="collection.deleteable"
Expand Down
9 changes: 9 additions & 0 deletions resources/js/components/fieldtypes/HtmlFieldtype.vue
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
<template>
<div v-html="config.html" />
</template>

<script>
export default {
mixins: [Fieldtype]
};
</script>
1 change: 1 addition & 0 deletions resources/js/components/forms/Listing.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,6 +8,7 @@
<template slot="actions" slot-scope="{ row: form, index }">
<dropdown-list>
<dropdown-item :text="__('Edit')" :redirect="form.edit_url" />
<dropdown-item :text="__('Edit Blueprint')" :redirect="form.blueprint_url" />
<dropdown-item
v-if="form.deleteable"
:text="__('Delete')"
Expand Down
39 changes: 39 additions & 0 deletions resources/js/components/taxonomies/BlueprintListing.vue
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
<script>
import BlueprintListing from '../blueprints/Listing.vue';

export default {

components: {
BlueprintListing
},

props: {
initialRows: Array,
reorderUrl: String
},

data() {
return {
rows: this.initialRows,
hasBeenReordered: false
}
},

methods: {
reordered(rows) {
this.rows = rows;
this.hasBeenReordered = true;
},

saveOrder() {
let order = this.rows.map(blueprint => blueprint.handle);

this.$axios
.post(this.reorderUrl, { order })
.then(response => this.$toast.success(__('Blueprints successfully reordered')))
.catch(error => this.$toast.error(__('Something went wrong')))
}
}

}
</script>
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
d3b38e5
Initial Blueprints revamp ...
jasonvarga Jul 14, 2020
75dd755
Remove Blueprints fieldtype
jasonvarga Jul 14, 2020
ccd2354
Fix blueprint method
jasonvarga Jul 15, 2020
0ca90d2
Unnecessary
jasonvarga Jul 15, 2020
b748578
Apply blueprint changes to taxonomies
jasonvarga Jul 15, 2020
cbea3c0
Fix fields filter not working on taxonomy term listing
jasonvarga Jul 15, 2020
e383356
Support blueprint filter on taxonomy term listing
jasonvarga Jul 15, 2020
fb41342
Compose on any blueprint edit view, now that it could be in collectio…
jasonvarga Jul 15, 2020
e77ac09
Adjust some tests
jasonvarga Jul 15, 2020
2bcf33c
Adjust key
jasonvarga Jul 15, 2020
da16be6
Don't find it, get it from the collection
jasonvarga Jul 15, 2020
e8429d4
Apply blueprint changes to globals ...
jasonvarga Jul 15, 2020
ee397dd
Don't need to save the blueprint to file
jasonvarga Jul 15, 2020
9e4e3ff
Apply blueprint changes to assets ...
jasonvarga Jul 15, 2020
8b318d9
Fix test
jasonvarga Jul 15, 2020
eea6435
Apply blueprint changes to forms
jasonvarga Jul 15, 2020
0b5a323
Mark incomplete
jasonvarga Jul 15, 2020
7b3d37a
Just need the index
jasonvarga Jul 15, 2020
6fa49ce
Tidy
jasonvarga Jul 15, 2020
de4fe70
Blueprint index
jasonvarga Jul 15, 2020
cc72f70
Adjust link
jasonvarga Jul 15, 2020
efc27da
Apply blueprint changes to users
jasonvarga Jul 15, 2020
271f02c
Move breadcrumbs out of vue component
jasonvarga Jul 16, 2020
30574f8
Static title
jasonvarga Jul 16, 2020
de6cd12
Opt in for title field
jasonvarga Jul 16, 2020
9915261
Sections are optional (but used by default) and not used in forms and…
jasonvarga Jul 16, 2020
f4d0861
Add docs links
jasonvarga Jul 16, 2020
7a0bd62
Add blueprint link on users index
jasonvarga Jul 16, 2020
d401f1c
Add edit blueprint dropdown link to user edit form
jasonvarga Jul 16, 2020
7121463
More blueprint tweaks ...
jasonvarga Jul 20, 2020
5ca7928
Collection blueprints can be reordered
jasonvarga Jul 20, 2020
bd5eda8
Taxonomy blueprints can be reordered
jasonvarga Jul 20, 2020
5b3fbd1
Merge branch 'master' into feature/blueprints
jasonvarga Jul 20, 2020
b96ef99
BlueprintFound events
jasonvarga Jul 20, 2020
f9b3247
Apply fixes from StyleCI (#2107)
jasonvarga Jul 20, 2020
156a4e7
Pass items into method
jasonvarga Jul 20, 2020
c7f977a
Merge branch 'master' into feature/blueprints
jasonvarga Jul 20, 2020
0ff2381
Save the default blueprint when you opt for links and there are no bl…
jasonvarga Jul 21, 2020
44ff384
Simple html fieldtype, which is used to display links to edit bluepri…
jasonvarga Jul 21, 2020
ab850da
Prevent error when scaffolding blueprint
jasonvarga Jul 21, 2020
d22dedc
Apply fixes from StyleCI (#2108)
jasonvarga Jul 21, 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
7 changes: 0 additions & 7 deletions resources/blueprints/asset.yaml

This file was deleted.

8 changes: 0 additions & 8 deletions resources/blueprints/default.yaml

This file was deleted.

11 changes: 0 additions & 11 deletions resources/blueprints/entry_link.yaml

This file was deleted.

25 changes: 0 additions & 25 deletions resources/blueprints/user.yaml

This file was deleted.

2 changes: 2 additions & 0 deletions resources/js/app.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -130,6 +130,7 @@ Statamic.app({
CollectionScaffolder: require('./components/collections/Scaffolder.vue').default,
CollectionEditForm: require('./components/collections/EditForm.vue').default,
CollectionView: require('./components/collections/View.vue').default,
CollectionBlueprintListing: require('./components/collections/BlueprintListing.vue').default,
SessionExpiry: require('./components/SessionExpiry.vue').default,
NavigationListing: require('./components/navigation/Listing.vue').default,
NavigationCreateForm: require('./components/navigation/CreateForm.vue').default,
Expand All@@ -138,6 +139,7 @@ Statamic.app({
Stacks: require('./components/stacks/Stacks.vue').default,
TaxonomyCreateForm: require('./components/taxonomies/CreateForm.vue').default,
TaxonomyEditForm: require('./components/taxonomies/EditForm.vue').default,
TaxonomyBlueprintListing: require('./components/taxonomies/BlueprintListing.vue').default,
AssetContainerCreateForm: require('./components/asset-containers/CreateForm.vue').default,
AssetContainerEditForm: require('./components/asset-containers/EditForm.vue').default,
Updater: require('./components/updater/Updater.vue').default,
Expand Down
1 change: 1 addition & 0 deletions resources/js/bootstrap/fieldtypes.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -34,6 +34,7 @@ Vue.component('global_set_sites-fieldtype', require('../components/globals/Sites
Vue.component('grid-fieldtype', require('../components/fieldtypes/grid/Grid.vue').default);
Vue.component('grid-fieldtype-index', require('../components/fieldtypes/grid/GridIndex.vue').default);
Vue.component('hidden-fieldtype', require('../components/fieldtypes/HiddenFieldtype.vue').default);
Vue.component('html-fieldtype', require('../components/fieldtypes/HtmlFieldtype.vue').default);
Vue.component('integer-fieldtype', require('../components/fieldtypes/IntegerFieldtype.vue').default);
Vue.component('link-fieldtype', require('../components/fieldtypes/LinkFieldtype.vue').default);
Vue.component('list-fieldtype', require('../components/fieldtypes/ListFieldtype.vue').default);
Expand Down
4 changes: 4 additions & 0 deletions resources/js/components/assets/AssetManager.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,6 +11,10 @@
v-text="__('Edit Container')"
:redirect="container.edit_url">
</dropdown-item>
<dropdown-item
v-text="__('Edit Blueprint')"
:redirect="container.blueprint_url">
</dropdown-item>
<dropdown-item
v-if="container.can_delete"
v-text="__('Delete Container')"
Expand Down
14 changes: 1 addition & 13 deletions resources/js/components/assets/Editor/Editor.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -259,20 +259,8 @@ export default {
this.meta = data.meta;
this.runActionUrl = data.runActionUrl;
this.actions = data.actions;
this.getFieldset();
});
},

/**
* Load the fieldset
*/
getFieldset() {
const url = cp_url(`fields/publish-blueprints/${this.asset.blueprint}`);

this.$axios.get(url).then(response => {
this.fieldset = response.data;

// Flatten fields from all sections into one array.
this.fieldset = data.blueprint;
this.fields = _.chain(this.fieldset.sections)
.map(section => section.fields)
.flatten(true)
Expand Down
27 changes: 19 additions & 8 deletions resources/js/components/blueprints/Builder.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,15 +3,13 @@
<div class="blueprint-builder">

<header class="mb-3">
<breadcrumb :url="breadcrumbUrl" :title="__('Blueprints')" />

<div class="flex items-center justify-between">
<h1>{{ initialTitle }}</h1>
<h1 v-text="__('Edit Blueprint')" />
<button type="submit" class="btn-primary" @click.prevent="save" v-text="__('Save')" />
</div>
</header>

<div class="publish-form card p-0">
<div class="publish-form card p-0" v-if="showTitle">
<div class="form-group">
<label class="block">{{ __('Title') }}</label>
<small class="help-block">{{ __('messages.blueprints_title_instructions') }}</small>
Expand All@@ -22,12 +20,13 @@
</div>
</div>

<div class="content mt-5 mb-2">
<div class="content mt-5 mb-2" v-if="useSections">
<h2>{{ __('Tab Sections') }}</h2>
<p class="max-w-lg">{{ __('messages.tab_sections_instructions') }}</p>
</div>

<sections
:single-section="!useSections"
:initial-sections="blueprint.sections"
@updated="sectionsUpdated"
/>
Expand All@@ -45,13 +44,17 @@ export default {
Sections,
},

props: ['action', 'initialBlueprint', 'breadcrumbUrl'],
props: {
action: String,
initialBlueprint: Object,
showTitle: Boolean,
useSections: { type: Boolean, default: true }
},

data() {
return {
blueprint: clone(this.initialBlueprint),
blueprint: this.initializeBlueprint(),
sections: [],
initialTitle: this.initialBlueprint.title,
errors: {}
}
},
Expand DownExpand Up@@ -80,6 +83,14 @@ export default {

methods: {

initializeBlueprint() {
let blueprint = clone(this.initialBlueprint);

if (! this.showTitle) delete blueprint.title;

return blueprint;
},

sectionsUpdated(sections) {
this.sections = sections;
},
Expand Down
17 changes: 14 additions & 3 deletions resources/js/components/blueprints/Listing.vue
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
<template>
<data-list :visible-columns="columns" :columns="columns" :rows="rows">
<data-list :visible-columns="columns" :columns="columns" :rows="rows" :sort="false">
<div class="card p-0" slot-scope="{ filteredRows: rows }">
<data-list-table>
<data-list-table
:reorderable="reorderable"
@reordered="$emit('reordered', $event)"
>
<template slot="cell-title" slot-scope="{ row: blueprint }">
<a :href="blueprint.edit_url">{{ blueprint.title }}</a>
</template>
Expand DownExpand Up@@ -36,7 +39,7 @@ export default {

mixins: [Listing],

props: ['initialRows'],
props: ['initialRows', 'reorderable'],

data() {
return {
Expand All@@ -47,6 +50,14 @@ export default {
{ label: __('Fields'), field: 'fields' },
]
}
},

watch: {

initialRows(rows) {
this.rows = rows;
}

}

}
Expand Down
15 changes: 12 additions & 3 deletions resources/js/components/blueprints/Section.vue
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
<template>

<div class="blueprint-section w-full md:w-1/2 2xl:w-1/3" :class="{ 'w-full': isEditing }">
<div class="blueprint-section"
:class="{
'w-full md:w-1/2 2xl:w-1/3': !isEditing && !isSingle,
'w-full': isEditing || isSingle
}"
>
<div class="blueprint-section-card card p-0 h-full flex flex-col">

<div class="bg-grey-20 border-b text-sm flex rounded-t;">
<div class="bg-grey-20 border-b text-sm flex rounded-t;" v-if="!isSingle">
<div class="blueprint-drag-handle blueprint-section-drag-handle w-4 border-r"></div>
<div class="p-1.5 py-1 flex-1">
<span class="font-medium mr-1">
Expand All@@ -25,7 +30,7 @@
class="p-2"
:fields="section.fields"
:editing-field="editingField"
:is-section-expanded="isEditing"
:is-section-expanded="isEditing || isSingle"
:suggestable-condition-fields="suggestableConditionFields"
@field-created="fieldCreated"
@field-updated="fieldUpdated"
Expand DownExpand Up@@ -60,6 +65,10 @@ export default {
section: {
type: Object,
required: true
},
isSingle: {
type: Boolean,
default: false
}
},

Expand Down
10 changes: 8 additions & 2 deletions resources/js/components/blueprints/Sections.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,11 +9,12 @@
v-for="(section, i) in sections"
:key="section._id"
:section="section"
:is-single="singleSection"
@updated="updateSection(i, $event)"
@deleted="deleteSection(i)"
/>

<div class="blueprint-add-section-container w-full md:w-1/2 2xl:w-1/3">
<div class="blueprint-add-section-container w-full md:w-1/2 2xl:w-1/3" v-if="!singleSection">
<button class="blueprint-add-section-button outline-none" @click="addSection">
<div class="text-center flex items-center leading-none">
<div class="text-2xl mr-1">+</div>
Expand DownExpand Up@@ -55,6 +56,10 @@ export default {
newSectionText: {
type: String,
default: () => __('New Section')
},
singleSection: {
type: Boolean,
default: false
}
},

Expand All@@ -80,7 +85,8 @@ export default {
methods: {

makeSortable() {
this.makeSectionsSortable();
if (! this.singleSection) this.makeSectionsSortable();

this.makeFieldsSortable();
},

Expand Down
39 changes: 39 additions & 0 deletions resources/js/components/collections/BlueprintListing.vue
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
<script>
import BlueprintListing from '../blueprints/Listing.vue';

export default {

components: {
BlueprintListing
},

props: {
initialRows: Array,
reorderUrl: String
},

data() {
return {
rows: this.initialRows,
hasBeenReordered: false
}
},

methods: {
reordered(rows) {
this.rows = rows;
this.hasBeenReordered = true;
},

saveOrder() {
let order = this.rows.map(blueprint => blueprint.handle);

this.$axios
.post(this.reorderUrl, { order })
.then(response => this.$toast.success(__('Blueprints successfully reordered')))
.catch(error => this.$toast.error(__('Something went wrong')))
}
}

}
</script>
1 change: 1 addition & 0 deletions resources/js/components/collections/Listing.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,6 +8,7 @@
<template slot="actions" slot-scope="{ row: collection, index }">
<dropdown-list>
<dropdown-item :text="__('Edit Collection')" :redirect="collection.edit_url" />
<dropdown-item :text="__('Edit Blueprints')" :redirect="collection.blueprints_url" />
<dropdown-item :text="__('Scaffold Resources')" :redirect="collection.scaffold_url" />
<dropdown-item
v-if="collection.deleteable"
Expand Down
9 changes: 9 additions & 0 deletions resources/js/components/fieldtypes/HtmlFieldtype.vue
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
<template>
<div v-html="config.html" />
</template>

<script>
export default {
mixins: [Fieldtype]
};
</script>
1 change: 1 addition & 0 deletions resources/js/components/forms/Listing.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,6 +8,7 @@
<template slot="actions" slot-scope="{ row: form, index }">
<dropdown-list>
<dropdown-item :text="__('Edit')" :redirect="form.edit_url" />
<dropdown-item :text="__('Edit Blueprint')" :redirect="form.blueprint_url" />
<dropdown-item
v-if="form.deleteable"
:text="__('Delete')"
Expand Down
39 changes: 39 additions & 0 deletions resources/js/components/taxonomies/BlueprintListing.vue
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
<script>
import BlueprintListing from '../blueprints/Listing.vue';

export default {

components: {
BlueprintListing
},

props: {
initialRows: Array,
reorderUrl: String
},

data() {
return {
rows: this.initialRows,
hasBeenReordered: false
}
},

methods: {
reordered(rows) {
this.rows = rows;
this.hasBeenReordered = true;
},

saveOrder() {
let order = this.rows.map(blueprint => blueprint.handle);

this.$axios
.post(this.reorderUrl, { order })
.then(response => this.$toast.success(__('Blueprints successfully reordered')))
.catch(error => this.$toast.error(__('Something went wrong')))
}
}

}
</script>
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
d3b38e5
Initial Blueprints revamp ...
jasonvarga Jul 14, 2020
75dd755
Remove Blueprints fieldtype
jasonvarga Jul 14, 2020
ccd2354
Fix blueprint method
jasonvarga Jul 15, 2020
0ca90d2
Unnecessary
jasonvarga Jul 15, 2020
b748578
Apply blueprint changes to taxonomies
jasonvarga Jul 15, 2020
cbea3c0
Fix fields filter not working on taxonomy term listing
jasonvarga Jul 15, 2020
e383356
Support blueprint filter on taxonomy term listing
jasonvarga Jul 15, 2020
fb41342
Compose on any blueprint edit view, now that it could be in collectio…
jasonvarga Jul 15, 2020
e77ac09
Adjust some tests
jasonvarga Jul 15, 2020
2bcf33c
Adjust key
jasonvarga Jul 15, 2020
da16be6
Don't find it, get it from the collection
jasonvarga Jul 15, 2020
e8429d4
Apply blueprint changes to globals ...
jasonvarga Jul 15, 2020
ee397dd
Don't need to save the blueprint to file
jasonvarga Jul 15, 2020
9e4e3ff
Apply blueprint changes to assets ...
jasonvarga Jul 15, 2020
8b318d9
Fix test
jasonvarga Jul 15, 2020
eea6435
Apply blueprint changes to forms
jasonvarga Jul 15, 2020
0b5a323
Mark incomplete
jasonvarga Jul 15, 2020
7b3d37a
Just need the index
jasonvarga Jul 15, 2020
6fa49ce
Tidy
jasonvarga Jul 15, 2020
de4fe70
Blueprint index
jasonvarga Jul 15, 2020
cc72f70
Adjust link
jasonvarga Jul 15, 2020
efc27da
Apply blueprint changes to users
jasonvarga Jul 15, 2020
271f02c
Move breadcrumbs out of vue component
jasonvarga Jul 16, 2020
30574f8
Static title
jasonvarga Jul 16, 2020
de6cd12
Opt in for title field
jasonvarga Jul 16, 2020
9915261
Sections are optional (but used by default) and not used in forms and…
jasonvarga Jul 16, 2020
f4d0861
Add docs links
jasonvarga Jul 16, 2020
7a0bd62
Add blueprint link on users index
jasonvarga Jul 16, 2020
d401f1c
Add edit blueprint dropdown link to user edit form
jasonvarga Jul 16, 2020
7121463
More blueprint tweaks ...
jasonvarga Jul 20, 2020
5ca7928
Collection blueprints can be reordered
jasonvarga Jul 20, 2020
bd5eda8
Taxonomy blueprints can be reordered
jasonvarga Jul 20, 2020
5b3fbd1
Merge branch 'master' into feature/blueprints
jasonvarga Jul 20, 2020
b96ef99
BlueprintFound events
jasonvarga Jul 20, 2020
f9b3247
Apply fixes from StyleCI (#2107)
jasonvarga Jul 20, 2020
156a4e7
Pass items into method
jasonvarga Jul 20, 2020
c7f977a
Merge branch 'master' into feature/blueprints
jasonvarga Jul 20, 2020
0ff2381
Save the default blueprint when you opt for links and there are no bl…
jasonvarga Jul 21, 2020
44ff384
Simple html fieldtype, which is used to display links to edit bluepri…
jasonvarga Jul 21, 2020
ab850da
Prevent error when scaffolding blueprint
jasonvarga Jul 21, 2020
d22dedc
Apply fixes from StyleCI (#2108)
jasonvarga Jul 21, 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
7 changes: 0 additions & 7 deletions resources/blueprints/asset.yaml

This file was deleted.

8 changes: 0 additions & 8 deletions resources/blueprints/default.yaml

This file was deleted.

11 changes: 0 additions & 11 deletions resources/blueprints/entry_link.yaml

This file was deleted.

25 changes: 0 additions & 25 deletions resources/blueprints/user.yaml

This file was deleted.

2 changes: 2 additions & 0 deletions resources/js/app.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -130,6 +130,7 @@ Statamic.app({
CollectionScaffolder: require('./components/collections/Scaffolder.vue').default,
CollectionEditForm: require('./components/collections/EditForm.vue').default,
CollectionView: require('./components/collections/View.vue').default,
CollectionBlueprintListing: require('./components/collections/BlueprintListing.vue').default,
SessionExpiry: require('./components/SessionExpiry.vue').default,
NavigationListing: require('./components/navigation/Listing.vue').default,
NavigationCreateForm: require('./components/navigation/CreateForm.vue').default,
Expand All@@ -138,6 +139,7 @@ Statamic.app({
Stacks: require('./components/stacks/Stacks.vue').default,
TaxonomyCreateForm: require('./components/taxonomies/CreateForm.vue').default,
TaxonomyEditForm: require('./components/taxonomies/EditForm.vue').default,
TaxonomyBlueprintListing: require('./components/taxonomies/BlueprintListing.vue').default,
AssetContainerCreateForm: require('./components/asset-containers/CreateForm.vue').default,
AssetContainerEditForm: require('./components/asset-containers/EditForm.vue').default,
Updater: require('./components/updater/Updater.vue').default,
Expand Down
1 change: 1 addition & 0 deletions resources/js/bootstrap/fieldtypes.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -34,6 +34,7 @@ Vue.component('global_set_sites-fieldtype', require('../components/globals/Sites
Vue.component('grid-fieldtype', require('../components/fieldtypes/grid/Grid.vue').default);
Vue.component('grid-fieldtype-index', require('../components/fieldtypes/grid/GridIndex.vue').default);
Vue.component('hidden-fieldtype', require('../components/fieldtypes/HiddenFieldtype.vue').default);
Vue.component('html-fieldtype', require('../components/fieldtypes/HtmlFieldtype.vue').default);
Vue.component('integer-fieldtype', require('../components/fieldtypes/IntegerFieldtype.vue').default);
Vue.component('link-fieldtype', require('../components/fieldtypes/LinkFieldtype.vue').default);
Vue.component('list-fieldtype', require('../components/fieldtypes/ListFieldtype.vue').default);
Expand Down
4 changes: 4 additions & 0 deletions resources/js/components/assets/AssetManager.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,6 +11,10 @@
v-text="__('Edit Container')"
:redirect="container.edit_url">
</dropdown-item>
<dropdown-item
v-text="__('Edit Blueprint')"
:redirect="container.blueprint_url">
</dropdown-item>
<dropdown-item
v-if="container.can_delete"
v-text="__('Delete Container')"
Expand Down
14 changes: 1 addition & 13 deletions resources/js/components/assets/Editor/Editor.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -259,20 +259,8 @@ export default {
this.meta = data.meta;
this.runActionUrl = data.runActionUrl;
this.actions = data.actions;
this.getFieldset();
});
},

/**
* Load the fieldset
*/
getFieldset() {
const url = cp_url(`fields/publish-blueprints/${this.asset.blueprint}`);

this.$axios.get(url).then(response => {
this.fieldset = response.data;

// Flatten fields from all sections into one array.
this.fieldset = data.blueprint;
this.fields = _.chain(this.fieldset.sections)
.map(section => section.fields)
.flatten(true)
Expand Down
27 changes: 19 additions & 8 deletions resources/js/components/blueprints/Builder.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,15 +3,13 @@
<div class="blueprint-builder">

<header class="mb-3">
<breadcrumb :url="breadcrumbUrl" :title="__('Blueprints')" />

<div class="flex items-center justify-between">
<h1>{{ initialTitle }}</h1>
<h1 v-text="__('Edit Blueprint')" />
<button type="submit" class="btn-primary" @click.prevent="save" v-text="__('Save')" />
</div>
</header>

<div class="publish-form card p-0">
<div class="publish-form card p-0" v-if="showTitle">
<div class="form-group">
<label class="block">{{ __('Title') }}</label>
<small class="help-block">{{ __('messages.blueprints_title_instructions') }}</small>
Expand All@@ -22,12 +20,13 @@
</div>
</div>

<div class="content mt-5 mb-2">
<div class="content mt-5 mb-2" v-if="useSections">
<h2>{{ __('Tab Sections') }}</h2>
<p class="max-w-lg">{{ __('messages.tab_sections_instructions') }}</p>
</div>

<sections
:single-section="!useSections"
:initial-sections="blueprint.sections"
@updated="sectionsUpdated"
/>
Expand All@@ -45,13 +44,17 @@ export default {
Sections,
},

props: ['action', 'initialBlueprint', 'breadcrumbUrl'],
props: {
action: String,
initialBlueprint: Object,
showTitle: Boolean,
useSections: { type: Boolean, default: true }
},

data() {
return {
blueprint: clone(this.initialBlueprint),
blueprint: this.initializeBlueprint(),
sections: [],
initialTitle: this.initialBlueprint.title,
errors: {}
}
},
Expand DownExpand Up@@ -80,6 +83,14 @@ export default {

methods: {

initializeBlueprint() {
let blueprint = clone(this.initialBlueprint);

if (! this.showTitle) delete blueprint.title;

return blueprint;
},

sectionsUpdated(sections) {
this.sections = sections;
},
Expand Down
17 changes: 14 additions & 3 deletions resources/js/components/blueprints/Listing.vue
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
<template>
<data-list :visible-columns="columns" :columns="columns" :rows="rows">
<data-list :visible-columns="columns" :columns="columns" :rows="rows" :sort="false">
<div class="card p-0" slot-scope="{ filteredRows: rows }">
<data-list-table>
<data-list-table
:reorderable="reorderable"
@reordered="$emit('reordered', $event)"
>
<template slot="cell-title" slot-scope="{ row: blueprint }">
<a :href="blueprint.edit_url">{{ blueprint.title }}</a>
</template>
Expand DownExpand Up@@ -36,7 +39,7 @@ export default {

mixins: [Listing],

props: ['initialRows'],
props: ['initialRows', 'reorderable'],

data() {
return {
Expand All@@ -47,6 +50,14 @@ export default {
{ label: __('Fields'), field: 'fields' },
]
}
},

watch: {

initialRows(rows) {
this.rows = rows;
}

}

}
Expand Down
15 changes: 12 additions & 3 deletions resources/js/components/blueprints/Section.vue
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
<template>

<div class="blueprint-section w-full md:w-1/2 2xl:w-1/3" :class="{ 'w-full': isEditing }">
<div class="blueprint-section"
:class="{
'w-full md:w-1/2 2xl:w-1/3': !isEditing && !isSingle,
'w-full': isEditing || isSingle
}"
>
<div class="blueprint-section-card card p-0 h-full flex flex-col">

<div class="bg-grey-20 border-b text-sm flex rounded-t;">
<div class="bg-grey-20 border-b text-sm flex rounded-t;" v-if="!isSingle">
<div class="blueprint-drag-handle blueprint-section-drag-handle w-4 border-r"></div>
<div class="p-1.5 py-1 flex-1">
<span class="font-medium mr-1">
Expand All@@ -25,7 +30,7 @@
class="p-2"
:fields="section.fields"
:editing-field="editingField"
:is-section-expanded="isEditing"
:is-section-expanded="isEditing || isSingle"
:suggestable-condition-fields="suggestableConditionFields"
@field-created="fieldCreated"
@field-updated="fieldUpdated"
Expand DownExpand Up@@ -60,6 +65,10 @@ export default {
section: {
type: Object,
required: true
},
isSingle: {
type: Boolean,
default: false
}
},

Expand Down
10 changes: 8 additions & 2 deletions resources/js/components/blueprints/Sections.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,11 +9,12 @@
v-for="(section, i) in sections"
:key="section._id"
:section="section"
:is-single="singleSection"
@updated="updateSection(i, $event)"
@deleted="deleteSection(i)"
/>

<div class="blueprint-add-section-container w-full md:w-1/2 2xl:w-1/3">
<div class="blueprint-add-section-container w-full md:w-1/2 2xl:w-1/3" v-if="!singleSection">
<button class="blueprint-add-section-button outline-none" @click="addSection">
<div class="text-center flex items-center leading-none">
<div class="text-2xl mr-1">+</div>
Expand DownExpand Up@@ -55,6 +56,10 @@ export default {
newSectionText: {
type: String,
default: () => __('New Section')
},
singleSection: {
type: Boolean,
default: false
}
},

Expand All@@ -80,7 +85,8 @@ export default {
methods: {

makeSortable() {
this.makeSectionsSortable();
if (! this.singleSection) this.makeSectionsSortable();

this.makeFieldsSortable();
},

Expand Down
39 changes: 39 additions & 0 deletions resources/js/components/collections/BlueprintListing.vue
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
<script>
import BlueprintListing from '../blueprints/Listing.vue';

export default {

components: {
BlueprintListing
},

props: {
initialRows: Array,
reorderUrl: String
},

data() {
return {
rows: this.initialRows,
hasBeenReordered: false
}
},

methods: {
reordered(rows) {
this.rows = rows;
this.hasBeenReordered = true;
},

saveOrder() {
let order = this.rows.map(blueprint => blueprint.handle);

this.$axios
.post(this.reorderUrl, { order })
.then(response => this.$toast.success(__('Blueprints successfully reordered')))
.catch(error => this.$toast.error(__('Something went wrong')))
}
}

}
</script>
1 change: 1 addition & 0 deletions resources/js/components/collections/Listing.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,6 +8,7 @@
<template slot="actions" slot-scope="{ row: collection, index }">
<dropdown-list>
<dropdown-item :text="__('Edit Collection')" :redirect="collection.edit_url" />
<dropdown-item :text="__('Edit Blueprints')" :redirect="collection.blueprints_url" />
<dropdown-item :text="__('Scaffold Resources')" :redirect="collection.scaffold_url" />
<dropdown-item
v-if="collection.deleteable"
Expand Down
9 changes: 9 additions & 0 deletions resources/js/components/fieldtypes/HtmlFieldtype.vue
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
<template>
<div v-html="config.html" />
</template>

<script>
export default {
mixins: [Fieldtype]
};
</script>
1 change: 1 addition & 0 deletions resources/js/components/forms/Listing.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,6 +8,7 @@
<template slot="actions" slot-scope="{ row: form, index }">
<dropdown-list>
<dropdown-item :text="__('Edit')" :redirect="form.edit_url" />
<dropdown-item :text="__('Edit Blueprint')" :redirect="form.blueprint_url" />
<dropdown-item
v-if="form.deleteable"
:text="__('Delete')"
Expand Down
39 changes: 39 additions & 0 deletions resources/js/components/taxonomies/BlueprintListing.vue
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
<script>
import BlueprintListing from '../blueprints/Listing.vue';

export default {

components: {
BlueprintListing
},

props: {
initialRows: Array,
reorderUrl: String
},

data() {
return {
rows: this.initialRows,
hasBeenReordered: false
}
},

methods: {
reordered(rows) {
this.rows = rows;
this.hasBeenReordered = true;
},

saveOrder() {
let order = this.rows.map(blueprint => blueprint.handle);

this.$axios
.post(this.reorderUrl, { order })
.then(response => this.$toast.success(__('Blueprints successfully reordered')))
.catch(error => this.$toast.error(__('Something went wrong')))
}
}

}
</script>
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
d3b38e5
Initial Blueprints revamp ...
jasonvarga Jul 14, 2020
75dd755
Remove Blueprints fieldtype
jasonvarga Jul 14, 2020
ccd2354
Fix blueprint method
jasonvarga Jul 15, 2020
0ca90d2
Unnecessary
jasonvarga Jul 15, 2020
b748578
Apply blueprint changes to taxonomies
jasonvarga Jul 15, 2020
cbea3c0
Fix fields filter not working on taxonomy term listing
jasonvarga Jul 15, 2020
e383356
Support blueprint filter on taxonomy term listing
jasonvarga Jul 15, 2020
fb41342
Compose on any blueprint edit view, now that it could be in collectio…
jasonvarga Jul 15, 2020
e77ac09
Adjust some tests
jasonvarga Jul 15, 2020
2bcf33c
Adjust key
jasonvarga Jul 15, 2020
da16be6
Don't find it, get it from the collection
jasonvarga Jul 15, 2020
e8429d4
Apply blueprint changes to globals ...
jasonvarga Jul 15, 2020
ee397dd
Don't need to save the blueprint to file
jasonvarga Jul 15, 2020
9e4e3ff
Apply blueprint changes to assets ...
jasonvarga Jul 15, 2020
8b318d9
Fix test
jasonvarga Jul 15, 2020
eea6435
Apply blueprint changes to forms
jasonvarga Jul 15, 2020
0b5a323
Mark incomplete
jasonvarga Jul 15, 2020
7b3d37a
Just need the index
jasonvarga Jul 15, 2020
6fa49ce
Tidy
jasonvarga Jul 15, 2020
de4fe70
Blueprint index
jasonvarga Jul 15, 2020
cc72f70
Adjust link
jasonvarga Jul 15, 2020
efc27da
Apply blueprint changes to users
jasonvarga Jul 15, 2020
271f02c
Move breadcrumbs out of vue component
jasonvarga Jul 16, 2020
30574f8
Static title
jasonvarga Jul 16, 2020
de6cd12
Opt in for title field
jasonvarga Jul 16, 2020
9915261
Sections are optional (but used by default) and not used in forms and…
jasonvarga Jul 16, 2020
f4d0861
Add docs links
jasonvarga Jul 16, 2020
7a0bd62
Add blueprint link on users index
jasonvarga Jul 16, 2020
d401f1c
Add edit blueprint dropdown link to user edit form
jasonvarga Jul 16, 2020
7121463
More blueprint tweaks ...
jasonvarga Jul 20, 2020
5ca7928
Collection blueprints can be reordered
jasonvarga Jul 20, 2020
bd5eda8
Taxonomy blueprints can be reordered
jasonvarga Jul 20, 2020
5b3fbd1
Merge branch 'master' into feature/blueprints
jasonvarga Jul 20, 2020
b96ef99
BlueprintFound events
jasonvarga Jul 20, 2020
f9b3247
Apply fixes from StyleCI (#2107)
jasonvarga Jul 20, 2020
156a4e7
Pass items into method
jasonvarga Jul 20, 2020
c7f977a
Merge branch 'master' into feature/blueprints
jasonvarga Jul 20, 2020
0ff2381
Save the default blueprint when you opt for links and there are no bl…
jasonvarga Jul 21, 2020
44ff384
Simple html fieldtype, which is used to display links to edit bluepri…
jasonvarga Jul 21, 2020
ab850da
Prevent error when scaffolding blueprint
jasonvarga Jul 21, 2020
d22dedc
Apply fixes from StyleCI (#2108)
jasonvarga Jul 21, 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
7 changes: 0 additions & 7 deletions resources/blueprints/asset.yaml

This file was deleted.

8 changes: 0 additions & 8 deletions resources/blueprints/default.yaml

This file was deleted.

11 changes: 0 additions & 11 deletions resources/blueprints/entry_link.yaml

This file was deleted.

25 changes: 0 additions & 25 deletions resources/blueprints/user.yaml

This file was deleted.

2 changes: 2 additions & 0 deletions resources/js/app.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -130,6 +130,7 @@ Statamic.app({
CollectionScaffolder: require('./components/collections/Scaffolder.vue').default,
CollectionEditForm: require('./components/collections/EditForm.vue').default,
CollectionView: require('./components/collections/View.vue').default,
CollectionBlueprintListing: require('./components/collections/BlueprintListing.vue').default,
SessionExpiry: require('./components/SessionExpiry.vue').default,
NavigationListing: require('./components/navigation/Listing.vue').default,
NavigationCreateForm: require('./components/navigation/CreateForm.vue').default,
Expand All@@ -138,6 +139,7 @@ Statamic.app({
Stacks: require('./components/stacks/Stacks.vue').default,
TaxonomyCreateForm: require('./components/taxonomies/CreateForm.vue').default,
TaxonomyEditForm: require('./components/taxonomies/EditForm.vue').default,
TaxonomyBlueprintListing: require('./components/taxonomies/BlueprintListing.vue').default,
AssetContainerCreateForm: require('./components/asset-containers/CreateForm.vue').default,
AssetContainerEditForm: require('./components/asset-containers/EditForm.vue').default,
Updater: require('./components/updater/Updater.vue').default,
Expand Down
1 change: 1 addition & 0 deletions resources/js/bootstrap/fieldtypes.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -34,6 +34,7 @@ Vue.component('global_set_sites-fieldtype', require('../components/globals/Sites
Vue.component('grid-fieldtype', require('../components/fieldtypes/grid/Grid.vue').default);
Vue.component('grid-fieldtype-index', require('../components/fieldtypes/grid/GridIndex.vue').default);
Vue.component('hidden-fieldtype', require('../components/fieldtypes/HiddenFieldtype.vue').default);
Vue.component('html-fieldtype', require('../components/fieldtypes/HtmlFieldtype.vue').default);
Vue.component('integer-fieldtype', require('../components/fieldtypes/IntegerFieldtype.vue').default);
Vue.component('link-fieldtype', require('../components/fieldtypes/LinkFieldtype.vue').default);
Vue.component('list-fieldtype', require('../components/fieldtypes/ListFieldtype.vue').default);
Expand Down
4 changes: 4 additions & 0 deletions resources/js/components/assets/AssetManager.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,6 +11,10 @@
v-text="__('Edit Container')"
:redirect="container.edit_url">
</dropdown-item>
<dropdown-item
v-text="__('Edit Blueprint')"
:redirect="container.blueprint_url">
</dropdown-item>
<dropdown-item
v-if="container.can_delete"
v-text="__('Delete Container')"
Expand Down
14 changes: 1 addition & 13 deletions resources/js/components/assets/Editor/Editor.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -259,20 +259,8 @@ export default {
this.meta = data.meta;
this.runActionUrl = data.runActionUrl;
this.actions = data.actions;
this.getFieldset();
});
},

/**
* Load the fieldset
*/
getFieldset() {
const url = cp_url(`fields/publish-blueprints/${this.asset.blueprint}`);

this.$axios.get(url).then(response => {
this.fieldset = response.data;

// Flatten fields from all sections into one array.
this.fieldset = data.blueprint;
this.fields = _.chain(this.fieldset.sections)
.map(section => section.fields)
.flatten(true)
Expand Down
27 changes: 19 additions & 8 deletions resources/js/components/blueprints/Builder.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,15 +3,13 @@
<div class="blueprint-builder">

<header class="mb-3">
<breadcrumb :url="breadcrumbUrl" :title="__('Blueprints')" />

<div class="flex items-center justify-between">
<h1>{{ initialTitle }}</h1>
<h1 v-text="__('Edit Blueprint')" />
<button type="submit" class="btn-primary" @click.prevent="save" v-text="__('Save')" />
</div>
</header>

<div class="publish-form card p-0">
<div class="publish-form card p-0" v-if="showTitle">
<div class="form-group">
<label class="block">{{ __('Title') }}</label>
<small class="help-block">{{ __('messages.blueprints_title_instructions') }}</small>
Expand All@@ -22,12 +20,13 @@
</div>
</div>

<div class="content mt-5 mb-2">
<div class="content mt-5 mb-2" v-if="useSections">
<h2>{{ __('Tab Sections') }}</h2>
<p class="max-w-lg">{{ __('messages.tab_sections_instructions') }}</p>
</div>

<sections
:single-section="!useSections"
:initial-sections="blueprint.sections"
@updated="sectionsUpdated"
/>
Expand All@@ -45,13 +44,17 @@ export default {
Sections,
},

props: ['action', 'initialBlueprint', 'breadcrumbUrl'],
props: {
action: String,
initialBlueprint: Object,
showTitle: Boolean,
useSections: { type: Boolean, default: true }
},

data() {
return {
blueprint: clone(this.initialBlueprint),
blueprint: this.initializeBlueprint(),
sections: [],
initialTitle: this.initialBlueprint.title,
errors: {}
}
},
Expand DownExpand Up@@ -80,6 +83,14 @@ export default {

methods: {

initializeBlueprint() {
let blueprint = clone(this.initialBlueprint);

if (! this.showTitle) delete blueprint.title;

return blueprint;
},

sectionsUpdated(sections) {
this.sections = sections;
},
Expand Down
17 changes: 14 additions & 3 deletions resources/js/components/blueprints/Listing.vue
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
<template>
<data-list :visible-columns="columns" :columns="columns" :rows="rows">
<data-list :visible-columns="columns" :columns="columns" :rows="rows" :sort="false">
<div class="card p-0" slot-scope="{ filteredRows: rows }">
<data-list-table>
<data-list-table
:reorderable="reorderable"
@reordered="$emit('reordered', $event)"
>
<template slot="cell-title" slot-scope="{ row: blueprint }">
<a :href="blueprint.edit_url">{{ blueprint.title }}</a>
</template>
Expand DownExpand Up@@ -36,7 +39,7 @@ export default {

mixins: [Listing],

props: ['initialRows'],
props: ['initialRows', 'reorderable'],

data() {
return {
Expand All@@ -47,6 +50,14 @@ export default {
{ label: __('Fields'), field: 'fields' },
]
}
},

watch: {

initialRows(rows) {
this.rows = rows;
}

}

}
Expand Down
15 changes: 12 additions & 3 deletions resources/js/components/blueprints/Section.vue
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
<template>

<div class="blueprint-section w-full md:w-1/2 2xl:w-1/3" :class="{ 'w-full': isEditing }">
<div class="blueprint-section"
:class="{
'w-full md:w-1/2 2xl:w-1/3': !isEditing && !isSingle,
'w-full': isEditing || isSingle
}"
>
<div class="blueprint-section-card card p-0 h-full flex flex-col">

<div class="bg-grey-20 border-b text-sm flex rounded-t;">
<div class="bg-grey-20 border-b text-sm flex rounded-t;" v-if="!isSingle">
<div class="blueprint-drag-handle blueprint-section-drag-handle w-4 border-r"></div>
<div class="p-1.5 py-1 flex-1">
<span class="font-medium mr-1">
Expand All@@ -25,7 +30,7 @@
class="p-2"
:fields="section.fields"
:editing-field="editingField"
:is-section-expanded="isEditing"
:is-section-expanded="isEditing || isSingle"
:suggestable-condition-fields="suggestableConditionFields"
@field-created="fieldCreated"
@field-updated="fieldUpdated"
Expand DownExpand Up@@ -60,6 +65,10 @@ export default {
section: {
type: Object,
required: true
},
isSingle: {
type: Boolean,
default: false
}
},

Expand Down
10 changes: 8 additions & 2 deletions resources/js/components/blueprints/Sections.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,11 +9,12 @@
v-for="(section, i) in sections"
:key="section._id"
:section="section"
:is-single="singleSection"
@updated="updateSection(i, $event)"
@deleted="deleteSection(i)"
/>

<div class="blueprint-add-section-container w-full md:w-1/2 2xl:w-1/3">
<div class="blueprint-add-section-container w-full md:w-1/2 2xl:w-1/3" v-if="!singleSection">
<button class="blueprint-add-section-button outline-none" @click="addSection">
<div class="text-center flex items-center leading-none">
<div class="text-2xl mr-1">+</div>
Expand DownExpand Up@@ -55,6 +56,10 @@ export default {
newSectionText: {
type: String,
default: () => __('New Section')
},
singleSection: {
type: Boolean,
default: false
}
},

Expand All@@ -80,7 +85,8 @@ export default {
methods: {

makeSortable() {
this.makeSectionsSortable();
if (! this.singleSection) this.makeSectionsSortable();

this.makeFieldsSortable();
},

Expand Down
39 changes: 39 additions & 0 deletions resources/js/components/collections/BlueprintListing.vue
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
<script>
import BlueprintListing from '../blueprints/Listing.vue';

export default {

components: {
BlueprintListing
},

props: {
initialRows: Array,
reorderUrl: String
},

data() {
return {
rows: this.initialRows,
hasBeenReordered: false
}
},

methods: {
reordered(rows) {
this.rows = rows;
this.hasBeenReordered = true;
},

saveOrder() {
let order = this.rows.map(blueprint => blueprint.handle);

this.$axios
.post(this.reorderUrl, { order })
.then(response => this.$toast.success(__('Blueprints successfully reordered')))
.catch(error => this.$toast.error(__('Something went wrong')))
}
}

}
</script>
1 change: 1 addition & 0 deletions resources/js/components/collections/Listing.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,6 +8,7 @@
<template slot="actions" slot-scope="{ row: collection, index }">
<dropdown-list>
<dropdown-item :text="__('Edit Collection')" :redirect="collection.edit_url" />
<dropdown-item :text="__('Edit Blueprints')" :redirect="collection.blueprints_url" />
<dropdown-item :text="__('Scaffold Resources')" :redirect="collection.scaffold_url" />
<dropdown-item
v-if="collection.deleteable"
Expand Down
9 changes: 9 additions & 0 deletions resources/js/components/fieldtypes/HtmlFieldtype.vue
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
<template>
<div v-html="config.html" />
</template>

<script>
export default {
mixins: [Fieldtype]
};
</script>
1 change: 1 addition & 0 deletions resources/js/components/forms/Listing.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,6 +8,7 @@
<template slot="actions" slot-scope="{ row: form, index }">
<dropdown-list>
<dropdown-item :text="__('Edit')" :redirect="form.edit_url" />
<dropdown-item :text="__('Edit Blueprint')" :redirect="form.blueprint_url" />
<dropdown-item
v-if="form.deleteable"
:text="__('Delete')"
Expand Down
39 changes: 39 additions & 0 deletions resources/js/components/taxonomies/BlueprintListing.vue
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
<script>
import BlueprintListing from '../blueprints/Listing.vue';

export default {

components: {
BlueprintListing
},

props: {
initialRows: Array,
reorderUrl: String
},

data() {
return {
rows: this.initialRows,
hasBeenReordered: false
}
},

methods: {
reordered(rows) {
this.rows = rows;
this.hasBeenReordered = true;
},

saveOrder() {
let order = this.rows.map(blueprint => blueprint.handle);

this.$axios
.post(this.reorderUrl, { order })
.then(response => this.$toast.success(__('Blueprints successfully reordered')))
.catch(error => this.$toast.error(__('Something went wrong')))
}
}

}
</script>
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
d3b38e5
Initial Blueprints revamp ...
jasonvarga Jul 14, 2020
75dd755
Remove Blueprints fieldtype
jasonvarga Jul 14, 2020
ccd2354
Fix blueprint method
jasonvarga Jul 15, 2020
0ca90d2
Unnecessary
jasonvarga Jul 15, 2020
b748578
Apply blueprint changes to taxonomies
jasonvarga Jul 15, 2020
cbea3c0
Fix fields filter not working on taxonomy term listing
jasonvarga Jul 15, 2020
e383356
Support blueprint filter on taxonomy term listing
jasonvarga Jul 15, 2020
fb41342
Compose on any blueprint edit view, now that it could be in collectio…
jasonvarga Jul 15, 2020
e77ac09
Adjust some tests
jasonvarga Jul 15, 2020
2bcf33c
Adjust key
jasonvarga Jul 15, 2020
da16be6
Don't find it, get it from the collection
jasonvarga Jul 15, 2020
e8429d4
Apply blueprint changes to globals ...
jasonvarga Jul 15, 2020
ee397dd
Don't need to save the blueprint to file
jasonvarga Jul 15, 2020
9e4e3ff
Apply blueprint changes to assets ...
jasonvarga Jul 15, 2020
8b318d9
Fix test
jasonvarga Jul 15, 2020
eea6435
Apply blueprint changes to forms
jasonvarga Jul 15, 2020
0b5a323
Mark incomplete
jasonvarga Jul 15, 2020
7b3d37a
Just need the index
jasonvarga Jul 15, 2020
6fa49ce
Tidy
jasonvarga Jul 15, 2020
de4fe70
Blueprint index
jasonvarga Jul 15, 2020
cc72f70
Adjust link
jasonvarga Jul 15, 2020
efc27da
Apply blueprint changes to users
jasonvarga Jul 15, 2020
271f02c
Move breadcrumbs out of vue component
jasonvarga Jul 16, 2020
30574f8
Static title
jasonvarga Jul 16, 2020
de6cd12
Opt in for title field
jasonvarga Jul 16, 2020
9915261
Sections are optional (but used by default) and not used in forms and…
jasonvarga Jul 16, 2020
f4d0861
Add docs links
jasonvarga Jul 16, 2020
7a0bd62
Add blueprint link on users index
jasonvarga Jul 16, 2020
d401f1c
Add edit blueprint dropdown link to user edit form
jasonvarga Jul 16, 2020
7121463
More blueprint tweaks ...
jasonvarga Jul 20, 2020
5ca7928
Collection blueprints can be reordered
jasonvarga Jul 20, 2020
bd5eda8
Taxonomy blueprints can be reordered
jasonvarga Jul 20, 2020
5b3fbd1
Merge branch 'master' into feature/blueprints
jasonvarga Jul 20, 2020
b96ef99
BlueprintFound events
jasonvarga Jul 20, 2020
f9b3247
Apply fixes from StyleCI (#2107)
jasonvarga Jul 20, 2020
156a4e7
Pass items into method
jasonvarga Jul 20, 2020
c7f977a
Merge branch 'master' into feature/blueprints
jasonvarga Jul 20, 2020
0ff2381
Save the default blueprint when you opt for links and there are no bl…
jasonvarga Jul 21, 2020
44ff384
Simple html fieldtype, which is used to display links to edit bluepri…
jasonvarga Jul 21, 2020
ab850da
Prevent error when scaffolding blueprint
jasonvarga Jul 21, 2020
d22dedc
Apply fixes from StyleCI (#2108)
jasonvarga Jul 21, 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
7 changes: 0 additions & 7 deletions resources/blueprints/asset.yaml

This file was deleted.

8 changes: 0 additions & 8 deletions resources/blueprints/default.yaml

This file was deleted.

11 changes: 0 additions & 11 deletions resources/blueprints/entry_link.yaml

This file was deleted.

25 changes: 0 additions & 25 deletions resources/blueprints/user.yaml

This file was deleted.

2 changes: 2 additions & 0 deletions resources/js/app.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -130,6 +130,7 @@ Statamic.app({
CollectionScaffolder: require('./components/collections/Scaffolder.vue').default,
CollectionEditForm: require('./components/collections/EditForm.vue').default,
CollectionView: require('./components/collections/View.vue').default,
CollectionBlueprintListing: require('./components/collections/BlueprintListing.vue').default,
SessionExpiry: require('./components/SessionExpiry.vue').default,
NavigationListing: require('./components/navigation/Listing.vue').default,
NavigationCreateForm: require('./components/navigation/CreateForm.vue').default,
Expand All@@ -138,6 +139,7 @@ Statamic.app({
Stacks: require('./components/stacks/Stacks.vue').default,
TaxonomyCreateForm: require('./components/taxonomies/CreateForm.vue').default,
TaxonomyEditForm: require('./components/taxonomies/EditForm.vue').default,
TaxonomyBlueprintListing: require('./components/taxonomies/BlueprintListing.vue').default,
AssetContainerCreateForm: require('./components/asset-containers/CreateForm.vue').default,
AssetContainerEditForm: require('./components/asset-containers/EditForm.vue').default,
Updater: require('./components/updater/Updater.vue').default,
Expand Down
1 change: 1 addition & 0 deletions resources/js/bootstrap/fieldtypes.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -34,6 +34,7 @@ Vue.component('global_set_sites-fieldtype', require('../components/globals/Sites
Vue.component('grid-fieldtype', require('../components/fieldtypes/grid/Grid.vue').default);
Vue.component('grid-fieldtype-index', require('../components/fieldtypes/grid/GridIndex.vue').default);
Vue.component('hidden-fieldtype', require('../components/fieldtypes/HiddenFieldtype.vue').default);
Vue.component('html-fieldtype', require('../components/fieldtypes/HtmlFieldtype.vue').default);
Vue.component('integer-fieldtype', require('../components/fieldtypes/IntegerFieldtype.vue').default);
Vue.component('link-fieldtype', require('../components/fieldtypes/LinkFieldtype.vue').default);
Vue.component('list-fieldtype', require('../components/fieldtypes/ListFieldtype.vue').default);
Expand Down
4 changes: 4 additions & 0 deletions resources/js/components/assets/AssetManager.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,6 +11,10 @@
v-text="__('Edit Container')"
:redirect="container.edit_url">
</dropdown-item>
<dropdown-item
v-text="__('Edit Blueprint')"
:redirect="container.blueprint_url">
</dropdown-item>
<dropdown-item
v-if="container.can_delete"
v-text="__('Delete Container')"
Expand Down
14 changes: 1 addition & 13 deletions resources/js/components/assets/Editor/Editor.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -259,20 +259,8 @@ export default {
this.meta = data.meta;
this.runActionUrl = data.runActionUrl;
this.actions = data.actions;
this.getFieldset();
});
},

/**
* Load the fieldset
*/
getFieldset() {
const url = cp_url(`fields/publish-blueprints/${this.asset.blueprint}`);

this.$axios.get(url).then(response => {
this.fieldset = response.data;

// Flatten fields from all sections into one array.
this.fieldset = data.blueprint;
this.fields = _.chain(this.fieldset.sections)
.map(section => section.fields)
.flatten(true)
Expand Down
27 changes: 19 additions & 8 deletions resources/js/components/blueprints/Builder.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,15 +3,13 @@
<div class="blueprint-builder">

<header class="mb-3">
<breadcrumb :url="breadcrumbUrl" :title="__('Blueprints')" />

<div class="flex items-center justify-between">
<h1>{{ initialTitle }}</h1>
<h1 v-text="__('Edit Blueprint')" />
<button type="submit" class="btn-primary" @click.prevent="save" v-text="__('Save')" />
</div>
</header>

<div class="publish-form card p-0">
<div class="publish-form card p-0" v-if="showTitle">
<div class="form-group">
<label class="block">{{ __('Title') }}</label>
<small class="help-block">{{ __('messages.blueprints_title_instructions') }}</small>
Expand All@@ -22,12 +20,13 @@
</div>
</div>

<div class="content mt-5 mb-2">
<div class="content mt-5 mb-2" v-if="useSections">
<h2>{{ __('Tab Sections') }}</h2>
<p class="max-w-lg">{{ __('messages.tab_sections_instructions') }}</p>
</div>

<sections
:single-section="!useSections"
:initial-sections="blueprint.sections"
@updated="sectionsUpdated"
/>
Expand All@@ -45,13 +44,17 @@ export default {
Sections,
},

props: ['action', 'initialBlueprint', 'breadcrumbUrl'],
props: {
action: String,
initialBlueprint: Object,
showTitle: Boolean,
useSections: { type: Boolean, default: true }
},

data() {
return {
blueprint: clone(this.initialBlueprint),
blueprint: this.initializeBlueprint(),
sections: [],
initialTitle: this.initialBlueprint.title,
errors: {}
}
},
Expand DownExpand Up@@ -80,6 +83,14 @@ export default {

methods: {

initializeBlueprint() {
let blueprint = clone(this.initialBlueprint);

if (! this.showTitle) delete blueprint.title;

return blueprint;
},

sectionsUpdated(sections) {
this.sections = sections;
},
Expand Down
17 changes: 14 additions & 3 deletions resources/js/components/blueprints/Listing.vue
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
<template>
<data-list :visible-columns="columns" :columns="columns" :rows="rows">
<data-list :visible-columns="columns" :columns="columns" :rows="rows" :sort="false">
<div class="card p-0" slot-scope="{ filteredRows: rows }">
<data-list-table>
<data-list-table
:reorderable="reorderable"
@reordered="$emit('reordered', $event)"
>
<template slot="cell-title" slot-scope="{ row: blueprint }">
<a :href="blueprint.edit_url">{{ blueprint.title }}</a>
</template>
Expand DownExpand Up@@ -36,7 +39,7 @@ export default {

mixins: [Listing],

props: ['initialRows'],
props: ['initialRows', 'reorderable'],

data() {
return {
Expand All@@ -47,6 +50,14 @@ export default {
{ label: __('Fields'), field: 'fields' },
]
}
},

watch: {

initialRows(rows) {
this.rows = rows;
}

}

}
Expand Down
15 changes: 12 additions & 3 deletions resources/js/components/blueprints/Section.vue
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
<template>

<div class="blueprint-section w-full md:w-1/2 2xl:w-1/3" :class="{ 'w-full': isEditing }">
<div class="blueprint-section"
:class="{
'w-full md:w-1/2 2xl:w-1/3': !isEditing && !isSingle,
'w-full': isEditing || isSingle
}"
>
<div class="blueprint-section-card card p-0 h-full flex flex-col">

<div class="bg-grey-20 border-b text-sm flex rounded-t;">
<div class="bg-grey-20 border-b text-sm flex rounded-t;" v-if="!isSingle">
<div class="blueprint-drag-handle blueprint-section-drag-handle w-4 border-r"></div>
<div class="p-1.5 py-1 flex-1">
<span class="font-medium mr-1">
Expand All@@ -25,7 +30,7 @@
class="p-2"
:fields="section.fields"
:editing-field="editingField"
:is-section-expanded="isEditing"
:is-section-expanded="isEditing || isSingle"
:suggestable-condition-fields="suggestableConditionFields"
@field-created="fieldCreated"
@field-updated="fieldUpdated"
Expand DownExpand Up@@ -60,6 +65,10 @@ export default {
section: {
type: Object,
required: true
},
isSingle: {
type: Boolean,
default: false
}
},

Expand Down
10 changes: 8 additions & 2 deletions resources/js/components/blueprints/Sections.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,11 +9,12 @@
v-for="(section, i) in sections"
:key="section._id"
:section="section"
:is-single="singleSection"
@updated="updateSection(i, $event)"
@deleted="deleteSection(i)"
/>

<div class="blueprint-add-section-container w-full md:w-1/2 2xl:w-1/3">
<div class="blueprint-add-section-container w-full md:w-1/2 2xl:w-1/3" v-if="!singleSection">
<button class="blueprint-add-section-button outline-none" @click="addSection">
<div class="text-center flex items-center leading-none">
<div class="text-2xl mr-1">+</div>
Expand DownExpand Up@@ -55,6 +56,10 @@ export default {
newSectionText: {
type: String,
default: () => __('New Section')
},
singleSection: {
type: Boolean,
default: false
}
},

Expand All@@ -80,7 +85,8 @@ export default {
methods: {

makeSortable() {
this.makeSectionsSortable();
if (! this.singleSection) this.makeSectionsSortable();

this.makeFieldsSortable();
},

Expand Down
39 changes: 39 additions & 0 deletions resources/js/components/collections/BlueprintListing.vue
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
<script>
import BlueprintListing from '../blueprints/Listing.vue';

export default {

components: {
BlueprintListing
},

props: {
initialRows: Array,
reorderUrl: String
},

data() {
return {
rows: this.initialRows,
hasBeenReordered: false
}
},

methods: {
reordered(rows) {
this.rows = rows;
this.hasBeenReordered = true;
},

saveOrder() {
let order = this.rows.map(blueprint => blueprint.handle);

this.$axios
.post(this.reorderUrl, { order })
.then(response => this.$toast.success(__('Blueprints successfully reordered')))
.catch(error => this.$toast.error(__('Something went wrong')))
}
}

}
</script>
1 change: 1 addition & 0 deletions resources/js/components/collections/Listing.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,6 +8,7 @@
<template slot="actions" slot-scope="{ row: collection, index }">
<dropdown-list>
<dropdown-item :text="__('Edit Collection')" :redirect="collection.edit_url" />
<dropdown-item :text="__('Edit Blueprints')" :redirect="collection.blueprints_url" />
<dropdown-item :text="__('Scaffold Resources')" :redirect="collection.scaffold_url" />
<dropdown-item
v-if="collection.deleteable"
Expand Down
9 changes: 9 additions & 0 deletions resources/js/components/fieldtypes/HtmlFieldtype.vue
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
<template>
<div v-html="config.html" />
</template>

<script>
export default {
mixins: [Fieldtype]
};
</script>
1 change: 1 addition & 0 deletions resources/js/components/forms/Listing.vue
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,6 +8,7 @@
<template slot="actions" slot-scope="{ row: form, index }">
<dropdown-list>
<dropdown-item :text="__('Edit')" :redirect="form.edit_url" />
<dropdown-item :text="__('Edit Blueprint')" :redirect="form.blueprint_url" />
<dropdown-item
v-if="form.deleteable"
:text="__('Delete')"
Expand Down
39 changes: 39 additions & 0 deletions resources/js/components/taxonomies/BlueprintListing.vue
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
<script>
import BlueprintListing from '../blueprints/Listing.vue';

export default {

components: {
BlueprintListing
},

props: {
initialRows: Array,
reorderUrl: String
},

data() {
return {
rows: this.initialRows,
hasBeenReordered: false
}
},

methods: {
reordered(rows) {
this.rows = rows;
this.hasBeenReordered = true;
},

saveOrder() {
let order = this.rows.map(blueprint => blueprint.handle);

this.$axios
.post(this.reorderUrl, { order })
.then(response => this.$toast.success(__('Blueprints successfully reordered')))
.catch(error => this.$toast.error(__('Something went wrong')))
}
}

}
</script>
Loading