review/static/comments.js @ ee8d78fbf746

web: more styles
author Steve Losh <steve@stevelosh.com>
date Sun, 13 Jun 2010 02:45:53 -0400
parents 7521b06e6b18
children 757e193ec1b1
$(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;
    });

    $("tr.comment").hover(function(event) {
        var diff = $(event.target).closest(".diff");
        var lines = $(event.target).find(".commentlines").html().split(",");
        for (i=0; i < lines.length; i++) {
            diff.find(".line-" + lines[i]).addClass("viewing");
        }
    }, function(event) {
        $(".viewing").removeClass("viewing");
    });
    
    //$("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();
});