Sha256: 4ea40277bfb10bc590f16120417917af88c645a27cbd12971e8fa17addb37ca8
Contents?: true
Size: 1.48 KB
Versions: 1
Compression:
Stored size: 1.48 KB
Contents
var DiffPlayback; DiffPlayback = (function() { var self, commit, new_file = true, infoTemplate, rowTemplate; function DiffPlayback(commits) { this.commits = commits; } DiffPlayback.prototype.init = function() { commit = 0; self = this; this.setupTemplates(); this.drawCommit(commit); }; DiffPlayback.prototype.setupTemplates = function() { infoTemplate = Handlebars.compile($('#commit-template').html()); rowTemplate = Handlebars.compile($('#row-template').html()); } DiffPlayback.prototype.drawCommit = function(value) { var that = this; commit = value; $('.commit-history .info').html(infoTemplate(this.commits[commit])); $('tbody').html(rowTemplate(this.commits[commit])); $(this.commits[commit].diff_parts).each(function(index, part) { that.drawDiffParts(part); }); this.drawLineNumbers(); } DiffPlayback.prototype.drawDiffParts = function(part) { $('tbody').data().marker = part.start_line console.log(part); $(this.commits[commit].diff_parts[0].lines).each(function(index, value) { if(value.type === 'unchanged' || value.type === 'add') { $('tr:nth-child(' + $('tbody').data('marker') + ')').addClass(value.type); $('tbody').data().marker++; } }); } DiffPlayback.prototype.drawLineNumbers = function() { $('tr td:first-child').each(function(index, value) { $(value).html(index + 1); }); } return DiffPlayback; })(); window.DiffPlayback = DiffPlayback;
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
repoman-0.5.2 | lib/repoman/app/public/javascripts/diffplayback.js |