添加静态模板

This commit is contained in:
2025-09-08 07:24:28 +00:00
parent b4bb4896af
commit 6df94872b3
8 changed files with 126 additions and 2 deletions

View File

@@ -1371,6 +1371,15 @@ line=行
lines= lines=
from_comment=(评论) from_comment=(评论)
create_from_template_name_one=base
create_from_template_description_one=DevStar 基础镜像模板项目
create_from_template_name_two=pio
create_from_template_description_two=内置PlatformIO的嵌入式项目工程模板
create_from_template_name_three=pio
create_from_template_description_three=内置PlatformIO的嵌入式项目工程模板
create_from_template_name_four=python
create_from_template_description_four=python项目工程模板
editor.add_file=添加文件 editor.add_file=添加文件
editor.new_file=新建文件 editor.new_file=新建文件
editor.upload_file=上传文件 editor.upload_file=上传文件

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Creator: CorelDRAW X7 -->
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="41.7913mm" height="41.6859mm" version="1.1" style="shape-rendering:geometricPrecision; text-rendering:geometricPrecision; image-rendering:optimizeQuality; fill-rule:evenodd; clip-rule:evenodd"
viewBox="0 0 1079 1076"
xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<style type="text/css">
<![CDATA[
.fil1 {fill:#003CA8}
.fil0 {fill:#FF8812}
]]>
</style>
</defs>
<g id="图层_x0020_1">
<metadata id="CorelCorpID_0Corel-Layer"/>
<path class="fil0" d="M825 432l0 0c12,-2 19,13 10,21l0 0c-58,48 -84,124 -68,198l0 0c3,12 -13,20 -21,10l0 0c-45,-54 -115,-81 -185,-70 -108,58 -231,135 -303,214 -86,92 -100,229 49,248 -427,118 -464,-256 244,-492 49,-48 70,-119 55,-187l0 0c-2,-12 13,-19 21,-10l0 0c48,58 124,84 198,68z"/>
<path class="fil1" d="M636 0c102,0 187,30 253,80 75,55 127,135 158,226l0 0c11,32 19,65 24,98 5,35 8,70 7,105 0,34 -3,69 -8,103 -6,34 -14,67 -24,99 -32,94 -85,178 -160,236 -67,53 -150,84 -250,84l-267 0c-55,0 -91,-10 -112,-28 -19,-17 -25,-39 -22,-64 4,-24 15,-51 33,-78 60,-92 225,-230 320,-253 -101,59 -189,170 -231,243l279 0c57,0 105,-19 144,-51 44,-36 76,-88 95,-146 8,-23 14,-47 18,-71 4,-25 6,-50 6,-75 0,-25 -2,-50 -6,-74 -3,-24 -9,-48 -17,-70l0 0c-18,-55 -49,-103 -93,-136 -38,-30 -88,-47 -147,-47l0 0 -141 0 -68 0c-26,0 -51,4 -73,13 -22,9 -43,23 -61,42 -18,18 -32,38 -42,61 -9,22 -13,46 -13,72l0 213c135,-43 226,-51 307,-33 -160,29 -354,110 -474,221l-14 13 0 -19 0 -428 0 0 0 0c0,-94 38,-178 98,-238 61,-61 145,-98 238,-98l0 0 1 0 0 0 242 0 0 0z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -0,0 +1,20 @@
package repo
import (
"net/http"
"code.gitea.io/gitea/modules/templates"
"code.gitea.io/gitea/services/context"
)
const (
tplCreateFromTemplate templates.TplName = "repo/create-from-template/create-from-template"
)
func CreateFromTemplate(ctx *context.Context) {
createCommon(ctx)
if ctx.Written() {
return
}
ctx.HTML(http.StatusOK, tplCreateFromTemplate)
}

View File

@@ -709,7 +709,7 @@ func MoveIssues(ctx *context.Context) {
for _, issue := range movedIssues { for _, issue := range movedIssues {
if issue.RepoID != project.RepoID { if issue.RepoID != project.RepoID {
ctx.ServerError("Some issue's repoID is not equal to project's repoID", errors.New("Some issue's repoID is not equal to project's repoID")) ctx.ServerError("Some issue's repoID is not equal to project's repoID", errors.New("some issue's repoID is not equal to project's repoID"))
return return
} }
} }

View File

@@ -1022,6 +1022,7 @@ func registerWebRoutes(m *web.Router) {
m.Group("/repo", func() { m.Group("/repo", func() {
m.Get("/create", repo.Create) m.Get("/create", repo.Create)
m.Post("/create", web.Bind(forms.CreateRepoForm{}), repo.CreatePost) m.Post("/create", web.Bind(forms.CreateRepoForm{}), repo.CreatePost)
m.Get("/create-from-template", repo.CreateFromTemplate)
m.Get("/migrate", repo.Migrate) m.Get("/migrate", repo.Migrate)
m.Post("/migrate", web.Bind(forms.MigrateRepoForm{}), repo.MigratePost) m.Post("/migrate", web.Bind(forms.MigrateRepoForm{}), repo.MigratePost)
m.Get("/search", repo.SearchRepo) m.Get("/search", repo.SearchRepo)

View File

@@ -73,7 +73,7 @@
<a class="item" href="{{AppSubUrl}}/repo/create"> <a class="item" href="{{AppSubUrl}}/repo/create">
{{svg "octicon-plus"}} {{ctx.Locale.Tr "new_repo"}} {{svg "octicon-plus"}} {{ctx.Locale.Tr "new_repo"}}
</a> </a>
<a class="item" href="{{AppSubUrl}}/repo/create"> <a class="item" href="{{AppSubUrl}}/repo/create-from-template">
{{svg "octicon-plus-circle"}} {{ctx.Locale.Tr "new_repo_from_template"}} {{svg "octicon-plus-circle"}} {{ctx.Locale.Tr "new_repo_from_template"}}
</a> </a>
{{if not .DisableMigrations}} {{if not .DisableMigrations}}

View File

@@ -0,0 +1,54 @@
{{template "base/head" .}}
<div role="main" aria-label="{{.Title}}" class="page-content repository new migrate">
<div class="ui middle very relaxed page grid">
<div class="column">
<div class="ui cards migrate-entries">
<a class="ui card migrate-entry tw-flex tw-items-center" href="{{AppSubUrl}}/repo/create">
{{svg "devstar-favicon" 184 "tw-p-4"}}
<div class="content">
<div class="header tw-text-center">
{{ctx.Locale.Tr "repo.create_from_template_name_one"}}
</div>
<div class="description tw-text-center tw-text-balance">
{{ctx.Locale.Tr "repo.create_from_template_description_one"}}
</div>
</div>
</a>
<a class="ui card migrate-entry tw-flex tw-items-center" href="{{AppSubUrl}}/repo/create">
{{svg "devstar-favicon" 184 "tw-p-4"}}
<div class="content">
<div class="header tw-text-center">
{{ctx.Locale.Tr "repo.create_from_template_name_two"}}
</div>
<div class="description tw-text-center tw-text-balance">
{{ctx.Locale.Tr "repo.create_from_template_description_two"}}
</div>
</div>
</a>
<a class="ui card migrate-entry tw-flex tw-items-center" href="{{AppSubUrl}}/repo/create">
{{svg "devstar-favicon" 184 "tw-p-4"}}
<div class="content">
<div class="header tw-text-center">
{{ctx.Locale.Tr "repo.create_from_template_name_three"}}
</div>
<div class="description tw-text-center tw-text-balance">
{{ctx.Locale.Tr "repo.create_from_template_description_three"}}
</div>
</div>
</a>
<a class="ui card migrate-entry tw-flex tw-items-center" href="{{AppSubUrl}}/repo/create">
{{svg "devstar-favicon" 184 "tw-p-4"}}
<div class="content">
<div class="header tw-text-center">
{{ctx.Locale.Tr "repo.create_from_template_name_four"}}
</div>
<div class="description tw-text-center tw-text-balance">
{{ctx.Locale.Tr "repo.create_from_template_description_four"}}
</div>
</div>
</a>
</div>
</div>
</div>
</div>
{{template "base/footer" .}}

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Creator: CorelDRAW X7 -->
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="41.7913mm" height="41.6859mm" version="1.1" style="shape-rendering:geometricPrecision; text-rendering:geometricPrecision; image-rendering:optimizeQuality; fill-rule:evenodd; clip-rule:evenodd"
viewBox="0 0 1079 1076"
xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<style type="text/css">
<![CDATA[
.fil1 {fill:#003CA8}
.fil0 {fill:#FF8812}
]]>
</style>
</defs>
<g id="图层_x0020_1">
<metadata id="CorelCorpID_0Corel-Layer"/>
<path class="fil0" d="M825 432l0 0c12,-2 19,13 10,21l0 0c-58,48 -84,124 -68,198l0 0c3,12 -13,20 -21,10l0 0c-45,-54 -115,-81 -185,-70 -108,58 -231,135 -303,214 -86,92 -100,229 49,248 -427,118 -464,-256 244,-492 49,-48 70,-119 55,-187l0 0c-2,-12 13,-19 21,-10l0 0c48,58 124,84 198,68z"/>
<path class="fil1" d="M636 0c102,0 187,30 253,80 75,55 127,135 158,226l0 0c11,32 19,65 24,98 5,35 8,70 7,105 0,34 -3,69 -8,103 -6,34 -14,67 -24,99 -32,94 -85,178 -160,236 -67,53 -150,84 -250,84l-267 0c-55,0 -91,-10 -112,-28 -19,-17 -25,-39 -22,-64 4,-24 15,-51 33,-78 60,-92 225,-230 320,-253 -101,59 -189,170 -231,243l279 0c57,0 105,-19 144,-51 44,-36 76,-88 95,-146 8,-23 14,-47 18,-71 4,-25 6,-50 6,-75 0,-25 -2,-50 -6,-74 -3,-24 -9,-48 -17,-70l0 0c-18,-55 -49,-103 -93,-136 -38,-30 -88,-47 -147,-47l0 0 -141 0 -68 0c-26,0 -51,4 -73,13 -22,9 -43,23 -61,42 -18,18 -32,38 -42,61 -9,22 -13,46 -13,72l0 213c135,-43 226,-51 307,-33 -160,29 -354,110 -474,221l-14 13 0 -19 0 -428 0 0 0 0c0,-94 38,-178 98,-238 61,-61 145,-98 238,-98l0 0 1 0 0 0 242 0 0 0z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB