github.com/jancarloviray/community@v0.41.1-0.20170124221257-33a66c87cf2f/core/section/github/milestones_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 (
    15  	rawMSsvg  = `<path d="M8 2H6V0h2v2zm4 5H2c-.55 0-1-.45-1-1V4c0-.55.45-1 1-1h10l2 2-2 2zM8 4H6v2h2V4zM6 16h2V8H6v8z"></path>`
    16  	openMSsvg = `
    17  		<span class="issue-state" title="Open Milestone">
    18  			<svg height="16" width="14" version="1.1" viewBox="0 0 14 16">
    19  				` + rawMSsvg + `
    20  			</svg>
    21  		</span>
    22  		`
    23  	closedMSsvg = `
    24  		<span class="issue-state" title="Closed Milestone">
    25  			<svg aria-hidden="true" class="octicon octicon-check" height="16" height="14" version="1.1" viewBox="0 0 12 16">
    26  				<path d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"></path>
    27  			</svg>
    28  		</span>
    29  		`
    30  	milestonesTemplate = `
    31  <div class="section-github-render">
    32  	{{if .HasMilestones}}
    33  		<table class="github-table" style="width: 100%;">
    34  			<thead>
    35  				<tr>
    36  				<th class="title">Milestones <span>&middot; {{.ClosedMS}} closed and {{.OpenMS}} open</span>
    37  				</th>
    38  				<th></th>
    39  				</tr>
    40  			</thead>
    41  
    42  			<tbody>
    43  				{{range $data := .Milestones}}
    44  			        <tr>
    45  						<td>
    46  							{{if $data.IsMilestone}}
    47  								{{if $data.IsOpen}}
    48  									` + openMSsvg + `
    49  								{{else}}
    50  									` + closedMSsvg + `
    51  								{{end}}
    52  							{{end}}
    53  							<a class="link" href="{{$data.URL}}">{{$data.Name}}</a>
    54  							<span class="data"> &middot; {{if $data.IsMilestone}} {{$data.DueDate}}{{end}} </span>
    55  						</td>
    56  			            <td class="right-column">
    57  							{{if $data.IsMilestone}}
    58  								<span class="bold color-off-black">{{$data.CompleteMsg}}</span> complete
    59  								<span class="bold color-off-black">{{$data.OpenIssues}}</span> 	open
    60  								<span class="bold color-off-black">{{$data.ClosedIssues}}</span> closed
    61  							{{else}}
    62  								<span class="bold color-off-black">{{$data.OpenIssues}}</span> open <span class="bold color-off-black">{{$data.ClosedIssues}}</span> closed
    63  							{{end}}
    64  							<div class="progress-bar">
    65  								<div class="progress" style="width:{{$data.Progress}}%;"></div>
    66  							</div>
    67  						</td>
    68  			        </tr>
    69  				{{end}}
    70  		    </tbody>
    71  		</table>
    72  	{{end}}
    73  </div>
    74  `
    75  )