| @@ -2,7 +2,7 @@ | |||
| <div class="repository new repo" style="margin-top: 40px;"> | |||
| <div class="ui middle very relaxed page grid"> | |||
| <div class="column"> | |||
| <form class="ui form" action="{{.Link}}" method="post"> | |||
| <form class="ui form" action="{{.Link}}" method="post" id="create_repo_form"> | |||
| {{.CsrfTokenHtml}} | |||
| <h3 class="ui top attached header"> | |||
| {{.i18n.Tr "new_repo"}} | |||
| @@ -144,7 +144,7 @@ | |||
| <br/> | |||
| <div class="inline field"> | |||
| <label></label> | |||
| <button class="ui green button"> | |||
| <button class="ui green button" id="submit_reponame"> | |||
| {{.i18n.Tr "repo.create_repo"}} | |||
| </button> | |||
| <a class="ui button" href="{{AppSubUrl}}/">{{.i18n.Tr "cancel"}}</a> | |||
| @@ -2,7 +2,7 @@ | |||
| <div class="repository new migrate" style="margin-top: 40px;"> | |||
| <div class="ui middle very relaxed page grid"> | |||
| <div class="column"> | |||
| <form class="ui form" action="{{.Link}}" method="post"> | |||
| <form class="ui form" action="{{.Link}}" method="post" id="create_repo_form"> | |||
| {{.CsrfTokenHtml}} | |||
| <h3 class="ui top attached header"> | |||
| {{.i18n.Tr "new_migrate"}} | |||
| @@ -99,7 +99,7 @@ | |||
| <div class="inline field"> | |||
| <label></label> | |||
| <button class="ui green button"> | |||
| <button class="ui green button" id="submit_reponame"> | |||
| {{.i18n.Tr "repo.migrate_repo"}} | |||
| </button> | |||
| <a class="ui button" href="{{AppSubUrl}}/">{{.i18n.Tr "cancel"}}</a> | |||
| @@ -2,39 +2,13 @@ | |||
| <div class="repository new fork"> | |||
| <div class="ui middle very relaxed page grid"> | |||
| <div class="column"> | |||
| <form class="ui form" action="{{.Link}}" method="post"> | |||
| <form class="ui form" action="{{.Link}}" method="post" id="create_repo_form"> | |||
| {{.CsrfTokenHtml}} | |||
| <h3 class="ui top attached header"> | |||
| {{.i18n.Tr "new_fork"}} | |||
| </h3> | |||
| <div class="ui attached segment"> | |||
| {{template "base/alert" .}} | |||
| <!-- <div class="inline required field {{if .Err_Owner}}error{{end}}"> | |||
| <label>{{.i18n.Tr "repo.owner"}}</label> | |||
| <div class="ui selection owner dropdown"> | |||
| <input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required> | |||
| <span class="text" title="{{.ContextUser.Name}}"> | |||
| <img class="ui mini image" src="{{.ContextUser.RelAvatarLink}}"> | |||
| {{.ContextUser.ShortName 20}} | |||
| </span> | |||
| <i class="dropdown icon"></i> | |||
| <div class="menu"> | |||
| {{if .CanForkToUser}} | |||
| <div class="item" data-value="{{.SignedUser.ID}}" title="{{.SignedUser.Name}}"> | |||
| <img class="ui mini image" src="{{.SignedUser.RelAvatarLink}}"> | |||
| {{.SignedUser.ShortName 20}} | |||
| </div> | |||
| {{end}} | |||
| {{range .Orgs}} | |||
| <div class="item" data-value="{{.ID}}" title="{{.Name}}"> | |||
| <img class="ui mini image" src="{{.RelAvatarLink}}"> | |||
| {{.ShortName 20}} | |||
| </div> | |||
| {{end}} | |||
| </div> | |||
| </div> | |||
| </div> --> | |||
| <div class="inline field"> | |||
| <label>{{.i18n.Tr "repo.fork_from"}}</label> | |||
| <a href="{{AppSubUrl}}/{{.ForkFrom}}">{{.ForkFrom}}</a> | |||
| @@ -9,19 +9,19 @@ | |||
| <div class="required field {{if .Err_Owner}}error{{end}}" style="padding: 0;"> | |||
| <!-- <label>{{.i18n.Tr "repo.owner"}}</label> --> | |||
| <div class="ui selection owner dropdown" id="ownerDropdown"> | |||
| <input type="hidden" id="uid" name="uid" value="{{.ContextUser.Name}}" required> | |||
| <div class="text"> | |||
| <input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required> | |||
| <div class="text" title="{{.ContextUser.Name}}"> | |||
| <img class="ui mini image" src="{{.ContextUser.RelAvatarLink}}"> | |||
| {{.ContextUser.ShortName 20}} | |||
| </div> | |||
| <i class="dropdown icon"></i> | |||
| <div class="menu"> | |||
| <div class="item" data-value="{{.SignedUser.Name}}" title="{{.SignedUser.Name}}"> | |||
| <div class="item" data-value="{{.SignedUser.ID}}" title="{{.SignedUser.Name}}"> | |||
| <img class="ui mini image" src="{{.SignedUser.RelAvatarLink}}"> | |||
| {{.SignedUser.ShortName 20}} | |||
| </div> | |||
| {{range .Orgs}} | |||
| <div class="item" data-value="{{.Name}}" title="{{.Name}}"> | |||
| <div class="item" data-value="{{.ID}}" title="{{.Name}}"> | |||
| <img class="ui mini image" src="{{.RelAvatarLink}}"> | |||
| {{.ShortName 20}} | |||
| </div> | |||
| @@ -8,7 +8,7 @@ | |||
| {{.i18n.Tr "repo.settings.basic_settings"}} | |||
| </h4> | |||
| <div class="ui attached segment"> | |||
| <form class="ui form" action="{{.Link}}" method="post"> | |||
| <form class="ui form" action="{{.Link}}" method="post" id="create_repo_form"> | |||
| {{.CsrfTokenHtml}} | |||
| <input type="hidden" name="action" value="update"> | |||
| <!-- <div class="required field {{if .Err_RepoName}}error{{end}}"> | |||
| @@ -4142,13 +4142,11 @@ function initcreateRepo(){ | |||
| let timeout; | |||
| let keydown_flag = false | |||
| const urlAdd = location.href.split('/')[0] + '//' + location.href.split('/')[2] | |||
| let owner = $('input[name=uid]').val() | |||
| console.log(owner) | |||
| console.log(location.href.split('/'),urlAdd) | |||
| let owner = $('#ownerDropdown div.text').attr("title") | |||
| $(document).ready(function(){ | |||
| $('#ownerDropdown').dropdown({ | |||
| onChange:function(value){ | |||
| owner = value | |||
| onChange:function(value,text,$choice){ | |||
| owner = $choice[0].getAttribute("title") | |||
| $('#repoAdress').css("display","block") | |||
| $('#repoAdress span').text(urlAdd+'/'+owner+'/'+$('#repo_name').val()+'.git') | |||
| } | |||
| @@ -4159,31 +4157,55 @@ function initcreateRepo(){ | |||
| if(keydown_flag){ | |||
| $('#repoAdress').css("display","block") | |||
| $('#repoAdress span').text(urlAdd+'/'+owner+'/'+$('#repo_name').val()+'.git') | |||
| console.log("key_up",owner) | |||
| } | |||
| else{ | |||
| $('#repoAdress').css("display","none") | |||
| $('#repo_name').attr("placeholder","") | |||
| } | |||
| }) | |||
| $("#create_repo_form") | |||
| .form({ | |||
| on: 'blur', | |||
| // inline:true, | |||
| fields: { | |||
| alias: { | |||
| identifier : 'alias', | |||
| rules: [ | |||
| { | |||
| type: 'regExp[/^[\u4E00-\u9FA5A-Za-z0-9_.-]{1,100}$/]', | |||
| } | |||
| ] | |||
| }, | |||
| repo_name:{ | |||
| identifier : 'repo_name', | |||
| rules: [ | |||
| { | |||
| type: 'regExp[/^[A-Za-z0-9_.-]{1,100}$/]', | |||
| } | |||
| ] | |||
| }, | |||
| }, | |||
| onFailure: function(e){ | |||
| return false; | |||
| } | |||
| }) | |||
| $('#alias').bind('input propertychange', function (event) { | |||
| clearTimeout(timeout) | |||
| timeout = setTimeout(() => { | |||
| //在此处写调用的方法,可以实现仅最后一次操作生效 | |||
| const aliasValue = $('#alias').val() | |||
| const ownerValue = $('#uid').val() | |||
| if(keydown_flag){ | |||
| $('#repo_name').attr("placeholder","") | |||
| } | |||
| else if(aliasValue){ | |||
| $('#repo_name').attr("placeholder","正在获取路径...") | |||
| $.get(`${window.config.AppSubUrl}/repo/check_name?q=${aliasValue}&owner=${ownerValue }`,(data)=>{ | |||
| $.get(`${window.config.AppSubUrl}/repo/check_name?q=${aliasValue}&owner=${owner}`,(data)=>{ | |||
| const repo_name = data.name | |||
| $('#repo_name').val(repo_name) | |||
| $('#repoAdress').css("display","block") | |||
| $('#repoAdress span').text(urlAdd+'/'+owner+'/'+$('#repo_name').val()+'.git') | |||
| console.log("oninput",owner) | |||
| $('#repo_name').attr("placeholder","") | |||
| }) | |||
| }else{ | |||
| $('#repo_name').val('') | |||