Don't show comment form if user not logged in

openid
Micha Wrobel 13 years ago
parent d296d69aa3
commit 9a190cf474

@ -1,6 +1,7 @@
<ul class="comments">
</ul>
{{#if show_form}}
<form id="new-comment">
<p>
<textarea type="text" name="body" id="comment-body"></textarea>
@ -8,3 +9,6 @@
<input type="submit" value="Post">
</form>
{{else}}
<div>You need to sign in to create a comment.</div>
{{/if}}

@ -10,8 +10,11 @@ class AsciiIo.Views.CommentsIndex extends Backbone.View
@collection.on('reset', @render, this)
@collection.on('add', @render, this)
@current_user = AsciiIo.current_user
render: ->
$(@el).html @template
$(@el).html @template( show_form: @current_user )
$comments = this.$('.comments')
@collection.each (comment) ->

Loading…
Cancel
Save