| @@ -316,7 +316,8 @@ modify = Update | |||||
| [form] | [form] | ||||
| UserName = Username | UserName = Username | ||||
| Alias = Repository name | Alias = Repository name | ||||
| RepoName = Repository path | |||||
| RepoPath = Repository path | |||||
| RepoAdress = Repository Adress | |||||
| Email = Email address | Email = Email address | ||||
| Password = Password | Password = Password | ||||
| Retype = Re-Type Password | Retype = Re-Type Password | ||||
| @@ -340,6 +341,8 @@ SSPIDefaultLanguage = Default Language | |||||
| require_error = ` cannot be empty.` | require_error = ` cannot be empty.` | ||||
| alpha_dash_error = ` should contain only alphanumeric, dash ('-') and underscore ('_') characters.` | alpha_dash_error = ` should contain only alphanumeric, dash ('-') and underscore ('_') characters.` | ||||
| alpha_dash_dot_error = ` should contain only alphanumeric, dash ('-'), underscore ('_') and dot ('.') characters.` | alpha_dash_dot_error = ` should contain only alphanumeric, dash ('-'), underscore ('_') and dot ('.') characters.` | ||||
| reponame_dash_dot_error=` Please enter Chinese, alphanumeric, dash ('-') ,underscore ('_') and dot ('.')characters, up to 100 characters. ` | |||||
| repoadd_dash_dot_error=` Path only allows input alphanumeric, dash ('-') ,underscore ('_') and dot ('.')characters, up to 100 characters. ` | |||||
| git_ref_name_error = ` must be a well-formed Git reference name.` | git_ref_name_error = ` must be a well-formed Git reference name.` | ||||
| alpha_dash_dot_chinese_error= ` should contain only alphanumeric, chinese, dash ('-') and underscore ('_') characters.` | alpha_dash_dot_chinese_error= ` should contain only alphanumeric, chinese, dash ('-') and underscore ('_') characters.` | ||||
| size_error = ` must be size %s.` | size_error = ` must be size %s.` | ||||
| @@ -321,6 +321,8 @@ modify=更新 | |||||
| UserName=用户名 | UserName=用户名 | ||||
| RepoName=项目路径 | RepoName=项目路径 | ||||
| Alias=项目名称 | Alias=项目名称 | ||||
| RepoPath=项目路径 | |||||
| RepoAdress=项目地址 | |||||
| Email=邮箱地址 | Email=邮箱地址 | ||||
| Password=密码 | Password=密码 | ||||
| Retype=重新输入密码 | Retype=重新输入密码 | ||||
| @@ -344,6 +346,8 @@ SSPIDefaultLanguage=默认语言 | |||||
| require_error=不能为空。 | require_error=不能为空。 | ||||
| alpha_dash_error=应该只包含字母数字、破折号 ('-') 和下划线 ('_') 字符。 | alpha_dash_error=应该只包含字母数字、破折号 ('-') 和下划线 ('_') 字符。 | ||||
| alpha_dash_dot_error=应该只包含字母数字, 破折号 ('-'), 下划线 ('_') 和点 ('. ') 。 | alpha_dash_dot_error=应该只包含字母数字, 破折号 ('-'), 下划线 ('_') 和点 ('. ') 。 | ||||
| reponame_dash_dot_error=请输入中文、字母、数字和-_.、最多100个字符。 | |||||
| repoadd_dash_dot_error=路径只允许字母、数字和-_.,最多100个字符。 | |||||
| git_ref_name_error=` 必须是格式良好的 git 引用名称。` | git_ref_name_error=` 必须是格式良好的 git 引用名称。` | ||||
| alpha_dash_dot_chinese_error=应该只包含字母数字中文, 破折号 ('-'), 下划线 ('_') 和点 ('. ') 。 | alpha_dash_dot_chinese_error=应该只包含字母数字中文, 破折号 ('-'), 下划线 ('_') 和点 ('. ') 。 | ||||
| size_error=长度必须为 %s。 | size_error=长度必须为 %s。 | ||||
| @@ -9,54 +9,7 @@ | |||||
| </h3> | </h3> | ||||
| <div class="ui attached segment"> | <div class="ui attached segment"> | ||||
| {{template "base/alert" .}} | {{template "base/alert" .}} | ||||
| <div class="inline required field"> | |||||
| <label for="Alias">项目名称</label> | |||||
| <input id="alias" name="alias" value="" oninput="throttle()" autofocus required> | |||||
| <!-- <span class="help"></span> --> | |||||
| </div> | |||||
| <div class="inline required fields"> | |||||
| <label style="text-align: right;width: 250px!important;word-wrap: break-word;">项目路径</label> | |||||
| <div class="required field {{if .Err_Owner}}error{{end}}" style="padding: 0;"> | |||||
| <!-- <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"> | |||||
| <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="{{.ID}}" title="{{.Name}}"> | |||||
| <img class="ui mini image" src="{{.RelAvatarLink}}"> | |||||
| {{.ShortName 20}} | |||||
| </div> | |||||
| {{end}} | |||||
| </div> | |||||
| </div> | |||||
| <!-- <span class="help">{{.i18n.Tr "repo.repo_owner_helper"}}</span> --> | |||||
| </div> | |||||
| <!-- <div class="required field {{if .Err_RepoName}}error{{end}}"> | |||||
| <input id="repo_name" name="repo_name" value="{{.repo_name}}" autofocus required> | |||||
| </div> --> | |||||
| <div class="ui interval" style="width: 0.6em;font-size: 2rem;line-height: 0px;text-align: center;">/</div> | |||||
| <div class="required field {{if .Err_RepoName}}error{{end}}"> | |||||
| <!-- <label for="repo_name">{{.i18n.Tr "repo.repo_name"}}</label> --> | |||||
| <input style="width: 100% !important;" id="repo_name" name="repo_name" value="{{.repo_name}}" autofocus required> | |||||
| </div> | |||||
| </div> | |||||
| <div class="inline field"> | |||||
| <label for=""></label> | |||||
| <span id="repoAdress" style="display: none;margin-bottom: 1rem;"></span> | |||||
| </div> | |||||
| {{template "repo/repo_name" .}} | |||||
| <!-- <div class="js-project-full-path" id="repoAdress" ></div> --> | <!-- <div class="js-project-full-path" id="repoAdress" ></div> --> | ||||
| <div class="inline field"> | <div class="inline field"> | ||||
| <label>{{.i18n.Tr "repo.visibility"}}</label> | <label>{{.i18n.Tr "repo.visibility"}}</label> | ||||
| @@ -201,46 +154,4 @@ | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| {{template "base/footer" .}} | |||||
| <script> | |||||
| $('#alias').bind('input propertychange', function (event) { | |||||
| }); | |||||
| console.log() | |||||
| let timeout; | |||||
| let keydown_flag = false | |||||
| $('#repo_name').keyup(function(){ | |||||
| keydown_flag = $('#repo_name').val() ? true : false | |||||
| if(keydown_flag){ | |||||
| $('#repoAdress').css("display","block") | |||||
| $('#repoAdress').text("{{.i18n.Tr "repo.template.topics"}}:"+$('#repo_name').val()) | |||||
| } | |||||
| }) | |||||
| function throttle(){ | |||||
| //先清理 | |||||
| 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)=>{ | |||||
| const repo_name = data.name | |||||
| $('#repo_name').val(repo_name) | |||||
| $('#repoAdress').css("display","block") | |||||
| $('#repoAdress').text("{{.i18n.Tr "repo.template.topics"}}:"+$('#repo_name').val()) | |||||
| }) | |||||
| }else{ | |||||
| $('#repo_name').val('') | |||||
| $('#repo_name').attr("placeholder","") | |||||
| } | |||||
| }, 500) | |||||
| } | |||||
| </script> | |||||
| {{template "base/footer" .}} | |||||
| @@ -37,35 +37,7 @@ | |||||
| </div> | </div> | ||||
| <div class="ui divider"></div> | <div class="ui divider"></div> | ||||
| <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" title="{{.SignedUser.Name}}"> | |||||
| <div class="item" data-value="{{.SignedUser.ID}}"> | |||||
| <img class="ui mini image" src="{{.SignedUser.RelAvatarLink}}"> | |||||
| {{.SignedUser.ShortName 20}} | |||||
| </div> | |||||
| {{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 required field {{if .Err_RepoName}}error{{end}}"> | |||||
| <label for="repo_name">{{.i18n.Tr "repo.repo_name"}}</label> | |||||
| <input id="repo_name" name="repo_name" value="{{.repo_name}}" required> | |||||
| </div> | |||||
| {{template "repo/repo_name" .}} | |||||
| <div class="inline field"> | <div class="inline field"> | ||||
| <label>{{.i18n.Tr "repo.visibility"}}</label> | <label>{{.i18n.Tr "repo.visibility"}}</label> | ||||
| <div class="ui checkbox"> | <div class="ui checkbox"> | ||||
| @@ -9,7 +9,7 @@ | |||||
| </h3> | </h3> | ||||
| <div class="ui attached segment"> | <div class="ui attached segment"> | ||||
| {{template "base/alert" .}} | {{template "base/alert" .}} | ||||
| <div class="inline required field {{if .Err_Owner}}error{{end}}"> | |||||
| <!-- <div class="inline required field {{if .Err_Owner}}error{{end}}"> | |||||
| <label>{{.i18n.Tr "repo.owner"}}</label> | <label>{{.i18n.Tr "repo.owner"}}</label> | ||||
| <div class="ui selection owner dropdown"> | <div class="ui selection owner dropdown"> | ||||
| <input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required> | <input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required> | ||||
| @@ -33,16 +33,13 @@ | |||||
| {{end}} | {{end}} | ||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| </div> | |||||
| </div> --> | |||||
| <div class="inline field"> | <div class="inline field"> | ||||
| <label>{{.i18n.Tr "repo.fork_from"}}</label> | <label>{{.i18n.Tr "repo.fork_from"}}</label> | ||||
| <a href="{{AppSubUrl}}/{{.ForkFrom}}">{{.ForkFrom}}</a> | <a href="{{AppSubUrl}}/{{.ForkFrom}}">{{.ForkFrom}}</a> | ||||
| </div> | </div> | ||||
| <div class="inline required field {{if .Err_RepoName}}error{{end}}"> | |||||
| <label for="repo_name">{{.i18n.Tr "repo.repo_name"}}</label> | |||||
| <input id="repo_name" name="repo_name" value="{{.repo_name}}" required> | |||||
| </div> | |||||
| {{template "repo/repo_name" .}} | |||||
| <div class="inline field"> | <div class="inline field"> | ||||
| <label>{{.i18n.Tr "repo.visibility"}}</label> | <label>{{.i18n.Tr "repo.visibility"}}</label> | ||||
| <div class="ui read-only checkbox"> | <div class="ui read-only checkbox"> | ||||
| @@ -0,0 +1,50 @@ | |||||
| <div class="inline required field" > | |||||
| <label for="Alias">{{.i18n.Tr "form.Alias"}}</label> | |||||
| <input id="alias" name="alias" value="" autofocus required> | |||||
| <span class="help">{{.i18n.Tr "form.reponame_dash_dot_error"}}</span> | |||||
| </div> | |||||
| <div class="inline required fields" style="margin-bottom: 0;"> | |||||
| <label style="text-align: right;width: 250px!important;word-wrap: break-word;">{{.i18n.Tr "form.RepoPath"}}</label> | |||||
| <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"> | |||||
| <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}}"> | |||||
| <img class="ui mini image" src="{{.SignedUser.RelAvatarLink}}"> | |||||
| {{.SignedUser.ShortName 20}} | |||||
| </div> | |||||
| {{range .Orgs}} | |||||
| <div class="item" data-value="{{.Name}}" title="{{.Name}}"> | |||||
| <img class="ui mini image" src="{{.RelAvatarLink}}"> | |||||
| {{.ShortName 20}} | |||||
| </div> | |||||
| {{end}} | |||||
| </div> | |||||
| </div> | |||||
| <!-- <span class="help">{{.i18n.Tr "repo.repo_owner_helper"}}</span> --> | |||||
| </div> | |||||
| <!-- <div class="required field {{if .Err_RepoName}}error{{end}}"> | |||||
| <input id="repo_name" name="repo_name" value="{{.repo_name}}" autofocus required> | |||||
| </div> --> | |||||
| <div class="ui interval" style="width: 0.6em;font-size: 2rem;line-height: 0px;text-align: center;">/</div> | |||||
| <div class="required field {{if .Err_RepoName}}error{{end}}"> | |||||
| <!-- <label for="repo_name">{{.i18n.Tr "repo.repo_name"}}</label> --> | |||||
| <input style="width: 100% !important;" id="repo_name" name="repo_name" value="{{.repo_name}}" autofocus required> | |||||
| </div> | |||||
| </div> | |||||
| <span style="display: block;margin-bottom: 1em;" class="help">{{.i18n.Tr "form.repoadd_dash_dot_error"}}</span> | |||||
| <div class="inline field" id="repoAdress" style="display: none;word-break: break-all;"> | |||||
| <label for="">{{.i18n.Tr "form.RepoAdress"}}:</label> | |||||
| <span></span> | |||||
| </div> | |||||
| @@ -11,10 +11,61 @@ | |||||
| <form class="ui form" action="{{.Link}}" method="post"> | <form class="ui form" action="{{.Link}}" method="post"> | ||||
| {{.CsrfTokenHtml}} | {{.CsrfTokenHtml}} | ||||
| <input type="hidden" name="action" value="update"> | <input type="hidden" name="action" value="update"> | ||||
| <div class="required field {{if .Err_RepoName}}error{{end}}"> | |||||
| <!-- <div class="required field {{if .Err_RepoName}}error{{end}}"> | |||||
| <label for="repo_name">{{.i18n.Tr "repo.repo_name"}}</label> | <label for="repo_name">{{.i18n.Tr "repo.repo_name"}}</label> | ||||
| <input id="repo_name" name="alias" value="{{.Repository.Alias}}" data-repo-name="{{.Repository.Alias}}" autofocus required> | <input id="repo_name" name="alias" value="{{.Repository.Alias}}" data-repo-name="{{.Repository.Alias}}" autofocus required> | ||||
| <input type="hidden" name="repo_name" value="{{.Repository.Name}}" data-repo-name="{{.Repository.Name}}" autofocus required> | <input type="hidden" name="repo_name" value="{{.Repository.Name}}" data-repo-name="{{.Repository.Name}}" autofocus required> | ||||
| </div> --> | |||||
| <div class="required field"> | |||||
| <label for="Alias">{{.i18n.Tr "form.Alias"}}</label> | |||||
| <input id="alias" name="alias" value="{{.Repository.Alias}}" data-repo-name="{{.Repository.Alias}}" autofocus required> | |||||
| <span class="help">{{.i18n.Tr "form.reponame_dash_dot_error"}}</span> | |||||
| </div> | |||||
| <div class="required field"> | |||||
| <label>{{.i18n.Tr "form.RepoPath"}}</label> | |||||
| <div class="fields"> | |||||
| <div class="eight wide required field {{if .Err_Owner}}error{{end}}"> | |||||
| <!-- <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"> | |||||
| <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}}"> | |||||
| <img class="ui mini image" src="{{.SignedUser.RelAvatarLink}}"> | |||||
| {{.SignedUser.ShortName 20}} | |||||
| </div> | |||||
| {{range .Orgs}} | |||||
| <div class="item" data-value="{{.Name}}" title="{{.Name}}"> | |||||
| <img class="ui mini image" src="{{.RelAvatarLink}}"> | |||||
| {{.ShortName 20}} | |||||
| </div> | |||||
| {{end}} | |||||
| </div> | |||||
| </div> | |||||
| <!-- <span class="help">{{.i18n.Tr "repo.repo_owner_helper"}}</span> --> | |||||
| </div> | |||||
| <!-- <div class="required field {{if .Err_RepoName}}error{{end}}"> | |||||
| <input id="repo_name" name="repo_name" value="{{.repo_name}}" autofocus required> | |||||
| </div> --> | |||||
| <div class="ui interval" style="width: 0.6em;font-size: 2rem;line-height: 38px;text-align: center;">/</div> | |||||
| <div class="eight wide required field {{if .Err_RepoName}}error{{end}}"> | |||||
| <!-- <label for="repo_name">{{.i18n.Tr "repo.repo_name"}}</label> --> | |||||
| <input style="width: 100% !important;" id="repo_name" name="repo_name" value="{{.Repository.Name}}" data-repo-name="{{.Repository.Name}}" autofocus required> | |||||
| <span class="help">{{.i18n.Tr "form.repoadd_dash_dot_error"}}</span> | |||||
| </div> | |||||
| </div> | |||||
| </div> | |||||
| <div class="inline field" id="repoAdress" style="display: none;"> | |||||
| <label for="">{{.i18n.Tr "form.RepoAdress"}}:</label> | |||||
| <span></span> | |||||
| </div> | </div> | ||||
| <div class="inline field"> | <div class="inline field"> | ||||
| <label>{{.i18n.Tr "repo.repo_size"}}</label> | <label>{{.i18n.Tr "repo.repo_size"}}</label> | ||||
| @@ -4136,4 +4136,62 @@ $('.question.circle.icon').hover(function(){ | |||||
| //云脑详情页面跳转回上一个页面 | //云脑详情页面跳转回上一个页面 | ||||
| $(".section.backTodeBug").attr("href",localStorage.getItem('all')) | $(".section.backTodeBug").attr("href",localStorage.getItem('all')) | ||||
| //新建调试取消跳转 | //新建调试取消跳转 | ||||
| $(".ui.button.cancel").attr("href",localStorage.getItem('all')) | |||||
| $(".ui.button.cancel").attr("href",localStorage.getItem('all')) | |||||
| 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) | |||||
| $(document).ready(function(){ | |||||
| $('#ownerDropdown').dropdown({ | |||||
| onChange:function(value){ | |||||
| owner = value | |||||
| $('#repoAdress').css("display","block") | |||||
| $('#repoAdress span').text(urlAdd+'/'+owner+'/'+$('#repo_name').val()+'.git') | |||||
| } | |||||
| }); | |||||
| }) | |||||
| $('#repo_name').keyup(function(){ | |||||
| keydown_flag = $('#repo_name').val() ? true : false | |||||
| 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","") | |||||
| } | |||||
| }) | |||||
| $('#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)=>{ | |||||
| 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) | |||||
| }) | |||||
| }else{ | |||||
| $('#repo_name').val('') | |||||
| $('#repo_name').attr("placeholder","") | |||||
| $('#repoAdress').css("display","none") | |||||
| } | |||||
| }, 500) | |||||
| }); | |||||
| } | |||||
| initcreateRepo() | |||||
| @@ -2,7 +2,7 @@ | |||||
| .help { | .help { | ||||
| color: #999999; | color: #999999; | ||||
| padding-top: .6em; | padding-top: .6em; | ||||
| padding-bottom: .6em; | |||||
| display: inline-block; | display: inline-block; | ||||
| } | } | ||||
| } | } | ||||