1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-22 14:49:42 +02:00

New GitHub wip

This commit is contained in:
EnesAlili 2016-09-29 14:20:43 +01:00
parent cbbfd8f381
commit 48dbc0b196
7 changed files with 109 additions and 112 deletions

View file

@ -40,6 +40,11 @@
} }
.section-github-render { .section-github-render {
a:hover {
text-decoration: underline;
}
.github-table { .github-table {
margin: 0 !important; margin: 0 !important;
border: none !important; border: none !important;
@ -56,15 +61,36 @@
margin: 30px 0 0 0; margin: 30px 0 0 0;
} }
.github-table thead tr th {
padding: 15px 0;
border-bottom: 1px solid #e1e1e1;
text-transform: uppercase;
font-size: 14px;
text-align: left;
span {
color:#838d94;
}
}
.github-table tbody tr td {
border: none!important;
padding-left: 20px!important;
padding-bottom: 0!important;
}
span.dataid {
color:#838d94;
}
.issue-label { .issue-label {
font-size: 11px; color:white;
color: $color-white; font-size: 11px;
padding: 0px 8px; padding: 4px 6px;
margin-right: 5px; border-radius: 4px;
border-radius: 2px; box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.12);
box-shadow: inset 0 -1px 0 rgba(0,0,0,0.12); margin-left: 10px;
display: inline-block;
line-height: 22px;
} }
progress[value] { progress[value] {
@ -74,45 +100,15 @@
width: 150px; width: 150px;
} }
.progress-meta { span.issue-state {
color: $color-gray; float: left;
font-size: 1rem; margin-right: 10px;
font-family: "arial"; margin-top: 3px;
} }
.contributor-name { img.github-avatar {
line-height: 15px; width: 24px;
}
.milestone-name, .issue-name, .contributor-name {
font-size: 1.2rem;
}
.milestone-symbol {
padding-top: 3px;
}
.issue-symbol {
padding-top: 3px;
}
.contributor-meta {
line-height: 30px;
}
.milestone-meta, .issue-meta, .contributor-meta {
color: $color-gray;
font-size: 1rem;
}
.github-avatar {
border-radius: 4px; border-radius: 4px;
width: 36px; margin-right: 10px;
height: 36px;
margin-right: 5px;
}
.branch {
font-family: "open_sanssemibold";
} }
} }

View file

