| @@ -917,6 +917,9 @@ template.avatar = Avatar | |||
| template.issue_labels = Issue Labels | |||
| template.one_item = Must select at least one template item | |||
| template.invalid = Must select a template repository | |||
| template.repo_adress=Adress | |||
| template.repo_path=path | |||
| template.repo_name=Name | |||
| archive.title = This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests. | |||
| archive.issue.nocomment = This repo is archived. You cannot comment on issues. | |||
| @@ -927,6 +927,9 @@ template.avatar=头像 | |||
| template.issue_labels=任务标签 | |||
| template.one_item=必须至少选择一个模板项 | |||
| template.invalid=必须选择一个模板项目 | |||
| template.repo_adress=项目地址 | |||
| template.repo_path=项目地址 | |||
| template.repo_name=项目名称 | |||
| archive.title=此项目已存档。您可以查看文件和克隆,但不能推送或创建任务/合并请求。 | |||
| archive.issue.nocomment=此项目已存档,您不能在此任务添加评论。 | |||
| @@ -10,13 +10,13 @@ | |||
| <div class="ui attached segment"> | |||
| {{template "base/alert" .}} | |||
| <div class="inline required field"> | |||
| <label for="Alias">项目名称</label> | |||
| <label for="Alias">{{.i18n.Tr "repo.template.repo_name"}}</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> | |||
| <label style="text-align: right;width: 250px!important;word-wrap: break-word;">{{.i18n.Tr "repo.template.repo_path"}}</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"> | |||
| @@ -52,10 +52,10 @@ | |||
| </div> | |||
| </div> | |||
| <div class="inline field"> | |||
| <label for=""></label> | |||
| <span id="repoAdress" style="display: none;margin-bottom: 1rem;"></span> | |||
| <div class="inline field" id="repoAdress" style="display: none;"> | |||
| <label for="">{{.i18n.Tr "form.Alias"}}:</label> | |||
| <span></span> | |||
| </div> | |||
| <!-- <div class="js-project-full-path" id="repoAdress" ></div> --> | |||
| <div class="inline field"> | |||
| @@ -203,44 +203,7 @@ | |||
| </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) | |||
| } | |||
| console.log("---------asdasd") | |||
| </script> | |||
| @@ -11,11 +11,64 @@ | |||
| <form class="ui form" action="{{.Link}}" method="post"> | |||
| {{.CsrfTokenHtml}} | |||
| <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> | |||
| <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> | |||
| </div> --> | |||
| <div class="required field"> | |||
| <label for="Alias">{{.i18n.Tr "repo.template.repo_name"}}</label> | |||
| <input id="alias" name="alias" value="" oninput="throttle()" autofocus required> | |||
| <!-- <span class="help"></span> --> | |||
| </div> | |||
| <div class="required field"> | |||
| <label>{{.i18n.Tr "repo.template.repo_path"}}</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"> | |||
| <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: 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="{{.repo_name}}" autofocus required> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <div class="inline field" id="repoAdress" style="display: none;"> | |||
| <label for="">{{.i18n.Tr "repo.template.repo_adress"}}:</label> | |||
| <span></span> | |||
| </div> | |||
| <div class="inline field"> | |||
| <label>{{.i18n.Tr "repo.repo_size"}}</label> | |||
| <span>{{SizeFmt .Repository.Size}}</span> | |||
| @@ -4136,4 +4136,68 @@ $('.question.circle.icon').hover(function(){ | |||
| //云脑详情页面跳转回上一个页面 | |||
| $(".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 | |||
| $('#repo_name').keyup(function(e){ | |||
| keydown_flag = $('#repo_name').val() ? true : false | |||
| if(keydown_flag){ | |||
| $('#repoAdress').css("display","block") | |||
| $('#repoAdress span').text($('#repo_name').val()+'.git') | |||
| } | |||
| }) | |||
| // const createRepoAdress = () => { | |||
| // //在此处写调用的方法,可以实现仅最后一次操作生效 | |||
| // 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("{{AppSubUrl}}/{{.ContextUser.ShortName 20}}/"+$('#repo_name').val()+'.git') | |||
| // }) | |||
| // }else{ | |||
| // $('#repo_name').val('') | |||
| // $('#repo_name').attr("placeholder","") | |||
| // } | |||
| // } | |||
| $("#alias").on('input',function(){ | |||
| 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("{{AppSubUrl}}/{{.ContextUser.ShortName 20}}/"+$('#repo_name').val()+'.git') | |||
| }) | |||
| }else{ | |||
| $('#repo_name').val('') | |||
| $('#repo_name').attr("placeholder","") | |||
| } | |||
| }, 500) | |||
| }) | |||
| } | |||
| initcreateRepo() | |||