github.com/jancarloviray/community@v0.41.1-0.20170124221257-33a66c87cf2f/core/section/github/commits_template.go (about)

     1  // Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
     2  //
     3  // This software (Documize Community Edition) is licensed under
     4  // GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
     5  //
     6  // You can operate outside the AGPL restrictions by purchasing
     7  // Documize Enterprise Edition and obtaining a commercial license
     8  // by contacting <sales@documize.com>.
     9  //
    10  // https://documize.com
    11  
    12  package github
    13  
    14  const commitsTemplate = `
    15  <div class="section-github-render">
    16  	<!--
    17  	{{if .HasAuthorStats}}
    18  		<div class="heading">Contributors</div>
    19  		<p>
    20  			There
    21  			{{if eq 1 .NumContributors}}is{{else}}are{{end}}
    22  			{{.NumContributors}}
    23  			{{if eq 1 .NumContributors}}contributor{{else}}contributors{{end}}
    24  			across {{.RepoCount}}
    25  			{{if eq 1 .RepoCount}} repository. {{else}} repositories. {{end}}
    26  		</p>
    27  
    28  		<table class="github-table">
    29  
    30  			<thead>
    31  				<tr>
    32  				<th class="title">Contributors</th>
    33  				<th></th>
    34  				</tr>
    35  			</thead>
    36  
    37  			<tbody>
    38  				{{range $stats := .AuthorStats}}
    39  					<tr>
    40  						<td class="no-width">
    41  							<img class="github-avatar" alt="@{{$stats.Author}}" src="{{$stats.Avatar}}" />
    42  						</td>
    43  						<td>
    44  							<div class="contributor-name">{{$stats.Author}}</div>
    45  							<div class="contributor-meta">
    46  								{{if gt $stats.OpenIssues 0}}
    47  									assigned {{$stats.OpenIssues}}
    48  									{{if eq 1 $stats.OpenIssues}} issue {{else}} issues {{end}}
    49  								{{end}}
    50  								{{if gt $stats.ClosedIssues 0}}
    51  									 &middot; {{$stats.ClosedIssues}} closed
    52  								{{end}}
    53  								{{if gt $stats.CommitCount 0}}
    54  									{{if gt $stats.OpenIssues 0}} &middot; {{end}}
    55  									{{if gt $stats.ClosedIssues 0}} &middot; {{end}}
    56  									made {{$stats.CommitCount}}
    57  									{{if eq 1 $stats.CommitCount}} commit {{else}} commits {{end}}
    58  									on {{len $stats.Repos}} {{if eq 1 (len $stats.Repos)}} branch {{else}} branches {{end}}
    59  									{{range $repo := $stats.Repos}}	&middot; {{$repo}} {{end}}
    60  								{{end}}
    61  							</div>
    62  						</td>
    63  					</tr>
    64  				{{end}}
    65  			</tbody>
    66  		</table>
    67  	{{end}}
    68  	-->
    69  
    70  	{{if .HasCommits}}
    71  		<table class="github-table" style="width: 100%;">
    72  			<thead>
    73  				<tr>
    74  				<th class="title">Commits <span>&middot; {{len .BranchCommits}} commits by {{.NumContributors}} contributors</span>
    75  				</th>
    76  				<th></th>
    77  				</tr>
    78  			</thead>
    79  			<tbody>
    80  				{{range $commit := .BranchCommits}}
    81  					<tr>
    82  						<td>
    83  							<a href="{{$commit.URL}}">{{$commit.Message}}</a>
    84  							<span class="data"> {{$commit.Branch}}</span>
    85  						</td>
    86  						<td class="right-column">
    87  							<div class="contributor-meta">
    88  								<img class="github-avatar" title="@{{$commit.Name}}" alt="@{{$commit.Name}}" src="{{$commit.Avatar}}" />
    89  								{{$commit.Date}}
    90  							</div>
    91  						</td>
    92  					</tr>
    93  				{{end}}
    94  			</tbody>
    95  		</table>
    96  	{{end}}
    97  
    98  </div>
    99  `