Finish new migrate page
This commit is contained in:
parent
7bbf644dd5
commit
dabf5b057c
|
@ -60,6 +60,7 @@ Email = E-mail address
|
||||||
Password = Password
|
Password = Password
|
||||||
Retype = Re-type password
|
Retype = Re-type password
|
||||||
SSHTitle = SSH key name
|
SSHTitle = SSH key name
|
||||||
|
HttpsUrl = HTTPS URL
|
||||||
|
|
||||||
require_error = ` cannot be empty.`
|
require_error = ` cannot be empty.`
|
||||||
alpha_dash_error = ` must be valid alpha or numeric or dash(-_) characters.`
|
alpha_dash_error = ` must be valid alpha or numeric or dash(-_) characters.`
|
||||||
|
@ -83,6 +84,7 @@ illegal_org_name = Organization name contains illegal characters.
|
||||||
username_password_incorrect = Username or password is not correct.
|
username_password_incorrect = Username or password is not correct.
|
||||||
|
|
||||||
invalid_ssh_key = Sorry, we're not able to verify your SSH key: %s
|
invalid_ssh_key = Sorry, we're not able to verify your SSH key: %s
|
||||||
|
auth_failed = Authentication failed: %v
|
||||||
|
|
||||||
still_own_repo = Your account still have ownership of repository, you have to delete or transfer them first.
|
still_own_repo = Your account still have ownership of repository, you have to delete or transfer them first.
|
||||||
|
|
||||||
|
@ -142,6 +144,11 @@ license_helper = Select a license file
|
||||||
init_readme = Initialize this repository with a README.md
|
init_readme = Initialize this repository with a README.md
|
||||||
create_repo = Create Repository
|
create_repo = Create Repository
|
||||||
|
|
||||||
|
need_auth = Need Authorization
|
||||||
|
migrate_type = Migration Type
|
||||||
|
migrate_type_helper = This repository will be a <span class="label label-blue label-radius">Mirror</span>
|
||||||
|
migrate_repo = Migrate Repository
|
||||||
|
|
||||||
[org]
|
[org]
|
||||||
org_name_holder = Organization Name
|
org_name_holder = Organization Name
|
||||||
org_name_helper = Great organization names are short and memorable.
|
org_name_helper = Great organization names are short and memorable.
|
||||||
|
|
|
@ -60,6 +60,7 @@ Email = 邮箱地址
|
||||||
Password = 密码
|
Password = 密码
|
||||||
Retype = 确认密码
|
Retype = 确认密码
|
||||||
SSHTitle = SSH 密钥名称
|
SSHTitle = SSH 密钥名称
|
||||||
|
HttpsUrl = HTTPS URL 地址
|
||||||
|
|
||||||
require_error = 不能为空。
|
require_error = 不能为空。
|
||||||
alpha_dash_error = 必须为英文字母、阿拉伯数字或横线(-_)。
|
alpha_dash_error = 必须为英文字母、阿拉伯数字或横线(-_)。
|
||||||
|
@ -83,6 +84,7 @@ illegal_org_name = 组织名称包含非法字符。
|
||||||
username_password_incorrect = 用户名或密码不正确。
|
username_password_incorrect = 用户名或密码不正确。
|
||||||
|
|
||||||
invalid_ssh_key = 很抱歉,我们无法验证您输入的 SSH 密钥:%s
|
invalid_ssh_key = 很抱歉,我们无法验证您输入的 SSH 密钥:%s
|
||||||
|
auth_failed = 授权验证失败:%v
|
||||||
|
|
||||||
still_own_repo = 您的帐户仍然是某些仓库的拥有者,您必须先转移或删除它们才能执行删除帐户操作!
|
still_own_repo = 您的帐户仍然是某些仓库的拥有者,您必须先转移或删除它们才能执行删除帐户操作!
|
||||||
|
|
||||||
|
@ -142,6 +144,11 @@ license_helper = 请选择授权许可文件
|
||||||
init_readme = 使用 README.md 文件初始化仓库
|
init_readme = 使用 README.md 文件初始化仓库
|
||||||
create_repo = 创建仓库
|
create_repo = 创建仓库
|
||||||
|
|
||||||
|
need_auth = 需要授权验证
|
||||||
|
migrate_type = 迁移类型
|
||||||
|
migrate_type_helper = 本仓库将是 <span class="label label-blue label-radius">镜像</span>
|
||||||
|
migrate_repo = 迁移仓库
|
||||||
|
|
||||||
[org]
|
[org]
|
||||||
org_name_holder = 组织名称
|
org_name_holder = 组织名称
|
||||||
org_name_helper = 伟大的组织都有一个简短而寓意深刻的名字。
|
org_name_helper = 伟大的组织都有一个简短而寓意深刻的名字。
|
||||||
|
|
2
gogs.go
2
gogs.go
|
@ -17,7 +17,7 @@ import (
|
||||||
"github.com/gogits/gogs/modules/setting"
|
"github.com/gogits/gogs/modules/setting"
|
||||||
)
|
)
|
||||||
|
|
||||||
const APP_VER = "0.4.7.0731 Alpha"
|
const APP_VER = "0.4.7.0801 Alpha"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
runtime.GOMAXPROCS(runtime.NumCPU())
|
runtime.GOMAXPROCS(runtime.NumCPU())
|
||||||
|
|
|
@ -33,11 +33,11 @@ func (f *CreateRepoForm) Validate(ctx *macaron.Context, errs *binding.Errors, l
|
||||||
}
|
}
|
||||||
|
|
||||||
type MigrateRepoForm struct {
|
type MigrateRepoForm struct {
|
||||||
Url string `form:"url" binding:"Url"`
|
HttpsUrl string `form:"url" binding:"Url"`
|
||||||
AuthUserName string `form:"auth_username"`
|
AuthUserName string `form:"auth_username"`
|
||||||
AuthPasswd string `form:"auth_password"`
|
AuthPasswd string `form:"auth_password"`
|
||||||
Uid int64 `form:"uid" binding:"Required"`
|
Uid int64 `form:"uid" binding:"Required"`
|
||||||
RepoName string `form:"repo" binding:"Required;AlphaDash;MaxSize(100)"`
|
RepoName string `form:"repo_name" binding:"Required;AlphaDash;MaxSize(100)"`
|
||||||
Mirror bool `form:"mirror"`
|
Mirror bool `form:"mirror"`
|
||||||
Private bool `form:"private"`
|
Private bool `form:"private"`
|
||||||
Description string `form:"desc" binding:"MaxSize(255)"`
|
Description string `form:"desc" binding:"MaxSize(255)"`
|
||||||
|
|
|
@ -294,6 +294,8 @@ img.avatar-30 {
|
||||||
border: 1px solid #ddd;
|
border: 1px solid #ddd;
|
||||||
border-radius: .25em;
|
border-radius: .25em;
|
||||||
margin: 5px 0;
|
margin: 5px 0;
|
||||||
|
padding: 10px;
|
||||||
|
background-color: #f8f8f8;
|
||||||
}
|
}
|
||||||
.markdown > pre.linenums {
|
.markdown > pre.linenums {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
@ -836,6 +838,9 @@ The register and sign-in page style
|
||||||
margin-left: -15px;
|
margin-left: -15px;
|
||||||
}
|
}
|
||||||
/* repository main */
|
/* repository main */
|
||||||
|
#repo-wrapper {
|
||||||
|
padding-bottom: 100px;
|
||||||
|
}
|
||||||
#repo-header {
|
#repo-header {
|
||||||
height: 69px;
|
height: 69px;
|
||||||
border-bottom: 1px solid #d6d6d6;
|
border-bottom: 1px solid #d6d6d6;
|
||||||
|
@ -1100,29 +1105,36 @@ The register and sign-in page style
|
||||||
width: 520px;
|
width: 520px;
|
||||||
}
|
}
|
||||||
/* repository create */
|
/* repository create */
|
||||||
|
#repo-migrate-form,
|
||||||
#repo-create-form {
|
#repo-create-form {
|
||||||
width: 800px;
|
width: 800px;
|
||||||
margin: 60px auto 150px auto;
|
margin: 60px auto auto auto;
|
||||||
background: white;
|
background: white;
|
||||||
}
|
}
|
||||||
|
#repo-migrate-form h2,
|
||||||
#repo-create-form h2 {
|
#repo-create-form h2 {
|
||||||
margin: .5em 1em;
|
margin: .5em 1em;
|
||||||
}
|
}
|
||||||
|
#repo-migrate-form .field,
|
||||||
#repo-create-form .field {
|
#repo-create-form .field {
|
||||||
margin: 1.2em 0 2em 0;
|
margin: 1.2em 0 2em 0;
|
||||||
}
|
}
|
||||||
|
#repo-migrate-form .ipt,
|
||||||
#repo-create-form .ipt {
|
#repo-create-form .ipt {
|
||||||
width: 540px;
|
width: 540px;
|
||||||
}
|
}
|
||||||
|
#repo-migrate-form textarea,
|
||||||
#repo-create-form textarea {
|
#repo-create-form textarea {
|
||||||
height: 120px;
|
height: 120px;
|
||||||
}
|
}
|
||||||
|
#repo-migrate-form .avatar,
|
||||||
#repo-create-form .avatar {
|
#repo-create-form .avatar {
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
margin-right: .6em;
|
margin-right: .6em;
|
||||||
width: 28px;
|
width: 28px;
|
||||||
height: 28px;
|
height: 28px;
|
||||||
}
|
}
|
||||||
|
#repo-migrate-form:hover,
|
||||||
#repo-create-form:hover {
|
#repo-create-form:hover {
|
||||||
box-shadow: 0px 0px 6px #CCC;
|
box-shadow: 0px 0px 6px #CCC;
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,7 @@ var Gogs = {};
|
||||||
Gogs.renderMarkdown = function () {
|
Gogs.renderMarkdown = function () {
|
||||||
var $md = $('.markdown');
|
var $md = $('.markdown');
|
||||||
var $pre = $md.find('pre > code').parent();
|
var $pre = $md.find('pre > code').parent();
|
||||||
$pre.addClass('prettyprint linenums');
|
$pre.addClass('prettyprint');
|
||||||
prettyPrint();
|
prettyPrint();
|
||||||
|
|
||||||
// Set anchor.
|
// Set anchor.
|
||||||
|
@ -166,11 +166,17 @@ function initRepoCreate() {
|
||||||
console.log("set repo owner to uid :", uid, $(this).text().trim());
|
console.log("set repo owner to uid :", uid, $(this).text().trim());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#auth-button').click(function (e) {
|
||||||
|
$('#repo-migrate-auth').slideToggle('fast');
|
||||||
|
e.preventDefault();
|
||||||
|
})
|
||||||
|
console.log('initRepoCreate');
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
initCore();
|
initCore();
|
||||||
if ($('#repo-create-form').length) {
|
if ($('#repo-create-form').length || $('#repo-migrate-form').length) {
|
||||||
initRepoCreate();
|
initRepoCreate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,6 @@ const (
|
||||||
|
|
||||||
func Create(ctx *middleware.Context) {
|
func Create(ctx *middleware.Context) {
|
||||||
ctx.Data["Title"] = ctx.Tr("new_repo")
|
ctx.Data["Title"] = ctx.Tr("new_repo")
|
||||||
ctx.Data["PageIsRepoCreate"] = true
|
|
||||||
|
|
||||||
// Give default value for template to render.
|
// Give default value for template to render.
|
||||||
ctx.Data["gitignore"] = "0"
|
ctx.Data["gitignore"] = "0"
|
||||||
|
@ -57,7 +56,6 @@ func Create(ctx *middleware.Context) {
|
||||||
|
|
||||||
func CreatePost(ctx *middleware.Context, form auth.CreateRepoForm) {
|
func CreatePost(ctx *middleware.Context, form auth.CreateRepoForm) {
|
||||||
ctx.Data["Title"] = ctx.Tr("new_repo")
|
ctx.Data["Title"] = ctx.Tr("new_repo")
|
||||||
ctx.Data["PageIsRepoCreate"] = true
|
|
||||||
|
|
||||||
ctx.Data["Gitignores"] = models.Gitignores
|
ctx.Data["Gitignores"] = models.Gitignores
|
||||||
ctx.Data["Licenses"] = models.Licenses
|
ctx.Data["Licenses"] = models.Licenses
|
||||||
|
@ -100,9 +98,11 @@ func CreatePost(ctx *middleware.Context, form auth.CreateRepoForm) {
|
||||||
ctx.Redirect("/" + ctxUser.Name + "/" + form.RepoName)
|
ctx.Redirect("/" + ctxUser.Name + "/" + form.RepoName)
|
||||||
return
|
return
|
||||||
} else if err == models.ErrRepoAlreadyExist {
|
} else if err == models.ErrRepoAlreadyExist {
|
||||||
|
ctx.Data["Err_RepoName"] = true
|
||||||
ctx.RenderWithErr(ctx.Tr("form.repo_name_been_taken"), CREATE, &form)
|
ctx.RenderWithErr(ctx.Tr("form.repo_name_been_taken"), CREATE, &form)
|
||||||
return
|
return
|
||||||
} else if err == models.ErrRepoNameIllegal {
|
} else if err == models.ErrRepoNameIllegal {
|
||||||
|
ctx.Data["Err_RepoName"] = true
|
||||||
ctx.RenderWithErr(ctx.Tr("form.illegal_repo_name"), CREATE, &form)
|
ctx.RenderWithErr(ctx.Tr("form.illegal_repo_name"), CREATE, &form)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -112,12 +112,22 @@ func CreatePost(ctx *middleware.Context, form auth.CreateRepoForm) {
|
||||||
log.Error(4, "DeleteRepository: %v", errDelete)
|
log.Error(4, "DeleteRepository: %v", errDelete)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ctx.Handle(500, "CreateRepository", err)
|
ctx.Handle(500, "CreatePost", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
func Migrate(ctx *middleware.Context) {
|
func Migrate(ctx *middleware.Context) {
|
||||||
ctx.Data["Title"] = "Migrate repository"
|
ctx.Data["Title"] = ctx.Tr("new_migrate")
|
||||||
ctx.Data["PageIsNewRepo"] = true
|
|
||||||
|
ctxUser := ctx.User
|
||||||
|
if orgId := com.StrTo(ctx.Query("org")).MustInt64(); orgId > 0 {
|
||||||
|
org, err := models.GetUserById(orgId)
|
||||||
|
if err != nil && err != models.ErrUserNotExist {
|
||||||
|
ctx.Handle(500, "GetUserById", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ctxUser = org
|
||||||
|
}
|
||||||
|
ctx.Data["ContextUser"] = ctxUser
|
||||||
|
|
||||||
if err := ctx.User.GetOrganizations(); err != nil {
|
if err := ctx.User.GetOrganizations(); err != nil {
|
||||||
ctx.Handle(500, "GetOrganizations", err)
|
ctx.Handle(500, "GetOrganizations", err)
|
||||||
|
@ -129,8 +139,18 @@ func Migrate(ctx *middleware.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func MigratePost(ctx *middleware.Context, form auth.MigrateRepoForm) {
|
func MigratePost(ctx *middleware.Context, form auth.MigrateRepoForm) {
|
||||||
ctx.Data["Title"] = "Migrate repository"
|
ctx.Data["Title"] = ctx.Tr("new_migrate")
|
||||||
ctx.Data["PageIsNewRepo"] = true
|
|
||||||
|
ctxUser := ctx.User
|
||||||
|
if orgId := com.StrTo(ctx.Query("org")).MustInt64(); orgId > 0 {
|
||||||
|
org, err := models.GetUserById(orgId)
|
||||||
|
if err != nil && err != models.ErrUserNotExist {
|
||||||
|
ctx.Handle(500, "GetUserById", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ctxUser = org
|
||||||
|
}
|
||||||
|
ctx.Data["ContextUser"] = ctxUser
|
||||||
|
|
||||||
if err := ctx.User.GetOrganizations(); err != nil {
|
if err := ctx.User.GetOrganizations(); err != nil {
|
||||||
ctx.Handle(500, "GetOrganizations", err)
|
ctx.Handle(500, "GetOrganizations", err)
|
||||||
|
@ -143,49 +163,45 @@ func MigratePost(ctx *middleware.Context, form auth.MigrateRepoForm) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
u := ctx.User
|
if ctxUser.IsOrganization() {
|
||||||
// Not equal means current user is an organization.
|
// Check ownership of organization.
|
||||||
if u.Id != form.Uid {
|
if !ctxUser.IsOrgOwner(ctx.User.Id) {
|
||||||
var err error
|
ctx.Error(403)
|
||||||
u, err = models.GetUserById(form.Uid)
|
|
||||||
if err != nil {
|
|
||||||
if err == models.ErrUserNotExist {
|
|
||||||
ctx.Handle(404, "GetUserById", err)
|
|
||||||
} else {
|
|
||||||
ctx.Handle(500, "GetUserById", err)
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
authStr := strings.Replace(fmt.Sprintf("://%s:%s",
|
authStr := strings.Replace(fmt.Sprintf("://%s:%s",
|
||||||
form.AuthUserName, form.AuthPasswd), "@", "%40", -1)
|
form.AuthUserName, form.AuthPasswd), "@", "%40", -1)
|
||||||
url := strings.Replace(form.Url, "://", authStr+"@", 1)
|
url := strings.Replace(form.HttpsUrl, "://", authStr+"@", 1)
|
||||||
repo, err := models.MigrateRepository(u, form.RepoName, form.Description, form.Private,
|
repo, err := models.MigrateRepository(ctxUser, form.RepoName, form.Description, form.Private,
|
||||||
form.Mirror, url)
|
form.Mirror, url)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
log.Trace("%s Repository migrated: %s/%s", ctx.Req.RequestURI, u.LowerName, form.RepoName)
|
log.Trace("Repository migrated: %s/%s", ctxUser.Name, form.RepoName)
|
||||||
ctx.Redirect("/" + u.Name + "/" + form.RepoName)
|
ctx.Redirect("/" + ctxUser.Name + "/" + form.RepoName)
|
||||||
return
|
return
|
||||||
} else if err == models.ErrRepoAlreadyExist {
|
} else if err == models.ErrRepoAlreadyExist {
|
||||||
ctx.RenderWithErr("Repository name has already been used", MIGRATE, &form)
|
ctx.Data["Err_RepoName"] = true
|
||||||
|
ctx.RenderWithErr(ctx.Tr("form.repo_name_been_taken"), MIGRATE, &form)
|
||||||
return
|
return
|
||||||
} else if err == models.ErrRepoNameIllegal {
|
} else if err == models.ErrRepoNameIllegal {
|
||||||
ctx.RenderWithErr(models.ErrRepoNameIllegal.Error(), MIGRATE, &form)
|
ctx.Data["Err_RepoName"] = true
|
||||||
|
ctx.RenderWithErr(ctx.Tr("form.illegal_repo_name"), MIGRATE, &form)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if repo != nil {
|
if repo != nil {
|
||||||
if errDelete := models.DeleteRepository(u.Id, repo.Id, u.Name); errDelete != nil {
|
if errDelete := models.DeleteRepository(ctxUser.Id, repo.Id, ctxUser.Name); errDelete != nil {
|
||||||
log.Error(4, "DeleteRepository: %v", errDelete)
|
log.Error(4, "DeleteRepository: %v", errDelete)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if strings.Contains(err.Error(), "Authentication failed") {
|
if strings.Contains(err.Error(), "Authentication failed") {
|
||||||
ctx.RenderWithErr(err.Error(), MIGRATE, &form)
|
ctx.Data["Err_Auth"] = true
|
||||||
|
ctx.RenderWithErr(ctx.Tr("form.auth_failed", err), MIGRATE, &form)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
ctx.Handle(500, "MigrateRepository", err)
|
ctx.Handle(500, "MigratePost", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// func Action(ctx *middleware.Context, params martini.Params) {
|
// func Action(ctx *middleware.Context, params martini.Params) {
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
0.4.7.0731 Alpha
|
0.4.7.0801 Alpha
|
|
@ -36,7 +36,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label class="req" for="repo-name">{{.i18n.Tr "repo.repo_name"}}</label>
|
<label class="req" for="repo-name">{{.i18n.Tr "repo.repo_name"}}</label>
|
||||||
<input class="ipt ipt-radius" id="repo-name" name="repo_name" type="text" value="{{.repo_name}}" required />
|
<input class="ipt ipt-radius {{if .Err_RepoName}}ipt-error{{end}}" id="repo-name" name="repo_name" type="text" value="{{.repo_name}}" required />
|
||||||
<span class="form-label"></span>
|
<span class="form-label"></span>
|
||||||
<span class="help">{{.i18n.Tr "repo.repo_name_helper" | Str2html}}</span>
|
<span class="help">{{.i18n.Tr "repo.repo_name_helper" | Str2html}}</span>
|
||||||
</div>
|
</div>
|
||||||
|
@ -47,7 +47,7 @@
|
||||||
</p>
|
</p>
|
||||||
<div class="field clear">
|
<div class="field clear">
|
||||||
<label class="left" for="desc">{{.i18n.Tr "repo.repo_desc"}}</label>
|
<label class="left" for="desc">{{.i18n.Tr "repo.repo_desc"}}</label>
|
||||||
<textarea class="ipt ipt-radius" id="desc" name="desc">{{.desc}}</textarea>
|
<textarea class="ipt ipt-radius {{if .Err_Description}}ipt-error{{end}}" id="desc" name="desc">{{.desc}}</textarea>
|
||||||
</div>
|
</div>
|
||||||
<p class="field">
|
<p class="field">
|
||||||
<label for="lang">{{.i18n.Tr "repo.repo_lang"}}</label>
|
<label for="lang">{{.i18n.Tr "repo.repo_lang"}}</label>
|
||||||
|
|
|
@ -1,127 +1,82 @@
|
||||||
{{template "base/head" .}}
|
{{template "ng/base/head" .}}
|
||||||
{{template "base/navbar" .}}
|
{{template "ng/base/header" .}}
|
||||||
<div class="container" id="body">
|
<div id="repo-wrapper">
|
||||||
<form action="/repo/migrate" method="post" class="form-horizontal card" id="repo-create">
|
<form id="repo-migrate-form" class="form form-align panel panel-radius" action="/repo/migrate" method="post">
|
||||||
{{.CsrfTokenHtml}}
|
{{.CsrfTokenHtml}}
|
||||||
<h3>Repository Migration</h3>
|
<div class="panel-header"><h2>{{.i18n.Tr "new_migrate"}}</h2></div>
|
||||||
{{template "base/alert" .}}
|
<div class="panel-content">
|
||||||
<!-- <div class="form-group">
|
{{template "ng/base/alert" .}}
|
||||||
<label class="col-md-2 control-label">From<strong class="text-danger">*</strong></label>
|
<div class="field">
|
||||||
<div class="col-md-8">
|
<label class="req" for="url">HTTPS URL</label>
|
||||||
<select class="form-control" name="from">
|
<input class="ipt ipt-radius {{if .Err_HttpsUrl}}ipt-error{{end}}" id="url" name="url" type="text" value="{{.url}}" required />
|
||||||
<option value="github">GitHub</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
</div>
|
||||||
</div> -->
|
<div class="field">
|
||||||
|
<span class="form-label"></span>
|
||||||
<div class="form-group">
|
<button class="btn btn-large btn-gray btn-radius" id="auth-button" data-toggle="collapse" data-target="#repo-import-auth">{{.i18n.Tr "repo.need_auth"}}</button>
|
||||||
<label class="col-md-2 control-label">HTTPS URL<strong class="text-danger">*</strong></label>
|
<div id="repo-migrate-auth" {{if not .Err_Auth}}class="hide"{{end}}>
|
||||||
<div class="col-md-8">
|
<div class="field">
|
||||||
<input name="url" type="text" class="form-control" placeholder="Type your migration repository HTTPS URL" value="{{.url}}" required="required" >
|
<label for="auth_username">{{.i18n.Tr "username"}}</label>
|
||||||
</div>
|
<input class="ipt ipt-radius {{if .Err_Auth}}ipt-error{{end}}" id="auth_username" name="auth_username" type="text" value="{{.auth_username}}" />
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<div class="col-md-offset-2 col-md-8">
|
|
||||||
<a class="btn btn-default" data-toggle="collapse" data-target="#repo-import-auth">Need Authorization</a>
|
|
||||||
</div>
|
|
||||||
<div id="repo-import-auth" class="collapse">
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-md-2 control-label">Username</label>
|
|
||||||
<div class="col-md-8">
|
|
||||||
<input name="auth_username" type="text" class="form-control" placeholder="Type your user name" value="{{.auth_username}}" >
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="field">
|
||||||
<div class="form-group">
|
<label for="auth_password">{{.i18n.Tr "password"}}</label>
|
||||||
<label class="col-md-2 control-label">Password</label>
|
<input class="ipt ipt-radius {{if .Err_Auth}}ipt-error{{end}}" id="auth_password" name="auth_password" type="text" value="{{.auth_password}}" />
|
||||||
<div class="col-md-8">
|
|
||||||
<input name="auth_password" type="password" class="form-control" placeholder="Type your password" value="{{.auth_password}}" >
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<hr/>
|
||||||
<hr/>
|
<div class="field">
|
||||||
<div class="form-group">
|
<label for="owner" class="req">{{.i18n.Tr "repo.owner"}}</label>
|
||||||
<label class="col-md-2 control-label">Owner<strong class="text-danger">*</strong></label>
|
<input id="repo-owner-id" type="hidden" name="uid" value="{{.ContextUser.Id}}" />
|
||||||
<div class="col-md-8">
|
<div class="inline-block drop">
|
||||||
<div class="btn-group" id="repo-owner-switch">
|
<a href="#" class="drop-bottom">
|
||||||
<button type="button" class="btn btn-default" id="repo-owner-current">
|
<img class="avatar" src="{{.ContextUser.AvatarLink}}" id="repo-owner-avatar" alt="user-avatar">
|
||||||
<img src="{{.SignedUser.AvatarLink}}?s=28" alt="user-avatar" title="username" id="repo-owner-avatar">
|
<strong id="repo-owner-name">{{.ContextUser.Name}}</strong>
|
||||||
<span id="repo-owner-name">{{.SignedUser.Name}}</span>
|
</a>
|
||||||
</button>
|
<ul class="drop-down menu menu-vertical menu-radius switching-list" id="repo-create-owner-list">
|
||||||
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
|
<li {{if eq $.ContextUser.Id .SignedUser.Id}}class="checked"{{end}} data-uid="{{.SignedUser.Id}}">
|
||||||
<span class="caret"></span>
|
<a>
|
||||||
</button>
|
<i class="octicon octicon-check"></i>
|
||||||
<div class="dropdown-menu clone-group-btn no-propagation">
|
<img class="avatar" src="{{.SignedUser.AvatarLink}}" alt="user-avatar">
|
||||||
<ul id="dashboard-switch-menu" class="list-unstyled">
|
<strong>{{.SignedUser.Name}}</strong>
|
||||||
<li data-uid="{{.SignedUser.Id}}" class="checked">
|
</a>
|
||||||
<a>
|
</li>
|
||||||
<i class="fa fa-check"></i>
|
{{range .Orgs}}
|
||||||
<img src="{{.SignedUser.AvatarLink}}?s=28" alt="user-avatar" title="username">
|
<li {{if eq $.ContextUser.Id .Id}}class="checked"{{end}} data-uid="{{.Id}}">
|
||||||
{{.SignedUser.Name}}
|
<a>
|
||||||
</a>
|
<i class="octicon octicon-check"></i>
|
||||||
</li>
|
<img class="avatar" src="{{.AvatarLink}}" alt="user-avatar">
|
||||||
{{range .Orgs}}
|
<strong>{{.Name}}</strong>
|
||||||
<li data-uid="{{.Id}}">
|
</a>
|
||||||
<a>
|
</li>
|
||||||
<i class="fa fa-check"></i>
|
{{end}}
|
||||||
<img src="{{.AvatarLink}}?s=28" alt="user-avatar" title="username">
|
</ul>
|
||||||
{{.Name}}
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
{{end}}
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<input type="hidden" value="{{.SignedUserId}}" name="uid" id="repo-owner-id"/>
|
<div class="field">
|
||||||
</div>
|
<label class="req" for="repo-name">{{.i18n.Tr "repo.repo_name"}}</label>
|
||||||
|
<input class="ipt ipt-radius {{if .Err_RepoName}}ipt-error{{end}}" id="repo-name" name="repo_name" type="text" value="{{.repo_name}}" required />
|
||||||
<div class="form-group {{if .Err_RepoName}}has-error has-feedback{{end}}">
|
|
||||||
<label class="col-md-2 control-label">Repository<strong class="text-danger">*</strong></label>
|
|
||||||
<div class="col-md-8">
|
|
||||||
<input name="repo" type="text" class="form-control" placeholder="Type your repository name" value="{{.repo}}" required="required">
|
|
||||||
<span class="help-block">Great repository names are short and memorable. </span>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<p class="field">
|
||||||
|
<label for="visibility">{{.i18n.Tr "repo.visibility"}}</label>
|
||||||
<div class="form-group">
|
<input class="ipt-chk" id="visibility" name="private" type="checkbox" {{if .private}}checked{{end}} />
|
||||||
<label class="col-md-2 control-label">Migration Type</label>
|
<span>{{.i18n.Tr "repo.visiblity_helper" | Str2html}}</span>
|
||||||
<div class="col-md-8">
|
</p>
|
||||||
<div class="checkbox">
|
<p class="field">
|
||||||
<label>
|
<label for="visibility">{{.i18n.Tr "repo.migrate_type"}}</label>
|
||||||
<input type="checkbox" name="mirror" {{if .mirror}}checked{{end}}>
|
<input class="ipt-chk" id="visibility" name="mirror" type="checkbox" {{if .mirror}}checked{{end}} />
|
||||||
<strong>This repository is a mirror</strong>
|
<span>{{.i18n.Tr "repo.migrate_type_helper" | Str2html}}</span>
|
||||||
</label>
|
</p>
|
||||||
</div>
|
<div class="field clear">
|
||||||
</div>
|
<label class="left" for="desc">{{.i18n.Tr "repo.repo_desc"}}</label>
|
||||||
</div>
|
<textarea class="ipt ipt-radius {{if .Err_Description}}ipt-error{{end}}" id="desc" name="desc">{{.desc}}</textarea>
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-md-2 control-label">Visibility</label>
|
|
||||||
<div class="col-md-8">
|
|
||||||
<div class="checkbox">
|
|
||||||
<label>
|
|
||||||
<input type="checkbox" name="private" {{if .private}}checked{{end}}>
|
|
||||||
<strong>This repository is private</strong>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group {{if .Err_Description}}has-error has-feedback{{end}}">
|
|
||||||
<label class="col-md-2 control-label">Description</label>
|
|
||||||
<div class="col-md-8">
|
|
||||||
<textarea name="desc" class="form-control" placeholder="Type your repository description">{{.desc}}</textarea>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<div class="col-md-offset-2 col-md-8">
|
|
||||||
<button type="submit" class="btn btn-lg btn-primary">Migrate repository</button>
|
|
||||||
<a href="/" class="text-danger">Cancel</a>
|
|
||||||
</div>
|
</div>
|
||||||
|
<p class="field">
|
||||||
|
<label for="repo-create-submit"></label>
|
||||||
|
<button class="btn btn-large btn-blue btn-radius" id="repo-create-submit">{{.i18n.Tr "repo.migrate_repo"}}</button>
|
||||||
|
<a class="btn btn-small btn-gray btn-radius" id="repo-create-cancel" href="/"><strong>{{.i18n.Tr "cancel"}}</strong></a>
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
{{template "base/footer" .}}
|
{{template "ng/base/footer" .}}
|
Loading…
Reference in New Issue