code.gitea.io/gitea@v1.22.3/templates/repo/editor/edit.tmpl (about)

     1  {{template "base/head" .}}
     2  <div role="main" aria-label="{{.Title}}" class="page-content repository file editor edit">
     3  	{{template "repo/header" .}}
     4  	<div class="ui container">
     5  		{{template "base/alert" .}}
     6  		<form class="ui edit form" method="post">
     7  			{{.CsrfTokenHtml}}
     8  			<input type="hidden" name="last_commit" value="{{.last_commit}}">
     9  			<input type="hidden" name="page_has_posted" value="{{.PageHasPosted}}">
    10  			<div class="repo-editor-header">
    11  				<div class="ui breadcrumb field{{if .Err_TreePath}} error{{end}}">
    12  					<a class="section" href="{{$.BranchLink}}">{{.Repository.Name}}</a>
    13  					{{$n := len .TreeNames}}
    14  					{{$l := Eval $n "-" 1}}
    15  					{{range $i, $v := .TreeNames}}
    16  						<div class="breadcrumb-divider">/</div>
    17  						{{if eq $i $l}}
    18  							<input id="file-name" maxlength="255" value="{{$v}}" placeholder="{{ctx.Locale.Tr "repo.editor.name_your_file"}}" data-editorconfig="{{$.EditorconfigJson}}" required autofocus>
    19  							<span data-tooltip-content="{{ctx.Locale.Tr "repo.editor.filename_help"}}">{{svg "octicon-info"}}</span>
    20  						{{else}}
    21  							<span class="section"><a href="{{$.BranchLink}}/{{index $.TreePaths $i | PathEscapeSegments}}">{{$v}}</a></span>
    22  						{{end}}
    23  					{{end}}
    24  					<span>{{ctx.Locale.Tr "repo.editor.or"}} <a href="{{if .ReturnURI}}{{.ReturnURI}}{{else}}{{$.BranchLink}}{{if not .IsNewFile}}/{{PathEscapeSegments .TreePath}}{{end}}{{end}}">{{ctx.Locale.Tr "repo.editor.cancel_lower"}}</a></span>
    25  					<input type="hidden" id="tree_path" name="tree_path" value="{{.TreePath}}" required>
    26  				</div>
    27  			</div>
    28  			<div class="field">
    29  				<div class="ui top attached header">
    30  					<div class="ui compact small menu small-menu-items repo-editor-menu">
    31  						<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>
    32  						<a class="item" data-tab="preview" data-url="{{.Repository.Link}}/markup" data-context="{{.RepoLink}}/src/{{.BranchNameSubURL}}" data-markup-mode="file">{{svg "octicon-eye"}} {{ctx.Locale.Tr "preview"}}</a>
    33  						{{if not .IsNewFile}}
    34  						<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>
    35  						{{end}}
    36  					</div>
    37  				</div>
    38  				<div class="ui bottom attached segment tw-p-0">
    39  					<div class="ui active tab tw-rounded" data-tab="write">
    40  						<textarea id="edit_area" name="content" class="tw-hidden" data-id="repo-{{.Repository.Name}}-{{.TreePath}}"
    41  							data-url="{{.Repository.Link}}/markup"
    42  							data-context="{{.RepoLink}}"
    43  							data-previewable-extensions="{{.PreviewableExtensions}}"
    44  							data-line-wrap-extensions="{{.LineWrapExtensions}}">{{.FileContent}}</textarea>
    45  						<div class="editor-loading is-loading"></div>
    46  					</div>
    47  					<div class="ui tab markup tw-px-4 tw-py-3" data-tab="preview">
    48  						{{ctx.Locale.Tr "loading"}}
    49  					</div>
    50  					<div class="ui tab diff edit-diff" data-tab="diff">
    51  						<div class="tw-p-16"></div>
    52  					</div>
    53  				</div>
    54  			</div>
    55  			{{template "repo/editor/commit_form" .}}
    56  		</form>
    57  	</div>
    58  	<div class="ui g-modal-confirm modal" id="edit-empty-content-modal">
    59  		<div class="header">
    60  			{{svg "octicon-file"}}
    61  			{{ctx.Locale.Tr "repo.editor.commit_empty_file_header"}}
    62  		</div>
    63  		<div class="center content">
    64  			<p>{{ctx.Locale.Tr "repo.editor.commit_empty_file_text"}}</p>
    65  		</div>
    66  		<div class="actions">
    67  			<button class="ui cancel button">
    68  				{{svg "octicon-x"}}
    69  				{{ctx.Locale.Tr "repo.editor.cancel"}}
    70  			</button>
    71  			<button class="ui primary ok button">
    72  				{{svg "fontawesome-save"}}
    73  				{{ctx.Locale.Tr "repo.editor.commit_changes"}}
    74  			</button>
    75  		</div>
    76  	</div>
    77  </div>
    78  {{template "base/footer" .}}