mishina2228/git_stats

View on GitHub
templates/authors/_authors.haml

Summary

Maintainability
Test Coverage
.tabbable.tabs-left
  %ul.nav.nav-tabs
    %li.nav-item
      %a.nav-link{class: page == :best_authors ? 'active' : '', href: 'best_authors.html'}= :best_authors.t
    %li.nav-item
      %a.nav-link{class: page == :commits_sum_by_author_by_date ? 'active' : '',
                  href: 'commits_sum_by_author_by_date.html'}= :commits_sum_by_author_by_date.t
    %li.nav-item
      %a.nav-link{class: page == :changed_lines_by_author_by_date ? 'active' : '',
                  href: 'changed_lines_by_author_by_date.html'}= :changed_lines_by_author_by_date.t
    %li.nav-item
      %a.nav-link{class: page == :insertions_by_author_by_date ? 'active' : '',
                  href: 'insertions_by_author_by_date.html'}= :insertions_by_author_by_date.t
    %li.nav-item
      %a.nav-link{class: page == :deletions_by_author_by_date ? 'active' : '',
                  href: 'deletions_by_author_by_date.html'}= :deletions_by_author_by_date.t

  .tab-content
    .tab-pane.active
      .page-header
        %h1.text-center= page.t

      - case page
      - when :best_authors
        %table{class: 'table table-bordered table-condensed table-hover'}
          %tr
            %th #
            %th= :author.t
            %th= :commits.t
            %th= :insertions.t
            %th= :deletions.t
            %th= :first_commit.t
            %th= :last_commit.t
            %th{colspan: 2}
          - sorted_authors = repo.authors.sort_by { |a| -a.commits.size }
          - sorted_authors.each_with_index do |author, i|
            %tr
              %th= i + 1
              %th #{author.name} <#{author.email}>
              %td= author.commits.size
              %td= author.insertions
              %td= author.deletions
              - commit_first_date = author.commits.first&.date
              %td= I18n.l(commit_first_date, format: :long) if commit_first_date
              - commit_last_date = author.commits.last&.date
              %td= I18n.l(commit_last_date, format: :long) if commit_last_date
              %td
                %a.btn.btn-outline-secondary{href: "#{author.dirname}/activity/by_date.html"}= :activity.t
              %td
                %a.btn.btn-outline-secondary{href: "#{author.dirname}/author_details/commits_by_date.html"}= :details.t

      - when :commits_count_by_author
        -# This when clause is not be executed
        = high_chart('charts.commits_count_by_author', charts.commits_count_by_author)
        %small
          %center #{GitStats::StatsView::Charts::AuthorsCharts::AUTHORS_ON_CHART_LIMIT} #{:best_authors_shown.t}

      - when :commits_sum_by_author_by_date
        = high_stock('charts.commits_sum_by_author_by_date', charts.commits_sum_by_author_by_date)
        %small
          %center #{GitStats::StatsView::Charts::AuthorsCharts::AUTHORS_ON_CHART_LIMIT} #{:best_authors_shown.t}

      - when :changed_lines_by_author_by_date
        = high_stock('charts.total_changed_lines_by_author_by_date', charts.total_changed_lines_by_author_by_date)
        %small
          %center #{GitStats::StatsView::Charts::AuthorsCharts::AUTHORS_ON_CHART_LIMIT} #{:best_authors_shown.t}

      - when :insertions_by_author_by_date
        = high_stock('charts.total_insertions_by_author_by_date', charts.total_insertions_by_author_by_date)
        %small
          %center #{GitStats::StatsView::Charts::AuthorsCharts::AUTHORS_ON_CHART_LIMIT} #{:best_authors_shown.t}

      - when :deletions_by_author_by_date
        = high_stock('charts.total_deletions_by_author_by_date', charts.total_deletions_by_author_by_date)
        %small
          %center #{GitStats::StatsView::Charts::AuthorsCharts::AUTHORS_ON_CHART_LIMIT} #{:best_authors_shown.t}