Created
February 14, 2020 10:30
-
-
Save piotrze/87e7e4d365f13218e7208a33f79a700c to your computer and use it in GitHub Desktop.
Debug liquid
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
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