Skip to content

Instantly share code, notes, and snippets.

@did
Created June 3, 2011 00:24
Show Gist options
  • Save did/1005632 to your computer and use it in GitHub Desktop.
Save did/1005632 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