summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUnknown <joe2010xtmf@163.com>2014-04-09 14:20:02 -0400
committerUnknown <joe2010xtmf@163.com>2014-04-09 14:20:02 -0400
commit9f7bd5007b256d25c387499606720dca461a181c (patch)
tree464bfc6301e51aee830df3cd2e63e7dd722cbfa8
parent5f6bd323f530410c687b17b0251a5a2ffacb755b (diff)
downloadgitea-9f7bd5007b256d25c387499606720dca461a181c.tar.gz
gitea-9f7bd5007b256d25c387499606720dca461a181c.zip
Work on mirror repo
-rw-r--r--routers/repo/repo.go18
-rw-r--r--templates/repo/mirror.tmpl (renamed from templates/repo/import.tmpl)35
-rw-r--r--templates/user/dashboard.tmpl2
-rw-r--r--web.go2
4 files changed, 12 insertions, 45 deletions
diff --git a/routers/repo/repo.go b/routers/repo/repo.go
index 0ab1c9e420..32c198f2f4 100644
--- a/routers/repo/repo.go
+++ b/routers/repo/repo.go
@@ -55,36 +55,34 @@ func Create(ctx *middleware.Context, form auth.CreateRepoForm) {
ctx.Handle(200, "repo.Create", err)
}
-func Import(ctx *middleware.Context, form auth.CreateRepoForm) {
- ctx.Data["Title"] = "Import repository"
+func Mirror(ctx *middleware.Context, form auth.CreateRepoForm) {
+ ctx.Data["Title"] = "Mirror repository"
ctx.Data["PageIsNewRepo"] = true // For navbar arrow.
- ctx.Data["LanguageIgns"] = models.LanguageIgns
- ctx.Data["Licenses"] = models.Licenses
if ctx.Req.Method == "GET" {
- ctx.HTML(200, "repo/import")
+ ctx.HTML(200, "repo/mirror")
return
}
if ctx.HasError() {
- ctx.HTML(200, "repo/import")
+ ctx.HTML(200, "repo/mirror")
return
}
_, err := models.CreateRepository(ctx.User, form.RepoName, form.Description,
- form.Language, form.License, form.Visibility == "private", form.InitReadme == "on")
+ "", form.License, form.Visibility == "private", false)
if err == nil {
log.Trace("%s Repository created: %s/%s", ctx.Req.RequestURI, ctx.User.LowerName, form.RepoName)
ctx.Redirect("/" + ctx.User.Name + "/" + form.RepoName)
return
} else if err == models.ErrRepoAlreadyExist {
- ctx.RenderWithErr("Repository name has already been used", "repo/import", &form)
+ ctx.RenderWithErr("Repository name has already been used", "repo/mirror", &form)
return
} else if err == models.ErrRepoNameIllegal {
- ctx.RenderWithErr(models.ErrRepoNameIllegal.Error(), "repo/import", &form)
+ ctx.RenderWithErr(models.ErrRepoNameIllegal.Error(), "repo/mirror", &form)
return
}
- ctx.Handle(200, "repo.Import", err)
+ ctx.Handle(200, "repo.Mirror", err)
}
func Single(ctx *middleware.Context, params martini.Params) {
diff --git a/templates/repo/import.tmpl b/templates/repo/mirror.tmpl
index 75d928d138..c69f47a309 100644
--- a/templates/repo/import.tmpl
+++ b/templates/repo/mirror.tmpl
@@ -16,7 +16,7 @@
<div class="form-group">
<label class="col-md-2 control-label">URL<strong class="text-danger">*</strong></label>
<div class="col-md-8">
- <input name="url" type="text" class="form-control" placeholder="Type your imported repository url link" required="required">
+ <input name="url" type="text" class="form-control" placeholder="Type your mirror repository url link" required="required">
</div>
</div>
<div class="form-group">
@@ -71,39 +71,8 @@
</div>
<div class="form-group">
- <label class="col-md-2 control-label">Language</label>
- <div class="col-md-8">
- <select class="form-control" name="language">
- <option value="">Select a language</option>
- {{range .LanguageIgns}}<option value="{{.}}">{{.}}</option>{{end}}
- </select>
- </div>
- </div>
-
- <div class="form-group">
- <label class="col-md-2 control-label">License</label>
- <div class="col-md-8">
- <select class="form-control" name="license">
- <option value="">Select a license</option>
- {{range .Licenses}}<option value="{{.}}">{{.}}</option>{{end}}
- </select>
- </div>
- </div>
-
- <!--<div class="form-group">
- <div class="col-md-8 col-md-offset-2">
- <div class="checkbox">
- <label>
- <input type="checkbox" name="initReadme" {{if .initReadme}}checked{{end}}>
- <strong>Initialize this repository with a README</strong>
- </label>
- </div>
- </div>
- </div>-->
-
- <div class="form-group">
<div class="col-md-offset-2 col-md-8">
- <button type="submit" class="btn btn-lg btn-primary">Import repository</button>
+ <button type="submit" class="btn btn-lg btn-primary">Mirror repository</button>
<a href="/" class="text-danger">Cancel</a>
</div>
</div>
diff --git a/templates/user/dashboard.tmpl b/templates/user/dashboard.tmpl
index f0a0a0ccaa..cd55b651df 100644
--- a/templates/user/dashboard.tmpl
+++ b/templates/user/dashboard.tmpl
@@ -37,7 +37,7 @@
<div class="dropdown-menu dropdown-menu-right">
<ul class="list-unstyled">
<li><a href="/repo/create"><i class="fa fa-book"></i>Repository</a></li>
- <li><a href="/repo/import"><i class="fa fa-clipboard"></i>Mirror</a></li>
+ <li><a href="/repo/mirror"><i class="fa fa-clipboard"></i>Mirror</a></li>
<li><a href="#"><i class="fa fa-users"></i>Organization</a></li>
</ul>
diff --git a/web.go b/web.go
index 5dae84b64c..1a9c292f3e 100644
--- a/web.go
+++ b/web.go
@@ -116,7 +116,7 @@ func runWeb(*cli.Context) {
m.Get("/user/:username", ignSignIn, user.Profile)
m.Any("/repo/create", reqSignIn, binding.BindIgnErr(auth.CreateRepoForm{}), repo.Create)
- m.Any("/repo/import", reqSignIn, binding.BindIgnErr(auth.CreateRepoForm{}), repo.Import)
+ m.Any("/repo/mirror", reqSignIn, binding.BindIgnErr(auth.CreateRepoForm{}), repo.Mirror)
adminReq := middleware.Toggle(&middleware.ToggleOptions{SignInRequire: true, AdminRequire: true})