|
1 | 1 | {{template "base/head" .}} |
2 | 2 | <div role="main" aria-label="{{.Title}}" class="page-content repository file editor edit"> |
3 | 3 | {{template "repo/header" .}} |
4 | | - <div class="ui container fluid padded repo-view-container"> |
| 4 | + <div class="ui container fluid"> |
5 | 5 | {{template "base/alert" .}} |
6 | | - <div class="tw-flex tw-flex-col repo-view-file-tree-container not-mobile" data-edit data-user-is-signed-in> |
7 | | - {{template "repo/view_file_tree" .}} |
8 | | - </div> |
9 | | - <div class="repo-view-content"> |
10 | | - <form class="ui edit form form-fetch-action" method="post" action="{{.CommitFormOptions.TargetFormAction}}" |
11 | | - data-text-empty-confirm-header="{{ctx.Locale.Tr "repo.editor.commit_empty_file_header"}}" |
12 | | - data-text-empty-confirm-content="{{ctx.Locale.Tr "repo.editor.commit_empty_file_text"}}" |
13 | | - > |
14 | | - {{.CsrfTokenHtml}} |
15 | | - {{template "repo/editor/common_top" .}} |
16 | | - <div class="repo-editor-header"> |
17 | | - <button class="repo-view-file-tree-toggle-show ui compact basic button icon not-mobile tw-hidden" |
18 | | - data-global-click="onRepoViewFileTreeToggle" data-toggle-action="show" |
19 | | - data-tooltip-content="{{ctx.Locale.Tr "repo.diff.show_file_tree"}}" |
20 | | - type="button"> |
21 | | - {{svg "octicon-sidebar-collapse"}} |
22 | | - </button> |
23 | | - {{template "repo/editor/common_breadcrumb" .}} |
24 | | - </div> |
25 | | - {{if not .NotEditableReason}} |
26 | | - <div class="field"> |
27 | | - <div class="ui top attached header"> |
28 | | - <div class="ui compact small menu small-menu-items repo-editor-menu"> |
29 | | - <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> |
30 | | - <a class="item" data-tab="preview" data-preview-url="{{.Repository.Link}}/markup" data-preview-context-ref="{{.RepoLink}}/src/{{.RefTypeNameSubURL}}">{{svg "octicon-eye"}} {{ctx.Locale.Tr "preview"}}</a> |
31 | | - {{if not .IsNewFile}} |
32 | | - <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> |
33 | | - {{end}} |
34 | | - </div> |
35 | | - </div> |
36 | | - <div class="ui bottom attached segment tw-p-0"> |
37 | | - <div class="ui active tab tw-rounded-b" data-tab="write"> |
38 | | - <textarea id="edit_area" name="content" class="tw-hidden" data-id="repo-{{.Repository.Name}}-{{.TreePath}}" |
39 | | - data-previewable-extensions="{{.PreviewableExtensions}}" |
40 | | - data-line-wrap-extensions="{{.LineWrapExtensions}}">{{.FileContent}}</textarea> |
41 | | - <div class="editor-loading is-loading"></div> |
42 | | - </div> |
43 | | - <div class="ui tab tw-px-4 tw-py-3" data-tab="preview"> |
44 | | - {{ctx.Locale.Tr "loading"}} |
| 6 | + <div class="repo-view-container"> |
| 7 | + <div class="tw-flex tw-flex-col repo-view-file-tree-container not-mobile {{if or (not .UserSettingCodeViewShowFileTree) .IsEditingFileOnly}}tw-hidden{{end}}" data-user-is-signed-in> |
| 8 | + {{template "repo/view_file_tree" .}} |
| 9 | + </div> |
| 10 | + <div class="repo-view-content"> |
| 11 | + <form class="ui edit form form-fetch-action" method="post" action="{{.CommitFormOptions.TargetFormAction}}" |
| 12 | + data-text-empty-confirm-header="{{ctx.Locale.Tr "repo.editor.commit_empty_file_header"}}" |
| 13 | + data-text-empty-confirm-content="{{ctx.Locale.Tr "repo.editor.commit_empty_file_text"}}" |
| 14 | + > |
| 15 | + {{.CsrfTokenHtml}} |
| 16 | + {{template "repo/editor/common_top" .}} |
| 17 | + <div class="repo-editor-header"> |
| 18 | + <button class="repo-view-file-tree-toggle-show ui compact basic button icon not-mobile {{if and .UserSettingCodeViewShowFileTree (not .IsEditingFileOnly)}}tw-hidden{{end}}" |
| 19 | + data-global-click="onRepoViewFileTreeToggle" data-toggle-action="show" |
| 20 | + data-tooltip-content="{{ctx.Locale.Tr "repo.diff.show_file_tree"}}" |
| 21 | + type="button"> |
| 22 | + {{svg "octicon-sidebar-collapse"}} |
| 23 | + </button> |
| 24 | + {{template "repo/editor/common_breadcrumb" .}} |
| 25 | + </div> |
| 26 | + {{if not .NotEditableReason}} |
| 27 | + <div class="field"> |
| 28 | + <div class="ui top attached header"> |
| 29 | + <div class="ui compact small menu small-menu-items repo-editor-menu"> |
| 30 | + <a class="active item" data-tab="write"> |
| 31 | + {{svg "octicon-code"}} {{if .IsNewFile}}{{ctx.Locale.Tr "repo.editor.new_file"}}{{else}}{{ctx.Locale.Tr "repo.editor.edit_file"}}{{end}} |
| 32 | + </a> |
| 33 | + <a class="item" data-tab="preview" data-preview-url="{{.Repository.Link}}/markup" data-preview-context-ref="{{.RepoLink}}/src/{{.RefTypeNameSubURL}}"> |
| 34 | + {{svg "octicon-eye"}} {{ctx.Locale.Tr "preview"}}</a> |
| 35 | + {{if not .IsNewFile}} |
| 36 | + <a class="item" data-tab="diff" |
| 37 | + hx-params="context,content" |
| 38 | + hx-vals='{"context":"{{.BranchLink}}"}' |
| 39 | + hx-include="#edit_area" |
| 40 | + hx-swap="innerHTML" |
| 41 | + hx-target=".tab[data-tab='diff']" |
| 42 | + hx-indicator=".tab[data-tab='diff']" |
| 43 | + hx-post="{{.RepoLink}}/_preview/{{.BranchName | PathEscapeSegments}}/{{.TreePath | PathEscapeSegments}}"> |
| 44 | + {{svg "octicon-diff"}} {{ctx.Locale.Tr "repo.editor.preview_changes"}} |
| 45 | + </a> |
| 46 | + {{end}} |
| 47 | + </div> |
45 | 48 | </div> |
46 | | - <div class="ui tab" data-tab="diff"> |
47 | | - <div class="tw-p-16"></div> |
| 49 | + <div class="ui bottom attached segment tw-p-0"> |
| 50 | + <div class="ui active tab tw-rounded-b" data-tab="write"> |
| 51 | + <textarea id="edit_area" name="content" class="tw-hidden" data-id="repo-{{.Repository.Name}}-{{.TreePath}}" |
| 52 | + data-previewable-extensions="{{.PreviewableExtensions}}" |
| 53 | + data-line-wrap-extensions="{{.LineWrapExtensions}}">{{.FileContent}}</textarea> |
| 54 | + <div class="editor-loading is-loading"></div> |
| 55 | + </div> |
| 56 | + <div class="ui tab tw-px-4 tw-py-3" data-tab="preview"> |
| 57 | + {{ctx.Locale.Tr "loading"}} |
| 58 | + </div> |
| 59 | + <div class="ui tab" data-tab="diff"> |
| 60 | + <div class="tw-p-16"></div> |
| 61 | + </div> |
48 | 62 | </div> |
49 | 63 | </div> |
50 | | - </div> |
51 | | - {{else}} |
52 | | - <div class="field"> |
53 | | - <div class="ui segment tw-text-center"> |
54 | | - <h4 class="tw-font-semibold tw-mb-2">{{.NotEditableReason}}</h4> |
55 | | - <p>{{ctx.Locale.Tr "repo.editor.file_not_editable_hint"}}</p> |
| 64 | + {{else}} |
| 65 | + <div class="field"> |
| 66 | + <div class="ui segment tw-text-center"> |
| 67 | + <h4 class="tw-font-semibold tw-mb-2">{{.NotEditableReason}}</h4> |
| 68 | + <p>{{ctx.Locale.Tr "repo.editor.file_not_editable_hint"}}</p> |
| 69 | + </div> |
56 | 70 | </div> |
57 | | - </div> |
58 | | - {{end}} |
59 | | - {{template "repo/editor/commit_form" .}} |
60 | | - </form> |
| 71 | + {{end}} |
| 72 | + {{template "repo/editor/commit_form" .}} |
| 73 | + </form> |
| 74 | + </div> |
61 | 75 | </div> |
62 | 76 | </div> |
63 | 77 | </div> |
|
0 commit comments