Browse Source

Merge pull request 'fix-2151 创建项目时增加用户需承诺合法使用仓库的选项' (#2252) from fix-2151 into V20220616

Reviewed-on: https://git.openi.org.cn/OpenI/aiforge/pulls/2252
Reviewed-by: lewis <747342561@qq.com>
tags/v1.22.6.1^2
lewis 3 years ago
parent
commit
1396cba8a8
5 changed files with 51 additions and 23 deletions
  1. +1
    -0
      modules/auth/repo_form.go
  2. +3
    -1
      options/locale/locale_en-US.ini
  3. +3
    -1
      options/locale/locale_zh-CN.ini
  4. +6
    -2
      routers/repo/repo.go
  5. +38
    -19
      templates/repo/create.tmpl

+ 1
- 0
modules/auth/repo_form.go View File

@@ -46,6 +46,7 @@ type CreateRepoForm struct {
Webhooks bool
Avatar bool
Labels bool
AutoAgree bool
}

// Validate validates the fields


+ 3
- 1
options/locale/locale_en-US.ini View File

@@ -1184,6 +1184,7 @@ template.topics = Topics
template.avatar = Avatar
template.issue_labels = Issue Labels
template.one_item = Must select at least one template item
template.one_promise = Must agree to use the agreement!
template.invalid = Must select a template repository
template.repo_adress=Adress
template.repo_path=path
@@ -2258,7 +2259,8 @@ topic.done = Done
topic.count_prompt = You can not select more than 25 topics
topic.format_prompt = Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.
imagetopic.format_prompt = Topics can be up to 35 characters long.

use_repo_agreement=I promise that the content of this warehouse does not violate any national laws and regulations. During the use of the warehouse, I will abide by the OpenI community management regulations and platform usage rules, and will not conduct malicious attacks, mining, or any other illegal or disruptive platform order. Information release and related behaviors. For more information please refer to
openi_use_agreement=OpenI Qizhi Community Platform Use Agreement.
[org]
org_name_holder = Organization Name
org_full_name_holder = Organization Full Name


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

@@ -1194,6 +1194,7 @@ template.topics=主题
template.avatar=头像
template.issue_labels=任务标签
template.one_item=必须至少选择一个模板项
template.one_promise=创建项目需承诺使用协议!
template.invalid=必须选择一个模板项目
template.repo_adress=项目地址
template.repo_path=项目地址
@@ -2268,7 +2269,8 @@ topic.done=保存
topic.count_prompt=您最多选择25个标签
topic.format_prompt=标签必须以中文、字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
imagetopic.format_prompt=标签长度不得超过35个字符

use_repo_agreement=我承诺此仓内容不违反任何国家法律法规,仓库使用过程中遵守OpenI启智社区管理规定和平台使用规则,不进行恶意攻击、挖矿等任何违法或扰乱平台秩序的信息发布和相关行为。更多信息请参考
openi_use_agreement=OpenI启智社区平台使用协议
[org]
org_name_holder=组织名称
org_full_name_holder=组织全名


+ 6
- 2
routers/repo/repo.go View File

@@ -6,7 +6,6 @@
package repo

import (
"code.gitea.io/gitea/modules/validation"
"fmt"
"net/url"
"os"
@@ -15,6 +14,8 @@ import (
"strings"
"unicode/utf8"

"code.gitea.io/gitea/modules/validation"

"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/auth"
"code.gitea.io/gitea/modules/base"
@@ -193,7 +194,10 @@ func CreatePost(ctx *context.Context, form auth.CreateRepoForm) {
return
}
ctx.Data["ContextUser"] = ctxUser

if !form.AutoAgree {
ctx.RenderWithErr(ctx.Tr("repo.template.one_promise"), tplCreate, form)
return
}
if ctx.HasError() {
ctx.HTML(200, tplCreate)
return


+ 38
- 19
templates/repo/create.tmpl View File

@@ -15,11 +15,11 @@
<label>{{.i18n.Tr "repo.visibility"}}</label>
<div class="ui checkbox">
{{if .IsForcedPrivate}}
<input name="private" type="checkbox" checked readonly>
<label>{{.i18n.Tr "repo.visibility_helper_forced" | Safe}}</label>
<input name="private" type="checkbox" checked readonly>
<label>{{.i18n.Tr "repo.visibility_helper_forced" | Safe}}</label>
{{else}}
<input name="private" type="checkbox" {{if .private}}checked{{end}}>
<label>{{.i18n.Tr "repo.visibility_helper" | Safe}}</label>
<input name="private" type="checkbox" {{if .private}}checked{{end}}>
<label>{{.i18n.Tr "repo.visibility_helper" | Safe}}</label>
{{end}}
</div>
<span class="help">{{.i18n.Tr "repo.visibility_description"}}</span>
@@ -42,33 +42,41 @@
<div class="inline field">
<label>{{.i18n.Tr "repo.template.items"}}</label>
<div class="ui checkbox">
<input class="hidden" name="git_content" type="checkbox" tabindex="0" {{if .git_content}}checked{{end}}>
<input class="hidden" name="git_content" type="checkbox" tabindex="0"
{{if .git_content}}checked{{end}}>
<label>{{.i18n.Tr "repo.template.git_content"}}</label>
</div>
<div class="ui checkbox" {{if not .SignedUser.CanEditGitHook}}data-tooltip="{{.i18n.Tr "repo.template.git_hooks_tooltip"}}"{{end}}>
<input class="hidden" name="git_hooks" type="checkbox" tabindex="0" {{if .git_hooks}}checked{{end}}>
<div class="ui checkbox"
{{if not .SignedUser.CanEditGitHook}}data-tooltip="{{.i18n.Tr "repo.template.git_hooks_tooltip"}}"
{{end}}>
<input class="hidden" name="git_hooks" type="checkbox" tabindex="0"
{{if .git_hooks}}checked{{end}}>
<label>{{.i18n.Tr "repo.template.git_hooks"}}</label>
</div>
</div>
<div class="inline field">
<label></label>
<div class="ui checkbox">
<input class="hidden" name="webhooks" type="checkbox" tabindex="0" {{if .webhooks}}checked{{end}}>
<input class="hidden" name="webhooks" type="checkbox" tabindex="0"
{{if .webhooks}}checked{{end}}>
<label>{{.i18n.Tr "repo.template.webhooks"}}</label>
</div>
<div class="ui checkbox">
<input class="hidden" name="topics" type="checkbox" tabindex="0" {{if .topics}}checked{{end}}>
<input class="hidden" name="topics" type="checkbox" tabindex="0"
{{if .topics}}checked{{end}}>
<label>{{.i18n.Tr "repo.template.topics"}}</label>
</div>
</div>
<div class="inline field">
<label></label>
<div class="ui checkbox">
<input class="hidden" name="avatar" type="checkbox" tabindex="0" {{if .avatar}}checked{{end}}>
<input class="hidden" name="avatar" type="checkbox" tabindex="0"
{{if .avatar}}checked{{end}}>
<label>{{.i18n.Tr "repo.template.avatar"}}</label>
</div>
<div class="ui checkbox">
<input class="hidden" name="labels" type="checkbox" tabindex="0" {{if .labels}}checked{{end}}>
<input class="hidden" name="labels" type="checkbox" tabindex="0"
{{if .labels}}checked{{end}}>
<label>{{.i18n.Tr "repo.template.issue_labels"}}</label>
</div>
</div>
@@ -83,7 +91,8 @@
<div class="menu">
<div class="item" data-value="">{{.i18n.Tr "repo.issue_labels_helper"}}</div>
{{range $template, $labels := .LabelTemplates}}
<div class="item" data-value="{{$template}}">{{$template}}<br/><i>({{$labels}})</i></div>
<div class="item" data-value="{{$template}}">{{$template}}<br /><i>({{$labels}})</i>
</div>
{{end}}
</div>
</div>
@@ -98,7 +107,7 @@
<div class="default text">{{.i18n.Tr "repo.repo_gitignore_helper"}}</div>
<div class="menu">
{{range .Gitignores}}
<div class="item" data-value="{{.}}">{{.}}</div>
<div class="item" data-value="{{.}}">{{.}}</div>
{{end}}
</div>
</div>
@@ -111,7 +120,7 @@
<div class="menu">
<div class="item" data-value="">{{.i18n.Tr "repo.license_helper"}}</div>
{{range .Licenses}}
<div class="item" data-value="{{.}}">{{.}}</div>
<div class="item" data-value="{{.}}">{{.}}</div>
{{end}}
</div>
</div>
@@ -124,24 +133,34 @@
<div class="default text">{{.i18n.Tr "repo.readme_helper"}}</div>
<div class="menu">
{{range .Readmes}}
<div class="item" data-value="{{.}}">{{.}}</div>
<div class="item" data-value="{{.}}">{{.}}</div>
{{end}}
</div>
</div>
</div>
<div class="inline field">
<div class="ui checkbox" id="auto-init">
<input class="hidden" name="auto_init" type="checkbox" tabindex="0" {{if .auto_init}}checked{{end}}>
<input class="hidden" name="auto_init" type="checkbox" tabindex="0"
{{if .auto_init}}checked{{end}}>
<label>{{.i18n.Tr "repo.auto_init"}}</label>
</div>
</div>
<div class="inline field">
<label for="default_branch">{{.i18n.Tr "repo.default_branch"}}</label>
<input id="default_branch" name="default_branch" value="{{.default_branch}}" placeholder="master">
<input id="default_branch" name="default_branch" value="{{.default_branch}}"
placeholder="master">
</div>
<div class="inline field">
<div class="ui checkbox" id="auto-init">
<input class="hidden" name="auto_agree" type="checkbox" checked="checked">
<label
style="width: 76%;text-align: justify;line-height: 1.5;">{{.i18n.Tr "repo.use_repo_agreement"}}
<a href="/home/term/">{{.i18n.Tr "repo.openi_use_agreement"}}</a></label>
</div>
</div>
</div>

<br/>
<br />
<div class="inline field">
<label></label>
<button class="ui green button" id="submit_reponame">
@@ -154,4 +173,4 @@
</div>
</div>
</div>
{{template "base/footer" .}}
{{template "base/footer" .}}

Loading…
Cancel
Save