17f62bfec5
The only remaining (hard) part is "templates/repo/editor/edit.tmpl", see the FIXME By the way: * Make "user unfollow" use basic color but not red color, indeed it is not dangerous * Fix "org folllow" layout (use block gap instead of inline gap)
64 lines
3.5 KiB
Handlebars
64 lines
3.5 KiB
Handlebars
{{template "base/head" .}}
|
|
<div role="main" aria-label="{{.Title}}" class="page-content repository file editor edit">
|
|
{{template "repo/header" .}}
|
|
<div class="ui container fluid padded">
|
|
{{template "base/alert" .}}
|
|
<div class="repo-view-container">
|
|
{{template "repo/view_file_tree" .}}
|
|
<div class="repo-view-content">
|
|
<form class="ui edit form form-fetch-action" method="post" action="{{.CommitFormOptions.TargetFormAction}}"
|
|
data-text-empty-confirm-header="{{ctx.Locale.Tr "repo.editor.commit_empty_file_header"}}"
|
|
data-text-empty-confirm-content="{{ctx.Locale.Tr "repo.editor.commit_empty_file_text"}}"
|
|
>
|
|
{{template "repo/editor/common_top" .}}
|
|
<div class="repo-editor-header">
|
|
{{template "repo/view_file_tree_toggle_button" .}}
|
|
{{template "repo/editor/common_breadcrumb" .}}
|
|
</div>
|
|
{{if not .NotEditableReason}}
|
|
<div class="field">
|
|
<div class="ui top attached header">
|
|
<div class="flex-text-block tw-justify-between tw-flex-wrap">
|
|
<div class="ui compact small menu small-menu-items repo-editor-menu tw-self-start">
|
|
<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{{if not .CodeEditorConfig.Previewable}} tw-hidden{{end}}" data-tab="preview" data-preview-url="{{.Repository.Link}}/markup" data-preview-context-ref="{{.RepoLink}}/src/{{.RefTypeNameSubURL}}">{{svg "octicon-eye"}} {{ctx.Locale.Tr "preview"}}</a>
|
|
{{if not .IsNewFile}}
|
|
{{/*FIXME: the related logic is totally a mess, need to completely rewrite, that's also the root reason for
|
|
why the "migrate to CodeMirror" PR took very long time on the legacy code and introduced "#file-name (filenameInput)" regressions many times*/}}
|
|
<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}}
|
|
</div>
|
|
{{template "repo/editor/options" dict "CodeEditorConfig" $.CodeEditorConfig}}
|
|
</div>
|
|
</div>
|
|
<div class="ui bottom attached segment tw-p-0">
|
|
<div class="ui active tab tw-rounded-b" data-tab="write">
|
|
<textarea id="edit_area" name="content" class="tw-hidden" data-id="repo-{{.Repository.Name}}-{{.TreePath}}"
|
|
data-code-editor-config="{{JsonUtils.EncodeToString $.CodeEditorConfig}}"
|
|
placeholder="{{ctx.Locale.Tr "editor.code_editor.placeholder"}}">{{.FileContent}}</textarea>
|
|
<div class="editor-loading is-loading"></div>
|
|
</div>
|
|
<div class="ui tab tw-px-4 tw-py-3" data-tab="preview">
|
|
{{ctx.Locale.Tr "loading"}}
|
|
</div>
|
|
<div class="ui tab" data-tab="diff">
|
|
<div class="tw-p-16"></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{{else}}
|
|
<div class="field">
|
|
<div class="ui segment tw-text-center">
|
|
<h4 class="tw-font-semibold tw-mb-2">{{.NotEditableReason}}</h4>
|
|
<p>{{ctx.Locale.Tr "repo.editor.file_not_editable_hint"}}</p>
|
|
</div>
|
|
</div>
|
|
{{end}}
|
|
{{template "repo/editor/commit_form" .}}
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{{template "base/footer" .}}
|