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 class="comments">
</ul> </ul>
{{#if show_form}}
<form id="new-comment"> <form id="new-comment">
<p> <p>
<textarea type="text" name="body" id="comment-body"></textarea> <textarea type="text" name="body" id="comment-body"></textarea>
@ -8,3 +9,6 @@
<input type="submit" value="Post"> <input type="submit" value="Post">
</form> </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('reset', @render, this)
@collection.on('add', @render, this) @collection.on('add', @render, this)
@current_user = AsciiIo.current_user
render: -> render: ->
$(@el).html @template $(@el).html @template( show_form: @current_user )
$comments = this.$('.comments') $comments = this.$('.comments')
@collection.each (comment) -> @collection.each (comment) ->

Loading…
Cancel
Save