Skip to content

Commit 16b245c

Browse files
committed
refactor
1 parent fcb9ef8 commit 16b245c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+744
-820
lines changed

package-lock.json

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"@citation-js/plugin-csl": "0.6.7",
1313
"@citation-js/plugin-software-formats": "0.6.0",
1414
"@claviska/jquery-minicolors": "2.3.6",
15+
"@github/markdown-toolbar-element": "2.1.1",
1516
"@mcaptcha/vanilla-glue": "0.1.0-alpha-3",
1617
"@primer/octicons": "18.2.0",
1718
"@vue/compiler-sfc": "3.2.47",

routers/web/devtest/devtest.go

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// Copyright 2023 The Gitea Authors. All rights reserved.
2+
// SPDX-License-Identifier: MIT
3+
4+
package devtest
5+
6+
import (
7+
"net/http"
8+
"path"
9+
"strings"
10+
11+
"code.gitea.io/gitea/modules/base"
12+
"code.gitea.io/gitea/modules/context"
13+
"code.gitea.io/gitea/modules/templates"
14+
)
15+
16+
// List all devtest templates, they will be used for e2e tests for the UI components
17+
func List(ctx *context.Context) {
18+
templateNames := templates.GetTemplateAssetNames()
19+
var subNames []string
20+
const prefix = "templates/devtest/"
21+
for _, tmplName := range templateNames {
22+
if strings.HasPrefix(tmplName, prefix) {
23+
subName := strings.TrimSuffix(strings.TrimPrefix(tmplName, prefix), ".tmpl")
24+
if subName != "list" {
25+
subNames = append(subNames, subName)
26+
}
27+
}
28+
}
29+
ctx.Data["SubNames"] = subNames
30+
ctx.HTML(http.StatusOK, "devtest/list")
31+
}
32+
33+
func Tmpl(ctx *context.Context) {
34+
ctx.HTML(http.StatusOK, base.TplName("devtest"+path.Clean("/"+ctx.Params("sub"))))
35+
}

routers/web/misc/markup.go

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,6 @@ import (
1515

1616
// Markup render markup document to HTML
1717
func Markup(ctx *context.Context) {
18-
// swagger:operation POST /markup miscellaneous renderMarkup
19-
// ---
20-
// summary: Render a markup document as HTML
21-
// parameters:
22-
// - name: body
23-
// in: body
24-
// schema:
25-
// "$ref": "#/definitions/MarkupOption"
26-
// consumes:
27-
// - application/json
28-
// produces:
29-
// - text/html
30-
// responses:
31-
// "200":
32-
// "$ref": "#/responses/MarkupRender"
33-
// "422":
34-
// "$ref": "#/responses/validationError"
35-
3618
form := web.GetForm(ctx).(*api.MarkupOption)
3719

3820
if ctx.HasAPIError() {

routers/web/org/setting.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,6 @@ func Labels(ctx *context.Context) {
246246
ctx.Data["Title"] = ctx.Tr("repo.labels")
247247
ctx.Data["PageIsOrgSettings"] = true
248248
ctx.Data["PageIsOrgSettingsLabels"] = true
249-
ctx.Data["RequireTribute"] = true
250249
ctx.Data["LabelTemplates"] = repo_module.LabelTemplates
251250
ctx.HTML(http.StatusOK, tplSettingsLabels)
252251
}

routers/web/repo/commit.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,6 @@ func FileHistory(ctx *context.Context) {
253253
// Diff show different from current commit to previous commit
254254
func Diff(ctx *context.Context) {
255255
ctx.Data["PageIsDiff"] = true
256-
ctx.Data["RequireTribute"] = true
257256

258257
userName := ctx.Repo.Owner.Name
259258
repoName := ctx.Repo.Repository.Name

routers/web/repo/compare.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,6 @@ func CompareDiff(ctx *context.Context) {
781781

782782
ctx.Data["IsRepoToolbarCommits"] = true
783783
ctx.Data["IsDiffCompare"] = true
784-
ctx.Data["RequireTribute"] = true
785784
templateErrs := setTemplateIfExists(ctx, pullRequestTemplateKey, pullRequestTemplateCandidates)
786785

787786
if len(templateErrs) > 0 {

routers/web/repo/editor.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,6 @@ func DeleteFilePost(ctx *context.Context) {
538538
// UploadFile render upload file page
539539
func UploadFile(ctx *context.Context) {
540540
ctx.Data["PageIsUpload"] = true
541-
ctx.Data["RequireTribute"] = true
542541
upload.AddUploadContext(ctx, "repo")
543542
canCommit := renderCommitRights(ctx)
544543
treePath := cleanUploadFileName(ctx.Repo.TreePath)
@@ -573,7 +572,6 @@ func UploadFile(ctx *context.Context) {
573572
func UploadFilePost(ctx *context.Context) {
574573
form := web.GetForm(ctx).(*forms.UploadRepoFileForm)
575574
ctx.Data["PageIsUpload"] = true
576-
ctx.Data["RequireTribute"] = true
577575
upload.AddUploadContext(ctx, "repo")
578576
canCommit := renderCommitRights(ctx)
579577

routers/web/repo/issue.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,6 @@ func NewIssue(ctx *context.Context) {
849849
ctx.Data["Title"] = ctx.Tr("repo.issues.new")
850850
ctx.Data["PageIsIssueList"] = true
851851
ctx.Data["NewIssueChooseTemplate"] = ctx.HasIssueTemplatesOrContactLinks()
852-
ctx.Data["RequireTribute"] = true
853852
ctx.Data["PullRequestWorkInProgressPrefixes"] = setting.Repository.PullRequest.WorkInProgressPrefixes
854853
title := ctx.FormString("title")
855854
ctx.Data["TitleQuery"] = title
@@ -1295,7 +1294,6 @@ func ViewIssue(ctx *context.Context) {
12951294
ctx.Data["IssueType"] = "all"
12961295
}
12971296

1298-
ctx.Data["RequireTribute"] = true
12991297
ctx.Data["IsProjectsEnabled"] = ctx.Repo.CanRead(unit.TypeProjects)
13001298
ctx.Data["IsAttachmentEnabled"] = setting.Attachment.Enabled
13011299
upload.AddUploadContext(ctx, "comment")

routers/web/repo/issue_label.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ func Labels(ctx *context.Context) {
2828
ctx.Data["Title"] = ctx.Tr("repo.labels")
2929
ctx.Data["PageIsIssueList"] = true
3030
ctx.Data["PageIsLabels"] = true
31-
ctx.Data["RequireTribute"] = true
3231
ctx.Data["LabelTemplates"] = repo_module.LabelTemplates
3332
ctx.HTML(http.StatusOK, tplLabels)
3433
}

0 commit comments

Comments
 (0)