Skip to content

Commit

Permalink
Modernize syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasbestle committed Nov 9, 2024
1 parent ad43896 commit 42b2b0f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -242,11 +242,10 @@ panel.plugin('yourname/modified', {
text: null
}
},
created: function() {
this.load().then(response => {
this.label = response.label;
this.text = response.text;
});
created: async function() {
const response = await this.load();
this.label = response.label;
this.text = response.text;
}
}
}
Expand All @@ -269,11 +268,10 @@ panel.plugin('yourname/modified', {
text: null
}
},
created: function() {
this.load().then(response => {
this.label = response.label;
this.text = response.text;
});
created: async function() {
const response = await this.load();
this.label = response.label;
this.text = response.text;
},
template: `
<section class="k-modified-section">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,12 +238,11 @@ export default {
]
}
},
created() {
this.load().then(response => {
this.label = response.label;
this.layout = response.layout;
this.links = response.links;
});
async created() {
const response = await this.load();
this.label = response.label;
this.layout = response.layout;
this.links = response.links;
}
};
</script>
Expand All @@ -261,12 +260,11 @@ export default {
links: []
}
},
created() {
this.load().then(response => {
this.label = response.label;
this.layout = response.layout;
this.links = response.links;
});
async created() {
const response = await this.load();
this.label = response.label;
this.layout = response.layout;
this.links = response.links;
}
};
</script>
Expand Down Expand Up @@ -363,4 +361,3 @@ linksection/
This is a very basic example that should still have given you an understanding of how the different parts play together and enable you to set up your first custom sections for your clients. The data to fill this section can come in fact come from anywhere, you can provide it through a route, a database or whatever you see fit. And you probably don't just want to display stuff, but add actions to each item etc. We'll cover that in future recipes.

You don't have to use the components Kirby provides, either, but can come up with your own markup and design. The possibilities are pretty much endless.

0 comments on commit 42b2b0f

Please sign in to comment.