Skip to content

Instantly share code, notes, and snippets.

@piotrze
Created February 14, 2020 10:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save piotrze/87e7e4d365f13218e7208a33f79a700c to your computer and use it in GitHub Desktop.
Save piotrze/87e7e4d365f13218e7208a33f79a700c to your computer and use it in GitHub Desktop.
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