@ -59,11 +59,9 @@
} }
.heading { .heading {
padding: 10px 20px;
color: white!important;
a { a {
color: white!important; color: #3c3c3c!important;
} }
h3 { h3 {

View file

@ -25,8 +25,15 @@ const commitsTemplate = `
{{if eq 1 .RepoCount}} repository. {{else}} repositories. {{end}} {{if eq 1 .RepoCount}} repository. {{else}} repositories. {{end}}
</p> </p>
<div class="margin-top-20"></div>
<table class="github-table"> <table class="github-table">
<thead>
<tr>
<th class="title">Contributors</th>
<th></th>
</tr>
</thead>
<tbody> <tbody>
{{range $stats := .AuthorStats}} {{range $stats := .AuthorStats}}
<tr> <tr>
@ -52,7 +59,6 @@ const commitsTemplate = `
{{range $repo := $stats.Repos}} &middot; {{$repo}} {{end}} {{range $repo := $stats.Repos}} &middot; {{$repo}} {{end}}
{{end}} {{end}}
</div> </div>
<div class="margin-top-10"></div>
</td> </td>
</tr> </tr>
{{end}} {{end}}
@ -62,26 +68,27 @@ const commitsTemplate = `
--> -->
{{if .HasCommits}} {{if .HasCommits}}
<div class="heading">Commits</div> <table class="github-table" style="width: 100%;">
<!-- <p>There are {{len .BranchCommits}} commits by {{.NumContributors}} contributors across {{.RepoCount}} <thead>
{{if eq 1 .RepoCount}} repository. {{else}} repositories. {{end}} <tr>
</p> --> <th class="title">Commits <span>{{len .BranchCommits}} commits by {{.NumContributors}} contributors</span>
<div class="margin-top-20"></div> </th>
<table class="github-table"> <th></th>
</tr>
</thead>
<tbody> <tbody>
{{range $commit := .BranchCommits}} {{range $commit := .BranchCommits}}
<tr> <tr>
<td style="no-width"> <td style="no-width">
<img class="github-avatar" alt="@{{$commit.Name}}" src="{{$commit.Avatar}}" /> <a href="{{$commit.URL}}">{{$commit.Message}}</a>
</td> </td>
<td> <td style="text-align:right;">
<div class="contributor-name"><a href="{{$commit.URL}}">{{$commit.Message}}</a></div>
<div class="contributor-meta"> <div class="contributor-meta">
<img class="github-avatar" alt="@{{$commit.Name}}" src="{{$commit.Avatar}}" />
{{$commit.Name}} {{$commit.Name}}
{{if $commit.ShowDate}} &middot; {{$commit.Date}} {{end}} {{if $commit.ShowDate}} &middot; {{$commit.Date}} {{end}}
{{if $commit.ShowBranch}} &middot; {{$commit.Repo}}:<span class="bold">{{$commit.Branch}}</span>{{end}} {{if $commit.ShowBranch}} &middot; {{$commit.Repo}}:<span class="bold">{{$commit.Branch}}</span>{{end}}
</div> </div>
<div class="margin-top-10"></div>
</td> </td>
</tr> </tr>
{{end}} {{end}}

View file

@ -235,6 +235,9 @@ func (p *Provider) Render(ctx *provider.Context, config, data string) string {
if err != nil { if err != nil {
log.Error("github render template.Parse error:", err) log.Error("github render template.Parse error:", err)
for k,v := range strings.Split(resp.template,"\n"){
fmt.Println("DEBUG",k+1,v)
}
return "Documize internal github template.Parse error: " + err.Error() return "Documize internal github template.Parse error: " + err.Error()
} }

View file

@ -13,14 +13,14 @@ package github
const ( const (
openIsvg = ` openIsvg = `
<span title="Open issue"> <span class="issue-state" title="Open Issue">
<svg height="16" version="1.1" viewBox="0 0 14 16" width="14" class="color:#6cc644;"> <svg height="16" version="1.1" viewBox="0 0 14 16" width="14" class="color:#6cc644;">
<path d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"></path> <path d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"></path>
</svg> </svg>
</span> </span>
` `
closedIsvg = ` closedIsvg = `
<span title="Closed issue"> <span class="issue-state" title="Closed Issue">
<svg height="16" version="1.1" viewBox="0 0 16 16" width="16" class="color:#bd2c00;"> <svg height="16" version="1.1" viewBox="0 0 16 16" width="16" class="color:#bd2c00;">
<path d="M7 10h2v2H7v-2zm2-6H7v5h2V4zm1.5 1.5l-1 1L12 9l4-4.5-1-1L12 7l-1.5-1.5zM8 13.7A5.71 5.71 0 0 1 2.3 8c0-3.14 2.56-5.7 5.7-5.7 1.83 0 3.45.88 4.5 2.2l.92-.92A6.947 6.947 0 0 0 8 1C4.14 1 1 4.14 1 8s3.14 7 7 7 7-3.14 7-7l-1.52 1.52c-.66 2.41-2.86 4.19-5.48 4.19v-.01z"></path> <path d="M7 10h2v2H7v-2zm2-6H7v5h2V4zm1.5 1.5l-1 1L12 9l4-4.5-1-1L12 7l-1.5-1.5zM8 13.7A5.71 5.71 0 0 1 2.3 8c0-3.14 2.56-5.7 5.7-5.7 1.83 0 3.45.88 4.5 2.2l.92-.92A6.947 6.947 0 0 0 8 1C4.14 1 1 4.14 1 8s3.14 7 7 7 7-3.14 7-7l-1.52 1.52c-.66 2.41-2.86 4.19-5.48 4.19v-.01z"></path>
</svg> </svg>
@ -29,35 +29,35 @@ const (
issuesTemplate = ` issuesTemplate = `
<div class="section-github-render"> <div class="section-github-render">
{{if .HasIssues}} {{if .HasIssues}}
<div class="heading">Issues</div> <table class="github-table" style="width: 100%;">
<!-- <p> <thead>
There are {{.ClosedIssues}} closed <tr>
{{if eq 1 .ClosedIssues}}issue{{else}}issues{{end}} <th class="title">
and {{.OpenIssues}} open Issues <span>{{.ClosedIssues}} closed {{if eq 1 .ClosedIssues}}{{else}}issues{{end}} and {{.OpenIssues}} open
{{if eq 1 .OpenIssues}}issue{{else}}issues{{end}} {{if eq 1 .OpenIssues}}issue{{else}}{{end}}</span>
across {{.RepoCount}} </th>
{{if eq 1 .RepoCount}} repository. {{else}} repositories. {{end}}
</p> --> <th></th>
</tr>
</thead>
<div class="margin-top-20"></div>
<table class="github-table">
<tbody> <tbody>
{{range $data := .Issues}} {{range $data := .Issues}}
<tr> <tr>
<td class="no-width">
<div class="issue-symbol">
{{if $data.IsOpen}}
` + openIsvg + `
{{else}}
` + closedIsvg + `
{{end}}
</div>
</td>
<td><div class="margin-left-10"></div></td>
<td> <td>
<div class="issue-name"><a href="{{$data.URL}}">{{$data.Message}} <span class="dataid"></span></a></div> {{if $data.IsOpen}}
<span class="milestone-meta">#{{$data.ID}} &middot; {{$data.Repo}} &middot; {{$data.Milestone}} &middot; {{$data.Creator}} opened on {{$data.Date}}</span> ` + openIsvg + `
<div>{{$data.Labels}}</div> {{else}}
` + closedIsvg + `
{{end}}
<a href="{{$data.URL}}">{{$data.Message}}</a> <span class="dataid">#{{$data.ID}}</span>
{{$data.Labels}}
</td>
<td style="text-align:right;">
<div class="milestone-meta">
<span class="meta-milestone">{{$data.Milestone}}</span> &middot;
<span class="meta-creator">{{$data.Creator}}</span> &middot; <span class="meta-date">{{$data.Date}}</span>
</div>
</td> </td>
</tr> </tr>
{{end}} {{end}}

View file

@ -30,41 +30,34 @@ const (
milestonesTemplate = ` milestonesTemplate = `
<div class="section-github-render"> <div class="section-github-render">
{{if .HasMilestones}} {{if .HasMilestones}}
<div class="heading">Milestones</div> <table class="github-table" style="width: 100%;">
<!-- <p> <thead>
There are <tr>
{{.ClosedMS}} <th class="title">Milestones <span> {{.ClosedMS}} {{if eq 1 .ClosedMS}} closed and {{.OpenMS}} {{if eq 1 .OpenMS}} open </span>
{{if eq 1 .ClosedMS}} milestone {{else}} milestones {{end}} </th>
closed and {{.OpenMS}} <th></th>
{{if eq 1 .OpenMS}} milestone {{else}} milestones {{end}} </tr>
open across {{.RepoCount}} </thead>
{{if eq 1 .RepoCount}} repository. {{else}} repositories. {{end}}
</p> --> <tbody>
<div class="margin-top-20"></div>
<table class="github-table">
<tbody>
{{range $data := .Milestones}} {{range $data := .Milestones}}
<tr> <tr>
<td class="no-width"> <td>
<div class="milestone-symbol"> {{if $data.IsMilestone}}
{{if $data.IsMilestone}} {{if $data.IsOpen}}
{{if $data.IsOpen}} ` + openMSsvg + `
` + openMSsvg + ` {{else}}
{{else}} ` + closedMSsvg + `
` + closedMSsvg + `
{{end}}
{{end}} {{end}}
</div> {{end}}
</td> </td>
<td><div class="margin-left-10"></div></td>
<td> <td>
<div class="milestone-name"><a class="link" href="{{$data.URL}}">{{$data.Name}}</a></div> <div class="milestone-name"><a class="link" href="{{$data.URL}}">{{$data.Name}}</a></div>
<span class="milestone-meta">{{$data.Repo}}</span> <span class="milestone-meta">{{$data.Repo}}</span>
{{if $data.IsMilestone}} {{if $data.IsMilestone}}
<span class="milestone-meta">&middot; {{$data.DueDate}}</span> <span class="milestone-meta"> &middot; {{$data.DueDate}}</span>
{{end}} {{end}}
</td> </td>
<td><div class="margin-left-150"></div></td>
<td class="no-width"> <td class="no-width">
{{if $data.IsMilestone}} {{if $data.IsMilestone}}
<progress value="{{$data.Progress}}" max="100"></progress> <progress value="{{$data.Progress}}" max="100"></progress>

View file

@ -14,7 +14,7 @@ package trello
const tradTemplate = ` const tradTemplate = `
<div class="section-trello-render"> <div class="section-trello-render">
{{if ne .Detail.Board.ID ""}} {{if ne .Detail.Board.ID ""}}
<div class="heading" style="background-color:{{.Detail.Board.Prefs.BackgroundColor}};"> <div class="heading">
<h3><a href="{{ .Detail.Board.URL }}">{{.Detail.Board.Name}} Board</a></h3> <h3><a href="{{ .Detail.Board.URL }}">{{.Detail.Board.Name}} Board</a></h3>
<p>There are {{ .Detail.CardCount }} cards across {{ .Detail.ListCount }} lists</p> <p>There are {{ .Detail.CardCount }} cards across {{ .Detail.ListCount }} lists</p>
</div> </div>