use query parameter for commit branch
This commit is contained in:
parent
10c3c8108e
commit
055ed199a1
9 changed files with 27 additions and 19 deletions
|
@ -222,9 +222,9 @@ func setupHandlers() {
|
||||||
m.Post("/install", handler.ErrorHandler(handler.InstallPost))
|
m.Post("/install", handler.ErrorHandler(handler.InstallPost))
|
||||||
|
|
||||||
// handlers for repository, commits and build details
|
// handlers for repository, commits and build details
|
||||||
m.Get("/:host/:owner/:name/commit/:branch/:commit/build/:label/out.txt", handler.RepoHandler(handler.BuildOut))
|
m.Get("/:host/:owner/:name/commit/:commit/build/:label/out.txt", handler.RepoHandler(handler.BuildOut))
|
||||||
m.Get("/:host/:owner/:name/commit/:branch/:commit/build/:label", handler.RepoHandler(handler.CommitShow))
|
m.Get("/:host/:owner/:name/commit/:commit/build/:label", handler.RepoHandler(handler.CommitShow))
|
||||||
m.Get("/:host/:owner/:name/commit/:branch/:commit", handler.RepoHandler(handler.CommitShow))
|
m.Get("/:host/:owner/:name/commit/:commit", handler.RepoHandler(handler.CommitShow))
|
||||||
m.Get("/:host/:owner/:name/tree", handler.RepoHandler(handler.RepoDashboard))
|
m.Get("/:host/:owner/:name/tree", handler.RepoHandler(handler.RepoDashboard))
|
||||||
m.Get("/:host/:owner/:name/status.svg", handler.ErrorHandler(handler.Badge))
|
m.Get("/:host/:owner/:name/status.svg", handler.ErrorHandler(handler.Badge))
|
||||||
m.Get("/:host/:owner/:name/settings", handler.RepoAdminHandler(handler.RepoSettingsForm))
|
m.Get("/:host/:owner/:name/settings", handler.RepoAdminHandler(handler.RepoSettingsForm))
|
||||||
|
|
|
@ -9,7 +9,11 @@ import (
|
||||||
|
|
||||||
// Returns the combined stdout / stderr for an individual Build.
|
// Returns the combined stdout / stderr for an individual Build.
|
||||||
func BuildOut(w http.ResponseWriter, r *http.Request, u *User, repo *Repo) error {
|
func BuildOut(w http.ResponseWriter, r *http.Request, u *User, repo *Repo) error {
|
||||||
branch := r.FormValue(":branch")
|
branch := r.FormValue("branch")
|
||||||
|
if branch == "" {
|
||||||
|
branch = "master"
|
||||||
|
}
|
||||||
|
|
||||||
hash := r.FormValue(":commit")
|
hash := r.FormValue(":commit")
|
||||||
labl := r.FormValue(":label")
|
labl := r.FormValue(":label")
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,11 @@ import (
|
||||||
|
|
||||||
// Display a specific Commit.
|
// Display a specific Commit.
|
||||||
func CommitShow(w http.ResponseWriter, r *http.Request, u *User, repo *Repo) error {
|
func CommitShow(w http.ResponseWriter, r *http.Request, u *User, repo *Repo) error {
|
||||||
branch := r.FormValue(":branch")
|
branch := r.FormValue("branch")
|
||||||
|
if branch == "" {
|
||||||
|
branch = "master"
|
||||||
|
}
|
||||||
|
|
||||||
hash := r.FormValue(":commit")
|
hash := r.FormValue(":commit")
|
||||||
labl := r.FormValue(":label")
|
labl := r.FormValue(":label")
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<table class="commit-table" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; width: 100%; margin: 0; padding: 0;">
|
<table class="commit-table" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; width: 100%; margin: 0; padding: 0;">
|
||||||
<tr style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;">
|
<tr style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;">
|
||||||
<th style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; text-align: left; color: #333; margin: 0; padding: 0 30px 0 20px;" align="left">commit:</th>
|
<th style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; text-align: left; color: #333; margin: 0; padding: 0 30px 0 20px;" align="left">commit:</th>
|
||||||
<td style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; width: 99%; color: #333; margin: 0; padding: 0;"><a href="{{.Host}}/{{.Repo.Slug}}/commit/{{.Commit.Branch}}/{{ .Commit.Hash }}" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; color: #2a6496; font-weight: normal; margin: 0; padding: 0;">{{ .Commit.HashShort }}</a></td>
|
<td style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; width: 99%; color: #333; margin: 0; padding: 0;"><a href="{{.Host}}/{{.Repo.Slug}}/commit/{{ .Commit.Hash }}?branch={{.Commit.Branch}}" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; color: #2a6496; font-weight: normal; margin: 0; padding: 0;">{{ .Commit.HashShort }}</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;">
|
<tr style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;">
|
||||||
<th style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; text-align: left; color: #333; margin: 0; padding: 0 30px 0 20px;" align="left">branch:</th>
|
<th style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; text-align: left; color: #333; margin: 0; padding: 0 30px 0 20px;" align="left">branch:</th>
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<table class="commit-table" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; width: 100%; margin: 0; padding: 0;">
|
<table class="commit-table" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; width: 100%; margin: 0; padding: 0;">
|
||||||
<tr style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;">
|
<tr style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;">
|
||||||
<th style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; text-align: left; color: #333; margin: 0; padding: 0 30px 0 20px;" align="left">commit:</th>
|
<th style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; text-align: left; color: #333; margin: 0; padding: 0 30px 0 20px;" align="left">commit:</th>
|
||||||
<td style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; width: 99%; color: #333; margin: 0; padding: 0;"><a href="{{.Host}}/{{.Repo.Slug}}/commit/{{ .Commit.Branch }}/{{ .Commit.Hash }}" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; color: #2a6496; font-weight: normal; margin: 0; padding: 0;">{{ .Commit.HashShort }}</a></td>
|
<td style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; width: 99%; color: #333; margin: 0; padding: 0;"><a href="{{.Host}}/{{.Repo.Slug}}/commit/{{ .Commit.Hash }}?branch={{ .Commit.Branch }}" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; color: #2a6496; font-weight: normal; margin: 0; padding: 0;">{{ .Commit.HashShort }}</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;">
|
<tr style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;">
|
||||||
<th style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; text-align: left; color: #333; margin: 0; padding: 0 30px 0 20px;" align="left">branch:</th>
|
<th style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; text-align: left; color: #333; margin: 0; padding: 0 30px 0 20px;" align="left">branch:</th>
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<div class="subhead">
|
<div class="subhead">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<ul class="nav nav-tabs pull-right">
|
<ul class="nav nav-tabs pull-right">
|
||||||
<li class="active"><a href="/{{.Repo.Slug}}/commit/{{ .Commit.Branch }}/{{ .Commit.Hash }}">{{ .Commit.HashShort }}</a></li>
|
<li class="active"><a href="/{{.Repo.Slug}}/commit/{{ .Commit.Hash }}?branch={{ .Commit.Branch }}">{{ .Commit.HashShort }}</a></li>
|
||||||
<li><a href="/{{.Repo.Slug}}">Commits</a></li>
|
<li><a href="/{{.Repo.Slug}}">Commits</a></li>
|
||||||
<li><a href="/{{.Repo.Slug}}/settings">Settings</a></li>
|
<li><a href="/{{.Repo.Slug}}/settings">Settings</a></li>
|
||||||
</ul> <!-- ./nav -->
|
</ul> <!-- ./nav -->
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="alert alert-build-{{ .Build.Status }}">
|
<div class="alert alert-build-{{ .Build.Status }}">
|
||||||
<a href="/{{.Repo.Slug}}/{{.Commit.Branch}}/commit/{{ .Commit.Branch }}/{{ .Commit.Hash }}" class="btn btn-{{ .Build.Status }}"></a>
|
<a href="/{{.Repo.Slug}}/commit/{{ .Commit.Hash }}?branch={{ .Commit.Branch }}" class="btn btn-{{ .Build.Status }}"></a>
|
||||||
{{ if .Commit.PullRequest }}
|
{{ if .Commit.PullRequest }}
|
||||||
<span>opened pull request <span># {{ .Commit.PullRequest }}</span></span>
|
<span>opened pull request <span># {{ .Commit.PullRequest }}</span></span>
|
||||||
{{ else }}
|
{{ else }}
|
||||||
|
@ -78,7 +78,7 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
{{ else }}
|
{{ else }}
|
||||||
$.get("/{{ .Repo.Slug }}/commit/{{ .Commit.Branch }}/{{ .Commit.Hash }}/build/{{ .Build.Slug }}/out.txt", function( data ) {
|
$.get("/{{ .Repo.Slug }}/commit/{{ .Commit.Hash }}/build/{{ .Build.Slug }}/out.txt?branch={{ .Commit.Branch }}", function( data ) {
|
||||||
var lineFormatter = new Drone.LineFormatter();
|
var lineFormatter = new Drone.LineFormatter();
|
||||||
$( "#stdout" ).html(lineFormatter.format(data));
|
$( "#stdout" ).html(lineFormatter.format(data));
|
||||||
});
|
});
|
||||||
|
|
|
@ -28,12 +28,12 @@
|
||||||
<ul class="commit-list commit-list-alt">
|
<ul class="commit-list commit-list-alt">
|
||||||
{{ range .Commits }}
|
{{ range .Commits }}
|
||||||
<li>
|
<li>
|
||||||
<a href="/{{$repo.Slug}}/commit/{{.Branch}}/{{.Hash}}" class="btn btn-{{.Status}}"></a>
|
<a href="/{{$repo.Slug}}/commit/{{.Hash}}?branch={{.Branch}}" class="btn btn-{{.Status}}"></a>
|
||||||
<h3>
|
<h3>
|
||||||
<a href="/{{$repo.Slug}}/commit/{{.Branch}}/{{.Hash}}">{{.HashShort}}</a>
|
<a href="/{{$repo.Slug}}/commit/{{.Hash}}?branch={{.Branch}}">{{.HashShort}}</a>
|
||||||
<small class="timeago" title="{{.CreatedString}}"></small>
|
<small class="timeago" title="{{.CreatedString}}"></small>
|
||||||
{{ if .PullRequest }}
|
{{ if .PullRequest }}
|
||||||
<p>opened pull request <a href="/{{$repo.Slug}}/commit/{{.Branch}}/{{.Hash}}"># {{.PullRequest}}</a></p>
|
<p>opened pull request <a href="/{{$repo.Slug}}/commit/{{.Hash}}?branch={{.Branch}}"># {{.PullRequest}}</a></p>
|
||||||
{{ else }}
|
{{ else }}
|
||||||
<p>{{.Message}} </p>
|
<p>{{.Message}} </p>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
|
@ -45,14 +45,14 @@
|
||||||
<ul class="commit-list">
|
<ul class="commit-list">
|
||||||
{{ range $commit := .Commits }}
|
{{ range $commit := .Commits }}
|
||||||
<li>
|
<li>
|
||||||
<a href="/{{$commit.Slug}}/commit/{{$commit.Branch}}/{{$commit.Hash}}" class="btn btn-{{$commit.Status}}"></a>
|
<a href="/{{$commit.Slug}}/commit/{{$commit.Hash}}?branch={{$commit.Branch}}" class="btn btn-{{$commit.Status}}"></a>
|
||||||
<h3>
|
<h3>
|
||||||
<a href="/{{$commit.Slug}}">{{$commit.Owner}} / {{$commit.Name}}</a>
|
<a href="/{{$commit.Slug}}">{{$commit.Owner}} / {{$commit.Name}}</a>
|
||||||
<small class="timeago" title="{{$commit.CreatedString}}"></small>
|
<small class="timeago" title="{{$commit.CreatedString}}"></small>
|
||||||
{{ if $commit.PullRequest }}
|
{{ if $commit.PullRequest }}
|
||||||
<p>opened pull request <a href="/{{$commit.Slug}}/commit/{{$commit.Branch}}/{{$commit.Hash}}"># {{$commit.PullRequest}}</a></p>
|
<p>opened pull request <a href="/{{$commit.Slug}}/commit/{{$commit.Hash}}?branch={{$commit.Branch}}"># {{$commit.PullRequest}}</a></p>
|
||||||
{{ else }}
|
{{ else }}
|
||||||
<p>commit <a href="/{{$commit.Slug}}/commit/{{$commit.Branch}}/{{$commit.Hash}}">{{$commit.HashShort}}</a> to <a href="/{{$commit.Slug}}?branch={{$commit.Branch}}">{{$commit.Branch}}</a> branch</p>
|
<p>commit <a href="/{{$commit.Slug}}/commit/{{$commit.Hash}}?branch={{$commit.Branch}}">{{$commit.HashShort}}</a> to <a href="/{{$commit.Slug}}?branch={{$commit.Branch}}">{{$commit.Branch}}</a> branch</p>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</h3>
|
</h3>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -43,14 +43,14 @@
|
||||||
<ul class="commit-list">
|
<ul class="commit-list">
|
||||||
{{ range $commit := .Commits }}
|
{{ range $commit := .Commits }}
|
||||||
<li>
|
<li>
|
||||||
<a href="/{{$commit.Slug}}/commit/{{$commit.Branch}}/{{$commit.Hash}}" class="btn btn-{{$commit.Status}}"></a>
|
<a href="/{{$commit.Slug}}/commit/{{$commit.Hash}}?branch={{$commit.Branch}}" class="btn btn-{{$commit.Status}}"></a>
|
||||||
<h3>
|
<h3>
|
||||||
<a href="/{{$commit.Slug}}">{{$commit.Owner}} / {{$commit.Name}}</a>
|
<a href="/{{$commit.Slug}}">{{$commit.Owner}} / {{$commit.Name}}</a>
|
||||||
<small class="timeago" title="{{$commit.CreatedString}}"></small>
|
<small class="timeago" title="{{$commit.CreatedString}}"></small>
|
||||||
{{ if $commit.PullRequest }}
|
{{ if $commit.PullRequest }}
|
||||||
<p>opened pull request <a href="/{{$commit.Slug}}/commit/{{$commit.Branch}}/{{$commit.Hash}}"># {{$commit.PullRequest}}</a></p>
|
<p>opened pull request <a href="/{{$commit.Slug}}/commit/{{$commit.Hash}}?branch={{$commit.Branch}}"># {{$commit.PullRequest}}</a></p>
|
||||||
{{ else }}
|
{{ else }}
|
||||||
<p>commit <a href="/{{$commit.Slug}}/commit/{{$commit.Branch}}/{{$commit.Hash}}">{{$commit.HashShort}}</a> to <a href="/{{$commit.Slug}}?branch={{$commit.Branch}}">{{$commit.Branch}}</a> branch</p>
|
<p>commit <a href="/{{$commit.Slug}}/commit/{{$commit.Hash}}?branch={{$commit.Branch}}">{{$commit.HashShort}}</a> to <a href="/{{$commit.Slug}}?branch={{$commit.Branch}}">{{$commit.Branch}}</a> branch</p>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</h3>
|
</h3>
|
||||||
</li>
|
</li>
|
||||||
|
|
Loading…
Reference in a new issue