var Comments = (function () {

    var bindFunction = function () {
        $.fn.editable.defaults.mode = 'inline';
        $('[data-editable]').each(function(i,e) {
            var _this = $(e);
            _this.editable({
                showbuttons: 'bottom',
                url: Routing.generate('cs_cms_comments_set'),
                name: _this.data('name')
            })
        });
    };

    return {
        init: function () {
            bindFunction();
        }
    }
})();

$(function(){
    if($('body.cs_comments').length) {
        Pagination.onChange.add(function () {
            Comments.init();
        });
        Comments.init();
    }
});
