Skip to content

Instantly share code, notes, and snippets.

@piotrze
Created Feb 14, 2020
Embed
What would you like to do?
Debug liquid
---
slug: debug
layout_name:
---
{% graphql partials %}
query partials{
partials: admin_liquid_partials(filter:{ path: { contains: "debug_content" }}){
results{
id
physical_file_path
}
}
}
{% endgraphql %}
{% assign partial = partials.partials.results | first %}
{% unless partial %}
{% graphql create_partial %}
mutation create_partial{
partial: admin_liquid_partial_create(
liquid_partial: {
path: "debug_content"
physical_file_path: "views/partials/debug_content"
body: "hello world"
}
){
id
}
}
{% endgraphql %}
{% assign partial = create_partial.partial %}
{% endunless %}
{% assign partial_body = context.params.body %}
{% graphql g, partial_id: partial.id, body: partial_body %}
mutation change_partial($partial_id:ID!, $body:String!){
admin_liquid_partial_update(
id: $partial_id
liquid_partial: {
body: $body
}
){
id
}
}
{% endgraphql %}
<form action="/debug">
<textarea name="body" cols=80 rows=20>{{partial_body}}</textarea>
<br>
<input type="submit" value="Execute">
</form>
<hr>
{% include 'debug_content' %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment