Skip to content

Instantly share code, notes, and snippets.

@pacifists
Forked from did/loco_tip_1.html
Created October 7, 2011 06:27
Show Gist options
  • Save pacifists/1269600 to your computer and use it in GitHub Desktop.
Save pacifists/1269600 to your computer and use it in GitHub Desktop.
How to post a comment related to an artist
<h2>{{ artist.name }}</h2>
<div>{{ artist.bio }}</div>
{% with_scope artist: artist._id %}
{% assign comments = contents.comments %}
{% if comments == empty %}
<p>No comments</p>
{% else %}
<ul class="artist">
{% for comment in comments %}
<li>
<p>{{comment.email}}</p>
<p>{{comment.message}}</p>
<hr />
</li>
{% endfor %}
</ul>
{% endif %}
{% endwith_scope %}
<div>Add Comment: </div>
<form action="{{ contents.comments.api.create }}" method="post">
<input type="hidden" name="success_callback" value="{{ url }}"/>
<fieldset>
<ol>
<li>
<label for="comment_email">Your Email:</label>
<input name="content[email]" id="comment_email" /> </li>
<li>
<label for="comment_message">Message:</label>
<textarea name="content[message]" id="comment_message"></textarea>
</li>
<input type=hidden name="content[artist]" value="{{artist._id}}" />
<button type="submit">Add Comment</button>
</ol>
</fieldset>
</form>
{% endblock %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment