Added settings to github_add page (fix redirect)

This commit is contained in:
Vsevolod Strukchinsky 2014-02-09 20:09:38 +06:00
parent 44d5f3baca
commit 833563763c
2 changed files with 6 additions and 2 deletions

View file

@ -54,6 +54,7 @@ func RepoDashboard(w http.ResponseWriter, r *http.Request, u *User, repo *Repo)
}
func RepoAdd(w http.ResponseWriter, r *http.Request, u *User) error {
settings := database.SettingsMust()
teams, err := database.ListTeams(u.ID)
if err != nil {
return err
@ -61,7 +62,8 @@ func RepoAdd(w http.ResponseWriter, r *http.Request, u *User) error {
data := struct {
User *User
Teams []*Team
}{u, teams}
Settings *Settings
}{u, teams, settings}
// if the user hasn't linked their GitHub account
// render a different template
if len(u.GithubToken) == 0 {

View file

@ -25,6 +25,7 @@
<a class="btn btn-default pull-right" href="/auth/login/github" style="font-size: 18px;background:#f4f4f4;">Re-Link Account</a>
</div>
<form class="form-repo" method="POST" action="/new/github.com">
<input type="hidden" name="domain" autocomplete="off" value="{{.Settings.GitHubDomain}}">
<div class="field-group">
<div>
<label>GitHub Owner</label>
@ -85,7 +86,8 @@
if (this.status == 200) {
var name = $("input[name=name]").val()
var owner = $("input[name=owner]").val()
window.location.pathname = "/github.com/"+owner+"/"+name
var domain = $("input[name=domain]").val()
window.location.pathname = "/" + domain + "/"+owner+"/"+name
} else {
$("#failureAlert").text("Unable to setup the Repository");
$("#failureAlert").show().removeClass("hide");