review/static/comments.js @ 191d8a0d6190

web: hide file contents by default
author Steve Losh <steve@stevelosh.com>
date Sun, 13 Jun 2010 00:23:16 -0400
parents fcbf8d764330
children 7521b06e6b18
$(function() {
    
    $(".activate a").click(function(event) {
        $(event.target).closest(".activate").hide();
        $(event.target).closest("div").children("form").fadeIn("fast");
        return false;
    });

    $("a.cancel").click(function(event) {
        $(event.target).closest(".togglebox").children(".activate").show();
        $(event.target).parents("form").hide();
        return false;
    });
    
    //$("span.cancel-line a").live("click", function(event) {
        //$(event.target).closest("tr").prev().removeClass("comment-line-selected").addClass("commentable");
        //$(event.target).closest("tr").remove();
        //return false;
    //});
    
    //$("tr.rem.commentable,tr.add.commentable,tr.con.commentable").live("click", function(event) {
        //$(event.target).closest("tr").addClass("comment-line-selected").removeClass("commentable");
        //var filename = $(event.target).closest("tr").find(".line-data").children(".filename").first().text();
        //var linenumber = $(event.target).closest("tr").find(".line-data").children(".linenumber").first().html();
        
        //var comment_form = '<tr class="comment-line">\n\
                //<td>\n\
                    //<form id="comment-line-form" method="post" action="">\n\
                        //<div class="field">\n\
                            //<label for="body">Add a comment on this line:</label>\n\
                            //<textarea cols="60" rows="6" name="new-comment-body"></textarea>\n\
                        //</div>\n\
                        //<div class="buttons">\n\
                            //<input type="submit" class="button" value="Submit" />\n\
                            //<span class="cancel-line"><a href="">Cancel</a></span>\n\
                        //</div>\n\
                        //<input type="hidden" name="filename" value="<<<FILENAME>>>" />\n\
                        //<input type="hidden" name="lines" value="<<<LINENUMBER>>>" />\n\
                    //</form>\n\
                //</td>\n\
            //</tr>';
        //comment_form = comment_form.replace('<<<FILENAME>>>', filename);
        //comment_form = comment_form.replace('<<<LINENUMBER>>>', linenumber);
        
        //$(event.target).closest("tr").after(comment_form);
        //return false;
    //});
    
    $("label.infield").inFieldLabels();
});