/* eslint-disable func-names, space-before-function-paren, wrap-iife, no-var, one-var, camelcase, one-var-declaration-per-line, quotes, no-param-reassign, quote-props, comma-dangle, prefer-template, max-len, no-return-assign, no-shadow */ import _ from 'underscore'; import { ContributorsGraph, ContributorsAuthorGraph, ContributorsMasterGraph } from './stat_graph_contributors_graph'; import ContributorsStatGraphUtil from './stat_graph_contributors_util'; import { n__, s__, createDateTimeFormat, sprintf } from '../locale'; export default (function() { function ContributorsStatGraph() { this.dateFormat = createDateTimeFormat({ year: 'numeric', month: 'long', day: 'numeric' }); } ContributorsStatGraph.prototype.init = function(log) { var author_commits, total_commits; this.parsed_log = ContributorsStatGraphUtil.parse_log(log); this.set_current_field("commits"); total_commits = ContributorsStatGraphUtil.get_total_data(this.parsed_log, this.field); author_commits = ContributorsStatGraphUtil.get_author_data(this.parsed_log, this.field); this.add_master_graph(total_commits); this.add_authors_graph(author_commits); return this.change_date_header(); }; ContributorsStatGraph.prototype.add_master_graph = function(total_data) { this.master_graph = new ContributorsMasterGraph(total_data); return this.master_graph.draw(); }; ContributorsStatGraph.prototype.add_authors_graph = function(author_data) { var limited_author_data; this.authors = []; limited_author_data = author_data.slice(0, 100); return _.each(limited_author_data, (function(_this) { return function(d) { var author_graph, author_header; author_header = _this.create_author_header(d); $(".contributors-list").append(author_header); _this.authors[d.author_name] = author_graph = new ContributorsAuthorGraph(d.dates); return author_graph.draw(); }; })(this)); }; ContributorsStatGraph.prototype.format_author_commit_info = function(author) { var commits; commits = $('', { "class": 'graph-author-commits-count' }); commits.text(n__('%d commit', '%d commits', author.commits)); return $('').append(commits); }; ContributorsStatGraph.prototype.create_author_header = function(author) { var author_commit_info, author_commit_info_span, author_email, author_name, list_item; list_item = $('
', { "class": 'person', style: 'display: block;' }); author_name = $('