mirror of
https://codeberg.org/forgejo/forgejo
synced 2024-11-28 20:56:11 +01:00
Fix data-context + Remove RelativePath attributes
This commit is contained in:
parent
a625a0b307
commit
a057b7f582
|
@ -41,10 +41,6 @@ type MarkupOption struct {
|
|||
//
|
||||
// in: body
|
||||
BranchPath string
|
||||
// Relative path to the repository
|
||||
//
|
||||
// in: body
|
||||
RelativePath string
|
||||
}
|
||||
|
||||
// MarkupRender is a rendered markup document
|
||||
|
|
|
@ -47,7 +47,6 @@ func Markup(ctx *context.APIContext) {
|
|||
URLPrefix: form.Context,
|
||||
FilePath: form.FilePath,
|
||||
BranchPath: form.BranchPath,
|
||||
RelativePath: form.RelativePath,
|
||||
IsWiki: form.Wiki,
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ import (
|
|||
)
|
||||
|
||||
type Renderer struct {
|
||||
Mode, Text, URLPrefix, FilePath, BranchPath, RelativePath string
|
||||
Mode, Text, URLPrefix, FilePath, BranchPath string
|
||||
IsWiki bool
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,7 @@ func (re *Renderer) RenderMarkup(ctx *context.Base, repo *context.Repository) {
|
|||
case "file":
|
||||
// File as document based on file extension
|
||||
markupType = ""
|
||||
re.URLPrefix = re.RelativePath
|
||||
re.URLPrefix = repo.RepoLink
|
||||
relativePath = re.FilePath
|
||||
default:
|
||||
ctx.Error(http.StatusUnprocessableEntity, fmt.Sprintf("Unknown mode: %s", re.Mode))
|
||||
|
|
|
@ -21,7 +21,6 @@ func Markup(ctx *context.Context) {
|
|||
URLPrefix: form.Context,
|
||||
FilePath: form.FilePath,
|
||||
BranchPath: form.BranchPath,
|
||||
RelativePath: form.RelativePath,
|
||||
IsWiki: form.Wiki,
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
<div class="field">
|
||||
<div class="ui top attached tabular menu" data-write="write" data-preview="preview" data-diff="diff">
|
||||
<a class="active item" data-tab="write">{{svg "octicon-code"}} {{if .IsNewFile}}{{ctx.Locale.Tr "repo.editor.new_file"}}{{else}}{{ctx.Locale.Tr "repo.editor.edit_file"}}{{end}}</a>
|
||||
<a class="item" data-tab="preview" data-url="{{.Repository.Link}}/markup" data-context="{{.RepoLink}}/src/{{.BranchNameSubURL}}" data-branch-path="{{.BranchNameSubURL}}" data-relative-path="{{.Repository.Link}}" data-markup-mode="file">{{svg "octicon-eye"}} {{ctx.Locale.Tr "preview"}}</a>
|
||||
<a class="item" data-tab="preview" data-url="{{.Repository.Link}}/markup" data-context="{{.RepoLink}}" data-branch-path="{{.BranchNameSubURL}}" data-markup-mode="file">{{svg "octicon-eye"}} {{ctx.Locale.Tr "preview"}}</a>
|
||||
{{if not .IsNewFile}}
|
||||
<a class="item" data-tab="diff" hx-params="context,content" hx-vals='{"context":"{{.BranchLink}}"}' hx-include="#edit_area" hx-swap="innerHTML" hx-target=".tab[data-tab='diff']" hx-indicator=".tab[data-tab='diff']" hx-post="{{.RepoLink}}/_preview/{{.BranchName | PathEscapeSegments}}/{{.TreePath | PathEscapeSegments}}">{{svg "octicon-diff"}} {{ctx.Locale.Tr "repo.editor.preview_changes"}}</a>
|
||||
{{end}}
|
||||
|
|
4
templates/swagger/v1_json.tmpl
generated
4
templates/swagger/v1_json.tmpl
generated
|
@ -24335,10 +24335,6 @@
|
|||
"description": "Mode to render (comment, gfm, markdown, file)\n\nin: body",
|
||||
"type": "string"
|
||||
},
|
||||
"RelativePath": {
|
||||
"description": "Relative path to the repository\n\nin: body",
|
||||
"type": "string"
|
||||
},
|
||||
"Text": {
|
||||
"description": "Text markup to render\n\nin: body",
|
||||
"type": "string"
|
||||
|
|
|
@ -27,7 +27,6 @@ function initEditPreviewTab($form) {
|
|||
formData.append('mode', mode);
|
||||
formData.append('context', context);
|
||||
formData.append('branch_path', $this.data('branch-path'));
|
||||
formData.append('relative_path', $this.data('relative-path'));
|
||||
formData.append(
|
||||
'text',
|
||||
$form.find(`.tab[data-tab="${$tabMenu.data('write')}"] textarea`).val(),
|
||||
|
|
Loading…
Reference in a new issue