Browse Source

fix issue

tags/v1.22.1.3^2
zhoupzh 3 years ago
parent
commit
3f2c50e271
3 changed files with 103 additions and 0 deletions
  1. +2
    -0
      options/locale/locale_en-US.ini
  2. +3
    -0
      options/locale/locale_zh-CN.ini
  3. +98
    -0
      templates/repo/createCourse.tmpl

+ 2
- 0
options/locale/locale_en-US.ini View File

@@ -348,6 +348,8 @@ modify = Update
[form] [form]
UserName = Username UserName = Username
Alias = Repository name Alias = Repository name
courseAlias = Course Name
courseAdress = Course Path
RepoPath = Repository path RepoPath = Repository path
RepoAdress = Repository Adress RepoAdress = Repository Adress
Email = Email address Email = Email address


+ 3
- 0
options/locale/locale_zh-CN.ini View File

@@ -353,6 +353,8 @@ modify=更新
UserName=用户名 UserName=用户名
RepoName=项目路径 RepoName=项目路径
Alias=项目名称 Alias=项目名称
courseAlias=课程名称
courseAdress=课程地址
RepoPath=项目路径 RepoPath=项目路径
RepoAdress=项目地址 RepoAdress=项目地址
Email=邮箱地址 Email=邮箱地址
@@ -802,6 +804,7 @@ generate_from=生成自
repo_desc=项目描述 repo_desc=项目描述
repo_lang=项目语言 repo_lang=项目语言
repo_gitignore_helper=选择 .gitignore 模板。 repo_gitignore_helper=选择 .gitignore 模板。
repo_label_helpe=输入完成后回车键完成标签确定。
issue_labels=任务标签 issue_labels=任务标签
issue_labels_helper=选择一个任务标签集 issue_labels_helper=选择一个任务标签集
license=授权许可 license=授权许可


+ 98
- 0
templates/repo/createCourse.tmpl View File

@@ -0,0 +1,98 @@
{{template "base/head" .}}
<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" id="create_repo_form">
{{.CsrfTokenHtml}}
<h3 class="ui top attached header">
{{.i18n.Tr "new_course"}}
</h3>
<div class="ui attached segment">
{{template "base/alert" .}}
<div class="inline required field" >
<label for="Alias">{{.i18n.Tr "form.courseAlias"}}</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.courseAdress"}}</label>
<div class="required field {{if .Err_Owner}}error{{end}}" style="padding: 0;">
<div class="ui selection owner dropdown" id="ownerDropdown">
<input type="hidden" id="uid" name="uid" value="{{.Owner.Name}}" required>
<div class="text" title="{{.Owner.Name}}">
<img class="ui mini image" src="{{.Owner.RelAvatarLink}}">
{{$.Owner.Name}}
</div>
</div>
</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}}">
<input style="width: 100% !important;" id="repo_name" name="RepoName" 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>

<div class="inline required field">
<label>{{.i18n.Tr "repo.model.manage.label"}}</label>
<div class="ui multiple search selection dropdown">
<input type="hidden" name="Topics" value="">
<div class="default text">{{.i18n.Tr "repo.repo_label_helpe"}}</div>
<div class="menu" id="course_label_item">
</div>
</div>
</div>

<div class="inline field {{if .Err_Description}}error{{end}}">
<label for="description">{{.i18n.Tr "repo.repo_desc"}}</label>
<textarea id="description" name="Description" maxlength="254">{{.description}}</textarea>
</div>
<div class="inline field">
<label></label>
<button class="ui green button" id="submit_reponame">
{{.i18n.Tr "new_course"}}
</button>
<a class="ui button" href="{{AppSubUrl}}/">{{.i18n.Tr "cancel"}}</a>
</div>
</div>
</form>
</div>
</div>
</div>
{{template "base/footer" .}}

<script>

$(document).ready(function(){
$('.ui.multiple.search.selection.dropdown')
.dropdown({
allowAdditions: true,
onChange: function(value, text, $selectedItem) {
$('#course_label_item').empty()
}
})
$('input.search').bind('input propertychange', function (event) {
const query = $('input.search').val()
if(!query){
$('#course_label_item').empty()
}else{
$.get(`/api/v1/topics/search?q=${query}`,(data)=>{
console.log(data)
if(data.topics.length!==0){
let html=''
$('#course_label_item').empty()
data.topics.forEach(element => {
html += `<div class="item" data-value="${element.topic_name}">${element.topic_name}</div>`
});
$('#course_label_item').append(html)
}
})
}
});
})

</script>

Loading…
Cancel
Save