Sha256: db0afa04f3e944ab23dc443ca26223b0790b687de70c0a2028bd5fe40df88949
Contents?: true
Size: 927 Bytes
Versions: 2
Compression:
Stored size: 927 Bytes
Contents
$(document).ready -> $('#kublog #new_kublog_comment').submit -> resetErrors() $('#kublog #new_kublog_comment').bind 'ajax:success', (xhr, data, status)-> $('.post-comments').append(commentTemplate(data)) $(this).find('textarea,input[type=text]').val('') $('#kublog #new_kublog_comment').bind 'ajax:error', (xhr, error, status)-> errors = JSON.parse(error.responseText) setErrors('comment', errors) $('#kublog .comment a.delete').click -> $link = $(this) if confirm($(this).attr('data-confirm')) $.post $link.attr('href'), { _method: 'delete'}, (data) -> $link.closest('.comment').remove() false # Templates commentTemplate = (comment) -> extra_class = ' admin' if comment['admin?']? """ <div class='comment#{extra_class}'> <h4>#{comment.author}</h4> <span>#{comment.ftime}</span> <p class='body'>#{comment.body}</p> </div> """
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
kublog-0.9.0 | app/assets/javascripts/kublog/comments.js.coffee |
kublog-0.0.1.1 | app/assets/javascripts/kublog/comments.js.coffee |