diff options
Diffstat (limited to 'templates/repo')
154 files changed, 2717 insertions, 2444 deletions
diff --git a/templates/repo/actions/runs_list.tmpl b/templates/repo/actions/runs_list.tmpl index fa1adb3e3b..23df61a43c 100644 --- a/templates/repo/actions/runs_list.tmpl +++ b/templates/repo/actions/runs_list.tmpl @@ -5,36 +5,55 @@ <h2>{{if $.IsFiltered}}{{ctx.Locale.Tr "actions.runs.no_results"}}{{else}}{{ctx.Locale.Tr "actions.runs.no_runs"}}{{end}}</h2> </div> {{end}} - {{range .Runs}} + {{range $run := .Runs}} <div class="flex-item tw-items-center"> <div class="flex-item-leading"> - {{template "repo/actions/status" (dict "status" .Status.String)}} + {{template "repo/actions/status" (dict "status" $run.Status.String)}} </div> <div class="flex-item-main"> - <a class="flex-item-title" title="{{.Title}}" href="{{if .Link}}{{.Link}}{{else}}{{$.Link}}/{{.Index}}{{end}}"> - {{if .Title}}{{.Title}}{{else}}{{ctx.Locale.Tr "actions.runs.empty_commit_message"}}{{end}} + <a class="flex-item-title" title="{{$run.Title}}" href="{{$run.Link}}"> + {{or $run.Title (ctx.Locale.Tr "actions.runs.empty_commit_message")}} </a> <div class="flex-item-body"> - <span><b>{{if not $.CurWorkflow}}{{.WorkflowID}} {{end}}#{{.Index}}</b>:</span> - {{- if .ScheduleID -}} + <span><b>{{if not $.CurWorkflow}}{{$run.WorkflowID}} {{end}}#{{$run.Index}}</b>:</span> + {{- if $run.ScheduleID -}} {{ctx.Locale.Tr "actions.runs.scheduled"}} {{- else -}} {{ctx.Locale.Tr "actions.runs.commit"}} - <a href="{{$.RepoLink}}/commit/{{.CommitSHA}}">{{ShortSha .CommitSHA}}</a> + <a href="{{$.RepoLink}}/commit/{{$run.CommitSHA}}">{{ShortSha $run.CommitSHA}}</a> {{ctx.Locale.Tr "actions.runs.pushed_by"}} - <a href="{{.TriggerUser.HomeLink}}">{{.TriggerUser.GetDisplayName}}</a> + <a href="{{$run.TriggerUser.HomeLink}}">{{$run.TriggerUser.GetDisplayName}}</a> {{- end -}} </div> </div> <div class="flex-item-trailing"> - {{if .IsRefDeleted}} - <span class="ui label run-list-ref gt-ellipsis tw-line-through" data-tooltip-content="{{.PrettyRef}}">{{.PrettyRef}}</span> + {{if $run.IsRefDeleted}} + <span class="ui label run-list-ref gt-ellipsis tw-line-through" data-tooltip-content="{{$run.PrettyRef}}">{{$run.PrettyRef}}</span> {{else}} - <a class="ui label run-list-ref gt-ellipsis" href="{{.RefLink}}" data-tooltip-content="{{.PrettyRef}}">{{.PrettyRef}}</a> + <a class="ui label run-list-ref gt-ellipsis" href="{{$run.RefLink}}" data-tooltip-content="{{$run.PrettyRef}}">{{$run.PrettyRef}}</a> {{end}} <div class="run-list-item-right"> - <div class="run-list-meta">{{svg "octicon-calendar" 16}}{{DateUtils.TimeSince .Updated}}</div> - <div class="run-list-meta">{{svg "octicon-stopwatch" 16}}{{.Duration}}</div> + <div class="run-list-meta">{{svg "octicon-calendar" 16}}{{DateUtils.TimeSince $run.Updated}}</div> + <div class="run-list-meta">{{svg "octicon-stopwatch" 16}}{{$run.Duration}}</div> + </div> + <div class="ui dropdown jump tw-p-2"> + {{svg "octicon-kebab-horizontal"}} + <div class="menu flex-items-menu"> + <a class="item" href="{{$run.Link}}/workflow">{{svg "octicon-play"}}{{ctx.Locale.Tr "actions.runs.view_workflow_file"}}</a> + {{if and $.CanWriteRepoUnitActions (not $run.Status.IsDone)}} + <a class="item link-action" data-url="{{$run.Link}}/cancel"> + {{svg "octicon-x"}}{{ctx.Locale.Tr "actions.runs.cancel"}} + </a> + {{end}} + {{if and $.CanWriteRepoUnitActions $run.Status.IsDone}} + <a class="item link-action" + data-url="{{$run.Link}}/delete" + data-modal-confirm="{{ctx.Locale.Tr "actions.runs.delete.description"}}" + > + {{svg "octicon-trash"}}{{ctx.Locale.Tr "actions.runs.delete"}} + </a> + {{end}} + </div> </div> </div> </div> diff --git a/templates/repo/actions/status.tmpl b/templates/repo/actions/status.tmpl index 64c2543302..f2020bc160 100644 --- a/templates/repo/actions/status.tmpl +++ b/templates/repo/actions/status.tmpl @@ -16,7 +16,7 @@ {{else if eq .status "blocked"}} {{svg "octicon-blocked" $size (printf "text yellow %s" $className)}} {{else if eq .status "running"}} - {{svg "octicon-meter" $size (printf "text yellow job-status-rotate %s" $className)}} + {{svg "octicon-meter" $size (printf "text yellow circular-spin %s" $className)}} {{else}}{{/*failure, unknown*/}} {{svg "octicon-x-circle-fill" $size (printf "text red %s" $className)}} {{end}} diff --git a/templates/repo/actions/view_component.tmpl b/templates/repo/actions/view_component.tmpl index 8d1de41f70..4e338ffcfc 100644 --- a/templates/repo/actions/view_component.tmpl +++ b/templates/repo/actions/view_component.tmpl @@ -4,7 +4,7 @@ data-actions-url="{{.ActionsURL}}" data-locale-approve="{{ctx.Locale.Tr "repo.diff.review.approve"}}" - data-locale-cancel="{{ctx.Locale.Tr "cancel"}}" + data-locale-cancel="{{ctx.Locale.Tr "actions.runs.cancel"}}" data-locale-rerun="{{ctx.Locale.Tr "rerun"}}" data-locale-rerun-all="{{ctx.Locale.Tr "rerun_all"}}" data-locale-runs-scheduled="{{ctx.Locale.Tr "actions.runs.scheduled"}}" @@ -19,6 +19,7 @@ data-locale-status-skipped="{{ctx.Locale.Tr "actions.status.skipped"}}" data-locale-status-blocked="{{ctx.Locale.Tr "actions.status.blocked"}}" data-locale-artifacts-title="{{ctx.Locale.Tr "artifacts"}}" + data-locale-artifact-expired="{{ctx.Locale.Tr "expired"}}" data-locale-confirm-delete-artifact="{{ctx.Locale.Tr "confirm_delete_artifact"}}" data-locale-show-timestamps="{{ctx.Locale.Tr "show_timestamps"}}" data-locale-show-log-seconds="{{ctx.Locale.Tr "show_log_seconds"}}" diff --git a/templates/repo/actions/workflow_dispatch.tmpl b/templates/repo/actions/workflow_dispatch.tmpl index 21f3ef2077..540bbe9162 100644 --- a/templates/repo/actions/workflow_dispatch.tmpl +++ b/templates/repo/actions/workflow_dispatch.tmpl @@ -10,8 +10,8 @@ <span class="ui inline required field"> <label>{{ctx.Locale.Tr "actions.workflow.from_ref"}}:</label> </span> - <div class="ui inline field dropdown button select-branch branch-selector-dropdown ellipsis-items-nowrap"> - <input type="hidden" name="ref" value="refs/heads/{{index .Branches 0}}"> + <div class="ui inline field dropdown button select-branch branch-selector-dropdown ellipsis-text-items"> + <input type="hidden" name="ref" hx-sync="this:replace" hx-target="#runWorkflowDispatchModalInputs" hx-swap="innerHTML" hx-get="{{$.Link}}/workflow-dispatch-inputs?workflow={{$.CurWorkflow}}" hx-trigger="change" value="refs/heads/{{index .Branches 0}}"> {{svg "octicon-git-branch" 14}} <div class="default text">{{index .Branches 0}}</div> {{svg "octicon-triangle-down" 14 "dropdown icon"}} @@ -49,30 +49,9 @@ <div class="divider"></div> - {{range $item := .WorkflowDispatchConfig.Inputs}} - <div class="ui field {{if .Required}}required{{end}}"> - {{if eq .Type "choice"}} - <label>{{.Description}}:</label> - <select class="ui selection type dropdown" name="{{.Name}}"> - {{range .Options}} - <option value="{{.}}" {{if eq $item.Default .}}selected{{end}} >{{.}}</option> - {{end}} - </select> - {{else if eq .Type "boolean"}} - <div class="ui inline checkbox"> - <label>{{.Description}}</label> - <input type="checkbox" name="{{.Name}}" {{if eq .Default "true"}}checked{{end}}> - </div> - {{else if eq .Type "number"}} - <label>{{.Description}}:</label> - <input name="{{.Name}}" value="{{.Default}}" {{if .Required}}required{{end}}> - {{else}} - <label>{{.Description}}:</label> - <input name="{{.Name}}" value="{{.Default}}" {{if .Required}}required{{end}}> - {{end}} + <div id="runWorkflowDispatchModalInputs"> + {{template "repo/actions/workflow_dispatch_inputs" .}} </div> - {{end}} - <button class="ui tiny primary button" type="submit">Submit</button> </form> </div> </div> diff --git a/templates/repo/actions/workflow_dispatch_inputs.tmpl b/templates/repo/actions/workflow_dispatch_inputs.tmpl new file mode 100644 index 0000000000..37538a318f --- /dev/null +++ b/templates/repo/actions/workflow_dispatch_inputs.tmpl @@ -0,0 +1,46 @@ +{{if not .WorkflowDispatchConfig}} + <div class="ui error message tw-block">{{/* using "ui message" in "ui form" needs to force to display */}} + {{if not .CurWorkflowExists}} + {{ctx.Locale.Tr "actions.workflow.not_found" $.CurWorkflow}} + {{else}} + {{ctx.Locale.Tr "actions.workflow.has_no_workflow_dispatch" $.CurWorkflow}} + {{end}} + </div> +{{else}} + {{range $item := .WorkflowDispatchConfig.Inputs}} + <div class="ui field {{if .Required}}required{{end}}"> + {{if eq .Type "choice"}} + <label>{{or .Description .Name}}:</label> + {{/* htmx won't initialize the fomantic dropdown, so it is a standard "select" input */}} + <select class="ui selection dropdown" name="{{.Name}}"> + {{range .Options}} + <option value="{{.}}" {{if eq $item.Default .}}selected{{end}}>{{.}}</option> + {{end}} + </select> + {{else if eq .Type "boolean"}} + {{/* htmx doesn't trigger our JS code to attach fomantic label to checkbox, so here we use standard checkbox */}} + <label class="tw-flex flex-text-inline"> + <input type="checkbox" name="{{.Name}}" {{if eq .Default "true"}}checked{{end}}> + {{or .Description .Name}} + </label> + {{else if eq .Type "number"}} + <label>{{or .Description .Name}}:</label> + <input name="{{.Name}}" value="{{.Default}}" {{if .Required}}required{{end}}> + {{else}} + <label>{{or .Description .Name}}:</label> + <input name="{{.Name}}" value="{{.Default}}" {{if .Required}}required{{end}}> + {{end}} + </div> + {{end}} + <div class="ui field"> + {{/* use autofocus here to prevent the "branch selection" dropdown from getting focus, otherwise it will auto popup */}} + <button class="ui tiny primary button" autofocus type="submit">{{ctx.Locale.Tr "actions.workflow.run"}}</button> + </div> +{{end}} +{{range .workflows}} + {{if and .ErrMsg (eq .Entry.Name $.CurWorkflow)}} + <div class="ui field"> + <div>{{svg "octicon-alert" 16 "text red"}} {{.ErrMsg}}</div> + </div> + {{end}} +{{end}} diff --git a/templates/repo/blame.tmpl b/templates/repo/blame.tmpl index 62d1bbf2ba..c4d9f0741f 100644 --- a/templates/repo/blame.tmpl +++ b/templates/repo/blame.tmpl @@ -1,5 +1,5 @@ {{if or .UsesIgnoreRevs .FaultyIgnoreRevsFile}} - {{$revsFileLink := URLJoin .RepoLink "src" .BranchNameSubURL "/.git-blame-ignore-revs"}} + {{$revsFileLink := URLJoin .RepoLink "src" .RefTypeNameSubURL "/.git-blame-ignore-revs"}} {{if .UsesIgnoreRevs}} <div class="ui info message"> <p>{{ctx.Locale.Tr "repo.blame.ignore_revs" $revsFileLink "?bypass-blame-ignore=true"}}</p> @@ -10,7 +10,7 @@ </div> {{end}} {{end}} -<div class="{{TabSizeClass .Editorconfig .FileName}} non-diff-file-content"> +<div class="{{TabSizeClass .Editorconfig .FileTreePath}} non-diff-file-content"> <h4 class="file-header ui top attached header tw-flex tw-items-center tw-justify-between tw-flex-wrap"> <div class="file-header-left tw-flex tw-items-center tw-py-2 tw-pr-4"> {{template "repo/file_info" .}} @@ -18,11 +18,11 @@ <div class="file-header-right file-actions tw-flex tw-items-center tw-flex-wrap"> <div class="ui buttons"> <a class="ui tiny button" href="{{$.RawFileLink}}">{{ctx.Locale.Tr "repo.file_raw"}}</a> - {{if not .IsViewCommit}} + {{if or .RefFullName.IsBranch .RefFullName.IsTag}} <a class="ui tiny button" href="{{.RepoLink}}/src/commit/{{.CommitID | PathEscape}}/{{.TreePath | PathEscapeSegments}}">{{ctx.Locale.Tr "repo.file_permalink"}}</a> {{end}} - <a class="ui tiny button" href="{{.RepoLink}}/src/{{.BranchNameSubURL}}/{{.TreePath | PathEscapeSegments}}">{{ctx.Locale.Tr "repo.normal_view"}}</a> - <a class="ui tiny button" href="{{.RepoLink}}/commits/{{.BranchNameSubURL}}/{{.TreePath | PathEscapeSegments}}">{{ctx.Locale.Tr "repo.file_history"}}</a> + <a class="ui tiny button" href="{{.RepoLink}}/src/{{.RefTypeNameSubURL}}/{{.TreePath | PathEscapeSegments}}">{{ctx.Locale.Tr "repo.normal_view"}}</a> + <a class="ui tiny button" href="{{.RepoLink}}/commits/{{.RefTypeNameSubURL}}/{{.TreePath | PathEscapeSegments}}">{{ctx.Locale.Tr "repo.file_history"}}</a> <button class="ui tiny button unescape-button">{{ctx.Locale.Tr "repo.unescape_control_characters"}}</button> <button class="ui tiny button escape-button tw-hidden">{{ctx.Locale.Tr "repo.escape_control_characters"}}</button> </div> @@ -82,6 +82,8 @@ </table> {{end}}{{/* end if .IsFileTooLarge */}} <div class="code-line-menu tippy-target"> + {{/*FIXME: the "HasSourceRenderedToggle" is never set on blame page, it should mean "whether the file is renderable". + If the file is renderable, then it must has the "display=source" parameter to make sure the file view page shows the source code, then line number works. */}} {{if $.Permission.CanRead ctx.Consts.RepoUnitTypeIssues}} <a class="item ref-in-new-issue" role="menuitem" data-url-issue-new="{{.RepoLink}}/issues/new" data-url-param-body-link="{{.Repository.Link}}/src/commit/{{PathEscape .CommitID}}/{{PathEscapeSegments .TreePath}}{{if $.HasSourceRenderedToggle}}?display=source{{end}}" rel="nofollow noindex">{{ctx.Locale.Tr "repo.issues.context.reference_issue"}}</a> {{end}} diff --git a/templates/repo/branch/list.tmpl b/templates/repo/branch/list.tmpl index cb504e2b75..9e86641c6f 100644 --- a/templates/repo/branch/list.tmpl +++ b/templates/repo/branch/list.tmpl @@ -20,17 +20,17 @@ <tr> <td> <div class="flex-text-block"> - <a class="gt-ellipsis" href="{{.RepoLink}}/src/branch/{{PathEscapeSegments .DefaultBranchBranch.DBBranch.Name}}">{{.DefaultBranchBranch.DBBranch.Name}}</a> + <a class="gt-ellipsis branch-name" href="{{.RepoLink}}/src/branch/{{PathEscapeSegments .DefaultBranchBranch.DBBranch.Name}}">{{.DefaultBranchBranch.DBBranch.Name}}</a> {{if .DefaultBranchBranch.IsProtected}} <span data-tooltip-content="{{ctx.Locale.Tr "repo.settings.protected_branch"}}">{{svg "octicon-shield-lock"}}</span> {{end}} <button class="btn interact-fg tw-px-1" data-clipboard-text="{{.DefaultBranchBranch.DBBranch.Name}}" data-tooltip-content="{{ctx.Locale.Tr "copy_branch"}}">{{svg "octicon-copy" 14}}</button> {{template "repo/commit_statuses" dict "Status" (index $.CommitStatus .DefaultBranchBranch.DBBranch.CommitID) "Statuses" (index $.CommitStatuses .DefaultBranchBranch.DBBranch.CommitID)}} </div> - <p class="info tw-flex tw-items-center tw-my-1">{{svg "octicon-git-commit" 16 "tw-mr-1"}}<a href="{{.RepoLink}}/commit/{{PathEscape .DefaultBranchBranch.DBBranch.CommitID}}">{{ShortSha .DefaultBranchBranch.DBBranch.CommitID}}</a> · <span class="commit-message">{{ctx.RenderUtils.RenderCommitMessage .DefaultBranchBranch.DBBranch.CommitMessage (.Repository.ComposeMetas ctx)}}</span> · {{ctx.Locale.Tr "org.repo_updated"}} {{DateUtils.TimeSince .DefaultBranchBranch.DBBranch.CommitTime}}{{if .DefaultBranchBranch.DBBranch.Pusher}} {{template "shared/user/avatarlink" dict "user" .DefaultBranchBranch.DBBranch.Pusher}}{{template "shared/user/namelink" .DefaultBranchBranch.DBBranch.Pusher}}{{end}}</p> + <p class="info tw-flex tw-items-center tw-my-1">{{svg "octicon-git-commit" 16 "tw-mr-1"}}<a href="{{.RepoLink}}/commit/{{PathEscape .DefaultBranchBranch.DBBranch.CommitID}}">{{ShortSha .DefaultBranchBranch.DBBranch.CommitID}}</a> · <span class="commit-message">{{ctx.RenderUtils.RenderCommitMessage .DefaultBranchBranch.DBBranch.CommitMessage .Repository}}</span> · {{ctx.Locale.Tr "org.repo_updated"}} {{DateUtils.TimeSince .DefaultBranchBranch.DBBranch.CommitTime}}{{if .DefaultBranchBranch.DBBranch.Pusher}} {{template "shared/user/avatarlink" dict "user" .DefaultBranchBranch.DBBranch.Pusher}}{{template "shared/user/namelink" .DefaultBranchBranch.DBBranch.Pusher}}{{end}}</p> </td> {{/* FIXME: here and below, the tw-overflow-visible is not quite right but it is still needed the moment: to show the important buttons when the width is narrow */}} - <td class="right aligned middle aligned tw-overflow-visible"> + <td class="tw-text-right tw-overflow-visible"> {{if and $.IsWriter (not $.Repository.IsArchived) (not .IsDeleted)}} <button class="btn interact-bg show-create-branch-modal tw-p-2" data-modal="#create-branch-modal" @@ -42,7 +42,7 @@ </button> {{end}} {{if .EnableFeed}} - <a role="button" class="btn interact-bg tw-p-2" href="{{$.FeedURL}}/rss/branch/{{PathEscapeSegments .DefaultBranchBranch.DBBranch.Name}}" data-tooltip-content="{{ctx.Locale.Tr "rss_feed"}}">{{svg "octicon-rss"}}</a> + <a role="button" class="btn interact-bg tw-p-2" href="{{$.RepoLink}}/rss/branch/{{PathEscapeSegments .DefaultBranchBranch.DBBranch.Name}}" data-tooltip-content="{{ctx.Locale.Tr "rss_feed"}}">{{svg "octicon-rss"}}</a> {{end}} {{if not $.DisableDownloadSourceArchives}} <div class="ui dropdown btn interact-bg tw-p-2" data-tooltip-content="{{ctx.Locale.Tr "repo.branch.download" ($.DefaultBranchBranch.DBBranch.Name)}}"> @@ -90,25 +90,31 @@ <td class="eight wide"> {{if .DBBranch.IsDeleted}} <div class="flex-text-block"> - <span class="gt-ellipsis">{{.DBBranch.Name}}</span> + <span class="gt-ellipsis branch-name">{{.DBBranch.Name}}</span> <button class="btn interact-fg tw-px-1" data-clipboard-text="{{.DBBranch.Name}}" data-tooltip-content="{{ctx.Locale.Tr "copy_branch"}}">{{svg "octicon-copy" 14}}</button> </div> <p class="info">{{ctx.Locale.Tr "repo.branch.deleted_by" .DBBranch.DeletedBy.Name}} {{DateUtils.TimeSince .DBBranch.DeletedUnix}}</p> {{else}} <div class="flex-text-block"> - <a class="gt-ellipsis" href="{{$.RepoLink}}/src/branch/{{PathEscapeSegments .DBBranch.Name}}">{{.DBBranch.Name}}</a> + <a class="gt-ellipsis branch-name" href="{{$.RepoLink}}/src/branch/{{PathEscapeSegments .DBBranch.Name}}">{{.DBBranch.Name}}</a> {{if .IsProtected}} <span data-tooltip-content="{{ctx.Locale.Tr "repo.settings.protected_branch"}}">{{svg "octicon-shield-lock"}}</span> {{end}} <button class="btn interact-fg tw-px-1" data-clipboard-text="{{.DBBranch.Name}}" data-tooltip-content="{{ctx.Locale.Tr "copy_branch"}}">{{svg "octicon-copy" 14}}</button> {{template "repo/commit_statuses" dict "Status" (index $.CommitStatus .DBBranch.CommitID) "Statuses" (index $.CommitStatuses .DBBranch.CommitID)}} </div> - <p class="info tw-flex tw-items-center tw-my-1">{{svg "octicon-git-commit" 16 "tw-mr-1"}}<a href="{{$.RepoLink}}/commit/{{PathEscape .DBBranch.CommitID}}">{{ShortSha .DBBranch.CommitID}}</a> · <span class="commit-message">{{ctx.RenderUtils.RenderCommitMessage .DBBranch.CommitMessage ($.Repository.ComposeMetas ctx)}}</span> · {{ctx.Locale.Tr "org.repo_updated"}} {{DateUtils.TimeSince .DBBranch.CommitTime}}{{if .DBBranch.Pusher}} {{template "shared/user/avatarlink" dict "user" .DBBranch.Pusher}} {{template "shared/user/namelink" .DBBranch.Pusher}}{{end}}</p> + <p class="info tw-flex tw-items-center tw-my-1">{{svg "octicon-git-commit" 16 "tw-mr-1"}}<a href="{{$.RepoLink}}/commit/{{PathEscape .DBBranch.CommitID}}">{{ShortSha .DBBranch.CommitID}}</a> · <span class="commit-message">{{ctx.RenderUtils.RenderCommitMessage .DBBranch.CommitMessage $.Repository}}</span> · {{ctx.Locale.Tr "org.repo_updated"}} {{DateUtils.TimeSince .DBBranch.CommitTime}}{{if .DBBranch.Pusher}} {{template "shared/user/avatarlink" dict "user" .DBBranch.Pusher}} {{template "shared/user/namelink" .DBBranch.Pusher}}{{end}}</p> {{end}} </td> <td class="two wide ui"> - {{if and (not .DBBranch.IsDeleted) $.DefaultBranchBranch}} - <div class="commit-divergence"> + {{if and (not .DBBranch.IsDeleted) $.DefaultBranchBranch}} + {{$tooltipDivergence := ""}} + {{if or .CommitsBehind .CommitsAhead}} + {{$tooltipDivergence = ctx.Locale.Tr "repo.branch.commits_divergence_from" .CommitsBehind .CommitsAhead $.DefaultBranchBranch.DBBranch.Name}} + {{else}} + {{$tooltipDivergence = ctx.Locale.Tr "repo.branch.commits_no_divergence" $.DefaultBranchBranch.DBBranch.Name}} + {{end}} + <div class="commit-divergence" data-tooltip-content="{{$tooltipDivergence}}"> <div class="bar-group"> <div class="count count-behind">{{.CommitsBehind}}</div> {{/* old code bears 0/0.0 = NaN output, so it might output invalid "width: NaNpx", it just works and doesn't caues any problem. */}} @@ -119,22 +125,22 @@ <div class="bar bar-ahead" style="width: {{Eval 100 "*" .CommitsAhead "/" "(" .CommitsBehind "+" .CommitsAhead "+" 0.0 ")"}}%"></div> </div> </div> - {{end}} + {{end}} </td> - <td class="two wide right aligned"> + <td class="two wide tw-text-right"> {{if not .LatestPullRequest}} {{if .IsIncluded}} <span class="ui orange large label" data-tooltip-content="{{ctx.Locale.Tr "repo.branch.included_desc"}}"> {{svg "octicon-git-pull-request"}} {{ctx.Locale.Tr "repo.branch.included"}} </span> {{else if and (not .DBBranch.IsDeleted) $.AllowsPulls (gt .CommitsAhead 0)}} - <a href="{{$.RepoLink}}/compare/{{PathEscapeSegments $.DefaultBranchBranch.DBBranch.Name}}...{{if ne $.Repository.Owner.Name $.Owner.Name}}{{PathEscape $.Owner.Name}}:{{end}}{{PathEscapeSegments .DBBranch.Name}}"> + <a href="{{$.RepoLink}}/compare/{{PathEscapeSegments $.DefaultBranchBranch.DBBranch.Name}}...{{if ne $.Repository.Owner.Name $.Owner.Name}}{{PathEscape $.Owner.Name}}:{{end}}{{PathEscapeSegments .DBBranch.Name}}?expand=1"> <button id="new-pull-request" class="ui compact basic button tw-mr-0">{{if $.CanPull}}{{ctx.Locale.Tr "repo.pulls.compare_changes"}}{{else}}{{ctx.Locale.Tr "action.compare_branch"}}{{end}}</button> </a> {{end}} {{else if and .LatestPullRequest.HasMerged .MergeMovedOn}} {{if and (not .DBBranch.IsDeleted) $.AllowsPulls (gt .CommitsAhead 0)}} - <a href="{{$.RepoLink}}/compare/{{PathEscapeSegments $.DefaultBranchBranch.DBBranch.Name}}...{{if ne $.Repository.Owner.Name $.Owner.Name}}{{PathEscape $.Owner.Name}}:{{end}}{{PathEscapeSegments .DBBranch.Name}}"> + <a href="{{$.RepoLink}}/compare/{{PathEscapeSegments $.DefaultBranchBranch.DBBranch.Name}}...{{if ne $.Repository.Owner.Name $.Owner.Name}}{{PathEscape $.Owner.Name}}:{{end}}{{PathEscapeSegments .DBBranch.Name}}?expand=1"> <button id="new-pull-request" class="ui compact basic button tw-mr-0">{{if $.CanPull}}{{ctx.Locale.Tr "repo.pulls.compare_changes"}}{{else}}{{ctx.Locale.Tr "action.compare_branch"}}{{end}}</button> </a> {{end}} @@ -143,14 +149,14 @@ {{if .LatestPullRequest.HasMerged}} <a href="{{.LatestPullRequest.Issue.Link}}" class="ui purple large label">{{svg "octicon-git-merge" 16 "tw-mr-1"}}{{ctx.Locale.Tr "repo.pulls.merged"}}</a> {{else if .LatestPullRequest.Issue.IsClosed}} - <a href="{{.LatestPullRequest.Issue.Link}}" class="ui red large label">{{svg "octicon-git-pull-request" 16 "tw-mr-1"}}{{ctx.Locale.Tr "repo.issues.closed_title"}}</a> + <a href="{{.LatestPullRequest.Issue.Link}}" class="ui red large label">{{svg "octicon-git-pull-request-closed" 16 "tw-mr-1"}}{{ctx.Locale.Tr "repo.issues.closed_title"}}</a> {{else}} <a href="{{.LatestPullRequest.Issue.Link}}" class="ui green large label">{{svg "octicon-git-pull-request" 16 "tw-mr-1"}}{{ctx.Locale.Tr "repo.issues.open_title"}}</a> {{end}} {{end}} </td> {{/* FIXME: here and above, the tw-overflow-visible is not quite right */}} - <td class="three wide right aligned tw-overflow-visible"> + <td class="three wide tw-text-right tw-overflow-visible"> {{if and $.IsWriter (not $.Repository.IsArchived) (not .DBBranch.IsDeleted)}} <button class="btn interact-bg tw-p-2 show-modal show-create-branch-modal" data-branch-from="{{.DBBranch.Name}}" @@ -162,7 +168,7 @@ </button> {{end}} {{if $.EnableFeed}} - <a role="button" class="btn interact-bg tw-p-2" href="{{$.FeedURL}}/rss/branch/{{PathEscapeSegments .DBBranch.Name}}" data-tooltip-content="{{ctx.Locale.Tr "rss_feed"}}">{{svg "octicon-rss"}}</a> + <a role="button" class="btn interact-bg tw-p-2" href="{{$.RepoLink}}/rss/branch/{{PathEscapeSegments .DBBranch.Name}}" data-tooltip-content="{{ctx.Locale.Tr "rss_feed"}}">{{svg "octicon-rss"}}</a> {{end}} {{if and (not .DBBranch.IsDeleted) (not $.DisableDownloadSourceArchives)}} <div class="ui dropdown btn interact-bg tw-p-2" data-tooltip-content="{{ctx.Locale.Tr "repo.branch.download" (.DBBranch.Name)}}"> diff --git a/templates/repo/branch_dropdown.tmpl b/templates/repo/branch_dropdown.tmpl index b68c34a02a..36dc047c23 100644 --- a/templates/repo/branch_dropdown.tmpl +++ b/templates/repo/branch_dropdown.tmpl @@ -1,8 +1,8 @@ {{/* Attributes: * ContainerClasses * Repository -* CurrentRefType: eg. "branch", "tag" -* CurrentRefShortName: eg. "master", "v1.0" +* CurrentRefType: eg. "branch", "tag", "commit" +* CurrentRefShortName: eg. "master", "v1.0", "abcdef0123" * CurrentTreePath * RefLinkTemplate: redirect to the link when a branch/tag is selected * RefFormActionTemplate: change the parent form's action when a branch/tag is selected @@ -14,7 +14,8 @@ Search "repo/branch_dropdown" in the template directory to find all occurrences. */}} -<div class="js-branch-tag-selector {{if .ContainerClasses}}{{.ContainerClasses}}{{end}}" +<div class="{{if .ContainerClasses}}{{.ContainerClasses}}{{end}}" + data-global-init="initRepoBranchTagSelector" data-text-release-compare="{{ctx.Locale.Tr "repo.release.compare"}}" data-text-branches="{{ctx.Locale.Tr "repo.branches"}}" data-text-tags="{{ctx.Locale.Tr "repo.tags"}}" @@ -45,17 +46,21 @@ Search "repo/branch_dropdown" in the template directory to find all occurrences. data-enable-feed="{{ctx.RootData.EnableFeed}}" > {{/* show dummy elements before Vue componment is mounted, this code must match the code in BranchTagSelector.vue */}} - <div class="ui dropdown custom branch-selector-dropdown ellipsis-items-nowrap"> - <div class="ui button branch-dropdown-button"> + <div class="ui dropdown custom branch-selector-dropdown ellipsis-text-items"> + <div class="ui compact button branch-dropdown-button"> <span class="flex-text-block gt-ellipsis"> - {{if not .DropdownFixedText}} - {{if .ShowTabTags}} + {{if .DropdownFixedText}} + {{.DropdownFixedText}} + {{else}} + {{if eq .CurrentRefType "tag"}} {{svg "octicon-tag"}} - {{else if .ShowTabBranches}} + {{else if eq .CurrentRefType "branch"}} {{svg "octicon-git-branch"}} + {{else}} + {{svg "octicon-git-commit"}} {{end}} + <strong class="tw-inline-block gt-ellipsis">{{.CurrentRefShortName}}</strong> {{end}} - <strong class="tw-ml-2 tw-inline-block gt-ellipsis">{{Iif .DropdownFixedText .SelectedRefShortName}}</strong> </span> {{svg "octicon-triangle-down" 14 "dropdown icon"}} </div> diff --git a/templates/repo/clone_panel.tmpl b/templates/repo/clone_panel.tmpl index d3496bdb73..e23bc8a19a 100644 --- a/templates/repo/clone_panel.tmpl +++ b/templates/repo/clone_panel.tmpl @@ -1,5 +1,6 @@ -<button class="ui primary button js-btn-clone-panel"> - <span>{{svg "octicon-code" 16}} Code</span> +<button class="ui compact primary button js-btn-clone-panel"> + {{svg "octicon-code" 16}} + <span>{{ctx.Locale.Tr "repo.code"}}</span> {{svg "octicon-triangle-down" 14 "dropdown icon"}} </button> <div class="clone-panel-popup tippy-target"> @@ -13,6 +14,7 @@ {{if $.CloneButtonShowSSH}} <button class="item repo-clone-ssh" data-link="{{$.CloneButtonOriginLink.SSH}}">SSH</button> {{end}} + <button class="item repo-clone-tea" data-link="{{$.CloneButtonOriginLink.Tea}}">Tea CLI</button> </div> <div class="divider"></div> @@ -32,12 +34,14 @@ {{end}} </div> - {{if and (not $.DisableDownloadSourceArchives) $.RefName}} + {{if and (not $.DisableDownloadSourceArchives) $.RefFullName}} <div class="divider"></div> <div class="flex-items-block clone-panel-list"> - <a class="item muted archive-link" href="{{$.RepoLink}}/archive/{{PathEscapeSegments $.RefName}}.zip" rel="nofollow">{{svg "octicon-file-zip"}} {{ctx.Locale.Tr "repo.download_zip"}}</a> - <a class="item muted archive-link" href="{{$.RepoLink}}/archive/{{PathEscapeSegments $.RefName}}.tar.gz" rel="nofollow">{{svg "octicon-file-zip"}} {{ctx.Locale.Tr "repo.download_tar"}}</a> - <a class="item muted archive-link" href="{{$.RepoLink}}/archive/{{PathEscapeSegments $.RefName}}.bundle" rel="nofollow">{{svg "octicon-package"}} {{ctx.Locale.Tr "repo.download_bundle"}}</a> + {{/* FIXME: here it only uses the shortname in the ref to build the link, it can't distinguish the branch/tag/commit with the same name + in the future, it's better to use something like "/archive/branch/the-name.zip", "/archive/tag/the-name.zip" */}} + <a class="item muted archive-link" href="{{$.RepoLink}}/archive/{{PathEscapeSegments $.RefFullName.ShortName}}.zip" rel="nofollow">{{svg "octicon-file-zip"}} {{ctx.Locale.Tr "repo.download_zip"}}</a> + <a class="item muted archive-link" href="{{$.RepoLink}}/archive/{{PathEscapeSegments $.RefFullName.ShortName}}.tar.gz" rel="nofollow">{{svg "octicon-file-zip"}} {{ctx.Locale.Tr "repo.download_tar"}}</a> + <a class="item muted archive-link" href="{{$.RepoLink}}/archive/{{PathEscapeSegments $.RefFullName.ShortName}}.bundle" rel="nofollow">{{svg "octicon-package"}} {{ctx.Locale.Tr "repo.download_bundle"}}</a> </div> {{end}} {{end}} diff --git a/templates/repo/code/recently_pushed_new_branches.tmpl b/templates/repo/code/recently_pushed_new_branches.tmpl index f0edf6065b..8569bd6c13 100644 --- a/templates/repo/code/recently_pushed_new_branches.tmpl +++ b/templates/repo/code/recently_pushed_new_branches.tmpl @@ -1,12 +1,18 @@ -{{range .RecentlyPushedNewBranches}} - <div class="ui positive message tw-flex tw-items-center tw-gap-2"> - <div class="tw-flex-1 tw-break-anywhere"> - {{$timeSince := DateUtils.TimeSince .CommitTime}} - {{$branchLink := HTMLFormat `<a href="%s">%s</a>` .BranchLink .BranchDisplayName}} +{{/* Template Attributes: +* RecentBranchesPromptData +*/}} +{{$data := .RecentBranchesPromptData}} +{{if $data}} + {{range $recentBranch := $data.RecentlyPushedNewBranches}} + <div class="ui positive message flex-text-block"> + <div class="tw-flex-1"> + {{$timeSince := DateUtils.TimeSince $recentBranch.CommitTime}} + {{$branchLink := HTMLFormat `<a href="%s">%s</a>` $recentBranch.BranchLink .BranchDisplayName}} {{ctx.Locale.Tr "repo.pulls.recently_pushed_new_branches" $branchLink $timeSince}} </div> - <a role="button" class="ui compact green button tw-m-0" href="{{.BranchCompareURL}}"> + <a role="button" class="ui compact green button" href="{{QueryBuild $recentBranch.BranchCompareURL "expand" 1}}"> {{ctx.Locale.Tr "repo.pulls.compare_changes"}} </a> </div> + {{end}} {{end}} diff --git a/templates/repo/code/upstream_diverging_info.tmpl b/templates/repo/code/upstream_diverging_info.tmpl index 51402598f9..b3d35c05e5 100644 --- a/templates/repo/code/upstream_diverging_info.tmpl +++ b/templates/repo/code/upstream_diverging_info.tmpl @@ -1,16 +1,21 @@ -{{if and .UpstreamDivergingInfo (or .UpstreamDivergingInfo.BaseIsNewer .UpstreamDivergingInfo.CommitsBehind)}} +{{if and .UpstreamDivergingInfo .UpstreamDivergingInfo.BaseBranchHasNewCommits}} <div class="ui message flex-text-block"> <div class="tw-flex-1"> - {{$upstreamLink := printf "%s/src/branch/%s" .Repository.BaseRepo.Link (.BranchName|PathEscapeSegments)}} - {{$upstreamHtml := HTMLFormat `<a href="%s">%s:%s</a>` $upstreamLink .Repository.BaseRepo.FullName .BranchName}} - {{if .UpstreamDivergingInfo.CommitsBehind}} - {{ctx.Locale.TrN .UpstreamDivergingInfo.CommitsBehind "repo.pulls.upstream_diverging_prompt_behind_1" "repo.pulls.upstream_diverging_prompt_behind_n" .UpstreamDivergingInfo.CommitsBehind $upstreamHtml}} + {{$upstreamLink := printf "%s/src/branch/%s" .Repository.BaseRepo.Link (.UpstreamDivergingInfo.BaseBranchName|PathEscapeSegments)}} + {{$upstreamRepoBranchDisplay := HTMLFormat "%s:%s" .Repository.BaseRepo.FullName .UpstreamDivergingInfo.BaseBranchName}} + {{$thisRepoBranchDisplay := HTMLFormat "%s:%s" .Repository.FullName .BranchName}} + {{$upstreamHtml := HTMLFormat `<a href="%s">%s</a>` $upstreamLink $upstreamRepoBranchDisplay}} + {{if .UpstreamDivergingInfo.HeadBranchCommitsBehind}} + {{ctx.Locale.TrN .UpstreamDivergingInfo.HeadBranchCommitsBehind "repo.pulls.upstream_diverging_prompt_behind_1" "repo.pulls.upstream_diverging_prompt_behind_n" .UpstreamDivergingInfo.HeadBranchCommitsBehind $upstreamHtml}} {{else}} {{ctx.Locale.Tr "repo.pulls.upstream_diverging_prompt_base_newer" $upstreamHtml}} {{end}} </div> {{if .CanWriteCode}} - <button class="ui compact primary button tw-m-0 link-action" data-url="{{.Repository.Link}}/branches/merge-upstream?branch={{.BranchName}}"> + <button class="ui compact primary button tw-m-0 link-action" + data-modal-confirm-header="{{ctx.Locale.Tr "repo.pulls.upstream_diverging_merge"}}" + data-modal-confirm-content="{{ctx.Locale.Tr "repo.pulls.upstream_diverging_merge_confirm" $upstreamRepoBranchDisplay $thisRepoBranchDisplay}}" + data-url="{{.Repository.Link}}/branches/merge-upstream?branch={{.BranchName}}"> {{ctx.Locale.Tr "repo.pulls.upstream_diverging_merge"}} </button> {{end}} diff --git a/templates/repo/commit_page.tmpl b/templates/repo/commit_page.tmpl index 3d95e8a715..68ccf9d275 100644 --- a/templates/repo/commit_page.tmpl +++ b/templates/repo/commit_page.tmpl @@ -5,7 +5,7 @@ <div class="ui container fluid padded"> <div class="ui top attached header clearing segment tw-relative commit-header"> <div class="tw-flex tw-mb-4 tw-gap-1"> - <h3 class="tw-mb-0 tw-flex-1"><span class="commit-summary" title="{{.Commit.Summary}}">{{ctx.RenderUtils.RenderCommitMessage .Commit.Message ($.Repository.ComposeMetas ctx)}}</span>{{template "repo/commit_statuses" dict "Status" .CommitStatus "Statuses" .CommitStatuses}}</h3> + <h3 class="tw-mb-0 tw-flex-1"><span class="commit-summary" title="{{.Commit.Summary}}">{{ctx.RenderUtils.RenderCommitMessage .Commit.Message $.Repository}}</span>{{template "repo/commit_statuses" dict "Status" .CommitStatus "Statuses" .CommitStatuses "AdditionalClasses" "tw-inline"}}</h3> {{if not $.PageIsWiki}} <div class="commit-header-buttons"> <a class="ui primary tiny button" href="{{.SourcePath}}"> @@ -16,7 +16,7 @@ {{ctx.Locale.Tr "repo.commit.operations"}} {{svg "octicon-triangle-down" 14 "dropdown icon"}} <div class="menu"> - <div class="ui header">{{ctx.Locale.Tr "repo.commit.operations"}}</div> + <div class="header">{{ctx.Locale.Tr "repo.commit.operations"}}</div> <div class="divider"></div> <div class="item show-create-branch-modal" data-content="{{ctx.Locale.Tr "repo.branch.new_branch_from" (.CommitID)}}" {{/* used by the form */}} @@ -54,13 +54,11 @@ <p id="cherry-pick-content" class="branch-dropdown"></p> <form method="get"> - {{/*FIXME: CurrentRefShortName seems not making sense here (old code), - because the "commit page" has no "$.BranchName" info, so only using DefaultBranch should be enough */}} {{template "repo/branch_dropdown" dict "Repository" .Repository "ShowTabBranches" true "CurrentRefType" "branch" - "CurrentRefShortName" (or $.BranchName $.Repository.DefaultBranch) + "CurrentRefShortName" $.Repository.DefaultBranch "RefFormActionTemplate" (print "{RepoLink}/_cherrypick/" .CommitID "/{RefShortName}") }} <input type="hidden" id="cherry-pick-type" name="cherry-pick-type"><br> @@ -77,7 +75,7 @@ {{.CsrfTokenHtml}} <div class="field"> <label> - {{ctx.Locale.Tr "repo.branch.new_branch_from" (`<span class="text" id="modal-create-branch-from-span"></span>`|SafeHTML)}} + {{ctx.Locale.Tr "repo.branch.new_branch_from" (HTMLFormat `<span class="%s" id="%s"></span>` "text" "modal-create-branch-from-span")}} </label> </div> <div class="required field"> @@ -85,7 +83,7 @@ <input id="new_branch_name" name="new_branch_name" required> </div> - <div class="text right actions"> + <div class="actions"> <button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button> <button class="ui primary button">{{ctx.Locale.Tr "repo.branch.confirm_create_branch"}}</button> </div> @@ -102,7 +100,7 @@ <input type="hidden" name="create_tag" value="true"> <div class="field"> <label> - {{ctx.Locale.Tr "repo.tag.create_tag_from" (`<span class="text" id="modal-create-tag-from-span"></span>`|SafeHTML)}} + {{ctx.Locale.Tr "repo.tag.create_tag_from" (HTMLFormat `<span class="%s" id="%s"></span>` "text" "modal-create-tag-from-span")}} </label> </div> <div class="required field"> @@ -110,7 +108,7 @@ <input id="new_branch_name" name="new_branch_name" required> </div> - <div class="text right actions"> + <div class="actions"> <button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button> <button class="ui primary button">{{ctx.Locale.Tr "repo.tag.confirm_create_tag"}}</button> </div> @@ -124,7 +122,7 @@ {{end}} </div> {{if IsMultilineCommitMessage .Commit.Message}} - <pre class="commit-body">{{ctx.RenderUtils.RenderCommitBody .Commit.Message ($.Repository.ComposeMetas ctx)}}</pre> + <pre class="commit-body">{{ctx.RenderUtils.RenderCommitBody .Commit.Message $.Repository}}</pre> {{end}} {{template "repo/commit_load_branches_and_tags" .}} </div> @@ -149,7 +147,7 @@ <div class="flex-text-inline"> {{if or (ne .Commit.Committer.Name .Commit.Author.Name) (ne .Commit.Committer.Email .Commit.Author.Email)}} <span class="text grey">{{ctx.Locale.Tr "repo.diff.committed_by"}}</span> - {{if ne .Verification.CommittingUser.ID 0}} + {{if and .Verification.CommittingUser .Verification.CommittingUser.ID}} {{ctx.AvatarUtils.Avatar .Verification.CommittingUser 20}} <a href="{{.Verification.CommittingUser.HomeLink}}"><strong>{{.Commit.Committer.Name}}</strong></a> {{else}} diff --git a/templates/repo/commit_sign_badge.tmpl b/templates/repo/commit_sign_badge.tmpl index aa68e9dd23..02089d7a4c 100644 --- a/templates/repo/commit_sign_badge.tmpl +++ b/templates/repo/commit_sign_badge.tmpl @@ -38,6 +38,8 @@ so this template should be kept as small as possbile, DO NOT put large component {{- else -}} {{- if $verification.Warning -}} {{- $extraClass = print $extraClass " sign-warning" -}} + {{- else -}} + {{- $extraClass = "" -}}{{/* the commit is not signed */}} {{- end -}} {{- $msgReason = ctx.Locale.Tr $verification.Reason -}}{{- /* dirty part: it is the translation key ..... */ -}} {{- end -}} @@ -57,6 +59,7 @@ so this template should be kept as small as possbile, DO NOT put large component <a {{if $commitBaseLink}}href="{{$commitBaseLink}}/{{$commit.ID}}"{{end}} class="ui label commit-id-short {{$extraClass}}" rel="nofollow"> {{- ShortSha $commit.ID.String -}} {{- end -}} +{{- if or (not $commit) $extraClass}}{{/* only show the lock icon if there is no commit info (icon only) or the commit is really signed */}} <span class="ui label commit-sign-badge {{$extraClass}}"> {{- if $verified -}} {{- if and $signingUser $signingUser.ID -}} @@ -70,7 +73,7 @@ so this template should be kept as small as possbile, DO NOT put large component <span data-tooltip-content="{{$msgReason}}">{{svg "gitea-unlock"}}</span> {{- end -}} </span> - +{{- end -}} {{- if $commit -}} </a> {{- end -}} diff --git a/templates/repo/commit_status.tmpl b/templates/repo/commit_status.tmpl index eb700ab2bb..7184f5f8eb 100644 --- a/templates/repo/commit_status.tmpl +++ b/templates/repo/commit_status.tmpl @@ -14,3 +14,6 @@ {{if eq .State "warning"}} {{svg "gitea-exclamation" 18 "commit-status icon text yellow"}} {{end}} +{{if eq .State "skipped"}} + {{svg "octicon-skip" 18 "commit-status icon text grey"}} +{{end}} diff --git a/templates/repo/commit_statuses.tmpl b/templates/repo/commit_statuses.tmpl index a6f75584a3..1bbfb33105 100644 --- a/templates/repo/commit_statuses.tmpl +++ b/templates/repo/commit_statuses.tmpl @@ -1,10 +1,10 @@ {{if .Statuses}} {{if and (eq (len .Statuses) 1) .Status.TargetURL}} - <a class="flex-text-inline tw-no-underline {{.AdditionalClasses}}" data-tippy="commit-statuses" href="{{.Status.TargetURL}}"> + <a class="flex-text-inline tw-no-underline {{.AdditionalClasses}}" data-global-init="initCommitStatuses" href="{{.Status.TargetURL}}"> {{template "repo/commit_status" .Status}} </a> {{else}} - <span class="flex-text-inline {{.AdditionalClasses}}" data-tippy="commit-statuses" tabindex="0"> + <span class="flex-text-inline {{.AdditionalClasses}}" data-global-init="initCommitStatuses" tabindex="0"> {{template "repo/commit_status" .Status}} </span> {{end}} diff --git a/templates/repo/commits.tmpl b/templates/repo/commits.tmpl index 7065bf33f4..07c6b5f618 100644 --- a/templates/repo/commits.tmpl +++ b/templates/repo/commits.tmpl @@ -5,24 +5,17 @@ {{template "repo/sub_menu" .}} <div class="repo-button-row"> <div class="repo-button-row-left"> - - {{$branchDropdownCurrentRefType := "branch"}} - {{$branchDropdownCurrentRefShortName := .BranchName}} - {{if .IsViewTag}} - {{$branchDropdownCurrentRefType = "tag"}} - {{$branchDropdownCurrentRefShortName = .TagName}} - {{end}} - {{template "repo/branch_dropdown" dict + {{- /* for /owner/repo/commits/{RefType}/{RefShortName} */ -}} + {{- template "repo/branch_dropdown" dict "Repository" .Repository "ShowTabBranches" true "ShowTabTags" true - "CurrentRefType" $branchDropdownCurrentRefType - "CurrentRefShortName" $branchDropdownCurrentRefShortName + "CurrentRefType" .RefFullName.RefType + "CurrentRefShortName" .RefFullName.ShortName "CurrentTreePath" .TreePath "RefLinkTemplate" "{RepoLink}/commits/{RefType}/{RefShortName}/{TreePath}" "AllowCreateNewRef" .CanCreateBranch - }} - + -}} <a href="{{.RepoLink}}/graph" class="ui basic small compact button"> {{svg "octicon-git-branch"}} {{ctx.Locale.Tr "repo.commit_graph"}} diff --git a/templates/repo/commits_list.tmpl b/templates/repo/commits_list.tmpl index 329dc45149..959f2a9398 100644 --- a/templates/repo/commits_list.tmpl +++ b/templates/repo/commits_list.tmpl @@ -5,7 +5,7 @@ <th class="three wide">{{ctx.Locale.Tr "repo.commits.author"}}</th> <th class="two wide sha">{{StringUtils.ToUpper $.Repository.ObjectFormatName}}</th> <th class="eight wide message">{{ctx.Locale.Tr "repo.commits.message"}}</th> - <th class="two wide right aligned">{{ctx.Locale.Tr "repo.commits.date"}}</th> + <th class="two wide tw-text-right">{{ctx.Locale.Tr "repo.commits.date"}}</th> <th class="one wide"></th> </tr> </thead> @@ -44,33 +44,42 @@ <span class="commit-summary {{if gt .ParentCount 1}} grey text{{end}}" title="{{.Summary}}">{{.Summary | ctx.RenderUtils.RenderEmoji}}</span> {{else}} {{$commitLink:= printf "%s/commit/%s" $commitRepoLink (PathEscape .ID.String)}} - <span class="commit-summary {{if gt .ParentCount 1}} grey text{{end}}" title="{{.Summary}}">{{ctx.RenderUtils.RenderCommitMessageLinkSubject .Message $commitLink ($.Repository.ComposeMetas ctx)}}</span> + <span class="commit-summary {{if gt .ParentCount 1}} grey text{{end}}" title="{{.Summary}}">{{ctx.RenderUtils.RenderCommitMessageLinkSubject .Message $commitLink $.Repository}}</span> {{end}} </span> {{if IsMultilineCommitMessage .Message}} - <button class="ui button js-toggle-commit-body ellipsis-button" aria-expanded="false">...</button> + <button class="ui button ellipsis-button" aria-expanded="false" data-global-click="onRepoEllipsisButtonClick">...</button> {{end}} {{template "repo/commit_statuses" dict "Status" .Status "Statuses" .Statuses}} {{if IsMultilineCommitMessage .Message}} - <pre class="commit-body tw-hidden">{{ctx.RenderUtils.RenderCommitBody .Message ($.Repository.ComposeMetas ctx)}}</pre> + <pre class="commit-body tw-hidden">{{ctx.RenderUtils.RenderCommitBody .Message $.Repository}}</pre> {{end}} {{if $.CommitsTagsMap}} {{range (index $.CommitsTagsMap .ID.String)}} - {{- template "repo/tag/name" dict "RepoLink" $.Repository.Link "TagName" .TagName "IsRelease" (not .IsTag) -}} + {{- template "repo/tag/name" dict "AdditionalClasses" "tw-py-0" "RepoLink" $.Repository.Link "TagName" .TagName "IsRelease" (not .IsTag) -}} {{end}} {{end}} </td> {{if .Committer}} - <td class="text right aligned">{{DateUtils.TimeSince .Committer.When}}</td> + <td class="tw-text-right">{{DateUtils.TimeSince .Committer.When}}</td> {{else}} - <td class="text right aligned">{{DateUtils.TimeSince .Author.When}}</td> + <td class="tw-text-right">{{DateUtils.TimeSince .Author.When}}</td> {{end}} - <td class="text right aligned tw-py-0"> - <button class="btn interact-bg tw-p-2" data-tooltip-content="{{ctx.Locale.Tr "copy_hash"}}" data-clipboard-text="{{.ID}}">{{svg "octicon-copy"}}</button> - {{if not $.PageIsWiki}}{{/* at the moment, wiki doesn't support "view at history point*/}} + <td class="tw-text-right tw-py-0"> + <button class="btn interact-bg tw-p-2 copy-commit-id" data-tooltip-content="{{ctx.Locale.Tr "copy_hash"}}" data-clipboard-text="{{.ID}}">{{svg "octicon-copy"}}</button> + {{/* at the moment, wiki doesn't support these "view" links like "view at history point" */}} + {{if not $.PageIsWiki}} + {{/* view single file diff */}} + {{if $.FileTreePath}} + <a class="btn interact-bg tw-p-2 view-single-diff" data-tooltip-content="{{ctx.Locale.Tr "repo.commits.view_file_diff"}}" + href="{{$commitRepoLink}}/commit/{{.ID.String}}?files={{$.FileTreePath}}" + >{{svg "octicon-file-diff"}}</a> + {{end}} + + {{/* view at history point */}} {{$viewCommitLink := printf "%s/src/commit/%s" $commitRepoLink (PathEscape .ID.String)}} - {{if $.FileName}}{{$viewCommitLink = printf "%s/%s" $viewCommitLink (PathEscapeSegments $.FileName)}}{{end}} - <a class="btn interact-bg tw-p-2" data-tooltip-content="{{ctx.Locale.Tr "repo.commits.view_path"}}" href="{{$viewCommitLink}}">{{svg "octicon-file-code"}}</a> + {{if $.FileTreePath}}{{$viewCommitLink = printf "%s/%s" $viewCommitLink (PathEscapeSegments $.FileTreePath)}}{{end}} + <a class="btn interact-bg tw-p-2 view-commit-path" data-tooltip-content="{{ctx.Locale.Tr "repo.commits.view_path"}}" href="{{$viewCommitLink}}">{{svg "octicon-file-code"}}</a> {{end}} </td> </tr> diff --git a/templates/repo/commits_list_small.tmpl b/templates/repo/commits_list_small.tmpl index 2acf7c58b8..ee94ad7e58 100644 --- a/templates/repo/commits_list_small.tmpl +++ b/templates/repo/commits_list_small.tmpl @@ -15,7 +15,7 @@ {{$commitLink:= printf "%s/%s" $commitBaseLink (PathEscape .ID.String)}} <span class="tw-flex-1 tw-font-mono gt-ellipsis" title="{{.Summary}}"> - {{- ctx.RenderUtils.RenderCommitMessageLinkSubject .Message $commitLink ($.comment.Issue.PullRequest.BaseRepo.ComposeMetas ctx) -}} + {{- ctx.RenderUtils.RenderCommitMessageLinkSubject .Message $commitLink $.comment.Issue.PullRequest.BaseRepo -}} </span> {{if IsMultilineCommitMessage .Message}} @@ -29,7 +29,7 @@ </div> {{if IsMultilineCommitMessage .Message}} <pre class="commit-body tw-ml-[33px] tw-hidden" data-singular-commit-body-for="{{$tag}}"> - {{- ctx.RenderUtils.RenderCommitBody .Message ($.comment.Issue.PullRequest.BaseRepo.ComposeMetas ctx) -}} + {{- ctx.RenderUtils.RenderCommitBody .Message $.comment.Issue.PullRequest.BaseRepo -}} </pre> {{end}} {{end}} diff --git a/templates/repo/commits_table.tmpl b/templates/repo/commits_table.tmpl index 91fc1c2fae..a0c5eacdd4 100644 --- a/templates/repo/commits_table.tmpl +++ b/templates/repo/commits_table.tmpl @@ -19,7 +19,7 @@ {{if .PageIsCommits}} <div class="ui attached segment"> - <form class="ignore-dirty" action="{{.RepoLink}}/commits/{{.BranchNameSubURL}}/search"> + <form class="ignore-dirty" action="{{.RepoLink}}/commits/{{.RefTypeNameSubURL}}/search"> <div class="ui small fluid action input"> {{template "shared/search/input" dict "Value" .Keyword "Placeholder" (ctx.Locale.Tr "search.commit_kind")}} {{template "repo/commits_search_dropdown" .}} diff --git a/templates/repo/create.tmpl b/templates/repo/create.tmpl index 78eb2f704a..ada7e0c092 100644 --- a/templates/repo/create.tmpl +++ b/templates/repo/create.tmpl @@ -1,222 +1,217 @@ {{template "base/head" .}} <div role="main" aria-label="{{.Title}}" class="page-content repository new-repo"> - <div class="ui middle very relaxed page one column grid"> - <div class="column"> - <form class="ui form new-repo-form" action="{{.Link}}" method="post"> + <div class="ui container medium-width"> + <h3 class="ui top attached header"> + {{ctx.Locale.Tr "new_repo"}} + </h3> + <div class="ui attached segment"> + {{template "base/alert" .}} + {{template "repo/create_helper" .}} + <form class="ui form left-right-form new-repo-form" action="{{.Link}}" method="post"> {{.CsrfTokenHtml}} - <h3 class="ui top attached header"> - {{ctx.Locale.Tr "new_repo"}} - </h3> - <div class="ui attached segment"> - {{template "base/alert" .}} - {{template "repo/create_helper" .}} - - {{if not .CanCreateRepo}} - <div class="ui negative message"> - <p>{{ctx.Locale.TrN .MaxCreationLimit "repo.form.reach_limit_of_creation_1" "repo.form.reach_limit_of_creation_n" .MaxCreationLimit}}</p> - </div> - {{end}} - <div class="inline required field {{if .Err_Owner}}error{{end}}"> - <label>{{ctx.Locale.Tr "repo.owner"}}</label> - <div class="ui selection owner dropdown"> - <input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required> - <span class="text truncated-item-container" title="{{.ContextUser.Name}}"> - {{ctx.AvatarUtils.Avatar .ContextUser 28 "mini"}} - <span class="truncated-item-name">{{.ContextUser.ShortName 40}}</span> - </span> - {{svg "octicon-triangle-down" 14 "dropdown icon"}} - <div class="menu"> - <div class="item truncated-item-container" data-value="{{.SignedUser.ID}}" title="{{.SignedUser.Name}}"> - {{ctx.AvatarUtils.Avatar .SignedUser 28 "mini"}} - <span class="truncated-item-name">{{.SignedUser.ShortName 40}}</span> - </div> - {{range .Orgs}} - <div class="item truncated-item-container" data-value="{{.ID}}" title="{{.Name}}"> - {{ctx.AvatarUtils.Avatar . 28 "mini"}} - <span class="truncated-item-name">{{.ShortName 40}}</span> - </div> + <div id="create-repo-error-message" class="ui negative message tw-text-center tw-hidden"></div> + <div class="inline required field {{if .Err_Owner}}error{{end}}"> + <label>{{ctx.Locale.Tr "repo.owner"}}</label> + <div class="ui selection dropdown ellipsis-text-items" id="repo_owner_dropdown"> + <input type="hidden" name="uid" value="{{.ContextUser.ID}}"> + <span class="text"></span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + <div class="item" data-value="{{.SignedUser.ID}}" title="{{.SignedUser.Name}}" + {{if not .CanCreateRepoInDoer}} + data-create-repo-disallowed-prompt="{{ctx.Locale.TrN .MaxCreationLimit "repo.form.reach_limit_of_creation_1" "repo.form.reach_limit_of_creation_n" .MaxCreationLimitOfDoer}}" {{end}} - </div> + > + {{ctx.AvatarUtils.Avatar .SignedUser 28 "mini"}} + {{.SignedUser.ShortName 40}} + </div> + {{range .Orgs}} + <div class="item" data-value="{{.ID}}" title="{{.Name}}"> + {{ctx.AvatarUtils.Avatar . 28 "mini"}} + {{.ShortName 40}} + </div> + {{end}} </div> - <span class="help">{{ctx.Locale.Tr "repo.owner_helper"}}</span> </div> + <span class="help">{{ctx.Locale.Tr "repo.owner_helper"}}</span> + </div> + + <div class="inline required field {{if .Err_RepoName}}error{{end}}"> + <label for="repo_name">{{ctx.Locale.Tr "repo.repo_name"}}</label> + <input id="repo_name" name="repo_name" value="{{.repo_name}}" autofocus required maxlength="100"> + <span class="help" data-help-for-repo-name>{{ctx.Locale.Tr "repo.repo_name_helper"}}</span> + <span class="help tw-hidden" data-help-for-repo-name=".profile">{{ctx.Locale.Tr "repo.repo_name_profile_public_hint"}}</span> + <span class="help tw-hidden" data-help-for-repo-name=".profile-private">{{ctx.Locale.Tr "repo.repo_name_profile_private_hint"}}</span> + </div> - <div class="inline required field {{if .Err_RepoName}}error{{end}}"> - <label for="repo_name">{{ctx.Locale.Tr "repo.repo_name"}}</label> - <input id="repo_name" name="repo_name" value="{{.repo_name}}" autofocus required maxlength="100"> - <span class="help" data-help-for-repo-name>{{ctx.Locale.Tr "repo.repo_name_helper"}}</span> - <span class="help tw-hidden" data-help-for-repo-name=".profile">{{ctx.Locale.Tr "repo.repo_name_profile_public_hint"}}</span> - <span class="help tw-hidden" data-help-for-repo-name=".profile-private">{{ctx.Locale.Tr "repo.repo_name_profile_private_hint"}}</span> + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.visibility"}}</label> + <div class="ui checkbox"> + {{if .IsForcedPrivate}} + <input name="private" type="checkbox" checked disabled> + <label>{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</label> + {{else}} + <input name="private" type="checkbox" {{if .private}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> + {{end}} </div> + <span class="help">{{ctx.Locale.Tr "repo.visibility_description"}}</span> + </div> + <div class="inline field {{if .Err_Description}}error{{end}}"> + <label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label> + <textarea id="description" rows="2" name="description" placeholder="{{ctx.Locale.Tr "repo.repo_desc_helper"}}" maxlength="2048">{{.description}}</textarea> + </div> + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.template"}}</label> + <div id="repo_template_search" class="ui search selection dropdown"> + <input type="hidden" id="repo_template" name="repo_template" value="{{or .repo_template ""}}"> + <div class="default text">{{.repo_template_name}}</div> + <div class="menu"> + </div> + </div> + </div> + <div id="template_units" class="tw-hidden"> <div class="inline field"> - <label>{{ctx.Locale.Tr "repo.visibility"}}</label> + <label>{{ctx.Locale.Tr "repo.template.items"}}</label> <div class="ui checkbox"> - {{if .IsForcedPrivate}} - <input name="private" type="checkbox" checked disabled> - <label>{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</label> - {{else}} - <input name="private" type="checkbox" {{if .private}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> - {{end}} + <input name="git_content" type="checkbox" {{if .git_content}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.template.git_content"}}</label> + </div> + <div class="ui checkbox" {{if not .SignedUser.CanEditGitHook}}data-tooltip-content="{{ctx.Locale.Tr "repo.template.git_hooks_tooltip"}}"{{end}}> + <input name="git_hooks" type="checkbox" {{if .git_hooks}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.template.git_hooks"}}</label> </div> - <span class="help">{{ctx.Locale.Tr "repo.visibility_description"}}</span> - </div> - <div class="inline field {{if .Err_Description}}error{{end}}"> - <label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label> - <textarea id="description" rows="2" name="description" placeholder="{{ctx.Locale.Tr "repo.repo_desc_helper"}}" maxlength="2048">{{.description}}</textarea> </div> <div class="inline field"> - <label>{{ctx.Locale.Tr "repo.template"}}</label> - <div id="repo_template_search" class="ui search selection dropdown"> - <input type="hidden" id="repo_template" name="repo_template" value="{{.repo_template}}"> - <div class="default text">{{.repo_template_name}}</div> - <div class="menu"> - </div> + <label></label> + <div class="ui checkbox"> + <input name="webhooks" type="checkbox" {{if .webhooks}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.template.webhooks"}}</label> </div> - </div> - - <div id="template_units" class="tw-hidden"> - <div class="inline field"> - <label>{{ctx.Locale.Tr "repo.template.items"}}</label> - <div class="ui checkbox"> - <input name="git_content" type="checkbox" {{if .git_content}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.template.git_content"}}</label> - </div> - <div class="ui checkbox" {{if not .SignedUser.CanEditGitHook}}data-tooltip-content="{{ctx.Locale.Tr "repo.template.git_hooks_tooltip"}}"{{end}}> - <input name="git_hooks" type="checkbox" {{if .git_hooks}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.template.git_hooks"}}</label> - </div> + <div class="ui checkbox"> + <input name="topics" type="checkbox" {{if .topics}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.template.topics"}}</label> </div> - <div class="inline field"> - <label></label> - <div class="ui checkbox"> - <input name="webhooks" type="checkbox" {{if .webhooks}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.template.webhooks"}}</label> - </div> - <div class="ui checkbox"> - <input name="topics" type="checkbox" {{if .topics}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.template.topics"}}</label> - </div> + </div> + <div class="inline field"> + <label></label> + <div class="ui checkbox"> + <input name="avatar" type="checkbox" {{if .avatar}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.template.avatar"}}</label> </div> - <div class="inline field"> - <label></label> - <div class="ui checkbox"> - <input name="avatar" type="checkbox" {{if .avatar}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.template.avatar"}}</label> - </div> - <div class="ui checkbox"> - <input name="labels" type="checkbox" {{if .labels}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.template.issue_labels"}}</label> - </div> + <div class="ui checkbox"> + <input name="labels" type="checkbox" {{if .labels}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.template.issue_labels"}}</label> </div> - <div class="inline field"> - <label></label> - <div class="ui checkbox"> - <input name="protected_branch" type="checkbox" {{if .protected_branch}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.settings.protected_branch"}}</label> - </div> + </div> + <div class="inline field"> + <label></label> + <div class="ui checkbox"> + <input name="protected_branch" type="checkbox" {{if .protected_branch}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.protected_branch"}}</label> </div> </div> + </div> - <div id="non_template"> - <div class="inline field"> - <label>{{ctx.Locale.Tr "repo.issue_labels"}}</label> - <div class="ui search selection dropdown"> - <input type="hidden" name="issue_labels" value="{{.issueLabels}}"> - <div class="default text">{{ctx.Locale.Tr "repo.issue_labels_helper"}}</div> - <div class="menu"> - <div class="item" data-value="">{{ctx.Locale.Tr "repo.issue_labels_helper"}}</div> - {{range .LabelTemplateFiles}} - <div class="item" data-value="{{.DisplayName}}">{{.DisplayName}}<br><i>({{.Description}})</i></div> - {{end}} - </div> + <div id="non_template"> + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.issue_labels"}}</label> + <div class="ui search selection dropdown"> + <input type="hidden" name="issue_labels" value="{{.issueLabels}}"> + <div class="default text">{{ctx.Locale.Tr "repo.issue_labels_helper"}}</div> + <div class="menu"> + <div class="item" data-value="">{{ctx.Locale.Tr "repo.issue_labels_helper"}}</div> + {{range .LabelTemplateFiles}} + <div class="item" data-value="{{.DisplayName}}">{{.DisplayName}}<br><i>({{.Description}})</i></div> + {{end}} </div> </div> + </div> - <div class="divider"></div> + <div class="divider"></div> - <div class="inline field"> - <label>.gitignore</label> - <div class="ui multiple search selection dropdown"> - <input type="hidden" name="gitignores" value="{{.gitignores}}"> - <div class="default text">{{ctx.Locale.Tr "repo.repo_gitignore_helper"}}</div> - <div class="menu"> - {{range .Gitignores}} - <div class="item" data-value="{{.}}">{{.}}</div> - {{end}} - </div> - </div> - <span class="help">{{ctx.Locale.Tr "repo.repo_gitignore_helper_desc"}}</span> - </div> - <div class="inline field"> - <label>{{ctx.Locale.Tr "repo.license"}}</label> - <div class="ui search selection dropdown"> - <input type="hidden" name="license" value="{{.license}}"> - <div class="default text">{{ctx.Locale.Tr "repo.license_helper"}}</div> - <div class="menu"> - <div class="item" data-value="">{{ctx.Locale.Tr "repo.license_helper"}}</div> - {{range .Licenses}} - <div class="item" data-value="{{.}}">{{.}}</div> - {{end}} - </div> + <div class="inline field"> + <label>.gitignore</label> + <div class="ui multiple search selection dropdown"> + <input type="hidden" name="gitignores" value="{{.gitignores}}"> + <div class="default text">{{ctx.Locale.Tr "repo.repo_gitignore_helper"}}</div> + <div class="menu"> + {{range .Gitignores}} + <div class="item" data-value="{{.}}">{{.}}</div> + {{end}} </div> - <span class="help">{{ctx.Locale.Tr "repo.license_helper_desc" "https://choosealicense.com/"}}</span> </div> - - <div class="inline field"> - <label>{{ctx.Locale.Tr "repo.readme"}}</label> - <div class="ui selection dropdown"> - <input type="hidden" name="readme" value="{{.readme}}"> - <div class="default text">{{ctx.Locale.Tr "repo.readme_helper"}}</div> - <div class="menu"> - {{range .Readmes}} - <div class="item" data-value="{{.}}">{{.}}</div> - {{end}} - </div> + <span class="help">{{ctx.Locale.Tr "repo.repo_gitignore_helper_desc"}}</span> + </div> + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.license"}}</label> + <div class="ui search selection dropdown"> + <input type="hidden" name="license" value="{{.license}}"> + <div class="default text">{{ctx.Locale.Tr "repo.license_helper"}}</div> + <div class="menu"> + <div class="item" data-value="">{{ctx.Locale.Tr "repo.license_helper"}}</div> + {{range .Licenses}} + <div class="item" data-value="{{.}}">{{.}}</div> + {{end}} </div> - <span class="help">{{ctx.Locale.Tr "repo.readme_helper_desc"}}</span> </div> - <div class="inline field"> - <div class="ui checkbox" id="auto-init"> - <input name="auto_init" type="checkbox" {{if .auto_init}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.auto_init"}}</label> + <span class="help">{{ctx.Locale.Tr "repo.license_helper_desc" "https://choosealicense.com/"}}</span> + </div> + + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.readme"}}</label> + <div class="ui selection dropdown"> + <input type="hidden" name="readme" value="{{.readme}}"> + <div class="default text">{{ctx.Locale.Tr "repo.readme_helper"}}</div> + <div class="menu"> + {{range .Readmes}} + <div class="item" data-value="{{.}}">{{.}}</div> + {{end}} </div> </div> - <div class="inline field"> - <label for="default_branch">{{ctx.Locale.Tr "repo.default_branch"}}</label> - <input id="default_branch" name="default_branch" value="{{.default_branch}}" placeholder="{{.default_branch}}"> - <span class="help">{{ctx.Locale.Tr "repo.default_branch_helper"}}</span> - </div> - <div class="inline field"> - <label>{{ctx.Locale.Tr "repo.object_format"}}</label> - <div class="ui selection owner dropdown"> - <input type="hidden" id="object_format_name" name="object_format_name" value="{{.DefaultObjectFormat.Name}}" required> - <div class="default text">{{.DefaultObjectFormat.Name}}</div> - <div class="menu"> - {{range .SupportedObjectFormats}} - <div class="item" data-value="{{.Name}}">{{.Name}}</div> - {{end}} - </div> - </div> - <span class="help">{{ctx.Locale.Tr "repo.object_format_helper"}}</span> + <span class="help">{{ctx.Locale.Tr "repo.readme_helper_desc"}}</span> + </div> + <div class="inline field"> + <label></label> + <div class="ui checkbox" id="auto-init"> + <input name="auto_init" type="checkbox" {{if .auto_init}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.auto_init"}}</label> </div> - <div class="inline field"> - <label>{{ctx.Locale.Tr "repo.template"}}</label> - <div class="ui checkbox"> - <input name="template" type="checkbox"> - <label>{{ctx.Locale.Tr "repo.template_helper"}}</label> + </div> + <div class="inline field"> + <label for="default_branch">{{ctx.Locale.Tr "repo.default_branch"}}</label> + <input id="default_branch" name="default_branch" value="{{.default_branch}}" placeholder="{{.default_branch}}"> + <span class="help">{{ctx.Locale.Tr "repo.default_branch_helper"}}</span> + </div> + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.object_format"}}</label> + <div class="ui selection owner dropdown"> + <input type="hidden" id="object_format_name" name="object_format_name" value="{{or .object_format_name .DefaultObjectFormat.Name}}" required> + <div class="default text">{{.DefaultObjectFormat.Name}}</div> + <div class="menu"> + {{range .SupportedObjectFormats}} + <div class="item" data-value="{{.Name}}">{{.Name}}</div> + {{end}} </div> </div> + <span class="help">{{ctx.Locale.Tr "repo.object_format_helper"}}</span> </div> - <br> <div class="inline field"> - <label></label> - <button class="ui primary button{{if not .CanCreateRepo}} disabled{{end}}"> - {{ctx.Locale.Tr "repo.create_repo"}} - </button> + <label>{{ctx.Locale.Tr "repo.template"}}</label> + <div class="ui checkbox"> + <input name="template" type="checkbox"> + <label>{{ctx.Locale.Tr "repo.template_helper"}}</label> + </div> </div> </div> + <br> + <div class="inline field"> + <label></label> + <button class="ui primary button"> + {{ctx.Locale.Tr "repo.create_repo"}} + </button> + </div> </form> </div> </div> diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl index 9733e5f980..22abf9a219 100644 --- a/templates/repo/diff/box.tmpl +++ b/templates/repo/diff/box.tmpl @@ -1,6 +1,6 @@ -{{$showFileTree := (and (not .DiffNotAvailable) (gt .Diff.NumFiles 1))}} +{{$showFileTree := (and (not .DiffNotAvailable) (gt .DiffShortStat.NumFiles 1))}} <div> - <div class="diff-detail-box diff-box"> + <div class="diff-detail-box"> <div class="tw-flex tw-items-center tw-flex-wrap tw-gap-2 tw-ml-0.5"> {{if $showFileTree}} <button class="diff-toggle-file-tree-button not-mobile btn interact-fg" data-show-text="{{ctx.Locale.Tr "repo.diff.show_file_tree"}}" data-hide-text="{{ctx.Locale.Tr "repo.diff.hide_file_tree"}}"> @@ -19,17 +19,17 @@ {{end}} {{if not .DiffNotAvailable}} <div class="diff-detail-stats tw-flex tw-items-center tw-flex-wrap"> - {{svg "octicon-diff" 16 "tw-mr-1"}}{{ctx.Locale.Tr "repo.diff.stats_desc" .Diff.NumFiles .Diff.TotalAddition .Diff.TotalDeletion}} + {{svg "octicon-diff" 16 "tw-mr-1"}}{{ctx.Locale.Tr "repo.diff.stats_desc" .DiffShortStat.NumFiles .DiffShortStat.TotalAddition .DiffShortStat.TotalDeletion}} </div> {{end}} </div> <div class="diff-detail-actions"> - {{if and .PageIsPullFiles $.SignedUserID (not .IsArchived) (not .DiffNotAvailable)}} + {{if and .PageIsPullFiles $.SignedUserID (not .DiffNotAvailable)}} <div class="not-mobile tw-flex tw-items-center tw-flex-col tw-whitespace-nowrap tw-mr-1"> <label for="viewed-files-summary" id="viewed-files-summary-label" data-text-changed-template="{{ctx.Locale.Tr "repo.pulls.viewed_files_label"}}"> - {{ctx.Locale.Tr "repo.pulls.viewed_files_label" .Diff.NumViewedFiles .Diff.NumFiles}} + {{ctx.Locale.Tr "repo.pulls.viewed_files_label" .Diff.NumViewedFiles .DiffShortStat.NumFiles}} </label> - <progress id="viewed-files-summary" value="{{.Diff.NumViewedFiles}}" max="{{.Diff.NumFiles}}"></progress> + <progress id="viewed-files-summary" value="{{.Diff.NumViewedFiles}}" max="{{.DiffShortStat.NumFiles}}"></progress> </div> {{end}} {{template "repo/diff/whitespace_dropdown" .}} @@ -37,12 +37,12 @@ {{if .PageIsPullFiles}} <div id="diff-commit-select" data-issuelink="{{$.Issue.Link}}" data-queryparams="?style={{if $.IsSplitStyle}}split{{else}}unified{{end}}&whitespace={{$.WhitespaceBehavior}}&show-outdated={{$.ShowOutdatedComments}}" data-filter_changes_by_commit="{{ctx.Locale.Tr "repo.pulls.filter_changes_by_commit"}}"> {{/* the following will be replaced by vue component, but this avoids any loading artifacts till the vue component is initialized */}} - <div class="ui jump dropdown basic button custom"> + <div class="ui jump dropdown tiny basic button custom"> {{svg "octicon-git-commit"}} </div> </div> {{end}} - {{if and .PageIsPullFiles $.SignedUserID (not .IsArchived)}} + {{if and .PageIsPullFiles $.SignedUserID}} {{template "repo/diff/new_review" .}} {{end}} </div> @@ -57,35 +57,10 @@ <div>{{ctx.Locale.Tr "repo.pulls.showing_specified_commit_range" (ShortSha .BeforeCommitID) (ShortSha .AfterCommitID)}} - <a href="{{$.Issue.Link}}/files?style={{if $.IsSplitStyle}}split{{else}}unified{{end}}&whitespace={{$.WhitespaceBehavior}}&show-outdated={{$.ShowOutdatedComments}}">{{ctx.Locale.Tr "repo.pulls.show_all_commits"}}</a></div> </div> {{end}} - <script id="diff-data-script" type="module"> - const diffDataFiles = [{{range $i, $file := .Diff.Files}}{Name:"{{$file.Name}}",NameHash:"{{$file.NameHash}}",Type:{{$file.Type}},IsBin:{{$file.IsBin}},Addition:{{$file.Addition}},Deletion:{{$file.Deletion}},IsViewed:{{$file.IsViewed}}},{{end}}]; - const diffData = { - isIncomplete: {{.Diff.IsIncomplete}}, - tooManyFilesMessage: "{{ctx.Locale.Tr "repo.diff.too_many_files"}}", - binaryFileMessage: "{{ctx.Locale.Tr "repo.diff.bin"}}", - showMoreMessage: "{{ctx.Locale.Tr "repo.diff.show_more"}}", - statisticsMessage: "{{ctx.Locale.Tr "repo.diff.stats_desc_file"}}", - linkLoadMore: "?skip-to={{.Diff.End}}&file-only=true", - }; - - // for first time loading, the diffFileInfo is a plain object - // after the Vue component is mounted, the diffFileInfo is a reactive object - // keep in mind that this script block would be executed many times when loading more files, by "loadMoreFiles" - let diffFileInfo = window.config.pageData.diffFileInfo || { - files:[], - fileTreeIsVisible: false, - fileListIsVisible: false, - isLoadingNewData: false, - selectedItem: '', - }; - diffFileInfo = Object.assign(diffFileInfo, diffData); - diffFileInfo.files.push(...diffDataFiles); - window.config.pageData.diffFileInfo = diffFileInfo; - </script> - <div id="diff-file-list"></div> {{end}} <div id="diff-container"> {{if $showFileTree}} + {{$.FileIconPoolHTML}} <div id="diff-file-tree" class="tw-hidden not-mobile"></div> <script> if (diffTreeVisible) document.getElementById('diff-file-tree').classList.remove('tw-hidden'); @@ -105,8 +80,8 @@ {{$isCsv := (call $.IsCsvFile $file)}} {{$showFileViewToggle := or $isImage (and (not $file.IsIncomplete) $isCsv)}} {{$isExpandable := or (gt $file.Addition 0) (gt $file.Deletion 0) $file.IsBin}} - {{$isReviewFile := and $.IsSigned $.PageIsPullFiles (not $.IsArchived) $.IsShowingAllCommits}} - <div class="diff-file-box diff-box file-content {{TabSizeClass $.Editorconfig $file.Name}} tw-mt-0" id="diff-{{$file.NameHash}}" data-old-filename="{{$file.OldName}}" data-new-filename="{{$file.Name}}" {{if or ($file.ShouldBeHidden) (not $isExpandable)}}data-folded="true"{{end}}> + {{$isReviewFile := and $.IsSigned $.PageIsPullFiles (not $.Repository.IsArchived) $.IsShowingAllCommits}} + <div class="diff-file-box file-content {{TabSizeClass $.Editorconfig $file.Name}} tw-mt-0" id="diff-{{$file.NameHash}}" data-old-filename="{{$file.OldName}}" data-new-filename="{{$file.Name}}" {{if or ($file.ShouldBeHidden) (not $isExpandable)}}data-folded="true"{{end}}> <h4 class="diff-file-header sticky-2nd-row ui top attached header"> <div class="diff-file-name tw-flex tw-flex-1 tw-items-center tw-gap-1 tw-flex-wrap"> <button class="fold-file btn interact-bg tw-p-1{{if not $isExpandable}} tw-invisible{{end}}"> @@ -126,8 +101,8 @@ {{end}} </div> <span class="file tw-flex tw-items-center tw-font-mono tw-flex-1"><a class="muted file-link" title="{{if $file.IsRenamed}}{{$file.OldName}} → {{end}}{{$file.Name}}" href="#diff-{{$file.NameHash}}">{{if $file.IsRenamed}}{{$file.OldName}} → {{end}}{{$file.Name}}</a> - {{if .IsLFSFile}} ({{ctx.Locale.Tr "repo.stored_lfs"}}){{end}} <button class="btn interact-fg tw-p-2" data-clipboard-text="{{$file.Name}}" data-tooltip-content="{{ctx.Locale.Tr "copy_path"}}">{{svg "octicon-copy" 14}}</button> + {{if .IsLFSFile}}<span class="ui label">LFS</span>{{end}} {{if $file.IsGenerated}} <span class="ui label">{{ctx.Locale.Tr "repo.diff.generated"}}</span> {{end}} @@ -161,23 +136,25 @@ <input type="checkbox" name="{{$file.GetDiffFileName}}" autocomplete="off"{{if $file.IsViewed}} checked{{end}}> {{ctx.Locale.Tr "repo.pulls.has_viewed_file"}} </label> {{end}} - <button class="btn diff-header-popup-btn tw-p-1">{{svg "octicon-kebab-horizontal" 18}}</button> - <div class="tippy-target"> - {{if not (or $file.IsIncomplete $file.IsBin $file.IsSubmodule)}} - <button class="unescape-button item" data-unicode-content-selector="#diff-{{$file.NameHash}}">{{ctx.Locale.Tr "repo.unescape_control_characters"}}</button> - <button class="escape-button tw-hidden item" data-unicode-content-selector="#diff-{{$file.NameHash}}">{{ctx.Locale.Tr "repo.escape_control_characters"}}</button> - {{end}} - {{if and (not $file.IsSubmodule) (not $.PageIsWiki)}} - {{if $file.IsDeleted}} - <a class="item" rel="nofollow" href="{{$.BeforeSourcePath}}/{{PathEscapeSegments .Name}}">{{ctx.Locale.Tr "repo.diff.view_file"}}</a> - {{else}} - <a class="item" rel="nofollow" href="{{$.SourcePath}}/{{PathEscapeSegments .Name}}">{{ctx.Locale.Tr "repo.diff.view_file"}}</a> - {{if and $.Repository.CanEnableEditor $.CanEditFile (not $file.IsLFSFile) (not $file.IsBin)}} - <a class="item" rel="nofollow" href="{{$.HeadRepoLink}}/_edit/{{PathEscapeSegments $.HeadBranchName}}/{{PathEscapeSegments $file.Name}}?return_uri={{print $.BackToLink "#diff-" $file.NameHash | QueryEscape}}">{{ctx.Locale.Tr "repo.editor.edit_this_file"}}</a> + {{if not $file.IsSubmodule}} + <button class="btn diff-header-popup-btn tw-p-1">{{svg "octicon-kebab-horizontal" 18}}</button> + <div class="tippy-target"> + {{if not (or $file.IsIncomplete $file.IsBin)}} + <button class="unescape-button item" data-unicode-content-selector="#diff-{{$file.NameHash}}">{{ctx.Locale.Tr "repo.unescape_control_characters"}}</button> + <button class="escape-button tw-hidden item" data-unicode-content-selector="#diff-{{$file.NameHash}}">{{ctx.Locale.Tr "repo.escape_control_characters"}}</button> + {{end}} + {{if not $.PageIsWiki}} + {{if $file.IsDeleted}} + <a class="item" rel="nofollow" href="{{$.BeforeSourcePath}}/{{PathEscapeSegments .Name}}">{{ctx.Locale.Tr "repo.diff.view_file"}}</a> + {{else}} + <a class="item" rel="nofollow" href="{{$.SourcePath}}/{{PathEscapeSegments .Name}}">{{ctx.Locale.Tr "repo.diff.view_file"}}</a> + {{if and $.Repository.CanEnableEditor $.CanEditFile}} + <a class="item" rel="nofollow" href="{{$.HeadRepoLink}}/_edit/{{PathEscapeSegments $.HeadBranchName}}/{{PathEscapeSegments $file.Name}}?return_uri={{print $.BackToLink "#diff-" $file.NameHash | QueryEscape}}">{{ctx.Locale.Tr "repo.editor.edit_this_file"}}</a> + {{end}} {{end}} {{end}} - {{end}} - </div> + </div> + {{end}} </div> </h4> <div class="diff-file-body ui attached unstackable table segment" {{if and $file.IsViewed $.IsShowingAllCommits}}data-folded="true"{{end}}> @@ -195,6 +172,17 @@ {{ctx.Locale.Tr "repo.diff.bin_not_shown"}} {{end}} </div> + {{else if $file.SubmoduleDiffInfo}} + <div class="tw-p-3">{{svg "octicon-file-submodule"}} {{$submoduleDiffInfo := $file.SubmoduleDiffInfo -}} + {{- $submoduleName := $submoduleDiffInfo.SubmoduleRepoLinkHTML ctx -}} + {{- if $file.IsDeleted -}} + {{- ctx.Locale.Tr "repo.diff.submodule_deleted" $submoduleName ($submoduleDiffInfo.CommitRefIDLinkHTML ctx $submoduleDiffInfo.PreviousRefID) -}} + {{- else if $file.IsCreated -}} + {{- ctx.Locale.Tr "repo.diff.submodule_added" $submoduleName ($submoduleDiffInfo.CommitRefIDLinkHTML ctx $submoduleDiffInfo.NewRefID) -}} + {{- else -}} + {{- ctx.Locale.Tr "repo.diff.submodule_updated" $submoduleName ($submoduleDiffInfo.CompareRefIDLinkHTML ctx) -}} + {{end}} + </div> {{else}} <table class="chroma" data-new-comment-url="{{$.Issue.Link}}/files/reviews/new_comment" data-path="{{$file.Name}}"> {{if $.IsSplitStyle}} @@ -222,7 +210,7 @@ {{end}} {{if .Diff.IsIncomplete}} - <div class="diff-file-box diff-box file-content tw-mt-2" id="diff-incomplete"> + <div class="diff-file-box file-content tw-mt-2" id="diff-incomplete"> <h4 class="ui top attached header tw-font-normal tw-flex tw-items-center tw-justify-between"> {{ctx.Locale.Tr "repo.diff.too_many_files"}} <a class="ui basic tiny button" id="diff-show-more-files" data-href="?skip-to={{.Diff.End}}&file-only=true">{{ctx.Locale.Tr "repo.diff.show_more"}}</a> @@ -236,6 +224,7 @@ {{if and (not $.Repository.IsArchived) (not .DiffNotAvailable)}} <template id="issue-comment-editor-template"> <form class="ui form comment"> + <div class="field"> {{template "shared/combomarkdowneditor" (dict "CustomInit" true "MarkdownPreviewInRepo" $.Repository @@ -243,12 +232,13 @@ "TextareaName" "content" "DropzoneParentContainer" ".ui.form" )}} + </div> {{if .IsAttachmentEnabled}} <div class="field"> {{template "repo/upload" .}} </div> {{end}} - <div class="text right edit buttons"> + <div class="field flex-text-block tw-justify-end"> <button class="ui cancel button">{{ctx.Locale.Tr "repo.issues.cancel"}}</button> <button class="ui primary button">{{ctx.Locale.Tr "repo.issues.save"}}</button> </div> diff --git a/templates/repo/diff/comment_form.tmpl b/templates/repo/diff/comment_form.tmpl index 964dc2adc7..58b675467c 100644 --- a/templates/repo/diff/comment_form.tmpl +++ b/templates/repo/diff/comment_form.tmpl @@ -27,7 +27,7 @@ {{end}} <div class="field footer"> - <div class="tw-text-right"> + <div class="flex-text-block tw-justify-end"> {{if $.reply}} <button class="ui submit primary tiny button btn-reply" type="submit">{{ctx.Locale.Tr "repo.diff.comment.reply"}}</button> <input type="hidden" name="reply" value="{{$.reply}}"> diff --git a/templates/repo/diff/comments.tmpl b/templates/repo/diff/comments.tmpl index 2d716688b9..aa483ec669 100644 --- a/templates/repo/diff/comments.tmpl +++ b/templates/repo/diff/comments.tmpl @@ -8,8 +8,8 @@ {{template "shared/user/avatarlink" dict "user" .Poster}} {{end}} <div class="content comment-container"> - <div class="ui top attached header comment-header tw-flex tw-items-center tw-justify-between"> - <div class="comment-header-left tw-flex tw-items-center"> + <div class="comment-header"> + <div class="comment-header-left"> {{if .OriginalAuthor}} <span class="text black tw-font-semibold tw-mr-1"> {{svg (MigrationIcon $.root.Repository.GetOriginalURLHostname)}} @@ -30,7 +30,7 @@ </span> {{end}} </div> - <div class="comment-header-right actions tw-flex tw-items-center"> + <div class="comment-header-right"> {{if .Invalidated}} {{$referenceUrl := printf "%s#%s" $.root.Issue.Link .HashTag}} <a href="{{$referenceUrl}}" class="ui label basic small" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.review.outdated_description"}}"> @@ -48,7 +48,9 @@ </div> {{end}} {{end}} - {{template "repo/issue/view_content/add_reaction" dict "ActionURL" (printf "%s/comments/%d/reactions" $.root.RepoLink .ID)}} + {{if not $.root.Repository.IsArchived}} + {{template "repo/issue/view_content/add_reaction" dict "ActionURL" (printf "%s/comments/%d/reactions" $.root.RepoLink .ID)}} + {{end}} {{template "repo/issue/view_content/context_menu" dict "item" . "delete" true "issue" false "diff" true "IsCommentPoster" (and $.root.IsSigned (eq $.root.SignedUserID .PosterID))}} </div> </div> diff --git a/templates/repo/diff/compare.tmpl b/templates/repo/diff/compare.tmpl index 9a7a04a328..4e8ad1326c 100644 --- a/templates/repo/diff/compare.tmpl +++ b/templates/repo/diff/compare.tmpl @@ -32,7 +32,7 @@ <a class="tw-mr-2" href="{{$.HeadRepo.Link}}/compare/{{PathEscapeSegments $.HeadBranch}}{{$.CompareSeparator}}{{if not $.PullRequestCtx.SameRepo}}{{PathEscape $.BaseName}}/{{PathEscape $.Repository.Name}}:{{end}}{{PathEscapeSegments $.BaseBranch}}" title="{{ctx.Locale.Tr "repo.pulls.switch_head_and_base"}}">{{svg "octicon-git-compare"}}</a> <div class="ui dropdown jump select-branch"> <div class="ui basic small button"> - <span class="text">{{if $.PageIsComparePull}}{{ctx.Locale.Tr "repo.pulls.compare_base"}}{{else}}{{ctx.Locale.Tr "repo.compare.compare_base"}}{{end}}: {{$BaseCompareName}}:{{$.BaseBranch}}</span> + <span class="text">{{if $.PageIsComparePull}}{{ctx.Locale.Tr "repo.pulls.compare_base"}}{{else}}{{ctx.Locale.Tr "repo.compare.compare_base"}}{{end}}: <strong>{{$BaseCompareName}}:{{$.BaseBranch}}</strong></span> {{svg "octicon-triangle-down" 14 "dropdown icon"}} </div> <div class="menu"> @@ -103,7 +103,7 @@ <div class="ui dropdown jump select-branch"> <div class="ui basic small button"> - <span class="text">{{if $.PageIsComparePull}}{{ctx.Locale.Tr "repo.pulls.compare_compare"}}{{else}}{{ctx.Locale.Tr "repo.compare.compare_head"}}{{end}}: {{$HeadCompareName}}:{{$.HeadBranch}}</span> + <span class="text">{{if $.PageIsComparePull}}{{ctx.Locale.Tr "repo.pulls.compare_compare"}}{{else}}{{ctx.Locale.Tr "repo.compare.compare_head"}}{{end}}: <strong>{{$HeadCompareName}}:{{$.HeadBranch}}</strong></span> {{svg "octicon-triangle-down" 14 "dropdown icon"}} </div> <div class="menu"> @@ -189,7 +189,7 @@ <div class="ui segment flex-text-block tw-gap-4"> {{template "shared/issueicon" .}} <div class="issue-title tw-break-anywhere"> - {{ctx.RenderUtils.RenderIssueTitle .PullRequest.Issue.Title ($.Repository.ComposeMetas ctx)}} + {{ctx.RenderUtils.RenderIssueTitle .PullRequest.Issue.Title $.Repository}} <span class="index">#{{.PullRequest.Issue.Index}}</span> </div> <a href="{{$.RepoLink}}/pulls/{{.PullRequest.Issue.Index}}" class="ui compact button primary"> @@ -205,10 +205,10 @@ {{end}} </div> {{else if $allowCreatePR}} - <div class="ui info message pullrequest-form-toggle {{if .Flash}}tw-hidden{{end}}"> + <div class="ui info message pullrequest-form-toggle {{if .ExpandNewPrForm}}tw-hidden{{end}}"> <button class="ui button primary show-panel toggle" data-panel=".pullrequest-form-toggle, .pullrequest-form">{{ctx.Locale.Tr "repo.pulls.new"}}</button> </div> - <div class="pullrequest-form {{if not .Flash}}tw-hidden{{end}}"> + <div class="pullrequest-form {{if not .ExpandNewPrForm}}tw-hidden{{end}}"> {{template "repo/issue/new_form" .}} </div> {{end}} diff --git a/templates/repo/diff/conversation.tmpl b/templates/repo/diff/conversation.tmpl index 08f60644b3..eb2abfa7e9 100644 --- a/templates/repo/diff/conversation.tmpl +++ b/templates/repo/diff/conversation.tmpl @@ -8,9 +8,9 @@ {{$referenceUrl := printf "%s#%s" $.Issue.Link $comment.HashTag}} <div class="conversation-holder" data-path="{{$comment.TreePath}}" data-side="{{if lt $comment.Line 0}}left{{else}}right{{end}}" data-idx="{{$comment.UnsignedLine}}"> {{if $resolved}} - <div class="ui attached header resolved-placeholder tw-flex tw-items-center tw-justify-between"> - <div class="ui grey text tw-flex tw-items-center tw-flex-wrap tw-gap-1"> - {{svg "octicon-check" 16 "icon tw-mr-1"}} + <div class="resolved-placeholder"> + <div class="flex-text-block tw-flex-wrap grey text"> + {{svg "octicon-check"}} <b>{{$resolveDoer.Name}}</b> {{ctx.Locale.Tr "repo.issues.review.resolved_by"}} {{if $invalid}} <!-- @@ -22,35 +22,33 @@ </a> {{end}} </div> - <div class="tw-flex tw-items-center tw-gap-2"> - <button id="show-outdated-{{$comment.ID}}" data-comment="{{$comment.ID}}" class="ui tiny labeled button show-outdated tw-flex tw-items-center"> - {{svg "octicon-unfold" 16 "tw-mr-2"}} - {{ctx.Locale.Tr "repo.issues.review.show_resolved"}} + <div class="flex-text-block"> + <button id="show-outdated-{{$comment.ID}}" data-comment="{{$comment.ID}}" class="btn tiny show-outdated"> + {{svg "octicon-unfold" 16 "tw-mr-2"}}{{ctx.Locale.Tr "repo.issues.review.show_resolved"}} </button> - <button id="hide-outdated-{{$comment.ID}}" data-comment="{{$comment.ID}}" class="ui tiny labeled button hide-outdated tw-flex tw-items-center tw-hidden"> - {{svg "octicon-fold" 16 "tw-mr-2"}} - {{ctx.Locale.Tr "repo.issues.review.hide_resolved"}} + <button id="hide-outdated-{{$comment.ID}}" data-comment="{{$comment.ID}}" class="btn tiny hide-outdated tw-hidden"> + {{svg "octicon-fold" 16 "tw-mr-2"}}{{ctx.Locale.Tr "repo.issues.review.hide_resolved"}} </button> </div> </div> {{end}} <div id="code-comments-{{$comment.ID}}" class="field comment-code-cloud {{if $resolved}}tw-hidden{{end}}"> <div class="comment-list"> - <ui class="ui comments"> + <div class="ui comments"> {{template "repo/diff/comments" dict "root" $ "comments" .comments}} - </ui> + </div> </div> - <div class="tw-flex tw-justify-end tw-items-center tw-gap-2 tw-mt-2 tw-flex-wrap"> + <div class="flex-text-block tw-mt-2 tw-flex-wrap tw-justify-end"> <div class="ui buttons"> <button class="ui icon tiny basic button previous-conversation"> - {{svg "octicon-arrow-up" 12 "icon"}} {{ctx.Locale.Tr "repo.issues.previous"}} + {{svg "octicon-arrow-up" 12}} {{ctx.Locale.Tr "repo.issues.previous"}} </button> <button class="ui icon tiny basic button next-conversation"> - {{svg "octicon-arrow-down" 12 "icon"}} {{ctx.Locale.Tr "repo.issues.next"}} + {{svg "octicon-arrow-down" 12}} {{ctx.Locale.Tr "repo.issues.next"}} </button> </div> {{if and $.CanMarkConversation $hasReview (not $isReviewPending)}} - <button class="ui icon tiny basic button resolve-conversation tw-mr-0" data-origin="diff" data-action="{{if not $resolved}}Resolve{{else}}UnResolve{{end}}" data-comment-id="{{$comment.ID}}" data-update-url="{{$.RepoLink}}/issues/resolve_conversation"> + <button class="ui icon tiny basic button resolve-conversation" data-origin="diff" data-action="{{if not $resolved}}Resolve{{else}}UnResolve{{end}}" data-comment-id="{{$comment.ID}}" data-update-url="{{$.RepoLink}}/issues/resolve_conversation"> {{if $resolved}} {{ctx.Locale.Tr "repo.issues.review.un_resolve_conversation"}} {{else}} @@ -59,8 +57,8 @@ </button> {{end}} {{if and $.SignedUserID (not $.Repository.IsArchived)}} - <button class="comment-form-reply ui primary tiny labeled icon button tw-mr-0"> - {{svg "octicon-reply" 16 "reply icon tw-mr-1"}}{{ctx.Locale.Tr "repo.diff.comment.reply"}} + <button class="comment-form-reply ui primary icon tiny button"> + {{svg "octicon-reply" 12}}{{ctx.Locale.Tr "repo.diff.comment.reply"}} </button> {{end}} </div> diff --git a/templates/repo/diff/image_diff.tmpl b/templates/repo/diff/image_diff.tmpl index 608174e51b..7557129c64 100644 --- a/templates/repo/diff/image_diff.tmpl +++ b/templates/repo/diff/image_diff.tmpl @@ -9,20 +9,20 @@ > <overflow-menu class="ui secondary pointing tabular menu custom"> <div class="overflow-menu-items tw-justify-center"> - <a class="item active" data-tab="diff-side-by-side-{{.file.Index}}">{{ctx.Locale.Tr "repo.diff.image.side_by_side"}}</a> + <a class="item active" data-tab="diff-side-by-side-{{.file.NameHash}}">{{ctx.Locale.Tr "repo.diff.image.side_by_side"}}</a> {{if and .blobBase .blobHead}} - <a class="item" data-tab="diff-swipe-{{.file.Index}}">{{ctx.Locale.Tr "repo.diff.image.swipe"}}</a> - <a class="item" data-tab="diff-overlay-{{.file.Index}}">{{ctx.Locale.Tr "repo.diff.image.overlay"}}</a> + <a class="item" data-tab="diff-swipe-{{.file.NameHash}}">{{ctx.Locale.Tr "repo.diff.image.swipe"}}</a> + <a class="item" data-tab="diff-overlay-{{.file.NameHash}}">{{ctx.Locale.Tr "repo.diff.image.overlay"}}</a> {{end}} </div> </overflow-menu> <div class="image-diff-tabs is-loading"> - <div class="ui bottom attached tab image-diff-container active" data-tab="diff-side-by-side-{{.file.Index}}"> + <div class="ui bottom attached tab image-diff-container active" data-tab="diff-side-by-side-{{.file.NameHash}}"> <div class="diff-side-by-side"> {{if .blobBase}} <span class="side"> <p class="side-header">{{ctx.Locale.Tr "repo.diff.file_before"}}</p> - <span class="before-container"><img class="image-before"></span> + <span class="before-container"><img alt class="image-before"></span> <p> <span class="bounds-info-before"> {{ctx.Locale.Tr "repo.diff.file_image_width"}}: <span class="text bounds-info-width"></span> @@ -37,7 +37,7 @@ {{if .blobHead}} <span class="side"> <p class="side-header">{{ctx.Locale.Tr "repo.diff.file_after"}}</p> - <span class="after-container"><img class="image-after"></span> + <span class="after-container"><img alt class="image-after"></span> <p> <span class="bounds-info-after"> {{ctx.Locale.Tr "repo.diff.file_image_width"}}: <span class="text bounds-info-width"></span> @@ -52,12 +52,12 @@ </div> </div> {{if and .blobBase .blobHead}} - <div class="ui bottom attached tab image-diff-container" data-tab="diff-swipe-{{.file.Index}}"> + <div class="ui bottom attached tab image-diff-container" data-tab="diff-swipe-{{.file.NameHash}}"> <div class="diff-swipe"> <div class="swipe-frame"> - <span class="before-container"><img class="image-before"></span> + <span class="before-container"><img alt class="image-before"></span> <span class="swipe-container"> - <span class="after-container"><img class="image-after"></span> + <span class="after-container"><img alt class="image-after"></span> </span> <span class="swipe-bar"> <span class="handle top-handle"></span> @@ -66,12 +66,12 @@ </div> </div> </div> - <div class="ui bottom attached tab image-diff-container" data-tab="diff-overlay-{{.file.Index}}"> + <div class="ui bottom attached tab image-diff-container" data-tab="diff-overlay-{{.file.NameHash}}"> <div class="diff-overlay"> <input type="range" min="0" max="100" value="50"> <div class="overlay-frame"> - <span class="before-container"><img class="image-before"></span> - <span class="after-container"><img class="image-after"></span> + <span class="before-container"><img alt class="image-before"></span> + <span class="after-container"><img alt class="image-after"></span> </div> </div> </div> diff --git a/templates/repo/diff/new_review.tmpl b/templates/repo/diff/new_review.tmpl index 2febc6303a..3bb01a139a 100644 --- a/templates/repo/diff/new_review.tmpl +++ b/templates/repo/diff/new_review.tmpl @@ -1,56 +1,59 @@ -<div id="review-box"> - <button class="ui tiny primary button tw-pr-1 tw-flex js-btn-review {{if not $.IsShowingAllCommits}}disabled{{end}}" {{if not $.IsShowingAllCommits}}data-tooltip-content="{{ctx.Locale.Tr "repo.pulls.review_only_possible_for_full_diff"}}"{{end}}> +<div id="review-box" {{if $.Repository.IsArchived}}data-tooltip-content="{{ctx.Locale.Tr "repo.archive.pull.nocomment"}}"{{end}}> + <button class="ui tiny primary button tw-pr-1 js-btn-review {{if not $.IsShowingAllCommits}}disabled{{end}}" + {{if not $.IsShowingAllCommits}}data-tooltip-content="{{ctx.Locale.Tr "repo.pulls.review_only_possible_for_full_diff"}}"{{end}} + {{if $.Repository.IsArchived}}disabled{{end}} + > {{ctx.Locale.Tr "repo.diff.review"}} <span class="ui small label review-comments-counter" data-pending-comment-number="{{.PendingCodeCommentNumber}}">{{.PendingCodeCommentNumber}}</span> {{svg "octicon-triangle-down" 14 "dropdown icon"}} </button> - {{if $.IsShowingAllCommits}} - <div class="review-box-panel tippy-target"> - <div class="ui segment"> - <form class="ui form form-fetch-action" action="{{.Link}}/reviews/submit" method="post"> - {{.CsrfTokenHtml}} - <input type="hidden" name="commit_id" value="{{.AfterCommitID}}"> - <div class="field tw-flex tw-items-center"> - <div class="tw-flex-1">{{ctx.Locale.Tr "repo.diff.review.header"}}</div> - <a class="muted close">{{svg "octicon-x" 16}}</a> - </div> +</div> +{{if $.IsShowingAllCommits}} +<div class="review-box-panel tippy-target"> + <div class="ui segment"> + <form class="ui form form-fetch-action" action="{{.Link}}/reviews/submit" method="post"> + {{.CsrfTokenHtml}} + <input type="hidden" name="commit_id" value="{{.AfterCommitID}}"> + <div class="field tw-flex tw-items-center"> + <div class="tw-flex-1">{{ctx.Locale.Tr "repo.diff.review.header"}}</div> + <a class="muted close">{{svg "octicon-x" 16}}</a> + </div> + <div class="field"> + {{template "shared/combomarkdowneditor" (dict + "MarkdownPreviewInRepo" $.Repository + "MarkdownPreviewMode" "comment" + "TextareaName" "content" + "TextareaPlaceholder" (ctx.Locale.Tr "repo.diff.review.placeholder") + "DropzoneParentContainer" "form" + )}} + </div> + {{if .IsAttachmentEnabled}} <div class="field"> - {{template "shared/combomarkdowneditor" (dict - "MarkdownPreviewInRepo" $.Repository - "MarkdownPreviewMode" "comment" - "TextareaName" "content" - "TextareaPlaceholder" (ctx.Locale.Tr "repo.diff.review.placeholder") - "DropzoneParentContainer" "form" - )}} + {{template "repo/upload" .}} </div> - {{if .IsAttachmentEnabled}} - <div class="field"> - {{template "repo/upload" .}} - </div> - {{end}} - <div class="divider"></div> - {{$showSelfTooltip := (and $.IsSigned ($.Issue.IsPoster $.SignedUser.ID))}} - {{if not $.Issue.IsClosed}} - {{if $showSelfTooltip}} - <span class="tw-inline-block" data-tooltip-content="{{ctx.Locale.Tr "repo.diff.review.self_approve"}}"> - <button type="submit" name="type" value="approve" disabled class="ui submit primary tiny button btn-submit">{{ctx.Locale.Tr "repo.diff.review.approve"}}</button> - </span> - {{else}} - <button type="submit" name="type" value="approve" class="ui submit primary tiny button btn-submit">{{ctx.Locale.Tr "repo.diff.review.approve"}}</button> - {{end}} + {{end}} + <div class="divider"></div> + {{$showSelfTooltip := (and $.IsSigned ($.Issue.IsPoster $.SignedUser.ID))}} + {{if not $.Issue.IsClosed}} + {{if $showSelfTooltip}} + <span class="tw-inline-block" data-tooltip-content="{{ctx.Locale.Tr "repo.diff.review.self_approve"}}"> + <button type="submit" name="type" value="approve" disabled class="ui submit primary tiny button btn-submit">{{ctx.Locale.Tr "repo.diff.review.approve"}}</button> + </span> + {{else}} + <button type="submit" name="type" value="approve" class="ui submit primary tiny button btn-submit">{{ctx.Locale.Tr "repo.diff.review.approve"}}</button> {{end}} - <button type="submit" name="type" value="comment" class="ui submit tiny basic button btn-submit">{{ctx.Locale.Tr "repo.diff.review.comment"}}</button> - {{if not $.Issue.IsClosed}} - {{if $showSelfTooltip}} - <span class="tw-inline-block" data-tooltip-content="{{ctx.Locale.Tr "repo.diff.review.self_reject"}}"> - <button type="submit" name="type" value="reject" disabled class="ui submit red tiny button btn-submit">{{ctx.Locale.Tr "repo.diff.review.reject"}}</button> - </span> - {{else}} - <button type="submit" name="type" value="reject" class="ui submit red tiny button btn-submit">{{ctx.Locale.Tr "repo.diff.review.reject"}}</button> - {{end}} + {{end}} + <button type="submit" name="type" value="comment" class="ui submit tiny basic button btn-submit">{{ctx.Locale.Tr "repo.diff.review.comment"}}</button> + {{if not $.Issue.IsClosed}} + {{if $showSelfTooltip}} + <span class="tw-inline-block" data-tooltip-content="{{ctx.Locale.Tr "repo.diff.review.self_reject"}}"> + <button type="submit" name="type" value="reject" disabled class="ui submit red tiny button btn-submit">{{ctx.Locale.Tr "repo.diff.review.reject"}}</button> + </span> + {{else}} + <button type="submit" name="type" value="reject" class="ui submit red tiny button btn-submit">{{ctx.Locale.Tr "repo.diff.review.reject"}}</button> {{end}} - </form> - </div> + {{end}} + </form> </div> - {{end}} </div> +{{end}} diff --git a/templates/repo/diff/options_dropdown.tmpl b/templates/repo/diff/options_dropdown.tmpl index 09b7b80e41..8d08e7ad46 100644 --- a/templates/repo/diff/options_dropdown.tmpl +++ b/templates/repo/diff/options_dropdown.tmpl @@ -1,7 +1,6 @@ <div class="ui dropdown tiny basic button" data-tooltip-content="{{ctx.Locale.Tr "repo.diff.options_button"}}"> {{svg "octicon-kebab-horizontal"}} <div class="menu"> - <a class="item" id="show-file-list-btn">{{ctx.Locale.Tr "repo.diff.show_diff_stats"}}</a> {{if .Issue.Index}} <a class="item" href="{{$.RepoLink}}/pulls/{{.Issue.Index}}.patch" download="{{.Issue.Index}}.patch">{{ctx.Locale.Tr "repo.diff.download_patch"}}</a> <a class="item" href="{{$.RepoLink}}/pulls/{{.Issue.Index}}.diff" download="{{.Issue.Index}}.diff">{{ctx.Locale.Tr "repo.diff.download_diff"}}</a> diff --git a/templates/repo/editor/cherry_pick.tmpl b/templates/repo/editor/cherry_pick.tmpl index f9c9eef5aa..7981fd0761 100644 --- a/templates/repo/editor/cherry_pick.tmpl +++ b/templates/repo/editor/cherry_pick.tmpl @@ -3,15 +3,14 @@ {{template "repo/header" .}} <div class="ui container"> {{template "base/alert" .}} - <form class="ui edit form" method="post" action="{{.RepoLink}}/_cherrypick/{{.SHA}}/{{.BranchName | PathEscapeSegments}}"> + <form class="ui edit form form-fetch-action" method="post" action="{{.CommitFormOptions.TargetFormAction}}"> {{.CsrfTokenHtml}} - <input type="hidden" name="last_commit" value="{{.last_commit}}"> - <input type="hidden" name="page_has_posted" value="true"> + {{template "repo/editor/common_top" .}} <input type="hidden" name="revert" value="{{if eq .CherryPickType "revert"}}true{{else}}false{{end}}"> <div class="repo-editor-header"> - <div class="ui breadcrumb field {{if .Err_TreePath}}error{{end}}"> - {{$shaurl := printf "%s/commit/%s" $.RepoLink (PathEscape .SHA)}} - {{$shalink := HTMLFormat `<a class="ui primary sha label" href="%s">%s</a>` $shaurl (ShortSha .SHA)}} + <div class="breadcrumb"> + {{$shaurl := printf "%s/commit/%s" $.RepoLink (PathEscape .FromCommitID)}} + {{$shalink := HTMLFormat `<a class="ui primary sha label" href="%s">%s</a>` $shaurl (ShortSha .FromCommitID)}} {{if eq .CherryPickType "revert"}} {{ctx.Locale.Tr "repo.editor.revert" $shalink}} {{else}} diff --git a/templates/repo/editor/commit_form.tmpl b/templates/repo/editor/commit_form.tmpl index c050324e93..7067614444 100644 --- a/templates/repo/editor/commit_form.tmpl +++ b/templates/repo/editor/commit_form.tmpl @@ -1,11 +1,11 @@ <div class="commit-form-wrapper"> {{ctx.AvatarUtils.Avatar .SignedUser 40 "commit-avatar"}} <div class="commit-form"> - <h3>{{- if .CanCommitToBranch.WillSign}} - <span title="{{ctx.Locale.Tr "repo.signing.will_sign" .CanCommitToBranch.SigningKey}}">{{svg "octicon-lock" 24}}</span> + <h3>{{- if .CommitFormOptions.WillSign}} + <span title="{{ctx.Locale.Tr "repo.signing.will_sign" .CommitFormOptions.SigningKey}}">{{svg "octicon-lock" 24}}</span> {{ctx.Locale.Tr "repo.editor.commit_signed_changes"}} {{- else}} - <span title="{{ctx.Locale.Tr (printf "repo.signing.wont_sign.%s" .CanCommitToBranch.WontSignReason)}}">{{svg "octicon-unlock" 24}}</span> + <span title="{{ctx.Locale.Tr (printf "repo.signing.wont_sign.%s" .CommitFormOptions.WontSignReason)}}">{{svg "octicon-unlock" 24}}</span> {{ctx.Locale.Tr "repo.editor.commit_changes"}} {{- end}}</h3> <div class="field"> @@ -22,17 +22,17 @@ </div> <div class="quick-pull-choice js-quick-pull-choice"> <div class="field"> - <div class="ui radio checkbox {{if not .CanCommitToBranch.CanCommitToBranch}}disabled{{end}}"> + <div class="ui radio checkbox {{if not .CommitFormOptions.CanCommitToBranch}}disabled{{end}}"> <input type="radio" class="js-quick-pull-choice-option" name="commit_choice" value="direct" data-button-text="{{ctx.Locale.Tr "repo.editor.commit_changes"}}" {{if eq .commit_choice "direct"}}checked{{end}}> <label> {{svg "octicon-git-commit"}} {{ctx.Locale.Tr "repo.editor.commit_directly_to_this_branch" .BranchName}} - {{if not .CanCommitToBranch.CanCommitToBranch}} + {{if not .CommitFormOptions.CanCommitToBranch}} <div class="ui visible small warning message"> {{ctx.Locale.Tr "repo.editor.no_commit_to_branch"}} <ul> - {{if not .CanCommitToBranch.UserCanPush}}<li>{{ctx.Locale.Tr "repo.editor.user_no_push_to_branch"}}</li>{{end}} - {{if and .CanCommitToBranch.RequireSigned (not .CanCommitToBranch.WillSign)}}<li>{{ctx.Locale.Tr "repo.editor.require_signed_commit"}}</li>{{end}} + {{if not .CommitFormOptions.UserCanPush}}<li>{{ctx.Locale.Tr "repo.editor.user_no_push_to_branch"}}</li>{{end}} + {{if and .CommitFormOptions.RequireSigned (not .CommitFormOptions.WillSign)}}<li>{{ctx.Locale.Tr "repo.editor.require_signed_commit"}}</li>{{end}} </ul> </div> {{end}} @@ -42,14 +42,14 @@ {{if and (not .Repository.IsEmpty) (not .IsEditingFileOnly)}} <div class="field"> <div class="ui radio checkbox"> - {{if .CanCreatePullRequest}} + {{if .CommitFormOptions.CanCreatePullRequest}} <input type="radio" class="js-quick-pull-choice-option" name="commit_choice" value="commit-to-new-branch" data-button-text="{{ctx.Locale.Tr "repo.editor.propose_file_change"}}" {{if eq .commit_choice "commit-to-new-branch"}}checked{{end}}> {{else}} <input type="radio" class="js-quick-pull-choice-option" name="commit_choice" value="commit-to-new-branch" data-button-text="{{ctx.Locale.Tr "repo.editor.commit_changes"}}" {{if eq .commit_choice "commit-to-new-branch"}}checked{{end}}> {{end}} <label> {{svg "octicon-git-pull-request"}} - {{if .CanCreatePullRequest}} + {{if .CommitFormOptions.CanCreatePullRequest}} {{ctx.Locale.Tr "repo.editor.create_new_branch"}} {{else}} {{ctx.Locale.Tr "repo.editor.create_new_branch_np"}} @@ -58,7 +58,7 @@ </div> </div> <div class="quick-pull-branch-name {{if not (eq .commit_choice "commit-to-new-branch")}}tw-hidden{{end}}"> - <div class="new-branch-name-input field {{if .Err_NewBranchName}}error{{end}}"> + <div class="new-branch-name-input field"> {{svg "octicon-git-branch"}} <input type="text" name="new_branch_name" maxlength="100" value="{{.new_branch_name}}" class="input-contrast tw-mr-1 js-quick-pull-new-branch-name" placeholder="{{ctx.Locale.Tr "repo.editor.new_branch_name_desc"}}" {{if eq .commit_choice "commit-to-new-branch"}}required{{end}} title="{{ctx.Locale.Tr "repo.editor.new_branch_name"}}"> <span class="text-muted js-quick-pull-normalization-info"></span> @@ -66,7 +66,18 @@ </div> {{end}} </div> + {{if and .CommitCandidateEmails (gt (len .CommitCandidateEmails) 1)}} + <div class="field"> + <label>{{ctx.Locale.Tr "repo.editor.commit_email"}}</label> + <select class="ui selection dropdown" name="commit_email"> + {{- range $email := .CommitCandidateEmails -}} + <option {{if eq $email $.CommitDefaultEmail}}selected{{end}} value="{{$email}}">{{$email}}</option> + {{- end -}} + </select> + </div> + {{end}} </div> + <input type="hidden" name="last_commit" value="{{.last_commit}}"> <button id="commit-button" type="submit" class="ui primary button"> {{if eq .commit_choice "commit-to-new-branch"}}{{ctx.Locale.Tr "repo.editor.propose_file_change"}}{{else}}{{ctx.Locale.Tr "repo.editor.commit_changes"}}{{end}} </button> diff --git a/templates/repo/editor/common_breadcrumb.tmpl b/templates/repo/editor/common_breadcrumb.tmpl new file mode 100644 index 0000000000..8cfbe09d3e --- /dev/null +++ b/templates/repo/editor/common_breadcrumb.tmpl @@ -0,0 +1,16 @@ +<div class="breadcrumb"> + <a class="section" href="{{$.BranchLink}}">{{.Repository.Name}}</a> + {{$n := len .TreeNames}} + {{$l := Eval $n "-" 1}} + {{range $i, $v := .TreeNames}} + <div class="breadcrumb-divider">/</div> + {{if eq $i $l}} + <input id="file-name" maxlength="255" value="{{$v}}" placeholder="{{ctx.Locale.Tr (Iif $.PageIsUpload "repo.editor.add_subdir" "repo.editor.name_your_file")}}" data-editorconfig="{{$.EditorconfigJson}}" {{Iif $.PageIsUpload "" "required"}} autofocus> + <span data-tooltip-content="{{ctx.Locale.Tr "repo.editor.filename_help"}}">{{svg "octicon-info"}}</span> + {{else}} + <span class="section"><a href="{{$.BranchLink}}/{{index $.TreePaths $i | PathEscapeSegments}}">{{$v}}</a></span> + {{end}} + {{end}} + <span>{{ctx.Locale.Tr "repo.editor.or"}} <a href="{{or .ReturnURI (print $.BranchLink "/" (PathEscapeSegments .TreePath))}}">{{ctx.Locale.Tr "repo.editor.cancel_lower"}}</a></span> + <input type="hidden" id="tree_path" name="tree_path" value="{{.TreePath}}"> +</div> diff --git a/templates/repo/editor/common_top.tmpl b/templates/repo/editor/common_top.tmpl new file mode 100644 index 0000000000..23280ed565 --- /dev/null +++ b/templates/repo/editor/common_top.tmpl @@ -0,0 +1,6 @@ +{{if .CommitFormOptions.WillSubmitToFork}} +<div class="ui blue message"> + {{$repoLinkHTML := HTMLFormat `<a href="%s">%s</a>` .CommitFormOptions.TargetRepo.Link .CommitFormOptions.TargetRepo.FullName}} + {{ctx.Locale.Tr "repo.editor.fork_edit_description" $repoLinkHTML}} +</div> +{{end}} diff --git a/templates/repo/editor/delete.tmpl b/templates/repo/editor/delete.tmpl index 2c0c2fc792..bf6143f1cb 100644 --- a/templates/repo/editor/delete.tmpl +++ b/templates/repo/editor/delete.tmpl @@ -3,9 +3,9 @@ {{template "repo/header" .}} <div class="ui container"> {{template "base/alert" .}} - <form class="ui form" method="post"> + <form class="ui form form-fetch-action" method="post" action="{{.CommitFormOptions.TargetFormAction}}"> {{.CsrfTokenHtml}} - <input type="hidden" name="last_commit" value="{{.last_commit}}"> + {{template "repo/editor/common_top" .}} {{template "repo/editor/commit_form" .}} </form> </div> diff --git a/templates/repo/editor/edit.tmpl b/templates/repo/editor/edit.tmpl index 204a426970..0911d02e1f 100644 --- a/templates/repo/editor/edit.tmpl +++ b/templates/repo/editor/edit.tmpl @@ -3,56 +3,49 @@ {{template "repo/header" .}} <div class="ui container"> {{template "base/alert" .}} - <form class="ui edit form" method="post" + <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"}}" > {{.CsrfTokenHtml}} - <input type="hidden" name="last_commit" value="{{.last_commit}}"> - <input type="hidden" name="page_has_posted" value="{{.PageHasPosted}}"> + {{template "repo/editor/common_top" .}} <div class="repo-editor-header"> - <div class="ui breadcrumb field{{if .Err_TreePath}} error{{end}}"> - <a class="section" href="{{$.BranchLink}}">{{.Repository.Name}}</a> - {{$n := len .TreeNames}} - {{$l := Eval $n "-" 1}} - {{range $i, $v := .TreeNames}} - <div class="breadcrumb-divider">/</div> - {{if eq $i $l}} - <input id="file-name" maxlength="255" value="{{$v}}" placeholder="{{ctx.Locale.Tr "repo.editor.name_your_file"}}" data-editorconfig="{{$.EditorconfigJson}}" required autofocus> - <span data-tooltip-content="{{ctx.Locale.Tr "repo.editor.filename_help"}}">{{svg "octicon-info"}}</span> - {{else}} - <span class="section"><a href="{{$.BranchLink}}/{{index $.TreePaths $i | PathEscapeSegments}}">{{$v}}</a></span> - {{end}} - {{end}} - <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> - <input type="hidden" id="tree_path" name="tree_path" value="{{.TreePath}}" required> - </div> + {{template "repo/editor/common_breadcrumb" .}} </div> - <div class="field"> - <div class="ui top attached header"> - <div class="ui compact small menu small-menu-items repo-editor-menu"> - <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-preview-url="{{.Repository.Link}}/markup" data-preview-context-ref="{{.RepoLink}}/src/{{.BranchNameSubURL}}">{{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}} - </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-previewable-extensions="{{.PreviewableExtensions}}" - data-line-wrap-extensions="{{.LineWrapExtensions}}">{{.FileContent}}</textarea> - <div class="editor-loading is-loading"></div> + {{if not .NotEditableReason}} + <div class="field"> + <div class="ui top attached header"> + <div class="ui compact small menu small-menu-items repo-editor-menu"> + <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-preview-url="{{.Repository.Link}}/markup" data-preview-context-ref="{{.RepoLink}}/src/{{.RefTypeNameSubURL}}">{{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}} + </div> </div> - <div class="ui tab markup tw-px-4 tw-py-3" data-tab="preview"> - {{ctx.Locale.Tr "loading"}} + <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-previewable-extensions="{{.PreviewableExtensions}}" + data-line-wrap-extensions="{{.LineWrapExtensions}}">{{.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 class="ui tab diff edit-diff" data-tab="diff"> - <div class="tw-p-16"></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> - </div> + {{end}} {{template "repo/editor/commit_form" .}} </form> </div> diff --git a/templates/repo/editor/fork.tmpl b/templates/repo/editor/fork.tmpl new file mode 100644 index 0000000000..e28b2ba7a2 --- /dev/null +++ b/templates/repo/editor/fork.tmpl @@ -0,0 +1,18 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content repository"> + {{template "repo/header" .}} + <div class="ui container"> + {{template "base/alert" .}} + <form class="ui form form-fetch-action" method="post" action="{{.RepoLink}}/_fork/{{.BranchName | PathEscapeSegments}}"> + {{.CsrfTokenHtml}} + <div class="tw-text-center"> + <div class="tw-my-[40px]"> + <h3>{{ctx.Locale.Tr "repo.editor.fork_create"}}</h3> + <p>{{ctx.Locale.Tr "repo.editor.fork_create_description"}}</p> + </div> + <button class="ui primary button">{{ctx.Locale.Tr "repo.fork_repo"}}</button> + </div> + </form> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/repo/editor/patch.tmpl b/templates/repo/editor/patch.tmpl index 33a7c2a89d..fa00edd92e 100644 --- a/templates/repo/editor/patch.tmpl +++ b/templates/repo/editor/patch.tmpl @@ -3,15 +3,14 @@ {{template "repo/header" .}} <div class="ui container"> {{template "base/alert" .}} - <form class="ui edit form" method="post" action="{{.RepoLink}}/_diffpatch/{{.BranchName | PathEscapeSegments}}" + <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"}}" > {{.CsrfTokenHtml}} - <input type="hidden" name="last_commit" value="{{.last_commit}}"> - <input type="hidden" name="page_has_posted" value="{{.PageHasPosted}}"> + {{template "repo/editor/common_top" .}} <div class="repo-editor-header"> - <div class="ui breadcrumb field {{if .Err_TreePath}}error{{end}}"> + <div class="breadcrumb"> {{ctx.Locale.Tr "repo.editor.patching"}} <a class="section" href="{{$.RepoLink}}">{{.Repository.FullName}}</a> <div class="breadcrumb-divider">:</div> diff --git a/templates/repo/editor/upload.tmpl b/templates/repo/editor/upload.tmpl index 5725020406..3e36c77b3b 100644 --- a/templates/repo/editor/upload.tmpl +++ b/templates/repo/editor/upload.tmpl @@ -3,25 +3,11 @@ {{template "repo/header" .}} <div class="ui container"> {{template "base/alert" .}} - <form class="ui comment form" method="post"> + <form class="ui comment form form-fetch-action" method="post" action="{{.CommitFormOptions.TargetFormAction}}"> {{.CsrfTokenHtml}} + {{template "repo/editor/common_top" .}} <div class="repo-editor-header"> - <div class="ui breadcrumb field {{if .Err_TreePath}}error{{end}}"> - <a class="section" href="{{$.BranchLink}}">{{.Repository.Name}}</a> - {{$n := len .TreeNames}} - {{$l := Eval $n "-" 1}} - {{range $i, $v := .TreeNames}} - <div class="breadcrumb-divider">/</div> - {{if eq $i $l}} - <input type="text" id="file-name" maxlength="255" value="{{$v}}" placeholder="{{ctx.Locale.Tr "repo.editor.add_subdir"}}" autofocus> - <span data-tooltip-content="{{ctx.Locale.Tr "repo.editor.filename_help"}}">{{svg "octicon-info"}}</span> - {{else}} - <span class="section"><a href="{{$.BranchLink}}/{{index $.TreePaths $i | PathEscapeSegments}}">{{$v}}</a></span> - {{end}} - {{end}} - <span>{{ctx.Locale.Tr "repo.editor.or"}} <a href="{{$.BranchLink}}{{if not .IsNewFile}}/{{.TreePath | PathEscapeSegments}}{{end}}">{{ctx.Locale.Tr "repo.editor.cancel_lower"}}</a></span> - <input type="hidden" id="tree_path" name="tree_path" value="{{.TreePath}}" required> - </div> + {{template "repo/editor/common_breadcrumb" .}} </div> <div class="field"> {{template "repo/upload" .}} diff --git a/templates/repo/empty.tmpl b/templates/repo/empty.tmpl index 7170fe3602..32b5c8401b 100644 --- a/templates/repo/empty.tmpl +++ b/templates/repo/empty.tmpl @@ -14,14 +14,13 @@ {{end}} </div> {{end}} + {{if .Repository.IsBroken}} - <div class="ui segment center"> - {{ctx.Locale.Tr "repo.broken_message"}} - </div> + <div class="ui segment center">{{ctx.Locale.Tr "repo.broken_message"}}</div> + {{else if .RepoHasContentsWithoutBranch}} + <div class="ui segment center">{{ctx.Locale.Tr "repo.no_branch"}}</div> {{else if .CanWriteCode}} - <h4 class="ui top attached header"> - {{ctx.Locale.Tr "repo.quick_guide"}} - </h4> + <h4 class="ui top attached header">{{ctx.Locale.Tr "repo.quick_guide"}}</h4> <div class="ui attached guide table segment empty-repo-guide"> <div class="item"> <h3>{{ctx.Locale.Tr "repo.clone_this_repo"}} <small>{{ctx.Locale.Tr "repo.clone_helper" "http://git-scm.com/book/en/v2/Git-Basics-Getting-a-Git-Repository"}}</small></h3> @@ -48,7 +47,7 @@ <h3>{{ctx.Locale.Tr "repo.create_new_repo_command"}}</h3> <div class="markup"> <pre><code>touch README.md -git init +git init{{if ne .Repository.ObjectFormatName "sha1"}} --object-format={{.Repository.ObjectFormatName}}{{end}}{{/* for sha256 repo, it needs to set "object-format" explicitly*/}} {{if ne .Repository.DefaultBranch "master"}}git checkout -b {{.Repository.DefaultBranch}}{{end}} git add README.md git commit -m "first commit" @@ -66,12 +65,10 @@ git push -u origin {{.Repository.DefaultBranch}}</code></pre> </div> </div> {{end}} - {{else}} - <div class="ui segment center"> - {{ctx.Locale.Tr "repo.empty_message"}} - </div> - {{end}} - </div> + </div> + {{else}} + <div class="ui segment center">{{ctx.Locale.Tr "repo.empty_message"}}</div> + {{end}} </div> </div> </div> diff --git a/templates/repo/file_info.tmpl b/templates/repo/file_info.tmpl index b63af68973..38133bde2b 100644 --- a/templates/repo/file_info.tmpl +++ b/templates/repo/file_info.tmpl @@ -11,7 +11,7 @@ {{end}} {{if ne .FileSize nil}} <div class="file-info-entry"> - {{FileSize .FileSize}}{{if .IsLFSFile}} ({{ctx.Locale.Tr "repo.stored_lfs"}}){{end}} + {{FileSize .FileSize}}{{if .IsLFSFile}}<span class="ui label">LFS</span>{{end}} </div> {{end}} {{if .LFSLock}} diff --git a/templates/repo/forks.tmpl b/templates/repo/forks.tmpl index 725b67c651..6e46457893 100644 --- a/templates/repo/forks.tmpl +++ b/templates/repo/forks.tmpl @@ -1,20 +1,12 @@ {{template "base/head" .}} <div role="main" aria-label="{{.Title}}" class="page-content repository forks"> {{template "repo/header" .}} - <div class="ui container"> + <div class="ui container fork-list"> <h2 class="ui dividing header"> {{ctx.Locale.Tr "repo.forks"}} </h2> - <div class="flex-list"> - {{range .Forks}} - <div class="flex-item tw-border-0 repo-fork-item"> - <span>{{ctx.AvatarUtils.Avatar .Owner}}</span> - <span><a href="{{.Owner.HomeLink}}">{{.Owner.Name}}</a> / <a href="{{.Link}}">{{.Name}}</a></span> - </div> - {{end}} - </div> + {{template "shared/repo/list" .}} + {{template "base/paginate" .}} </div> - - {{template "base/paginate" .}} </div> {{template "base/footer" .}} diff --git a/templates/repo/graph.tmpl b/templates/repo/graph.tmpl index 9eb4bd4ecb..cd115f95dc 100644 --- a/templates/repo/graph.tmpl +++ b/templates/repo/graph.tmpl @@ -2,7 +2,7 @@ <div role="main" aria-label="{{.Title}}" class="page-content repository commits"> {{template "repo/header" .}} <div class="ui container"> - <div id="git-graph-container" class="ui segment{{if eq .Mode "monochrome"}} monochrome{{end}}"> + <div id="git-graph-container" class="ui segment {{if eq .Mode "monochrome"}}monochrome{{end}}"> <h2 class="ui header dividing"> {{ctx.Locale.Tr "repo.commit_graph"}} <div class="ui icon buttons tiny color-buttons"> @@ -11,52 +11,45 @@ <div class="default text">{{ctx.Locale.Tr "repo.commit_graph.select"}}</div> <div class="menu"> <div class="item" data-value="...flow-hide-pr-refs"> - <span class="truncate"> - {{svg "octicon-eye-closed" 16 "tw-mr-1"}}<span title="{{ctx.Locale.Tr "repo.commit_graph.hide_pr_refs"}}">{{ctx.Locale.Tr "repo.commit_graph.hide_pr_refs"}}</span> - </span> + {{svg "octicon-eye-closed"}} + <span class="gt-ellipsis" title="{{ctx.Locale.Tr "repo.commit_graph.hide_pr_refs"}}">{{ctx.Locale.Tr "repo.commit_graph.hide_pr_refs"}}</span> </div> {{range .AllRefs}} {{$refGroup := .RefGroup}} {{if eq $refGroup "pull"}} <div class="item" data-value="{{.Name}}"> - <span class="truncate"> - {{svg "octicon-git-pull-request" 16 "tw-mr-1"}}<span title="{{.ShortName}}">#{{.ShortName}}</span> - </span> + {{svg "octicon-git-pull-request"}} + <span class="gt-ellipsis" title="{{.ShortName}}">#{{.ShortName}}</span> </div> {{else if eq $refGroup "tags"}} <div class="item" data-value="{{.Name}}"> - <span class="truncate"> - {{svg "octicon-tag" 16 "tw-mr-1"}}<span title="{{.ShortName}}">{{.ShortName}}</span> - </span> + {{svg "octicon-tag"}} + <span class="gt-ellipsis" title="{{.ShortName}}">{{.ShortName}}</span> </div> {{else if eq $refGroup "remotes"}} <div class="item" data-value="{{.Name}}"> - <span class="truncate"> - {{svg "octicon-cross-reference" 16 "tw-mr-1"}}<span title="{{.ShortName}}">{{.ShortName}}</span> - </span> + {{svg "octicon-cross-reference"}} + <span class="gt-ellipsis" title="{{.ShortName}}">{{.ShortName}}</span> </div> {{else if eq $refGroup "heads"}} <div class="item" data-value="{{.Name}}"> - <span class="truncate"> - {{svg "octicon-git-branch" 16 "tw-mr-1"}}<span title="{{.ShortName}}">{{.ShortName}}</span> - </span> + {{svg "octicon-git-branch"}} + <span class="gt-ellipsis" title="{{.ShortName}}">{{.ShortName}}</span> </div> {{end}} {{end}} </div> </div> - <button id="flow-color-monochrome" class="ui labelled icon button{{if eq .Mode "monochrome"}} active{{end}}" title="{{ctx.Locale.Tr "repo.commit_graph.monochrome"}}">{{svg "material-invert-colors" 16 "tw-mr-1"}}{{ctx.Locale.Tr "repo.commit_graph.monochrome"}}</button> - <button id="flow-color-colored" class="ui labelled icon button{{if ne .Mode "monochrome"}} active{{end}}" title="{{ctx.Locale.Tr "repo.commit_graph.color"}}">{{svg "material-palette" 16 "tw-mr-1"}}{{ctx.Locale.Tr "repo.commit_graph.color"}}</button> + <button id="flow-color-monochrome" class="ui icon button{{if eq .Mode "monochrome"}} active{{end}}" title="{{ctx.Locale.Tr "repo.commit_graph.monochrome"}}">{{svg "material-invert-colors" 16 "tw-mr-1"}}{{ctx.Locale.Tr "repo.commit_graph.monochrome"}}</button> + <button id="flow-color-colored" class="ui icon button{{if ne .Mode "monochrome"}} active{{end}}" title="{{ctx.Locale.Tr "repo.commit_graph.color"}}">{{svg "material-palette" 16 "tw-mr-1"}}{{ctx.Locale.Tr "repo.commit_graph.color"}}</button> </div> </h2> - <div class="ui dividing"></div> - <div class="is-loading tw-py-32 tw-hidden" id="loading-indicator"></div> - {{template "repo/graph/svgcontainer" .}} - {{template "repo/graph/commits" .}} + <div id="git-graph-body"> + {{template "repo/graph/svgcontainer" .}} + {{template "repo/graph/commits" .}} + {{template "base/paginate" .}} + </div> </div> </div> </div> -<div id="pagination"> - {{template "base/paginate" .}} -</div> {{template "base/footer" .}} diff --git a/templates/repo/graph/commits.tmpl b/templates/repo/graph/commits.tmpl index 6af0ba1f0f..07ec076697 100644 --- a/templates/repo/graph/commits.tmpl +++ b/templates/repo/graph/commits.tmpl @@ -5,10 +5,13 @@ {{if $commit.OnlyRelation}} <span></span> {{else}} - {{template "repo/commit_sign_badge" dict "Commit" $commit.Commit "CommitBaseLink" (print $.RepoLink "/commit") "CommitSignVerification" $commit.Verification}} + {{/* every field must be in a span to get correctly styled */}} + <span> + {{template "repo/commit_sign_badge" dict "Commit" $commit.Commit "CommitBaseLink" (print $.RepoLink "/commit") "CommitSignVerification" $commit.Verification}} + </span> <span class="message tw-inline-block gt-ellipsis"> - <span>{{ctx.RenderUtils.RenderCommitMessage $commit.Subject ($.Repository.ComposeMetas ctx)}}</span> + {{ctx.RenderUtils.RenderCommitMessage $commit.Subject $.Repository}} </span> <span class="commit-refs flex-text-inline"> @@ -17,18 +20,18 @@ {{if eq $refGroup "pull"}} {{if or (not $.HidePRRefs) (SliceUtils.Contains $.SelectedBranches .Name)}} <!-- it's intended to use issues not pulls, if it's a pull you will get redirected --> - <a class="ui labelled basic tiny button" href="{{$.RepoLink}}/{{if $.Repository.UnitEnabled ctx ctx.Consts.RepoUnitTypePullRequests}}pulls{{else}}issues{{end}}/{{.ShortName|PathEscape}}"> + <a class="ui basic tiny button" href="{{$.RepoLink}}/{{if $.Repository.UnitEnabled ctx ctx.Consts.RepoUnitTypePullRequests}}pulls{{else}}issues{{end}}/{{.ShortName|PathEscape}}"> {{svg "octicon-git-pull-request"}} #{{.ShortName}} </a> {{end}} {{else if eq $refGroup "tags"}} - {{- template "repo/tag/name" dict "RepoLink" $.Repository.Link "TagName" .ShortName -}} + {{- template "repo/tag/name" dict "AdditionalClasses" "tag-label" "RepoLink" $.Repository.Link "TagName" .ShortName -}} {{else if eq $refGroup "remotes"}} - <a class="ui labelled basic tiny button" href="{{$.RepoLink}}/src/commit/{{$commit.Rev|PathEscape}}"> + <a class="ui basic tiny button" href="{{$.RepoLink}}/src/commit/{{$commit.Rev|PathEscape}}"> {{svg "octicon-cross-reference"}} {{.ShortName}} </a> {{else if eq $refGroup "heads"}} - <a class="ui labelled basic tiny button" href="{{$.RepoLink}}/src/branch/{{.ShortName|PathEscape}}"> + <a class="ui basic tiny button" href="{{$.RepoLink}}/src/branch/{{.ShortName|PathEscape}}"> {{svg "octicon-git-branch"}} {{.ShortName}} </a> {{else}} diff --git a/templates/repo/graph/div.tmpl b/templates/repo/graph/div.tmpl index c0bd4e269a..12c2869cd8 100644 --- a/templates/repo/graph/div.tmpl +++ b/templates/repo/graph/div.tmpl @@ -1,7 +1,3 @@ -<div> - {{template "repo/graph/svgcontainer" .}} - {{template "repo/graph/commits" .}} - <div id="pagination"> - {{template "base/paginate" .}} - </div> -</div> +{{template "repo/graph/svgcontainer" .}} +{{template "repo/graph/commits" .}} +{{template "base/paginate" .}} diff --git a/templates/repo/header.tmpl b/templates/repo/header.tmpl index c3ae697f31..b61076ff46 100644 --- a/templates/repo/header.tmpl +++ b/templates/repo/header.tmpl @@ -25,6 +25,9 @@ <div class="repo-icon only-mobile" data-tooltip-content="{{ctx.Locale.Tr "repo.desc.internal"}}">{{svg "octicon-shield-lock" 18}}</div> {{end}} {{end}} + {{if $.Permission.HasAnyUnitPublicAccess}} + <span class="ui basic orange label">{{ctx.Locale.Tr "repo.desc.public_access"}}</span> + {{end}} {{if .IsTemplate}} <span class="ui basic label not-mobile">{{ctx.Locale.Tr "repo.desc.template"}}</span> <div class="repo-icon only-mobile" data-tooltip-content="{{ctx.Locale.Tr "repo.desc.template"}}">{{svg "octicon-repo-template" 18}}</div> @@ -35,20 +38,20 @@ </div> </div> {{if not (or .IsBeingCreated .IsBroken)}} - <div class="repo-buttons"> + <div class="flex-text-block tw-flex-wrap"> {{if $.RepoTransfer}} <form method="post" action="{{$.RepoLink}}/action/accept_transfer?redirect_to={{$.RepoLink}}"> {{$.CsrfTokenHtml}} - <div data-tooltip-content="{{if $.CanUserAcceptTransfer}}{{ctx.Locale.Tr "repo.transfer.accept_desc" $.RepoTransfer.Recipient.DisplayName}}{{else}}{{ctx.Locale.Tr "repo.transfer.no_permission_to_accept"}}{{end}}"> - <button type="submit" class="ui basic button {{if $.CanUserAcceptTransfer}}primary {{end}} ok small"{{if not $.CanUserAcceptTransfer}} disabled{{end}}> + <div class="flex-text-inline" data-tooltip-content="{{if $.CanUserAcceptOrRejectTransfer}}{{ctx.Locale.Tr "repo.transfer.accept_desc" $.RepoTransfer.Recipient.DisplayName}}{{else}}{{ctx.Locale.Tr "repo.transfer.no_permission_to_accept"}}{{end}}"> + <button type="submit" class="ui compact small basic button {{if $.CanUserAcceptOrRejectTransfer}}primary {{end}} ok small"{{if not $.CanUserAcceptOrRejectTransfer}} disabled{{end}}> {{ctx.Locale.Tr "repo.transfer.accept"}} </button> </div> </form> <form method="post" action="{{$.RepoLink}}/action/reject_transfer?redirect_to={{$.RepoLink}}"> {{$.CsrfTokenHtml}} - <div data-tooltip-content="{{if $.CanUserAcceptTransfer}}{{ctx.Locale.Tr "repo.transfer.reject_desc" $.RepoTransfer.Recipient.DisplayName}}{{else}}{{ctx.Locale.Tr "repo.transfer.no_permission_to_reject"}}{{end}}"> - <button type="submit" class="ui basic button {{if $.CanUserAcceptTransfer}}red {{end}}ok small"{{if not $.CanUserAcceptTransfer}} disabled{{end}}> + <div class="flex-text-inline" data-tooltip-content="{{if $.CanUserAcceptOrRejectTransfer}}{{ctx.Locale.Tr "repo.transfer.reject_desc" $.RepoTransfer.Recipient.DisplayName}}{{else}}{{ctx.Locale.Tr "repo.transfer.no_permission_to_reject"}}{{end}}"> + <button type="submit" class="ui compact small basic button {{if $.CanUserAcceptOrRejectTransfer}}red {{end}}ok small"{{if not $.CanUserAcceptOrRejectTransfer}} disabled{{end}}> {{ctx.Locale.Tr "repo.transfer.reject"}} </button> </div> @@ -133,7 +136,7 @@ {{if not (or .Repository.IsBeingCreated .Repository.IsBroken)}} <div class="overflow-menu-items"> {{if .Permission.CanRead ctx.Consts.RepoUnitTypeCode}} - <a class="{{if .PageIsViewCode}}active {{end}}item" href="{{.RepoLink}}{{if and (ne .BranchName .Repository.DefaultBranch) (not $.PageIsWiki)}}/src/{{.BranchNameSubURL}}{{end}}"> + <a class="{{if .PageIsViewCode}}active {{end}}item" href="{{.RepoLink}}{{if and (ne .BranchName .Repository.DefaultBranch) (not $.PageIsWiki)}}/src/{{.RefTypeNameSubURL}}{{end}}"> {{svg "octicon-code"}} {{ctx.Locale.Tr "repo.code"}} </a> {{end}} @@ -162,7 +165,7 @@ </a> {{end}} - {{if and .EnableActions (.Permission.CanRead ctx.Consts.RepoUnitTypeActions)}} + {{if and .EnableActions (.Permission.CanRead ctx.Consts.RepoUnitTypeActions) (not .IsEmptyRepo)}} <a class="{{if .PageIsActions}}active {{end}}item" href="{{.RepoLink}}/actions"> {{svg "octicon-play"}} {{ctx.Locale.Tr "actions.actions"}} {{if .Repository.NumOpenActionRuns}} @@ -208,7 +211,7 @@ </a> {{end}} - {{if and (.Permission.CanReadAny ctx.Consts.RepoUnitTypePullRequests ctx.Consts.RepoUnitTypeIssues ctx.Consts.RepoUnitTypeReleases) (not .IsEmptyRepo)}} + {{if and (.Permission.CanReadAny ctx.Consts.RepoUnitTypePullRequests ctx.Consts.RepoUnitTypeIssues ctx.Consts.RepoUnitTypeReleases ctx.Consts.RepoUnitTypeCode) (not .IsEmptyRepo)}} <a class="{{if .PageIsActivity}}active {{end}}item" href="{{.RepoLink}}/activity"> {{svg "octicon-pulse"}} {{ctx.Locale.Tr "repo.activity"}} </a> @@ -223,11 +226,19 @@ </a> {{end}} </div> - {{else if .Permission.IsAdmin}} + {{else}} <div class="overflow-menu-items"> + {{if(and .Repository.IsBeingCreated (.Permission.CanRead ctx.Consts.RepoUnitTypeCode))}} + <a class="{{if not .PageIsRepoSettings}}active {{end}}item" href="{{.RepoLink}}"> + {{svg "octicon-clock"}} {{ctx.Locale.Tr "repo.migration_status"}} + </a> + {{end}} + + {{if .Permission.IsAdmin}} <a class="{{if .PageIsRepoSettings}}active {{end}} item" href="{{.RepoLink}}/settings"> {{svg "octicon-tools"}} {{ctx.Locale.Tr "repo.settings"}} </a> + {{end}} </div> {{end}} </overflow-menu> diff --git a/templates/repo/home.tmpl b/templates/repo/home.tmpl index d73b7470bc..2a6c0d2fe5 100644 --- a/templates/repo/home.tmpl +++ b/templates/repo/home.tmpl @@ -1,7 +1,8 @@ {{template "base/head" .}} +{{$showSidebar := and (not .TreeNames) (not .HideRepoInfo) (not .IsBlame)}} <div role="main" aria-label="{{.Title}}" class="page-content repository file list {{if .IsBlame}}blame{{end}}"> {{template "repo/header" .}} - <div class="ui container {{if .IsBlame}}fluid padded{{end}}"> + <div class="ui container {{if or .TreeNames .IsBlame}}fluid padded{{end}}"> {{template "base/alert" .}} {{if .Repository.IsArchived}} @@ -14,119 +15,11 @@ </div> {{end}} - {{template "repo/code/recently_pushed_new_branches" .}} + {{template "repo/code/recently_pushed_new_branches" dict "RecentBranchesPromptData" .RecentBranchesPromptData}} - {{$treeNamesLen := len .TreeNames}} - {{$isTreePathRoot := eq $treeNamesLen 0}} - {{$showSidebar := and $isTreePathRoot (not .HideRepoInfo) (not .IsBlame)}} <div class="{{Iif $showSidebar "repo-grid-filelist-sidebar" "repo-grid-filelist-only"}}"> <div class="repo-home-filelist"> - {{template "repo/sub_menu" .}} - <div class="repo-button-row"> - <div class="repo-button-row-left"> - {{$branchDropdownCurrentRefType := "branch"}} - {{$branchDropdownCurrentRefShortName := .BranchName}} - {{if .IsViewTag}} - {{$branchDropdownCurrentRefType = "tag"}} - {{$branchDropdownCurrentRefShortName = .TagName}} - {{end}} - {{template "repo/branch_dropdown" dict - "Repository" .Repository - "ShowTabBranches" true - "ShowTabTags" true - "CurrentRefType" $branchDropdownCurrentRefType - "CurrentRefShortName" $branchDropdownCurrentRefShortName - "CurrentTreePath" .TreePath - "RefLinkTemplate" "{RepoLink}/src/{RefType}/{RefShortName}/{TreePath}" - "AllowCreateNewRef" .CanCreateBranch - "ShowViewAllRefsEntry" true - }} - {{if and .CanCompareOrPull .IsViewBranch (not .Repository.IsArchived)}} - {{$cmpBranch := ""}} - {{if ne .Repository.ID .BaseRepo.ID}} - {{$cmpBranch = printf "%s/%s:" (.Repository.OwnerName|PathEscape) (.Repository.Name|PathEscape)}} - {{end}} - {{$cmpBranch = print $cmpBranch (.BranchName|PathEscapeSegments)}} - {{$compareLink := printf "%s/compare/%s...%s" .BaseRepo.Link (.BaseRepo.DefaultBranch|PathEscapeSegments) $cmpBranch}} - <a id="new-pull-request" role="button" class="ui compact basic button" href="{{$compareLink}}" - data-tooltip-content="{{if .PullRequestCtx.Allowed}}{{ctx.Locale.Tr "repo.pulls.compare_changes"}}{{else}}{{ctx.Locale.Tr "action.compare_branch"}}{{end}}"> - {{svg "octicon-git-pull-request"}} - </a> - {{end}} - - <!-- Show go to file if on home page --> - {{if $isTreePathRoot}} - <a href="{{.Repository.Link}}/find/{{.BranchNameSubURL}}" class="ui compact basic button">{{ctx.Locale.Tr "repo.find_file.go_to_file"}}</a> - {{end}} - - {{if and .CanWriteCode .IsViewBranch (not .Repository.IsMirror) (not .Repository.IsArchived) (not .IsViewFile)}} - <button class="ui dropdown basic compact jump button"{{if not .Repository.CanEnableEditor}} disabled{{end}}> - {{ctx.Locale.Tr "repo.editor.add_file"}} - {{svg "octicon-triangle-down" 14 "dropdown icon"}} - <div class="menu"> - <a class="item" href="{{.RepoLink}}/_new/{{.BranchName | PathEscapeSegments}}/{{.TreePath | PathEscapeSegments}}"> - {{ctx.Locale.Tr "repo.editor.new_file"}} - </a> - {{if .RepositoryUploadEnabled}} - <a class="item" href="{{.RepoLink}}/_upload/{{.BranchName | PathEscapeSegments}}/{{.TreePath | PathEscapeSegments}}"> - {{ctx.Locale.Tr "repo.editor.upload_file"}} - </a> - {{end}} - <a class="item" href="{{.RepoLink}}/_diffpatch/{{.BranchName | PathEscapeSegments}}/{{.TreePath | PathEscapeSegments}}"> - {{ctx.Locale.Tr "repo.editor.patch"}} - </a> - </div> - </button> - {{end}} - - {{if and $isTreePathRoot .Repository.IsTemplate}} - <a role="button" class="ui primary compact button" href="{{AppSubUrl}}/repo/create?template_id={{.Repository.ID}}"> - {{ctx.Locale.Tr "repo.use_template"}} - </a> - {{end}} - - {{if not $isTreePathRoot}} - {{$treeNameIdxLast := Eval $treeNamesLen "-" 1}} - <span class="breadcrumb repo-path tw-ml-1"> - <a class="section" href="{{.RepoLink}}/src/{{.BranchNameSubURL}}" title="{{.Repository.Name}}">{{StringUtils.EllipsisString .Repository.Name 30}}</a> - {{- range $i, $v := .TreeNames -}} - <span class="breadcrumb-divider">/</span> - {{- if eq $i $treeNameIdxLast -}} - <span class="active section" title="{{$v}}">{{$v}}</span> - <button class="btn interact-fg tw-mx-1" data-clipboard-text="{{$.TreePath}}" data-tooltip-content="{{ctx.Locale.Tr "copy_path"}}">{{svg "octicon-copy" 14}}</button> - {{- else -}} - {{$p := index $.Paths $i}}<span class="section"><a href="{{$.BranchLink}}/{{PathEscapeSegments $p}}" title="{{$v}}">{{$v}}</a></span> - {{- end -}} - {{- end -}} - </span> - {{end}} - </div> - - <div class="repo-button-row-right"> - <!-- Only show clone panel in repository home page --> - {{if $isTreePathRoot}} - {{template "repo/clone_panel" .}} - {{end}} - {{if and (not $isTreePathRoot) (not .IsViewFile) (not .IsBlame)}}{{/* IsViewDirectory (not home), TODO: split the templates, avoid using "if" tricks */}} - <a class="ui button" href="{{.RepoLink}}/commits/{{.BranchNameSubURL}}/{{.TreePath | PathEscapeSegments}}"> - {{svg "octicon-history" 16 "tw-mr-2"}}{{ctx.Locale.Tr "repo.file_history"}} - </a> - {{end}} - </div> - </div> - {{if .IsViewFile}} - {{template "repo/view_file" .}} - {{else if .IsBlame}} - {{template "repo/blame" .}} - {{else}}{{/* IsViewDirectory */}} - {{if $isTreePathRoot}} - {{template "repo/code/upstream_diverging_info" .}} - {{end}} - {{template "repo/view_list" .}} - {{if and .ReadmeExist (or .IsMarkup .IsPlainText)}} - {{template "repo/view_file" .}} - {{end}} - {{end}} + {{template "repo/view_content" .}} </div> {{if $showSidebar}} diff --git a/templates/repo/home_sidebar_bottom.tmpl b/templates/repo/home_sidebar_bottom.tmpl index f780dc122d..01e630ccbf 100644 --- a/templates/repo/home_sidebar_bottom.tmpl +++ b/templates/repo/home_sidebar_bottom.tmpl @@ -4,14 +4,14 @@ <div class="flex-item"> <div class="flex-item-main"> <div class="flex-item-title"> - <a class="item muted" href="{{.Link}}/releases"> + <a class="item muted" href="{{.RepoLink}}/releases"> {{ctx.Locale.Tr "repo.releases"}} <span class="ui small label">{{.NumReleases}}</span> </a> </div> <div class="flex-item"> - <div class="flex-item-icon"> - {{svg "octicon-tag" 16}} + <div class="flex-item-leading"> + <div class="tw-mt-1">{{svg "octicon-tag" 16}}</div> </div> <div class="flex-item-main"> <div class="flex-item-header"> diff --git a/templates/repo/home_sidebar_top.tmpl b/templates/repo/home_sidebar_top.tmpl index 607dc62e2e..8c2089c839 100644 --- a/templates/repo/home_sidebar_top.tmpl +++ b/templates/repo/home_sidebar_top.tmpl @@ -1,5 +1,5 @@ <div class="repo-home-sidebar-top"> - <form class="ignore-dirty tw-flex tw-flex-1 tw-mt-1" action="{{.RepoLink}}/search" method="get"> + <form class="ignore-dirty tw-flex tw-flex-1" action="{{.RepoLink}}/search" method="get"> <div class="ui small action input tw-flex-1"> <input name="q" size="10" placeholder="{{ctx.Locale.Tr "search.code_kind"}}"> {{template "shared/search/button"}} </div> @@ -45,7 +45,7 @@ {{end}} {{if .ReadmeExist}} - <a class="flex-text-block muted" href="{{.TreeLink}}/{{.FileName}}"> + <a class="flex-text-block muted" href="{{.RepoLink}}/src/{{.RefTypeNameSubURL}}/{{PathEscapeSegments .FileTreePath}}"> {{svg "octicon-book"}} {{ctx.Locale.Tr "readme"}} </a> {{end}} @@ -62,6 +62,11 @@ {{svg "octicon-cross-reference"}} {{ctx.Locale.Tr "repo.cite_this_repo"}} </a> {{end}} + <span class="flex-text-block muted" {{if not (eq .Repository.Size 0)}}data-tooltip-placement="top" data-tooltip-content="{{.Repository.SizeDetailsString}}"{{end}}> + {{$fileSizeFormatted := FileSize .Repository.Size}}{{/* the formatted string is always "{val} {unit}" */}} + {{$fileSizeFields := StringUtils.Split $fileSizeFormatted " "}} + {{svg "octicon-database"}} <b>{{ctx.Locale.PrettyNumber (index $fileSizeFields 0)}}</b> {{index $fileSizeFields 1}} + </span> </div> </div> </div> diff --git a/templates/repo/icon.tmpl b/templates/repo/icon.tmpl index e5e0bd68e7..e4a904c46b 100644 --- a/templates/repo/icon.tmpl +++ b/templates/repo/icon.tmpl @@ -1,6 +1,6 @@ {{$avatarLink := (.RelAvatarLink ctx)}} {{if $avatarLink}} - <img class="ui avatar tw-align-middle" src="{{$avatarLink}}" width="24" height="24" alt="{{.FullName}}"> + <img class="ui avatar tw-align-middle" src="{{$avatarLink}}" width="24" height="24" alt aria-hidden="true"> {{else if $.IsMirror}} {{svg "octicon-mirror" 24}} {{else if $.IsFork}} diff --git a/templates/repo/issue/branch_selector_field.tmpl b/templates/repo/issue/branch_selector_field.tmpl index 9183b7b46a..c8b67490ac 100644 --- a/templates/repo/issue/branch_selector_field.tmpl +++ b/templates/repo/issue/branch_selector_field.tmpl @@ -14,7 +14,7 @@ Still needs to figure out: */}} {{if and (not .Issue.IsPull) (not .PageIsComparePull)}} <input id="ref_selector" name="ref" type="hidden" value="{{.Reference}}"> -<div class="ui dropdown select-branch branch-selector-dropdown ellipsis-items-nowrap {{if not .HasIssuesOrPullsWritePermission}}disabled{{end}}" +<div class="ui dropdown select-branch branch-selector-dropdown ellipsis-text-items {{if not .HasIssuesOrPullsWritePermission}}disabled{{end}}" data-no-results="{{ctx.Locale.Tr "no_results_found"}}" {{if and .Issue (or .IsIssueWriter .HasIssuesOrPullsWritePermission)}}data-url-update-issueref="{{$.RepoLink}}/issues/{{.Issue.Index}}/ref"{{end}} > diff --git a/templates/repo/issue/card.tmpl b/templates/repo/issue/card.tmpl index 2e19e86d7a..6dae49c455 100644 --- a/templates/repo/issue/card.tmpl +++ b/templates/repo/issue/card.tmpl @@ -4,7 +4,7 @@ {{if $attachments}} <div class="card-attachment-images"> {{range $attachments}} - <img src="{{.DownloadURL}}" alt="{{.Name}}" /> + <img loading="lazy" src="{{.DownloadURL}}" alt="{{.Name}}" /> {{end}} </div> {{end}} @@ -16,7 +16,7 @@ </div> <a class="issue-card-title muted issue-title tw-break-anywhere" href="{{.Link}}">{{.Title | ctx.RenderUtils.RenderIssueSimpleTitle}}</a> {{if and $.isPinnedIssueCard $.Page.IsRepoAdmin}} - <a role="button" class="issue-card-unpin muted tw-flex tw-items-center" data-tooltip-content={{ctx.Locale.Tr "repo.issues.unpin_issue"}} data-issue-id="{{.ID}}" data-unpin-url="{{$.Page.Link}}/unpin/{{.Index}}"> + <a role="button" class="issue-card-unpin muted tw-flex tw-items-center" data-tooltip-content={{ctx.Locale.Tr "repo.issues.unpin"}} data-issue-id="{{.ID}}" data-unpin-url="{{$.Page.Link}}/unpin/{{.Index}}"> {{svg "octicon-x" 16}} </a> {{end}} @@ -45,7 +45,7 @@ {{if $.Page.LinkedPRs}} {{range index $.Page.LinkedPRs .ID}} <div class="meta tw-my-1"> - <a href="{{$.Issue.Repo.Link}}/pulls/{{.Index}}"> + <a href="{{.Repo.Link}}/pulls/{{.Index}}"> <span class="tw-m-0 text {{if .PullRequest.HasMerged}}purple{{else if .IsClosed}}red{{else}}green{{end}}">{{svg "octicon-git-merge" 16 "tw-mr-1 tw-align-middle"}}</span> <span class="tw-align-middle">{{.Title}} <span class="text light grey">#{{.Index}}</span></span> </a> @@ -63,16 +63,21 @@ {{if or .Labels .Assignees}} <div class="issue-card-bottom"> - <div class="labels-list"> - {{range .Labels}} - <a target="_blank" href="{{$.Issue.Repo.Link}}/issues?labels={{.ID}}">{{ctx.RenderUtils.RenderLabel .}}</a> + {{/* the labels container must always be present, to help the assignees list right-aligned */}} + <div class="issue-card-bottom-part labels-list"> + {{range $label := .Labels}} + {{$link := print $.Issue.Repo.Link "/issues"}} + {{$link = QueryBuild $link "labels" $label.ID}} + {{ctx.RenderUtils.RenderLabelWithLink $label $link}} {{end}} </div> - <div class="issue-card-assignees"> + {{if .Assignees}} + <div class="issue-card-bottom-part tw-justify-end"> {{range .Assignees}} - <a target="_blank" href="{{.HomeLink}}" data-tooltip-content="{{ctx.Locale.Tr "repo.projects.column.assigned_to"}} {{.Name}}">{{ctx.AvatarUtils.Avatar . 28}}</a> + <a target="_blank" href="{{.HomeLink}}" data-tooltip-content="{{ctx.Locale.Tr "repo.projects.column.assigned_to"}} {{.Name}}">{{ctx.AvatarUtils.Avatar . 24}}</a> {{end}} </div> + {{end}} </div> {{end}} {{end}} diff --git a/templates/repo/issue/choose.tmpl b/templates/repo/issue/choose.tmpl index 38cf9e485f..e3314f4260 100644 --- a/templates/repo/issue/choose.tmpl +++ b/templates/repo/issue/choose.tmpl @@ -10,11 +10,11 @@ {{range .IssueTemplates}} <div class="ui attached segment"> <div class="ui two column grid"> - <div class="column left aligned"> + <div class="column"> <strong>{{.Name}}</strong> <br>{{.About}} </div> - <div class="column right aligned"> + <div class="column tw-text-right"> <a href="{{$.RepoLink}}/issues/new?template={{.FileName}}{{if $.milestone}}&milestone={{$.milestone}}{{end}}{{if $.project}}&project={{$.project}}{{end}}" class="ui primary button">{{ctx.Locale.Tr "repo.issues.choose.get_started"}}</a> </div> </div> @@ -23,11 +23,11 @@ {{range .IssueConfig.ContactLinks}} <div class="ui attached segment"> <div class="ui two column grid"> - <div class="column left aligned"> + <div class="column"> <strong>{{.Name}}</strong> <br>{{.About}} </div> - <div class="column right aligned"> + <div class="column tw-text-right"> <a href="{{.URL}}" class="ui primary button">{{svg "octicon-link-external"}} {{ctx.Locale.Tr "repo.issues.choose.open_external_link"}}</a> </div> </div> @@ -36,11 +36,11 @@ {{if .IssueConfig.BlankIssuesEnabled}} <div class="ui attached segment"> <div class="ui two column grid"> - <div class="column left aligned"> + <div class="column"> <strong>{{ctx.Locale.Tr "repo.issues.choose.blank"}}</strong> <br/>{{ctx.Locale.Tr "repo.issues.choose.blank_about"}} </div> - <div class="column right aligned"> + <div class="column tw-text-right"> <a href="{{.RepoLink}}/issues/new?{{if .milestone}}&milestone={{.milestone}}{{end}}{{if $.project}}&project={{$.project}}{{end}}" class="ui primary button">{{ctx.Locale.Tr "repo.issues.choose.get_started"}}</a> </div> </div> diff --git a/templates/repo/issue/fields/markdown.tmpl b/templates/repo/issue/fields/markdown.tmpl index da8f5e6bdf..dbf4b71ba8 100644 --- a/templates/repo/issue/fields/markdown.tmpl +++ b/templates/repo/issue/fields/markdown.tmpl @@ -1,3 +1,3 @@ <div class="field {{if not .item.VisibleOnForm}}tw-hidden{{end}}"> - <div class="markup">{{ctx.RenderUtils.MarkdownToHtml .item.Attributes.value}}</div> + <div class="render-content markup">{{ctx.RenderUtils.MarkdownToHtml .item.Attributes.value}}</div> </div> diff --git a/templates/repo/issue/filter_item_label.tmpl b/templates/repo/issue/filter_item_label.tmpl index 0883d93804..04c3605a6a 100644 --- a/templates/repo/issue/filter_item_label.tmpl +++ b/templates/repo/issue/filter_item_label.tmpl @@ -22,7 +22,7 @@ <span class="label-filter-exclude-info">{{ctx.Locale.Tr "repo.issues.filter_label_exclude"}}</span> <div class="divider"></div> <a class="item label-filter-query-default" href="{{QueryBuild $queryLink "labels" NIL}}">{{ctx.Locale.Tr "repo.issues.filter_label_no_select"}}</a> - <a class="item label-filter-query-not-set" href="{{QueryBuild $queryLink "labels" 0}}">{{ctx.Locale.Tr "repo.issues.filter_label_select_no_label"}}</a> + <a class="item label-filter-query-not-set" href="{{QueryBuild $queryLink "labels" "0"}}">{{ctx.Locale.Tr "repo.issues.filter_label_select_no_label"}}</a> {{/* The logic here is not the same as the label selector in the issue sidebar. The one in the issue sidebar renders "repo labels | divider | org labels". Maybe the logic should be updated to be consistent.*/}} diff --git a/templates/repo/issue/filter_item_user_assign.tmpl b/templates/repo/issue/filter_item_user_assign.tmpl index 4f1db71d57..42886edaa0 100644 --- a/templates/repo/issue/filter_item_user_assign.tmpl +++ b/templates/repo/issue/filter_item_user_assign.tmpl @@ -4,8 +4,8 @@ * UserSearchList * SelectedUserId: 0 or empty means default, -1 means "no user is set" * TextFilterTitle -* TextZeroValue: the text for "all issues" -* TextNegativeOne: the text for "issues with no assignee" +* TextFilterMatchNone: the text for "issues with no assignee" +* TextFilterMatchAny: the text for "issues with any assignee" */}} {{$queryLink := .QueryLink}} <div class="item ui dropdown jump {{if not .UserSearchList}}disabled{{end}}"> @@ -15,16 +15,24 @@ <i class="icon">{{svg "octicon-search" 16}}</i> <input type="text" placeholder="{{ctx.Locale.Tr "repo.issues.filter_user_placeholder"}}"> </div> - {{if $.TextZeroValue}} - <a class="item {{if not .SelectedUserId}}selected{{end}}" href="{{QueryBuild $queryLink $.QueryParamKey NIL}}">{{$.TextZeroValue}}</a> + {{if $.TextFilterMatchNone}} + {{$isSelected := eq .SelectedUserId "(none)"}} + <a class="item" href="{{QueryBuild $queryLink $.QueryParamKey (Iif $isSelected NIL "(none)")}}"> + {{svg "octicon-check" 14 (Iif $isSelected "" "tw-invisible")}} {{$.TextFilterMatchNone}} + </a> {{end}} - {{if $.TextNegativeOne}} - <a class="item {{if eq .SelectedUserId -1}}selected{{end}}" href="{{QueryBuild $queryLink $.QueryParamKey -1}}">{{$.TextNegativeOne}}</a> + {{if $.TextFilterMatchAny}} + {{$isSelected := eq .SelectedUserId "(any)"}} + <a class="item" href="{{QueryBuild $queryLink $.QueryParamKey (Iif $isSelected NIL "(any)")}}"> + {{svg "octicon-check" 14 (Iif $isSelected "" "tw-invisible")}} {{$.TextFilterMatchAny}} + </a> {{end}} <div class="divider"></div> - {{range .UserSearchList}} - <a class="item {{if eq $.SelectedUserId .ID}}selected{{end}}" href="{{QueryBuild $queryLink $.QueryParamKey .ID}}"> - {{ctx.AvatarUtils.Avatar . 20}}{{template "repo/search_name" .}} + {{range $user := .UserSearchList}} + {{$isSelected := eq $.SelectedUserId (print $user.ID)}} + <a class="item" href="{{QueryBuild $queryLink $.QueryParamKey (Iif $isSelected NIL $user.ID)}}"> + {{svg "octicon-check" 14 (Iif $isSelected "" "tw-invisible")}} + {{ctx.AvatarUtils.Avatar $user 20}}{{template "repo/search_name" .}} </a> {{end}} </div> diff --git a/templates/repo/issue/filter_list.tmpl b/templates/repo/issue/filter_list.tmpl index 7612d93b21..bfdf94513e 100644 --- a/templates/repo/issue/filter_list.tmpl +++ b/templates/repo/issue/filter_list.tmpl @@ -15,7 +15,7 @@ <input type="text" placeholder="{{ctx.Locale.Tr "repo.issues.filter_milestone"}}"> </div> <div class="divider"></div> - <a class="{{if not $.MilestoneID}}active selected {{end}}item" href="{{QueryBuild $queryLink "milestone" 0}}">{{ctx.Locale.Tr "repo.issues.filter_milestone_all"}}</a> + <a class="{{if not $.MilestoneID}}active selected {{end}}item" href="{{QueryBuild $queryLink "milestone" NIL}}">{{ctx.Locale.Tr "repo.issues.filter_milestone_all"}}</a> <a class="{{if $.MilestoneID}}{{if eq $.MilestoneID -1}}active selected {{end}}{{end}}item" href="{{QueryBuild $queryLink "milestone" -1}}">{{ctx.Locale.Tr "repo.issues.filter_milestone_none"}}</a> {{if .OpenMilestones}} <div class="divider"></div> @@ -94,8 +94,8 @@ "UserSearchList" $.Assignees "SelectedUserId" $.AssigneeID "TextFilterTitle" (ctx.Locale.Tr "repo.issues.filter_assignee") - "TextZeroValue" (ctx.Locale.Tr "repo.issues.filter_assginee_no_select") - "TextNegativeOne" (ctx.Locale.Tr "repo.issues.filter_assginee_no_assignee") + "TextFilterMatchNone" (ctx.Locale.Tr "repo.issues.filter_assignee_no_assignee") + "TextFilterMatchAny" (ctx.Locale.Tr "repo.issues.filter_assignee_any_assignee") }} {{if .IsSigned}} @@ -106,7 +106,7 @@ </span> {{svg "octicon-triangle-down" 14 "dropdown icon"}} <div class="menu"> - <a class="{{if eq .ViewType "all"}}active {{end}}item" href="{{QueryBuild $queryLink "type" "all"}}">{{ctx.Locale.Tr "repo.issues.filter_type.all_issues"}}</a> + <a class="{{if eq .ViewType "all"}}active {{end}}item" href="{{QueryBuild $queryLink "type" "all"}}">{{if .PageIsPullList}}{{ctx.Locale.Tr "repo.issues.filter_type.all_pull_requests"}}{{else}}{{ctx.Locale.Tr "repo.issues.filter_type.all_issues"}}{{end}}</a> <a class="{{if eq .ViewType "assigned"}}active {{end}}item" href="{{QueryBuild $queryLink "type" "assigned"}}">{{ctx.Locale.Tr "repo.issues.filter_type.assigned_to_you"}}</a> <a class="{{if eq .ViewType "created_by"}}active {{end}}item" href="{{QueryBuild $queryLink "type" "created_by"}}">{{ctx.Locale.Tr "repo.issues.filter_type.created_by_you"}}</a> {{if .PageIsPullList}} @@ -133,5 +133,11 @@ <a class="{{if eq .SortType "leastcomment"}}active {{end}}item" href="{{QueryBuild $queryLink "sort" "leastcomment"}}">{{ctx.Locale.Tr "repo.issues.filter_sort.leastcomment"}}</a> <a class="{{if eq .SortType "nearduedate"}}active {{end}}item" href="{{QueryBuild $queryLink "sort" "nearduedate"}}">{{ctx.Locale.Tr "repo.issues.filter_sort.nearduedate"}}</a> <a class="{{if eq .SortType "farduedate"}}active {{end}}item" href="{{QueryBuild $queryLink "sort" "farduedate"}}">{{ctx.Locale.Tr "repo.issues.filter_sort.farduedate"}}</a> + <div class="divider"></div> + <div class="header">{{ctx.Locale.Tr "repo.issues.filter_label"}}</div> + {{range $scope := .ExclusiveLabelScopes}} + {{$sortType := (printf "scope-%s" $scope)}} + <a class="{{if eq $.SortType $sortType}}active {{end}}item" href="{{QueryBuild $queryLink "sort" $sortType}}">{{$scope}}</a> + {{end}} </div> </div> diff --git a/templates/repo/issue/filters.tmpl b/templates/repo/issue/filters.tmpl index 06e7c1aa6c..409ec876e6 100644 --- a/templates/repo/issue/filters.tmpl +++ b/templates/repo/issue/filters.tmpl @@ -9,7 +9,7 @@ <div class="ui compact tiny secondary menu"> <span class="item" data-tooltip-content='{{ctx.Locale.Tr "tracked_time_summary"}}'> {{svg "octicon-clock"}} - {{.TotalTrackedTime | Sec2Time}} + {{.TotalTrackedTime | Sec2Hour}} </span> </div> {{end}} diff --git a/templates/repo/issue/label_precolors.tmpl b/templates/repo/issue/label_precolors.tmpl index 80007662c0..7be3f40350 100644 --- a/templates/repo/issue/label_precolors.tmpl +++ b/templates/repo/issue/label_precolors.tmpl @@ -1,22 +1,27 @@ <div class="precolors"> - <div class="tw-flex"> - <a class="color" style="background-color:#e11d21" data-color-hex="#e11d21"></a> - <a class="color" style="background-color:#eb6420" data-color-hex="#eb6420"></a> - <a class="color" style="background-color:#fbca04" data-color-hex="#fbca04"></a> - <a class="color" style="background-color:#009800" data-color-hex="#009800"></a> - <a class="color" style="background-color:#006b75" data-color-hex="#006b75"></a> - <a class="color" style="background-color:#207de5" data-color-hex="#207de5"></a> - <a class="color" style="background-color:#0052cc" data-color-hex="#0052cc"></a> - <a class="color" style="background-color:#5319e7" data-color-hex="#5319e7"></a> - </div> - <div class="tw-flex"> - <a class="color" style="background-color:#f6c6c7" data-color-hex="#f6c6c7"></a> - <a class="color" style="background-color:#fad8c7" data-color-hex="#fad8c7"></a> - <a class="color" style="background-color:#fef2c0" data-color-hex="#fef2c0"></a> - <a class="color" style="background-color:#bfe5bf" data-color-hex="#bfe5bf"></a> - <a class="color" style="background-color:#bfdadc" data-color-hex="#bfdadc"></a> - <a class="color" style="background-color:#c7def8" data-color-hex="#c7def8"></a> - <a class="color" style="background-color:#bfd4f2" data-color-hex="#bfd4f2"></a> - <a class="color" style="background-color:#d4c5f9" data-color-hex="#d4c5f9"></a> + <button type="button" class="ui button generate-random-color"> + {{svg "octicon-sync"}} + </button> + <div> + <div class="tw-flex"> + <a class="color" style="background-color:#e11d21" data-color-hex="#e11d21"></a> + <a class="color" style="background-color:#eb6420" data-color-hex="#eb6420"></a> + <a class="color" style="background-color:#fbca04" data-color-hex="#fbca04"></a> + <a class="color" style="background-color:#009800" data-color-hex="#009800"></a> + <a class="color" style="background-color:#006b75" data-color-hex="#006b75"></a> + <a class="color" style="background-color:#207de5" data-color-hex="#207de5"></a> + <a class="color" style="background-color:#0052cc" data-color-hex="#0052cc"></a> + <a class="color" style="background-color:#5319e7" data-color-hex="#5319e7"></a> + </div> + <div class="tw-flex"> + <a class="color" style="background-color:#f6c6c7" data-color-hex="#f6c6c7"></a> + <a class="color" style="background-color:#fad8c7" data-color-hex="#fad8c7"></a> + <a class="color" style="background-color:#fef2c0" data-color-hex="#fef2c0"></a> + <a class="color" style="background-color:#bfe5bf" data-color-hex="#bfe5bf"></a> + <a class="color" style="background-color:#bfdadc" data-color-hex="#bfdadc"></a> + <a class="color" style="background-color:#c7def8" data-color-hex="#c7def8"></a> + <a class="color" style="background-color:#bfd4f2" data-color-hex="#bfd4f2"></a> + <a class="color" style="background-color:#d4c5f9" data-color-hex="#d4c5f9"></a> + </div> </div> </div> diff --git a/templates/repo/issue/labels/label_edit_modal.tmpl b/templates/repo/issue/labels/label_edit_modal.tmpl index 527b7ff900..ec57de2f3f 100644 --- a/templates/repo/issue/labels/label_edit_modal.tmpl +++ b/templates/repo/issue/labels/label_edit_modal.tmpl @@ -5,7 +5,7 @@ > <div class="header"></div> <div class="content"> - <form class="ui form ignore-dirty" method="post"> + <form class="ui form ignore-dirty form-fetch-action" method="post"> {{.CsrfTokenHtml}} <input name="id" type="hidden"> <div class="required field"> @@ -24,7 +24,13 @@ <div class="desc tw-ml-1 tw-mt-2 tw-hidden label-exclusive-warning"> {{svg "octicon-alert"}} {{ctx.Locale.Tr "repo.issues.label_exclusive_warning"}} </div> - <br> + <div class="field label-exclusive-order-input-field tw-mt-2"> + <label class="flex-text-block"> + {{ctx.Locale.Tr "repo.issues.label_exclusive_order"}} + <span data-tooltip-content="{{ctx.Locale.Tr "repo.issues.label_exclusive_order_tooltip"}}">{{svg "octicon-info"}}</span> + </label> + <input class="label-exclusive-order-input" name="exclusive_order" type="number" maxlength="4"> + </div> </div> <div class="field label-is-archived-input-field"> <div class="ui checkbox"> @@ -43,8 +49,9 @@ </div> <div class="field"> <label for="color">{{ctx.Locale.Tr "repo.issues.label_color"}}</label> - <div class="column js-color-picker-input"> - <input name="color" value="#70c24a"placeholder="#c320f6" required maxlength="7"> + <div class="color-picker-combo" data-global-init="initColorPicker"> + <!-- the "#" is optional because backend NormalizeColor is able to handle it, API also accepts both formats, and it is easier for users to directly copy-paste a hex value --> + <input name="color" value="#70c24a" placeholder="#c320f6" required pattern="^#?([\dA-Fa-f]{3}|[\dA-Fa-f]{6})$" maxlength="7"> {{template "repo/issue/label_precolors"}} </div> </div> diff --git a/templates/repo/issue/labels/label_list.tmpl b/templates/repo/issue/labels/label_list.tmpl index 822567301e..c8a6b46cc4 100644 --- a/templates/repo/issue/labels/label_list.tmpl +++ b/templates/repo/issue/labels/label_list.tmpl @@ -26,7 +26,7 @@ <div class="divider"></div> {{end}} - <ul class="issue-label-list"> + <ul class="issue-label-list muted-links"> {{$canEditLabel := and (not $.PageIsOrgSettingsLabels) (not $.Repository.IsArchived) (or $.CanWriteIssues $.CanWritePulls)}} {{$canEditLabel = or $canEditLabel $.PageIsOrgSettingsLabels}} {{range .Labels}} @@ -42,34 +42,31 @@ <a class="open-issues" href="{{$.RepoLink}}/issues?labels={{.ID}}">{{svg "octicon-issue-opened"}} {{ctx.Locale.Tr "repo.issues.label_open_issues" .NumOpenIssues}}</a> {{end}} </div> - <div class="label-operation tw-flex"> + <div class="label-operation"> {{template "repo/issue/labels/label_archived" .}} - <div class="tw-flex tw-ml-auto"> {{if $canEditLabel}} <a class="edit-label-button" href="#" data-label-id="{{.ID}}" data-label-name="{{.Name}}" data-label-color="{{.Color}}" data-label-exclusive="{{.Exclusive}}" data-label-is-archived="{{gt .ArchivedUnix 0}}" data-label-num-issues="{{.NumIssues}}" data-label-description="{{.Description}}" + data-label-exclusive-order="{{.ExclusiveOrder}}" >{{svg "octicon-pencil"}} {{ctx.Locale.Tr "repo.issues.label_edit"}}</a> <a class="link-action" href="#" data-url="{{$.Link}}/delete?id={{.ID}}" data-modal-confirm-header="{{ctx.Locale.Tr "repo.issues.label_deletion"}}" data-modal-confirm-content="{{ctx.Locale.Tr "repo.issues.label_deletion_desc"}}" >{{svg "octicon-trash"}} {{ctx.Locale.Tr "repo.issues.label_delete"}}</a> {{end}} - </div> </div> </li> {{end}} {{if and (not .PageIsOrgSettingsLabels) (.OrgLabels)}} <li class="item"> - <div class="ui grid middle aligned"> - <div class="ten wide column"> - {{ctx.Locale.Tr "repo.org_labels_desc"}} - {{if .IsOrganizationOwner}} - <a href="{{.OrganizationLink}}/settings/labels">({{ctx.Locale.Tr "repo.org_labels_desc_manage"}})</a>: - {{end}} - </div> + <div>{{/* parent is flex, so use block here to keep sentence spaces */}} + {{ctx.Locale.Tr "repo.org_labels_desc"}} + {{if .IsOrganizationOwner}} + <a href="{{.OrganizationLink}}/settings/labels">({{ctx.Locale.Tr "repo.org_labels_desc_manage"}})</a>: + {{end}} </div> </li> diff --git a/templates/repo/issue/list.tmpl b/templates/repo/issue/list.tmpl index 01b610b39d..1fe220e1b8 100644 --- a/templates/repo/issue/list.tmpl +++ b/templates/repo/issue/list.tmpl @@ -4,6 +4,8 @@ <div class="ui container"> {{template "base/alert" .}} + {{template "repo/code/recently_pushed_new_branches" dict "RecentBranchesPromptData" .RecentBranchesPromptData}} + {{if .PinnedIssues}} <div id="issue-pins" {{if .IsRepoAdmin}}data-is-repo-admin{{end}}> {{range .PinnedIssues}} @@ -14,9 +16,10 @@ </div> {{end}} - <div class="list-header"> - {{template "repo/issue/navbar" .}} + <div class="list-header flex-text-block"> {{template "repo/issue/search" .}} + <a class="ui small button" href="{{.RepoLink}}/labels">{{ctx.Locale.Tr "repo.labels"}}</a> + <a class="ui small button" href="{{.RepoLink}}/milestones">{{ctx.Locale.Tr "repo.milestones"}}</a> {{if not .Repository.IsArchived}} {{if .PageIsIssueList}} <a class="ui small primary button issue-list-new" href="{{.RepoLink}}/issues/new{{if .NewIssueChooseTemplate}}/choose{{end}}">{{ctx.Locale.Tr "repo.issues.new"}}</a> @@ -40,7 +43,7 @@ <div class="ui compact tiny secondary menu"> <span class="item" data-tooltip-content='{{ctx.Locale.Tr "tracked_time_summary"}}'> {{svg "octicon-clock"}} - {{.TotalTrackedTime | Sec2Time}} + {{.TotalTrackedTime | Sec2Hour}} </span> </div> {{end}} diff --git a/templates/repo/issue/milestone_issues.tmpl b/templates/repo/issue/milestone_issues.tmpl index 4fc6057117..591820080f 100644 --- a/templates/repo/issue/milestone_issues.tmpl +++ b/templates/repo/issue/milestone_issues.tmpl @@ -3,10 +3,10 @@ {{template "repo/header" .}} <div class="ui container"> {{template "base/alert" .}} - <div class="tw-flex"> - <h1 class="tw-mb-2">{{.Milestone.Name}}</h1> + <div class="flex-text-block tw-flex-wrap tw-mb-2"> + <h1 class="tw-flex-1 tw-m-0">{{.Milestone.Name}}</h1> {{if not .Repository.IsArchived}} - <div class="text right tw-flex-1"> + <div> {{if or .CanWriteIssues .CanWritePulls}} {{if .Milestone.IsClosed}} <a class="ui primary basic button link-action" href data-url="{{$.RepoLink}}/milestones/{{.MilestoneID}}/open">{{ctx.Locale.Tr "repo.milestones.open"}} @@ -22,14 +22,14 @@ {{end}} </div> {{if .Milestone.RenderedContent}} - <div class="markup content tw-mb-4"> + <div class="render-content markup tw-mb-4"> {{.Milestone.RenderedContent}} </div> {{end}} <div class="tw-flex tw-flex-col tw-gap-2"> <progress class="milestone-progress-big" value="{{.Milestone.Completeness}}" max="100"></progress> - <div class="tw-flex tw-gap-4"> - <div classs="tw-flex tw-items-center"> + <div class="flex-text-block tw-gap-4"> + <div class="flex-text-inline"> {{$closedDate:= DateUtils.TimeSince .Milestone.ClosedDateUnix}} {{if .IsClosed}} {{svg "octicon-clock"}} {{ctx.Locale.Tr "repo.milestones.closed" $closedDate}} @@ -46,11 +46,11 @@ {{end}} {{end}} </div> - <div class="tw-mr-2">{{ctx.Locale.Tr "repo.milestones.completeness" .Milestone.Completeness}}</div> + <div>{{ctx.Locale.Tr "repo.milestones.completeness" .Milestone.Completeness}}</div> {{if .TotalTrackedTime}} <div data-tooltip-content='{{ctx.Locale.Tr "tracked_time_summary"}}'> {{svg "octicon-clock"}} - {{.TotalTrackedTime | Sec2Time}} + {{.TotalTrackedTime | Sec2Hour}} </div> {{end}} </div> diff --git a/templates/repo/issue/milestone_new.tmpl b/templates/repo/issue/milestone_new.tmpl index 4809149a21..9bcced6f54 100644 --- a/templates/repo/issue/milestone_new.tmpl +++ b/templates/repo/issue/milestone_new.tmpl @@ -44,7 +44,7 @@ "TextareaPlaceholder" (ctx.Locale.Tr "repo.milestones.desc") )}} </div> - <div class="tw-text-right"> + <div class="flex-text-block tw-justify-end"> {{if .PageIsEditMilestone}} <a class="ui primary basic button" href="{{.RepoLink}}/milestones"> {{ctx.Locale.Tr "repo.milestones.cancel"}} diff --git a/templates/repo/issue/milestones.tmpl b/templates/repo/issue/milestones.tmpl index 9515acfb8e..8805c709a0 100644 --- a/templates/repo/issue/milestones.tmpl +++ b/templates/repo/issue/milestones.tmpl @@ -41,7 +41,7 @@ {{if .TotalTrackedTime}} <div class="flex-text-block"> {{svg "octicon-clock"}} - {{.TotalTrackedTime|Sec2Time}} + {{.TotalTrackedTime|Sec2Hour}} </div> {{end}} {{if .UpdatedUnix}} @@ -76,14 +76,12 @@ {{else}} <a class="link-action flex-text-inline" href data-url="{{$.Link}}/{{.ID}}/close">{{svg "octicon-x" 14}}{{ctx.Locale.Tr "repo.milestones.close"}}</a> {{end}} - <a class="delete-button flex-text-inline" href="#" data-url="{{$.RepoLink}}/milestones/delete" data-id="{{.ID}}">{{svg "octicon-trash" 14}}{{ctx.Locale.Tr "repo.issues.label_delete"}}</a> + <a class="link-action flex-text-inline text red" href data-modal-confirm="#repo-milestone-delete-modal" data-url="{{$.RepoLink}}/milestones/delete?id={{.ID}}">{{svg "octicon-trash" 14}}{{ctx.Locale.Tr "repo.issues.label_delete"}}</a> </div> {{end}} </div> {{if .Content}} - <div class="markup content"> - {{.RenderedContent}} - </div> + <div class="render-content markup">{{.RenderedContent}}</div> {{end}} </li> {{end}} @@ -94,15 +92,11 @@ </div> {{if or .CanWriteIssues .CanWritePulls}} - <div class="ui g-modal-confirm delete modal"> - <div class="header"> - {{svg "octicon-trash"}} - {{ctx.Locale.Tr "repo.milestones.deletion"}} - </div> - <div class="content"> - <p>{{ctx.Locale.Tr "repo.milestones.deletion_desc"}}</p> - </div> + <div class="ui small modal" id="repo-milestone-delete-modal"> + <div class="header">{{svg "octicon-trash"}} {{ctx.Locale.Tr "repo.milestones.deletion"}}</div> + <div class="content"><p>{{ctx.Locale.Tr "repo.milestones.deletion_desc"}}</p></div> {{template "base/modal_actions_confirm" .}} </div> {{end}} + {{template "base/footer" .}} diff --git a/templates/repo/issue/new_form.tmpl b/templates/repo/issue/new_form.tmpl index dd4c7617ce..9413200870 100644 --- a/templates/repo/issue/new_form.tmpl +++ b/templates/repo/issue/new_form.tmpl @@ -1,6 +1,4 @@ -{{if .Flash}} {{template "base/alert" .}} -{{end}} <form class="issue-content ui comment form form-fetch-action" id="new-issue" action="{{.Link}}" method="post"> {{.CsrfTokenHtml}} <div class="issue-content-left"> @@ -9,7 +7,10 @@ {{ctx.AvatarUtils.Avatar .SignedUser 40}} <div class="ui segment content tw-my-0"> <div class="field"> - <input name="title" class="js-autofocus-end" id="issue_title" placeholder="{{ctx.Locale.Tr "repo.milestones.title"}}" value="{{if .TitleQuery}}{{.TitleQuery}}{{else if .IssueTemplateTitle}}{{.IssueTemplateTitle}}{{else}}{{.title}}{{end}}" required maxlength="255" autocomplete="off"> + <input name="title" data-global-init="initInputAutoFocusEnd" id="issue_title" required maxlength="255" autocomplete="off" + placeholder="{{ctx.Locale.Tr "repo.milestones.title"}}" + value="{{if .TitleQuery}}{{.TitleQuery}}{{else if .IssueTemplateTitle}}{{.IssueTemplateTitle}}{{else}}{{.title}}{{end}}" + > {{if .PageIsComparePull}} <div class="title_wip_desc" data-wip-prefixes="{{JsonUtils.EncodeToString .PullRequestWorkInProgressPrefixes}}">{{ctx.Locale.Tr "repo.pulls.title_wip_desc" (index .PullRequestWorkInProgressPrefixes 0)}}</div> {{end}} @@ -32,7 +33,7 @@ {{else}} {{template "repo/issue/comment_tab" .}} {{end}} - <div class="text right"> + <div class="flex-text-block tw-justify-end"> <button class="ui primary button"> {{if .PageIsComparePull}} {{ctx.Locale.Tr "repo.pulls.create"}} diff --git a/templates/repo/issue/openclose.tmpl b/templates/repo/issue/openclose.tmpl index b9dd04a7db..00a31b5fad 100644 --- a/templates/repo/issue/openclose.tmpl +++ b/templates/repo/issue/openclose.tmpl @@ -17,7 +17,7 @@ {{ctx.Locale.PrettyNumber .OpenCount}} {{ctx.Locale.Tr "repo.issues.open_title"}} </a> <a class="{{if eq .State "closed"}}active {{end}}item flex-text-inline" href="{{if eq .State "closed"}}{{$allStatesLink}}{{else}}{{$closedLink}}{{end}}"> - {{svg "octicon-check"}} + {{svg "octicon-issue-closed"}} {{ctx.Locale.PrettyNumber .ClosedCount}} {{ctx.Locale.Tr "repo.issues.closed_title"}} </a> </div> diff --git a/templates/repo/issue/search.tmpl b/templates/repo/issue/search.tmpl index 07732ab5e7..de6c194ee8 100644 --- a/templates/repo/issue/search.tmpl +++ b/templates/repo/issue/search.tmpl @@ -8,6 +8,7 @@ <input type="hidden" name="project" value="{{$.ProjectID}}"> <input type="hidden" name="assignee" value="{{$.AssigneeID}}"> <input type="hidden" name="poster" value="{{$.PosterUsername}}"> + <input type="hidden" name="sort" value="{{$.SortType}}"> {{end}} {{template "shared/search/input" dict "Value" .Keyword}} {{if .PageIsIssueList}} diff --git a/templates/repo/issue/sidebar/allow_maintainer_edit.tmpl b/templates/repo/issue/sidebar/allow_maintainer_edit.tmpl index ad4ce96a47..f584f9076c 100644 --- a/templates/repo/issue/sidebar/allow_maintainer_edit.tmpl +++ b/templates/repo/issue/sidebar/allow_maintainer_edit.tmpl @@ -1,13 +1,18 @@ -{{if and .Issue.IsPull .IsIssuePoster (not .Issue.IsClosed) .Issue.PullRequest.HeadRepo}} - {{if and (not (eq .Issue.PullRequest.HeadRepo.FullName .Issue.PullRequest.BaseRepo.FullName)) .CanWriteToHeadRepo}} +{{- $isHeadForkedRepo := and .Issue.PullRequest .Issue.PullRequest.HeadRepo (ne .Issue.PullRequest.HeadRepo.FullName .Issue.PullRequest.BaseRepo.FullName) -}} +{{if $isHeadForkedRepo}} + {{- $isPullPoster := and .Issue.IsPull .IsIssuePoster -}} + {{- $isPullEditable := and .Issue.PullRequest (not .Issue.IsClosed) (not .Repository.IsArchived) -}} + {{- $allowToChange := and $isPullPoster $isPullEditable -}} <div class="divider"></div> - <div class="ui checkbox loading-icon-2px" id="allow-edits-from-maintainers" + <div class="ui checkbox {{if not $allowToChange}}disabled{{end}} loading-icon-2px" + {{if $allowToChange}} + id="allow-edits-from-maintainers" data-url="{{.Issue.Link}}" data-tooltip-content="{{ctx.Locale.Tr "repo.pulls.allow_edits_from_maintainers_desc"}}" data-prompt-error="{{ctx.Locale.Tr "repo.pulls.allow_edits_from_maintainers_err"}}" + {{end}} > <label><strong>{{ctx.Locale.Tr "repo.pulls.allow_edits_from_maintainers"}}</strong></label> - <input type="checkbox" {{if .Issue.PullRequest.AllowMaintainerEdit}}checked{{end}}> + <input type="checkbox" {{if .Issue.PullRequest.AllowMaintainerEdit}}checked{{end}} {{if not $allowToChange}}disabled{{end}}> </div> - {{end}} {{end}} diff --git a/templates/repo/issue/sidebar/assignee_list.tmpl b/templates/repo/issue/sidebar/assignee_list.tmpl index d8ccd73387..1d2279a45d 100644 --- a/templates/repo/issue/sidebar/assignee_list.tmpl +++ b/templates/repo/issue/sidebar/assignee_list.tmpl @@ -6,8 +6,8 @@ {{if $pageMeta.Issue}}data-update-url="{{$pageMeta.RepoLink}}/issues/assignee?issue_ids={{$pageMeta.Issue.ID}}"{{end}} > <input class="combo-value" name="assignee_ids" type="hidden" value="{{$data.SelectedAssigneeIDs}}"> - <div class="ui dropdown {{if not $pageMeta.CanModifyIssueOrPull}}disabled{{end}}"> - <a class="text muted"> + <div class="ui dropdown full-width {{if not $pageMeta.CanModifyIssueOrPull}}disabled{{end}}"> + <a class="fixed-text muted"> <strong>{{ctx.Locale.Tr "repo.issues.new.assignees"}}</strong> {{if $pageMeta.CanModifyIssueOrPull}}{{svg "octicon-gear"}}{{end}} </a> <div class="menu"> @@ -15,10 +15,11 @@ <i class="icon">{{svg "octicon-search" 16}}</i> <input type="text" placeholder="{{ctx.Locale.Tr "repo.issues.filter_assignees"}}"> </div> - <div class="item clear-selection">{{ctx.Locale.Tr "repo.issues.new.clear_assignees"}}</div> - <div class="scrolling menu"> + <div class="scrolling menu flex-items-block"> + <div class="item clear-selection" data-text="">{{ctx.Locale.Tr "repo.issues.new.clear_assignees"}}</div> + <div class="divider"></div> {{range $data.CandidateAssignees}} - <a class="item muted" href="#" data-value="{{.ID}}"> + <a class="item" href="#" data-value="{{.ID}}"> <span class="item-check-mark">{{svg "octicon-check"}}</span> {{ctx.AvatarUtils.Avatar . 20}} {{template "repo/search_name" .}} </a> @@ -26,10 +27,10 @@ </div> </div> </div> - <div class="ui list tw-flex tw-flex-row tw-gap-2"> + <div class="ui relaxed list muted-links flex-items-block"> <span class="item empty-list {{if $issueAssignees}}tw-hidden{{end}}">{{ctx.Locale.Tr "repo.issues.new.no_assignees"}}</span> {{range $issueAssignees}} - <a class="item muted" href="{{$pageMeta.RepoLink}}/{{if $pageMeta.IsPullRequest}}pulls{{else}}issues{{end}}?assignee={{.ID}}"> + <a class="item" href="{{$pageMeta.RepoLink}}/{{if $pageMeta.IsPullRequest}}pulls{{else}}issues{{end}}?assignee={{.ID}}"> {{ctx.AvatarUtils.Avatar . 20}} {{.GetDisplayName}} </a> {{end}} diff --git a/templates/repo/issue/sidebar/issue_dependencies.tmpl b/templates/repo/issue/sidebar/issue_dependencies.tmpl index 837bcd5670..bbae011958 100644 --- a/templates/repo/issue/sidebar/issue_dependencies.tmpl +++ b/templates/repo/issue/sidebar/issue_dependencies.tmpl @@ -22,7 +22,7 @@ {{range .BlockingDependencies}} <div class="item dependency{{if .Issue.IsClosed}} is-closed{{end}} tw-flex tw-items-center tw-justify-between"> <div class="item-left tw-flex tw-justify-center tw-flex-col tw-flex-1 gt-ellipsis"> - <a class="muted gt-ellipsis" href="{{.Issue.Link}}" data-tooltip-content="#{{.Issue.Index}} {{.Issue.Title | ctx.RenderUtils.RenderEmoji}}"> + <a class="muted issue-dependency-title gt-ellipsis" href="{{.Issue.Link}}" data-tooltip-content="#{{.Issue.Index}} {{.Issue.Title | ctx.RenderUtils.RenderEmoji}}"> #{{.Issue.Index}} {{.Issue.Title | ctx.RenderUtils.RenderEmoji}} </a> <div class="text small gt-ellipsis" data-tooltip-content="{{.Repository.OwnerName}}/{{.Repository.Name}}"> @@ -31,7 +31,9 @@ </div> <div class="item-right tw-flex tw-items-center tw-m-1"> {{if and $.CanCreateIssueDependencies (not $.Repository.IsArchived)}} - <a class="delete-dependency-button ci muted" data-id="{{.Issue.ID}}" data-type="blocking" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.dependency.remove_info"}}"> + <a class="muted show-modal" data-modal="#issue-remove-dependency-confirm" + data-modal-remove-dependency-id="{{.Issue.ID}}" data-modal-dependency-type="blocking" + data-tooltip-content="{{ctx.Locale.Tr "repo.issues.dependency.remove_info"}}"> {{svg "octicon-trash" 16}} </a> {{end}} @@ -54,7 +56,7 @@ {{range .BlockedByDependencies}} <div class="item dependency{{if .Issue.IsClosed}} is-closed{{end}} tw-flex tw-items-center tw-justify-between"> <div class="item-left tw-flex tw-justify-center tw-flex-col tw-flex-1 gt-ellipsis"> - <a class="muted gt-ellipsis" href="{{.Issue.Link}}" data-tooltip-content="#{{.Issue.Index}} {{.Issue.Title | ctx.RenderUtils.RenderEmoji}}"> + <a class="muted issue-dependency-title gt-ellipsis" href="{{.Issue.Link}}" data-tooltip-content="#{{.Issue.Index}} {{.Issue.Title | ctx.RenderUtils.RenderEmoji}}"> #{{.Issue.Index}} {{.Issue.Title | ctx.RenderUtils.RenderEmoji}} </a> <div class="text small gt-ellipsis" data-tooltip-content="{{.Repository.OwnerName}}/{{.Repository.Name}}"> @@ -63,7 +65,9 @@ </div> <div class="item-right tw-flex tw-items-center tw-m-1"> {{if and $.CanCreateIssueDependencies (not $.Repository.IsArchived)}} - <a class="delete-dependency-button ci muted" data-id="{{.Issue.ID}}" data-type="blockedBy" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.dependency.remove_info"}}"> + <a class="muted show-modal" data-modal="#issue-remove-dependency-confirm" + data-modal-remove-dependency-id="{{.Issue.ID}}" data-modal-dependency-type="blockedBy" + data-tooltip-content="{{ctx.Locale.Tr "repo.issues.dependency.remove_info"}}"> {{svg "octicon-trash" 16}} </a> {{end}} @@ -76,7 +80,7 @@ <div class="item-left tw-flex tw-justify-center tw-flex-col tw-flex-1 gt-ellipsis"> <div class="gt-ellipsis"> <span data-tooltip-content="{{ctx.Locale.Tr "repo.issues.dependency.no_permission.can_remove"}}">{{svg "octicon-lock" 16}}</span> - <span class="gt-ellipsis" data-tooltip-content="#{{.Issue.Index}} {{.Issue.Title | ctx.RenderUtils.RenderEmoji}}"> + <span class="gt-ellipsis issue-dependency-title" data-tooltip-content="#{{.Issue.Index}} {{.Issue.Title | ctx.RenderUtils.RenderEmoji}}"> #{{.Issue.Index}} {{.Issue.Title | ctx.RenderUtils.RenderEmoji}} </span> </div> @@ -86,7 +90,9 @@ </div> <div class="item-right tw-flex tw-items-center tw-m-1"> {{if and $.CanCreateIssueDependencies (not $.Repository.IsArchived)}} - <a class="delete-dependency-button ci muted" data-id="{{.Issue.ID}}" data-type="blocking" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.dependency.remove_info"}}"> + <a class="muted show-modal" data-modal="#issue-remove-dependency-confirm" + data-modal-remove-dependency-id="{{.Issue.ID}}" data-modal-dependency-type="blocking" + data-tooltip-content="{{ctx.Locale.Tr "repo.issues.dependency.remove_info"}}"> {{svg "octicon-trash" 16}} </a> {{end}} @@ -106,7 +112,7 @@ <form method="post" action="{{.Issue.Link}}/dependency/add" id="addDependencyForm"> {{$.CsrfTokenHtml}} <div class="ui fluid action input"> - <div class="ui search selection dropdown" id="new-dependency-drop-list" data-issue-id="{{.Issue.ID}}"> + <div class="ui search selection dropdown" id="new-dependency-drop-list" data-issue-id="{{.Issue.ID}}" data-issue-cross-repo-search="{{.AllowCrossRepositoryDependencies}}"> <input name="newDependency" type="hidden"> {{svg "octicon-triangle-down" 14 "dropdown icon"}} <input type="text" class="search"> @@ -122,28 +128,19 @@ </div> {{if and .CanCreateIssueDependencies (not .Repository.IsArchived)}} - <input type="hidden" id="crossRepoSearch" value="{{.AllowCrossRepositoryDependencies}}"> - - <div class="ui g-modal-confirm modal remove-dependency"> - <div class="header"> - {{svg "octicon-trash"}} - {{ctx.Locale.Tr "repo.issues.dependency.remove_header"}} - </div> + <form id="issue-remove-dependency-confirm" class="ui g-modal-confirm modal" method="post" action="{{.Issue.Link}}/dependency/delete"> + <div class="header">{{svg "octicon-trash"}} {{ctx.Locale.Tr "repo.issues.dependency.remove_header"}}</div> <div class="content"> - <form method="post" action="{{.Issue.Link}}/dependency/delete" id="removeDependencyForm"> - {{$.CsrfTokenHtml}} - <input type="hidden" value="" name="removeDependencyID" id="removeDependencyID"> - <input type="hidden" value="" name="dependencyType" id="dependencyType"> - </form> - <p>{{if .Issue.IsPull}} - {{ctx.Locale.Tr "repo.issues.dependency.pr_remove_text"}} - {{else}} - {{ctx.Locale.Tr "repo.issues.dependency.issue_remove_text"}} - {{end}}</p> + {{$.CsrfTokenHtml}} + <input type="hidden" value="" name="removeDependencyID" class="remove-dependency-id"> + <input type="hidden" value="" name="dependencyType" class="dependency-type"> + <p> + {{ctx.Locale.Tr (Iif .Issue.IsPull "repo.issues.dependency.pr_remove_text" "repo.issues.dependency.issue_remove_text")}} + </p> + {{$ModalButtonCancelText := ctx.Locale.Tr "repo.issues.dependency.cancel"}} + {{$ModalButtonOkText := ctx.Locale.Tr "repo.issues.dependency.remove"}} + {{template "base/modal_actions_confirm" (dict "." . "ModalButtonCancelText" $ModalButtonCancelText "ModalButtonOkText" $ModalButtonOkText)}} </div> - {{$ModalButtonCancelText := ctx.Locale.Tr "repo.issues.dependency.cancel"}} - {{$ModalButtonOkText := ctx.Locale.Tr "repo.issues.dependency.remove"}} - {{template "base/modal_actions_confirm" (dict "." . "ModalButtonCancelText" $ModalButtonCancelText "ModalButtonOkText" $ModalButtonOkText)}} - </div> + </form> {{end}} {{end}} diff --git a/templates/repo/issue/sidebar/issue_management.tmpl b/templates/repo/issue/sidebar/issue_management.tmpl index 76edf16e03..8876a5054e 100644 --- a/templates/repo/issue/sidebar/issue_management.tmpl +++ b/templates/repo/issue/sidebar/issue_management.tmpl @@ -1,6 +1,7 @@ {{if and .IsRepoAdmin (not .Repository.IsArchived)}} <div class="divider"></div> + {{/* Pin issue */}} {{if or .PinEnabled .Issue.IsPinned}} <form class="tw-mt-1 form-fetch-action single-button-form" method="post" {{if $.NewPinAllowed}}action="{{.Issue.Link}}/pin"{{else}}data-tooltip-content="{{ctx.Locale.Tr "repo.issues.max_pinned"}}"{{end}}> {{$.CsrfTokenHtml}} @@ -16,16 +17,15 @@ </form> {{end}} - <button class="tw-mt-1 fluid ui show-modal button{{if .Issue.IsLocked}} red{{end}}" data-modal="#lock"> + {{/* Lock/unlock conversation */}} + <button class="tw-mt-1 fluid ui show-modal button{{if .Issue.IsLocked}} red{{end}}" data-modal="#lock-conversation"> {{if .Issue.IsLocked}} - {{svg "octicon-key"}} - {{ctx.Locale.Tr "repo.issues.unlock"}} + {{svg "octicon-key"}} {{ctx.Locale.Tr "repo.issues.unlock"}} {{else}} - {{svg "octicon-lock"}} - {{ctx.Locale.Tr "repo.issues.lock"}} + {{svg "octicon-lock"}} {{ctx.Locale.Tr "repo.issues.lock"}} {{end}} </button> - <div class="ui tiny modal" id="lock"> + <div class="ui tiny modal" id="lock-conversation"> <div class="header"> {{if .Issue.IsLocked}} {{ctx.Locale.Tr "repo.issues.unlock.title"}} @@ -45,29 +45,20 @@ {{end}} </div> - <form class="ui form form-fetch-action" action="{{.Issue.Link}}{{if .Issue.IsLocked}}/unlock{{else}}/lock{{end}}" - method="post"> + <form class="ui form form-fetch-action" method="post" action="{{.Issue.Link}}{{if .Issue.IsLocked}}/unlock{{else}}/lock{{end}}"> {{.CsrfTokenHtml}} {{if not .Issue.IsLocked}} <div class="field"> - <strong> {{ctx.Locale.Tr "repo.issues.lock.reason"}} </strong> + <strong>{{ctx.Locale.Tr "repo.issues.lock.reason"}}</strong> </div> <div class="field"> <div class="ui fluid dropdown selection"> - - <select name="reason"> - <option value=""> </option> - {{range .LockReasons}} - <option value="{{.}}">{{.}}</option> - {{end}} - </select> - {{svg "octicon-triangle-down" 14 "dropdown icon"}} - - <div class="default text"> </div> - + <input type="hidden" name="reason"> + <div class="text"></div> {{svg "octicon-triangle-down" 14 "dropdown icon"}} <div class="menu"> + <div class="item" data-value=""></div> {{range .LockReasons}} <div class="item" data-value="{{.}}">{{.}}</div> {{end}} @@ -76,9 +67,10 @@ </div> {{end}} - <div class="text right actions"> + <div class="actions"> <button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button> - <button class="ui red button"> + {{/* explicitly focus the submit button, to avoid Fomantic modal focuses and popups the dropdown */}} + <button class="ui red button" autofocus> {{if .Issue.IsLocked}} {{ctx.Locale.Tr "repo.issues.unlock_confirm"}} {{else}} diff --git a/templates/repo/issue/sidebar/label_list.tmpl b/templates/repo/issue/sidebar/label_list.tmpl index 9dd83ba188..15c8760d1a 100644 --- a/templates/repo/issue/sidebar/label_list.tmpl +++ b/templates/repo/issue/sidebar/label_list.tmpl @@ -4,8 +4,8 @@ {{if $pageMeta.Issue}}data-update-url="{{$pageMeta.RepoLink}}/issues/labels?issue_ids={{$pageMeta.Issue.ID}}"{{end}} > <input class="combo-value" name="label_ids" type="hidden" value="{{$data.SelectedLabelIDs}}"> - <div class="ui dropdown {{if not $pageMeta.CanModifyIssueOrPull}}disabled{{end}}"> - <a class="text muted"> + <div class="ui dropdown full-width {{if not $pageMeta.CanModifyIssueOrPull}}disabled{{end}}"> + <a class="fixed-text muted"> <strong>{{ctx.Locale.Tr "repo.issues.new.labels"}}</strong> {{if $pageMeta.CanModifyIssueOrPull}}{{svg "octicon-gear"}}{{end}} </a> <div class="menu"> @@ -16,8 +16,9 @@ <i class="icon">{{svg "octicon-search" 16}}</i> <input type="text" placeholder="{{ctx.Locale.Tr "repo.issues.filter_labels"}}"> </div> - <a class="item clear-selection" href="#">{{ctx.Locale.Tr "repo.issues.new.clear_labels"}}</a> <div class="scrolling menu"> + <a class="item clear-selection" data-text="" href="#">{{ctx.Locale.Tr "repo.issues.new.clear_labels"}}</a> + <div class="divider"></div> {{$previousExclusiveScope := "_no_scope"}} {{range $data.RepoLabels}} {{$exclusiveScope := .ExclusiveScope}} @@ -42,7 +43,7 @@ </div> </div> - <div class="ui list labels-list tw-my-2 tw-flex tw-gap-2"> + <div class="ui list labels-list"> <span class="item empty-list {{if $data.SelectedLabelIDs}}tw-hidden{{end}}">{{ctx.Locale.Tr "repo.issues.new.no_label"}}</span> {{range $data.AllLabels}} {{if .IsChecked}} diff --git a/templates/repo/issue/sidebar/milestone_list.tmpl b/templates/repo/issue/sidebar/milestone_list.tmpl index 8b3e5b0eee..5bc961ed3c 100644 --- a/templates/repo/issue/sidebar/milestone_list.tmpl +++ b/templates/repo/issue/sidebar/milestone_list.tmpl @@ -6,8 +6,8 @@ {{if $pageMeta.Issue}}data-update-url="{{$pageMeta.RepoLink}}/issues/milestone?issue_ids={{$pageMeta.Issue.ID}}"{{end}} > <input class="combo-value" name="milestone_id" type="hidden" value="{{$data.SelectedMilestoneID}}"> - <div class="ui dropdown {{if not $pageMeta.CanModifyIssueOrPull}}disabled{{end}}"> - <a class="text muted"> + <div class="ui dropdown full-width {{if not $pageMeta.CanModifyIssueOrPull}}disabled{{end}}"> + <a class="fixed-text muted"> <strong>{{ctx.Locale.Tr "repo.issues.new.milestone"}}</strong> {{if $pageMeta.CanModifyIssueOrPull}}{{svg "octicon-gear"}}{{end}} </a> <div class="menu"> @@ -18,13 +18,13 @@ <i class="icon">{{svg "octicon-search"}}</i> <input type="text" placeholder="{{ctx.Locale.Tr "repo.issues.filter_milestones"}}"> </div> - <div class="divider"></div> - <div class="item clear-selection">{{ctx.Locale.Tr "repo.issues.new.clear_milestone"}}</div> <div class="scrolling menu"> + <div class="item clear-selection" data-text="">{{ctx.Locale.Tr "repo.issues.new.clear_milestone"}}</div> + <div class="divider"></div> {{if $data.OpenMilestones}} <div class="header">{{ctx.Locale.Tr "repo.issues.filter_milestone_open"}}</div> {{range $data.OpenMilestones}} - <a class="item muted" data-value="{{.ID}}" href="{{$pageMeta.RepoLink}}/issues?milestone={{.ID}}"> + <a class="item muted" data-value="{{.ID}}" href="{{$pageMeta.RepoLink}}/milestone/{{.ID}}"> {{svg "octicon-milestone" 18}} {{.Name}} </a> {{end}} @@ -33,7 +33,7 @@ {{if $data.ClosedMilestones}} <div class="header">{{ctx.Locale.Tr "repo.issues.filter_milestone_closed"}}</div> {{range $data.ClosedMilestones}} - <a class="item muted" data-value="{{.ID}}" href="{{$pageMeta.RepoLink}}/issues?milestone={{.ID}}"> + <a class="item muted" data-value="{{.ID}}" href="{{$pageMeta.RepoLink}}/milestone/{{.ID}}"> {{svg "octicon-milestone" 18}} {{.Name}} </a> {{end}} @@ -43,10 +43,10 @@ </div> </div> - <div class="ui list"> + <div class="ui list muted-links flex-items-block"> <span class="item empty-list {{if $issueMilestone}}tw-hidden{{end}}">{{ctx.Locale.Tr "repo.issues.new.no_milestone"}}</span> {{if $issueMilestone}} - <a class="item muted" href="{{$pageMeta.RepoLink}}/milestone/{{$issueMilestone.ID}}"> + <a class="item" href="{{$pageMeta.RepoLink}}/milestone/{{$issueMilestone.ID}}"> {{svg "octicon-milestone" 18}} {{$issueMilestone.Name}} </a> {{end}} diff --git a/templates/repo/issue/sidebar/project_list.tmpl b/templates/repo/issue/sidebar/project_list.tmpl index 0cbbdce760..a212261a22 100644 --- a/templates/repo/issue/sidebar/project_list.tmpl +++ b/templates/repo/issue/sidebar/project_list.tmpl @@ -6,8 +6,8 @@ {{if $pageMeta.Issue}}data-update-url="{{$pageMeta.RepoLink}}/issues/projects?issue_ids={{$pageMeta.Issue.ID}}"{{end}} > <input class="combo-value" name="project_id" type="hidden" value="{{$data.SelectedProjectID}}"> - <div class="ui dropdown {{if not $pageMeta.CanModifyIssueOrPull}}disabled{{end}}"> - <a class="text muted"> + <div class="ui dropdown full-width {{if not $pageMeta.CanModifyIssueOrPull}}disabled{{end}}"> + <a class="fixed-text muted"> <strong>{{ctx.Locale.Tr "repo.issues.new.projects"}}</strong> {{if $pageMeta.CanModifyIssueOrPull}}{{svg "octicon-gear"}}{{end}} </a> <div class="menu"> @@ -17,8 +17,9 @@ <input type="text" placeholder="{{ctx.Locale.Tr "repo.issues.filter_projects"}}"> </div> {{end}} - <div class="item clear-selection">{{ctx.Locale.Tr "repo.issues.new.clear_projects"}}</div> <div class="scrolling menu"> + <div class="item clear-selection" data-text="">{{ctx.Locale.Tr "repo.issues.new.clear_projects"}}</div> + <div class="divider"></div> {{if $data.OpenProjects}} <div class="header">{{ctx.Locale.Tr "repo.issues.new.open_projects"}}</div> {{range $data.OpenProjects}} @@ -39,10 +40,10 @@ </div> </div> </div> - <div class="ui list"> + <div class="ui list muted-links flex-items-block"> <span class="item empty-list {{if $issueProject}}tw-hidden{{end}}">{{ctx.Locale.Tr "repo.issues.new.no_projects"}}</span> {{if $issueProject}} - <a class="item muted" href="{{$issueProject.Link ctx}}"> + <a class="item" href="{{$issueProject.Link ctx}}"> {{svg $issueProject.IconName 18}} {{$issueProject.Title}} </a> {{end}} diff --git a/templates/repo/issue/sidebar/reference_link.tmpl b/templates/repo/issue/sidebar/reference_link.tmpl index 6b8f120c7b..ad7c0f6bc0 100644 --- a/templates/repo/issue/sidebar/reference_link.tmpl +++ b/templates/repo/issue/sidebar/reference_link.tmpl @@ -1,8 +1,6 @@ <div class="divider"></div> -<div class="ui equal width compact grid"> - {{$issueReferenceLink := printf "%s#%d" .Issue.Repo.FullName .Issue.Index}} - <div class="row tw-items-center" data-tooltip-content="{{$issueReferenceLink}}"> - <span class="text column truncate">{{ctx.Locale.Tr "repo.issues.reference_link" $issueReferenceLink}}</span> - <button class="ui two wide button column tw-p-2" data-clipboard-text="{{$issueReferenceLink}}">{{svg "octicon-copy" 14}}</button> - </div> +{{$issueReferenceLink := printf "%s#%d" .Issue.Repo.FullName .Issue.Index}} +<div class="flex-text-block" data-tooltip-content="{{$issueReferenceLink}}"> + <span class="tw-flex-1 gt-ellipsis">{{ctx.Locale.Tr "repo.issues.reference_link" $issueReferenceLink}}</span> + <button class="ui compact tiny icon button" data-clipboard-text="{{$issueReferenceLink}}">{{svg "octicon-copy" 14}}</button> </div> diff --git a/templates/repo/issue/sidebar/reviewer_list.tmpl b/templates/repo/issue/sidebar/reviewer_list.tmpl index b3d9590d58..2b5ca80fe7 100644 --- a/templates/repo/issue/sidebar/reviewer_list.tmpl +++ b/templates/repo/issue/sidebar/reviewer_list.tmpl @@ -6,8 +6,8 @@ {{if $pageMeta.Issue}}data-update-url="{{$pageMeta.RepoLink}}/issues/request_review?issue_ids={{$pageMeta.Issue.ID}}"{{end}} > <input type="hidden" class="combo-value" name="reviewer_ids">{{/* match CreateIssueForm */}} - <div class="ui dropdown {{if or (not $hasCandidates) (not $data.CanChooseReviewer)}}disabled{{end}}"> - <a class="text muted"> + <div class="ui dropdown full-width {{if or (not $hasCandidates) (not $data.CanChooseReviewer)}}disabled{{end}}"> + <a class="fixed-text muted"> <strong>{{ctx.Locale.Tr "repo.issues.review.reviewers"}}</strong> {{if $data.CanChooseReviewer}}{{svg "octicon-gear"}}{{end}} </a> <div class="menu flex-items-menu"> @@ -43,7 +43,7 @@ </div> </div> - <div class="ui relaxed list flex-items-block tw-my-4"> + <div class="ui relaxed list flex-items-block"> <span class="item empty-list {{if or $data.OriginalReviews $data.CurrentPullReviewers}}tw-hidden{{end}}"> {{ctx.Locale.Tr "repo.issues.new.no_reviewers"}} </span> @@ -51,9 +51,9 @@ <div class="item"> <div class="flex-text-inline tw-flex-1"> {{if .User}} - <a class="muted flex-text-inline" href="{{.User.HomeLink}}">{{ctx.AvatarUtils.Avatar .User 20}} {{.User.GetDisplayName}}</a> + <a class="muted flex-text-inline tw-gap-2" href="{{.User.HomeLink}}">{{ctx.AvatarUtils.Avatar .User 20}} {{.User.GetDisplayName}}</a> {{else if .Team}} - {{svg "octicon-people" 20}} {{$repoOwnerName}}/{{.Team.Name}} + <span class="flex-text-inline tw-gap-2">{{svg "octicon-people" 20}} {{$repoOwnerName}}/{{.Team.Name}}</span> {{end}} </div> <div class="flex-text-inline"> @@ -92,7 +92,7 @@ <div class="flex-text-inline tw-flex-1"> {{$originalURLHostname := $pageMeta.Repository.GetOriginalURLHostname}} {{$originalURL := $pageMeta.Repository.OriginalURL}} - <a class="muted flex-text-inline" href="{{$originalURL}}" data-tooltip-content="{{ctx.Locale.Tr "repo.migrated_from_fake" $originalURLHostname}}"> + <a class="muted flex-text-inline tw-gap-2" href="{{$originalURL}}" data-tooltip-content="{{ctx.Locale.Tr "repo.migrated_from_fake" $originalURLHostname}}"> {{svg (MigrationIcon $originalURLHostname) 20}} {{.OriginalAuthor}} </a> </div> @@ -121,7 +121,7 @@ <label for="issue-sidebar-dismiss-review-message">{{ctx.Locale.Tr "action.review_dismissed_reason"}}</label> <input id="issue-sidebar-dismiss-review-message" name="message"> </div> - <div class="text right actions"> + <div class="actions"> <button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button> <button class="ui red button" type="submit">{{ctx.Locale.Tr "ok"}}</button> </div> diff --git a/templates/repo/issue/sidebar/stopwatch_timetracker.tmpl b/templates/repo/issue/sidebar/stopwatch_timetracker.tmpl index f107dc5ef5..6168b06e17 100644 --- a/templates/repo/issue/sidebar/stopwatch_timetracker.tmpl +++ b/templates/repo/issue/sidebar/stopwatch_timetracker.tmpl @@ -2,32 +2,28 @@ {{if and .CanUseTimetracker (not .Repository.IsArchived)}} <div class="divider"></div> <div> - <div class="ui dropdown jump"> - <a class="text muted"> - <strong>{{ctx.Locale.Tr "repo.issues.tracker"}}</strong> {{svg "octicon-gear"}} - {{if $.IsStopwatchRunning}}{{svg "octicon-stopwatch"}}{{end}} - </a> - <div class="menu"> - <a class="item issue-set-time-estimate show-modal" data-modal="#issue-time-set-estimate-modal"> - {{svg "octicon-pencil"}} {{ctx.Locale.Tr "repo.issues.time_estimate_set"}} - </a> - <div class="divider"></div> - {{if $.IsStopwatchRunning}} - <a class="item issue-stop-time link-action" data-url="{{.Issue.Link}}/times/stopwatch/toggle"> - {{svg "octicon-stopwatch"}} {{ctx.Locale.Tr "repo.issues.timetracker_timer_stop"}} - </a> - <a class="item issue-cancel-time link-action" data-url="{{.Issue.Link}}/times/stopwatch/cancel"> - {{svg "octicon-trash"}} {{ctx.Locale.Tr "repo.issues.timetracker_timer_discard"}} - </a> - {{else}} - <a class="item issue-start-time link-action" data-url="{{.Issue.Link}}/times/stopwatch/toggle"> - {{svg "octicon-stopwatch"}} {{ctx.Locale.Tr "repo.issues.timetracker_timer_start"}} - </a> - <a class="item issue-add-time show-modal" data-modal="#issue-time-manually-add-modal"> - {{svg "octicon-plus"}} {{ctx.Locale.Tr "repo.issues.timetracker_timer_manually_add"}} - </a> - {{end}} - </div> + <div class="flex-text-block"> + <strong class="tw-flex-1">{{ctx.Locale.Tr "repo.issues.tracker"}}</strong> + <button class="btn interact-fg show-modal" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.time_estimate_set"}}" data-modal="#issue-time-set-estimate-modal"> + {{svg "octicon-pencil"}} + </button> + </div> + <div class="ui buttons tw-mt-2 tw-w-full"> + {{if $.IsStopwatchRunning}} + <button class="ui button tw-flex-1 issue-stop-time link-action" data-url="{{.Issue.Link}}/times/stopwatch/stop"> + {{svg "octicon-stopwatch"}} {{ctx.Locale.Tr "repo.issues.timetracker_timer_stop"}} + </button> + <button class="ui icon button issue-cancel-time link-action" data-url="{{.Issue.Link}}/times/stopwatch/cancel" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.timetracker_timer_discard"}}"> + {{svg "octicon-trash"}} + </button> + {{else}} + <button class="ui button tw-flex-1 issue-start-time link-action" data-url="{{.Issue.Link}}/times/stopwatch/start"> + {{svg "octicon-stopwatch"}} {{ctx.Locale.Tr "repo.issues.timetracker_timer_start"}} + </button> + <button class="ui icon button issue-add-time show-modal" data-modal="#issue-time-manually-add-modal" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.timetracker_timer_manually_add"}}"> + {{svg "octicon-plus"}} + </button> + {{end}} </div> {{if and (not $.IsStopwatchRunning) .HasUserStopwatch}} @@ -71,23 +67,19 @@ </div> {{end}} {{if .WorkingUsers}} - <div class="ui comments tw-mt-2"> - {{ctx.Locale.Tr "repo.issues.time_spent_from_all_authors" ($.Issue.TotalTrackedTime | Sec2Time)}} - <div> - {{range $user, $trackedtime := .WorkingUsers}} - <div class="comment tw-mt-2"> - <a class="avatar"> - {{ctx.AvatarUtils.Avatar $user}} - </a> - <div class="content"> - {{template "shared/user/authorlink" $user}} - <div class="text"> - {{$trackedtime|Sec2Time}} - </div> - </div> + <div class="tw-mt-2"> + {{ctx.Locale.Tr "repo.issues.time_spent_from_all_authors" ($.Issue.TotalTrackedTime | Sec2Hour)}} + </div> + <div class="ui list flex-items-block"> + {{range $user, $trackedtime := .WorkingUsers}} + <div class="item tw-gap-3"> + {{template "shared/user/avatarlink" dict "user" $user}} + <div> + {{template "shared/user/authorlink" $user}} + <div class="text">{{$trackedtime|Sec2Hour}}</div> </div> - {{end}} - </div> + </div> + {{end}} </div> {{end}} {{end}} diff --git a/templates/repo/issue/sidebar/wip_switch.tmpl b/templates/repo/issue/sidebar/wip_switch.tmpl index 06a3be0d8f..8c40908f62 100644 --- a/templates/repo/issue/sidebar/wip_switch.tmpl +++ b/templates/repo/issue/sidebar/wip_switch.tmpl @@ -1,7 +1,5 @@ {{if and (or .HasIssuesOrPullsWritePermission .IsIssuePoster) (not .HasMerged) (not .Issue.IsClosed) (not .IsPullWorkInProgress)}} - <div class="toggle-wip tw-mt-2" data-title="{{.Issue.Title}}" data-wip-prefix="{{index .PullRequestWorkInProgressPrefixes 0}}" data-update-url="{{.Issue.Link}}/title"> - <a class="muted"> - {{ctx.Locale.Tr "repo.pulls.still_in_progress"}} {{ctx.Locale.Tr "repo.pulls.add_prefix" (index .PullRequestWorkInProgressPrefixes 0)}} - </a> - </div> + <a data-global-init="initPullRequestWipToggle" data-title="{{.Issue.Title}}" data-wip-prefix="{{index .PullRequestWorkInProgressPrefixes 0}}" data-update-url="{{.Issue.Link}}/title"> + {{ctx.Locale.Tr "repo.pulls.still_in_progress"}} {{ctx.Locale.Tr "repo.pulls.add_prefix" (index .PullRequestWorkInProgressPrefixes 0)}} + </a> {{end}} diff --git a/templates/repo/issue/view_content.tmpl b/templates/repo/issue/view_content.tmpl index 1a68781ecd..926c6e3de5 100644 --- a/templates/repo/issue/view_content.tmpl +++ b/templates/repo/issue/view_content.tmpl @@ -13,8 +13,8 @@ </a> {{end}} <div class="content comment-container"> - <div class="ui top attached header comment-header tw-flex tw-items-center tw-justify-between" role="heading" aria-level="3"> - <div class="comment-header-left tw-flex tw-items-center"> + <div class="comment-header" role="heading" aria-level="3"> + <div class="comment-header-left"> {{if .Issue.OriginalAuthor}} <span class="text black tw-font-semibold"> {{svg (MigrationIcon .Repository.GetOriginalURLHostname)}} @@ -36,7 +36,7 @@ </span> {{end}} </div> - <div class="comment-header-right actions tw-flex tw-items-center"> + <div class="comment-header-right"> {{template "repo/issue/view_content/show_role" dict "ShowRole" .Issue.ShowRole "IgnorePoster" true}} {{if not $.Repository.IsArchived}} {{template "repo/issue/view_content/add_reaction" dict "ActionURL" (printf "%s/issues/%d/reactions" $.RepoLink .Issue.Index)}} @@ -68,7 +68,7 @@ {{template "repo/issue/view_content/comments" .}} {{if and .Issue.IsPull (not $.Repository.IsArchived)}} - {{template "repo/issue/view_content/pull".}} + {{template "repo/issue/view_content/pull_merge_box".}} {{end}} {{if .IsSigned}} @@ -83,7 +83,7 @@ {{template "repo/issue/comment_tab" .}} {{.CsrfTokenHtml}} <div class="field footer"> - <div class="text right"> + <div class="flex-text-block tw-justify-end"> {{if and (or .HasIssuesOrPullsWritePermission .IsIssuePoster) (not .DisableStatusChange)}} {{if .Issue.IsClosed}} <button id="status-button" class="ui primary basic button" data-status="{{ctx.Locale.Tr "repo.issues.reopen_issue"}}" data-status-and-comment="{{ctx.Locale.Tr "repo.issues.reopen_comment_issue"}}" name="status" value="reopen"> @@ -157,7 +157,7 @@ {{end}} <div class="field"> - <div class="text right edit"> + <div class="flex-text-block tw-justify-end"> <button type="button" class="ui cancel button">{{ctx.Locale.Tr "repo.issues.cancel"}}</button> <button type="submit" class="ui primary button">{{ctx.Locale.Tr "repo.issues.save"}}</button> </div> diff --git a/templates/repo/issue/view_content/add_reaction.tmpl b/templates/repo/issue/view_content/add_reaction.tmpl index 6baded8fe9..2f5764d964 100644 --- a/templates/repo/issue/view_content/add_reaction.tmpl +++ b/templates/repo/issue/view_content/add_reaction.tmpl @@ -3,7 +3,7 @@ <a class="muted">{{svg "octicon-smiley"}}</a> <div class="menu"> {{range $value := AllowedReactions}} - <a class="item emoji comment-reaction-button" data-tooltip-content="{{$value}}" aria-label="{{$value}}" data-reaction-content="{{$value}}">{{ReactionToEmoji $value}}</a> + <a class="item emoji" data-tooltip-content="{{$value}}" aria-label="{{$value}}" data-reaction-content="{{$value}}" data-global-click="onCommentReactionButtonClick">{{ReactionToEmoji $value}}</a> {{end}} </div> </div> diff --git a/templates/repo/issue/view_content/attachments.tmpl b/templates/repo/issue/view_content/attachments.tmpl index 2155f78656..e865050559 100644 --- a/templates/repo/issue/view_content/attachments.tmpl +++ b/templates/repo/issue/view_content/attachments.tmpl @@ -31,7 +31,7 @@ {{if FilenameIsImage .Name}} {{if not (StringUtils.Contains (StringUtils.ToString $.RenderedContent) .UUID)}} <a target="_blank" rel="noopener noreferrer" href="{{.DownloadURL}}"> - <img alt="{{.Name}}" src="{{.DownloadURL}}" title="{{ctx.Locale.Tr "repo.issues.attachment.open_tab" .Name}}"> + <img loading="lazy" alt="{{.Name}}" src="{{.DownloadURL}}" title="{{ctx.Locale.Tr "repo.issues.attachment.open_tab" .Name}}"> </a> {{end}} {{end}} diff --git a/templates/repo/issue/view_content/comments.tmpl b/templates/repo/issue/view_content/comments.tmpl index 2e1a67edcc..2bf8837dd5 100644 --- a/templates/repo/issue/view_content/comments.tmpl +++ b/templates/repo/issue/view_content/comments.tmpl @@ -26,8 +26,8 @@ </a> {{end}} <div class="content comment-container"> - <div class="ui top attached header comment-header tw-flex tw-items-center tw-justify-between" role="heading" aria-level="3"> - <div class="comment-header-left tw-flex tw-items-center"> + <div class="comment-header" role="heading" aria-level="3"> + <div class="comment-header-left"> {{if .OriginalAuthor}} <span class="text black tw-font-semibold tw-mr-1"> {{svg (MigrationIcon $.Repository.GetOriginalURLHostname)}} @@ -51,7 +51,7 @@ </span> {{end}} </div> - <div class="comment-header-right actions tw-flex tw-items-center"> + <div class="comment-header-right"> {{template "repo/issue/view_content/show_role" dict "ShowRole" .ShowRole}} {{if not $.Repository.IsArchived}} {{template "repo/issue/view_content/add_reaction" dict "ActionURL" (printf "%s/comments/%d/reactions" $.RepoLink .ID)}} @@ -163,12 +163,13 @@ </span> <div class="detail flex-text-block"> {{svg "octicon-git-commit"}} + {{/* the content is a link like <a href="{RepoLink}/commit/{CommitID}">message title</a> (from CreateRefComment) */}} <span class="text grey muted-links">{{.Content | SanitizeHTML}}</span> </div> </div> {{else if eq .Type 7}} {{if or .AddedLabels .RemovedLabels}} - <div class="timeline-item event" id="{{.HashTag}}"> + <div class="timeline-item event with-labels-list-inline" id="{{.HashTag}}"> <span class="badge">{{svg "octicon-tag"}}</span> {{template "shared/user/avatarlink" dict "user" .Poster}} <span class="text grey muted-links"> @@ -252,7 +253,7 @@ <span class="text grey muted-links"> {{template "shared/user/authorlink" .Poster}} {{$timeStr := .RenderedContent}} {{/* compatibility with time comments made before v1.21 */}} - {{if not $timeStr}}{{$timeStr = .Content|Sec2Time}}{{end}} + {{if not $timeStr}}{{$timeStr = .Content|Sec2Hour}}{{end}} {{ctx.Locale.Tr "repo.issues.stop_tracking_history" $timeStr $createdStr}} </span> {{template "repo/issue/view_content/comments_delete_time" dict "ctxData" $ "comment" .}} @@ -264,7 +265,7 @@ <span class="text grey muted-links"> {{template "shared/user/authorlink" .Poster}} {{$timeStr := .RenderedContent}} {{/* compatibility with time comments made before v1.21 */}} - {{if not $timeStr}}{{$timeStr = .Content|Sec2Time}}{{end}} + {{if not $timeStr}}{{$timeStr = .Content|Sec2Hour}}{{end}} {{ctx.Locale.Tr "repo.issues.add_time_history" $timeStr $createdStr}} </span> {{template "repo/issue/view_content/comments_delete_time" dict "ctxData" $ "comment" .}} @@ -393,8 +394,8 @@ {{if or .Content .Attachments}} <div class="timeline-item comment"> <div class="content comment-container"> - <div class="ui top attached header comment-header tw-flex tw-items-center tw-justify-between"> - <div class="comment-header-left tw-flex tw-items-center"> + <div class="comment-header"> + <div class="comment-header-left"> {{if gt .Poster.ID 0}} <a class="inline-timeline-avatar" href="{{.Poster.HomeLink}}"> {{ctx.AvatarUtils.Avatar .Poster 24}} @@ -415,7 +416,7 @@ {{ctx.Locale.Tr "repo.issues.review.left_comment"}} </span> </div> - <div class="comment-header-right actions tw-flex tw-items-center"> + <div class="comment-header-right"> {{template "repo/issue/view_content/show_role" dict "ShowRole" .ShowRole}} {{if not $.Repository.IsArchived}} {{template "repo/issue/view_content/add_reaction" dict "ActionURL" (printf "%s/comments/%d/reactions" $.RepoLink .ID)}} @@ -506,7 +507,7 @@ {{/* compatibility with time comments made before v1.21 */}} <span class="text grey muted-links">{{.RenderedContent}}</span> {{else}} - <span class="text grey muted-links">- {{.Content|Sec2Time}}</span> + <span class="text grey muted-links">- {{.Content|Sec2Hour}}</span> {{end}} </div> </div> @@ -615,7 +616,7 @@ <div class="timeline-item-group"> <div class="timeline-item event" id="{{.HashTag}}"> <a class="timeline-avatar"{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}> - <img src="{{.Poster.AvatarLink ctx}}" width="40" height="40"> + <img loading="lazy" alt src="{{.Poster.AvatarLink ctx}}" width="40" height="40"> </a> <span class="badge grey">{{svg "octicon-x" 16}}</span> <span class="text grey muted-links"> @@ -633,8 +634,8 @@ </div> {{if .Content}} <div class="timeline-item comment"> - <div class="content"> - <div class="ui top attached header comment-header-left tw-flex tw-items-center arrow-top"> + <div class="content comment-container"> + <div class="comment-header arrow-top"> {{if gt .Poster.ID 0}} <a class="inline-timeline-avatar" href="{{.Poster.HomeLink}}"> {{ctx.AvatarUtils.Avatar .Poster 24}} @@ -644,7 +645,7 @@ {{ctx.Locale.Tr "action.review_dismissed_reason"}} </span> </div> - <div class="ui attached segment"> + <div class="ui attached segment comment-body"> <div class="render-content markup"> {{if .RenderedContent}} {{.RenderedContent}} diff --git a/templates/repo/issue/view_content/conversation.tmpl b/templates/repo/issue/view_content/conversation.tmpl index 14803298b8..07051d5ec0 100644 --- a/templates/repo/issue/view_content/conversation.tmpl +++ b/templates/repo/issue/view_content/conversation.tmpl @@ -17,7 +17,7 @@ </div> <div> {{if or $invalid $resolved}} - <button id="show-outdated-{{$comment.ID}}" data-comment="{{$comment.ID}}" class="{{if not $resolved}}tw-hidden {{end}}ui compact labeled button show-outdated tw-flex tw-items-center"> + <button id="show-outdated-{{$comment.ID}}" data-comment="{{$comment.ID}}" class="{{if not $resolved}}tw-hidden{{end}} btn tiny show-outdated"> {{svg "octicon-unfold" 16 "tw-mr-2"}} {{if $resolved}} {{ctx.Locale.Tr "repo.issues.review.show_resolved"}} @@ -25,7 +25,7 @@ {{ctx.Locale.Tr "repo.issues.review.show_outdated"}} {{end}} </button> - <button id="hide-outdated-{{$comment.ID}}" data-comment="{{$comment.ID}}" class="{{if $resolved}}tw-hidden {{end}}ui compact labeled button hide-outdated tw-flex tw-items-center"> + <button id="hide-outdated-{{$comment.ID}}" data-comment="{{$comment.ID}}" class="{{if $resolved}}tw-hidden {{end}} btn tiny hide-outdated"> {{svg "octicon-fold" 16 "tw-mr-2"}} {{if $resolved}} {{ctx.Locale.Tr "repo.issues.review.hide_resolved"}} @@ -40,7 +40,7 @@ {{if $diff}} {{$file := (index $diff.Files 0)}} <div id="code-preview-{{$comment.ID}}" class="ui table segment{{if $resolved}} tw-hidden{{end}}"> - <div class="diff-file-box diff-box file-content {{TabSizeClass $.Editorconfig $file.Name}}"> + <div class="diff-file-box file-content {{TabSizeClass $.Editorconfig $file.Name}}"> <div class="file-body file-code code-view code-diff code-diff-unified unicode-escaped"> <table> <tbody> @@ -57,8 +57,8 @@ {{$createdSubStr:= DateUtils.TimeSince .CreatedUnix}} <div class="comment code-comment" id="{{.HashTag}}"> <div class="content comment-container"> - <div class="header comment-header"> - <div class="comment-header-left tw-flex tw-items-center"> + <div class="comment-header"> + <div class="comment-header-left"> {{if not .OriginalAuthor}} <a class="avatar"> {{ctx.AvatarUtils.Avatar .Poster 20}} @@ -79,7 +79,7 @@ {{ctx.Locale.Tr "repo.issues.commented_at" .HashTag $createdSubStr}} </span> </div> - <div class="comment-header-right actions tw-flex tw-items-center"> + <div class="comment-header-right"> {{template "repo/issue/view_content/show_role" dict "ShowRole" .ShowRole}} {{if not $.Repository.IsArchived}} {{template "repo/issue/view_content/add_reaction" dict "ActionURL" (printf "%s/comments/%d/reactions" $.RepoLink .ID)}} @@ -109,7 +109,7 @@ </div> {{end}} </div> - <div class="code-comment-buttons tw-flex tw-items-center tw-flex-wrap tw-mt-2 tw-mb-1 tw-mx-2"> + <div class="flex-text-block tw-flex-wrap tw-my-2"> <div class="tw-flex-1"> {{if $resolved}} <div class="ui grey text"> @@ -118,7 +118,7 @@ </div> {{end}} </div> - <div class="code-comment-buttons-buttons"> + <div class="flex-text-block"> {{if and $.CanMarkConversation $hasReview (not $isReviewPending)}} <button class="ui tiny basic button resolve-conversation" data-origin="timeline" data-action="{{if not $resolved}}Resolve{{else}}UnResolve{{end}}" data-comment-id="{{$comment.ID}}" data-update-url="{{$.RepoLink}}/issues/resolve_conversation"> {{if $resolved}} @@ -129,8 +129,8 @@ </button> {{end}} {{if and $.SignedUserID (not $.Repository.IsArchived)}} - <button class="comment-form-reply ui primary tiny labeled icon button tw-ml-1 tw-mr-0"> - {{svg "octicon-reply" 16 "reply icon tw-mr-1"}}{{ctx.Locale.Tr "repo.diff.comment.reply"}} + <button class="comment-form-reply ui primary icon tiny button"> + {{svg "octicon-reply" 12}}{{ctx.Locale.Tr "repo.diff.comment.reply"}} </button> {{end}} </div> diff --git a/templates/repo/issue/view_content/pull.tmpl b/templates/repo/issue/view_content/pull_merge_box.tmpl index 7c53c5edb5..46bcd3b8b3 100644 --- a/templates/repo/issue/view_content/pull.tmpl +++ b/templates/repo/issue/view_content/pull_merge_box.tmpl @@ -1,7 +1,13 @@ {{if and .Issue.PullRequest.HasMerged (not .IsPullBranchDeletable)}} {{/* Then the merge box will not be displayed because this page already contains enough information */}} {{else}} -<div class="timeline-item comment merge box"> +<div class="timeline-item comment pull-merge-box" + data-global-init="initRepoPullMergeBox" + {{if .PullMergeBoxReloadingInterval}} + data-pull-merge-box-reloading-interval="{{.PullMergeBoxReloadingInterval}}" + data-pull-link="{{.Issue.Link}}" + {{end}} +> <div class="timeline-avatar text {{if .Issue.PullRequest.HasMerged}}purple {{- else if .Issue.IsClosed}}grey {{- else if .IsPullWorkInProgress}}grey @@ -83,13 +89,13 @@ {{ctx.Locale.Tr "repo.pulls.data_broken"}} </div> {{else if .IsPullWorkInProgress}} - <div class="item toggle-wip" data-title="{{.Issue.Title}}" data-wip-prefix="{{.WorkInProgressPrefix}}" data-update-url="{{.Issue.Link}}/title"> + <div class="item"> <div class="item-section-left flex-text-inline tw-flex-1"> {{svg "octicon-x"}} {{ctx.Locale.Tr "repo.pulls.cannot_merge_work_in_progress"}} </div> {{if or .HasIssuesOrPullsWritePermission .IsIssuePoster}} - <button class="ui compact button"> + <button class="ui compact button" data-global-init="initPullRequestWipToggle" data-title="{{.Issue.Title}}" data-wip-prefix="{{.WorkInProgressPrefix}}" data-update-url="{{.Issue.Link}}/title"> {{ctx.Locale.Tr "repo.pulls.remove_prefix" .WorkInProgressPrefix}} </button> {{end}} @@ -97,7 +103,7 @@ {{template "repo/issue/view_content/update_branch_by_merge" $}} {{else if .Issue.PullRequest.IsChecking}} <div class="item"> - {{svg "octicon-sync"}} + {{svg "octicon-sync" 16 "circular-spin"}} {{ctx.Locale.Tr "repo.pulls.is_checking"}} </div> {{else if .Issue.PullRequest.IsAncestor}} @@ -191,10 +197,11 @@ </div> {{end}} {{end}} + {{template "repo/issue/view_content/update_branch_by_merge" $}} + {{if .Issue.PullRequest.IsEmpty}} <div class="divider"></div> - <div class="item"> {{svg "octicon-alert"}} {{ctx.Locale.Tr "repo.pulls.is_empty"}} @@ -216,7 +223,7 @@ const defaultMergeMessage = {{.DefaultMergeBody}}; const defaultSquashMergeMessage = {{.DefaultSquashMergeBody}}; const mergeForm = { - 'baseLink': {{.Link}}, + 'baseLink': {{.Issue.Link}}, 'textCancel': {{ctx.Locale.Tr "cancel"}}, 'textDeleteBranch': {{ctx.Locale.Tr "repo.branch.delete" .HeadTarget}}, 'textAutoMergeButtonWhenSucceed': {{ctx.Locale.Tr "repo.pulls.auto_merge_button_when_succeed"}}, @@ -318,7 +325,7 @@ {{if .IsBlockedByApprovals}} <div class="item text red"> {{svg "octicon-x"}} - {{ctx.Locale.Tr "repo.pulls.blocked_by_approvals" .GrantedApprovals .ProtectedBranch.RequiredApprovals}} + {{ctx.Locale.Tr "repo.pulls.blocked_by_approvals" .GrantedApprovals .ProtectedBranch.RequiredApprovals}} </div> {{else if .IsBlockedByRejection}} <div class="item text red"> @@ -377,7 +384,7 @@ */}} {{if and $.StillCanManualMerge (not $showGeneralMergeForm)}} <div class="divider"></div> - <form class="ui form form-fetch-action" action="{{.Link}}/merge" method="post">{{/* another similar form is in PullRequestMergeForm.vue*/}} + <form class="ui form form-fetch-action" action="{{.Issue.Link}}/merge" method="post">{{/* another similar form is in PullRequestMergeForm.vue*/}} {{.CsrfTokenHtml}} <div class="field"> <input type="text" name="merge_commit_id" placeholder="{{ctx.Locale.Tr "repo.pulls.merge_commit_id"}}"> diff --git a/templates/repo/issue/view_content/pull_merge_instruction.tmpl b/templates/repo/issue/view_content/pull_merge_instruction.tmpl index 9a3e2cb7d7..a1cff41a3a 100644 --- a/templates/repo/issue/view_content/pull_merge_instruction.tmpl +++ b/templates/repo/issue/view_content/pull_merge_instruction.tmpl @@ -1,55 +1,57 @@ <div class="divider"></div> -<div class="instruct-toggle"> {{ctx.Locale.Tr "repo.pulls.cmd_instruction_hint"}} </div> -<div class="instruct-content tw-mt-2 tw-hidden"> - <div><h3>{{ctx.Locale.Tr "repo.pulls.cmd_instruction_checkout_title"}}</h3>{{ctx.Locale.Tr "repo.pulls.cmd_instruction_checkout_desc"}}</div> - {{$localBranch := .PullRequest.HeadBranch}} - {{if ne .PullRequest.HeadRepo.ID .PullRequest.BaseRepo.ID}} - {{$localBranch = print .PullRequest.HeadRepo.OwnerName "-" .PullRequest.HeadBranch}} - {{end}} - <div class="ui secondary segment"> - {{if eq .PullRequest.Flow 0}} - <div>git fetch -u {{if ne .PullRequest.HeadRepo.ID .PullRequest.BaseRepo.ID}}<origin-url data-url="{{.PullRequest.HeadRepo.Link}}"></origin-url>{{else}}origin{{end}} {{.PullRequest.HeadBranch}}:{{$localBranch}}</div> - {{else}} - <div>git fetch -u origin {{.PullRequest.GetGitRefName}}:{{$localBranch}}</div> +<details> + <summary>{{ctx.Locale.Tr "repo.pulls.cmd_instruction_hint"}}</summary> + <div class="tw-mt-2"> + <div><h3>{{ctx.Locale.Tr "repo.pulls.cmd_instruction_checkout_title"}}</h3>{{ctx.Locale.Tr "repo.pulls.cmd_instruction_checkout_desc"}}</div> + {{$localBranch := .PullRequest.HeadBranch}} + {{if ne .PullRequest.HeadRepo.ID .PullRequest.BaseRepo.ID}} + {{$localBranch = print .PullRequest.HeadRepo.OwnerName "-" .PullRequest.HeadBranch}} {{end}} - <div>git checkout {{$localBranch}}</div> - </div> - {{if .ShowMergeInstructions}} - <div> - <h3>{{ctx.Locale.Tr "repo.pulls.cmd_instruction_merge_title"}}</h3> - {{ctx.Locale.Tr "repo.pulls.cmd_instruction_merge_desc"}} - {{if not .AutodetectManualMerge}} - <div>{{ctx.Locale.Tr "repo.pulls.cmd_instruction_merge_warning"}}</div> - {{end}} - </div> - <div class="ui secondary segment"> - <div data-pull-merge-style="merge"> - <div>git checkout {{.PullRequest.BaseBranch}}</div> - <div>git merge --no-ff {{$localBranch}}</div> - </div> - <div class="tw-hidden" data-pull-merge-style="rebase"> - <div>git checkout {{.PullRequest.BaseBranch}}</div> - <div>git merge --ff-only {{$localBranch}}</div> - </div> - <div class="tw-hidden" data-pull-merge-style="rebase-merge"> + <div class="ui secondary segment"> + {{if eq .PullRequest.Flow 0}} + <div>git fetch -u {{if ne .PullRequest.HeadRepo.ID .PullRequest.BaseRepo.ID}}<origin-url data-url="{{.PullRequest.HeadRepo.Link}}"></origin-url>{{else}}origin{{end}} {{.PullRequest.HeadBranch}}:{{$localBranch}}</div> + {{else}} + <div>git fetch -u origin {{.PullRequest.GetGitRefName}}:{{$localBranch}}</div> + {{end}} <div>git checkout {{$localBranch}}</div> - <div>git rebase {{.PullRequest.BaseBranch}}</div> - <div>git checkout {{.PullRequest.BaseBranch}}</div> - <div>git merge --no-ff {{$localBranch}}</div> - </div> - <div class="tw-hidden" data-pull-merge-style="squash"> - <div>git checkout {{.PullRequest.BaseBranch}}</div> - <div>git merge --squash {{$localBranch}}</div> </div> - <div class="tw-hidden" data-pull-merge-style="fast-forward-only"> - <div>git checkout {{.PullRequest.BaseBranch}}</div> - <div>git merge --ff-only {{$localBranch}}</div> + {{if .ShowMergeInstructions}} + <div> + <h3>{{ctx.Locale.Tr "repo.pulls.cmd_instruction_merge_title"}}</h3> + {{ctx.Locale.Tr "repo.pulls.cmd_instruction_merge_desc"}} + {{if not .AutodetectManualMerge}} + <div>{{ctx.Locale.Tr "repo.pulls.cmd_instruction_merge_warning"}}</div> + {{end}} </div> - <div class="tw-hidden" data-pull-merge-style="manually-merged"> - <div>git checkout {{.PullRequest.BaseBranch}}</div> - <div>git merge {{$localBranch}}</div> + <div class="ui secondary segment"> + <div data-pull-merge-style="merge"> + <div>git checkout {{.PullRequest.BaseBranch}}</div> + <div>git merge --no-ff {{$localBranch}}</div> + </div> + <div class="tw-hidden" data-pull-merge-style="rebase"> + <div>git checkout {{.PullRequest.BaseBranch}}</div> + <div>git merge --ff-only {{$localBranch}}</div> + </div> + <div class="tw-hidden" data-pull-merge-style="rebase-merge"> + <div>git checkout {{$localBranch}}</div> + <div>git rebase {{.PullRequest.BaseBranch}}</div> + <div>git checkout {{.PullRequest.BaseBranch}}</div> + <div>git merge --no-ff {{$localBranch}}</div> + </div> + <div class="tw-hidden" data-pull-merge-style="squash"> + <div>git checkout {{.PullRequest.BaseBranch}}</div> + <div>git merge --squash {{$localBranch}}</div> + </div> + <div class="tw-hidden" data-pull-merge-style="fast-forward-only"> + <div>git checkout {{.PullRequest.BaseBranch}}</div> + <div>git merge --ff-only {{$localBranch}}</div> + </div> + <div class="tw-hidden" data-pull-merge-style="manually-merged"> + <div>git checkout {{.PullRequest.BaseBranch}}</div> + <div>git merge {{$localBranch}}</div> + </div> + <div>git push origin {{.PullRequest.BaseBranch}}</div> </div> - <div>git push origin {{.PullRequest.BaseBranch}}</div> + {{end}} </div> - {{end}} -</div> +</details> diff --git a/templates/repo/issue/view_content/reactions.tmpl b/templates/repo/issue/view_content/reactions.tmpl index 0011efe8b2..286d93a9b1 100644 --- a/templates/repo/issue/view_content/reactions.tmpl +++ b/templates/repo/issue/view_content/reactions.tmpl @@ -1,9 +1,9 @@ <div class="bottom-reactions" data-action-url="{{$.ActionURL}}"> {{range $key, $value := .Reactions}} {{$hasReacted := $value.HasUser ctx.RootData.SignedUserID}} - <a role="button" class="ui label basic{{if $hasReacted}} primary{{end}}{{if not ctx.RootData.IsSigned}} disabled{{end}} comment-reaction-button" - data-tooltip-content - title="{{$value.GetFirstUsers}}{{if gt ($value.GetMoreUserCount) 0}} {{ctx.Locale.Tr "repo.reactions_more" $value.GetMoreUserCount}}{{end}}" + <a role="button" class="ui label basic{{if $hasReacted}} primary{{end}}{{if not ctx.RootData.IsSigned}} disabled{{end}}" + data-global-click="onCommentReactionButtonClick" + data-tooltip-content title="{{$value.GetFirstUsers}}{{if gt ($value.GetMoreUserCount) 0}} {{ctx.Locale.Tr "repo.reactions_more" $value.GetMoreUserCount}}{{end}}" aria-label="{{$value.GetFirstUsers}}{{if gt ($value.GetMoreUserCount) 0}} {{ctx.Locale.Tr "repo.reactions_more" $value.GetMoreUserCount}}{{end}}" data-tooltip-placement="bottom-start" data-reaction-content="{{$key}}" data-has-reacted="{{$hasReacted}}"> diff --git a/templates/repo/issue/view_content/reference_issue_dialog.tmpl b/templates/repo/issue/view_content/reference_issue_dialog.tmpl index d6c9081001..0b28bdc811 100644 --- a/templates/repo/issue/view_content/reference_issue_dialog.tmpl +++ b/templates/repo/issue/view_content/reference_issue_dialog.tmpl @@ -7,7 +7,7 @@ {{.CsrfTokenHtml}} <div class="field"> <label><strong>{{ctx.Locale.Tr "repository"}}</strong></label> - <div class="ui search selection dropdown issue_reference_repository_search ellipsis-items-nowrap"> + <div class="ui search selection dropdown issue_reference_repository_search ellipsis-text-items"> <div class="default text gt-ellipsis">{{.Repository.FullName}}</div> <div class="menu"></div> </div> @@ -20,7 +20,7 @@ <label><strong>{{ctx.Locale.Tr "repo.issues.reference_issue.body"}}</strong></label> <textarea name="content"></textarea> </div> - <div class="text right"> + <div class="flex-text-block tw-justify-end"> <button class="ui primary button">{{ctx.Locale.Tr "repo.issues.create"}}</button> </div> </form> diff --git a/templates/repo/issue/view_content/update_branch_by_merge.tmpl b/templates/repo/issue/view_content/update_branch_by_merge.tmpl index adce052dee..5d959bf0b3 100644 --- a/templates/repo/issue/view_content/update_branch_by_merge.tmpl +++ b/templates/repo/issue/view_content/update_branch_by_merge.tmpl @@ -8,8 +8,8 @@ <div class="item-section-right"> {{if and $.UpdateAllowed $.UpdateByRebaseAllowed}} <div class="tw-inline-block"> - <div class="ui buttons update-button"> - <button class="ui button" data-do="{{$.Link}}/update" data-redirect="{{$.Link}}"> + <div id="update-pr-branch-with-base" class="ui buttons"> + <button class="ui button" data-do="{{$.Issue.Link}}/update" data-redirect="{{$.Issue.Link}}"> <span class="button-text"> {{ctx.Locale.Tr "repo.pulls.update_branch"}} </span> @@ -17,15 +17,15 @@ <div class="ui dropdown icon button"> {{svg "octicon-triangle-down"}} <div class="menu"> - <a class="item active selected" data-do="{{$.Link}}/update">{{ctx.Locale.Tr "repo.pulls.update_branch"}}</a> - <a class="item" data-do="{{$.Link}}/update?style=rebase">{{ctx.Locale.Tr "repo.pulls.update_branch_rebase"}}</a> + <a class="item active selected" data-do="{{$.Issue.Link}}/update">{{ctx.Locale.Tr "repo.pulls.update_branch"}}</a> + <a class="item" data-do="{{$.Issue.Link}}/update?style=rebase">{{ctx.Locale.Tr "repo.pulls.update_branch_rebase"}}</a> </div> </div> </div> </div> {{end}} {{if and $.UpdateAllowed (not $.UpdateByRebaseAllowed)}} - <form action="{{$.Link}}/update" method="post" class="ui update-branch-form"> + <form action="{{$.Issue.Link}}/update" method="post" class="ui update-branch-form"> {{$.CsrfTokenHtml}} <button class="ui compact button"> <span class="ui text">{{ctx.Locale.Tr "repo.pulls.update_branch"}}</span> diff --git a/templates/repo/issue/view_title.tmpl b/templates/repo/issue/view_title.tmpl index 0354f6ef22..b8f28dfd9b 100644 --- a/templates/repo/issue/view_title.tmpl +++ b/templates/repo/issue/view_title.tmpl @@ -13,7 +13,7 @@ {{$canEditIssueTitle := and (or .HasIssuesOrPullsWritePermission .IsIssuePoster) (not .Repository.IsArchived)}} <div class="issue-title" id="issue-title-display"> <h1 class="tw-break-anywhere"> - {{ctx.RenderUtils.RenderIssueTitle .Issue.Title ($.Repository.ComposeMetas ctx)}} + {{ctx.RenderUtils.RenderIssueTitle .Issue.Title $.Repository}} <span class="index">#{{.Issue.Index}}</span> </h1> <div class="issue-title-buttons"> @@ -42,7 +42,7 @@ {{if .HasMerged}} <div class="ui purple label issue-state-label">{{svg "octicon-git-merge" 16 "tw-mr-1"}} {{if eq .Issue.PullRequest.Status 3}}{{ctx.Locale.Tr "repo.pulls.manually_merged"}}{{else}}{{ctx.Locale.Tr "repo.pulls.merged"}}{{end}}</div> {{else if .Issue.IsClosed}} - <div class="ui red label issue-state-label">{{svg (Iif .Issue.IsPull "octicon-git-pull-request" "octicon-issue-closed")}} {{ctx.Locale.Tr "repo.issues.closed_title"}}</div> + <div class="ui red label issue-state-label">{{svg (Iif .Issue.IsPull "octicon-git-pull-request-closed" "octicon-issue-closed")}} {{ctx.Locale.Tr "repo.issues.closed_title"}}</div> {{else if .Issue.IsPull}} {{if .IsPullWorkInProgress}} <div class="ui grey label issue-state-label">{{svg "octicon-git-pull-request-draft"}} {{ctx.Locale.Tr "repo.issues.draft_title"}}</div> diff --git a/templates/repo/latest_commit.tmpl b/templates/repo/latest_commit.tmpl index c62efc8e88..cff338949f 100644 --- a/templates/repo/latest_commit.tmpl +++ b/templates/repo/latest_commit.tmpl @@ -21,10 +21,10 @@ {{template "repo/commit_statuses" dict "Status" .LatestCommitStatus "Statuses" .LatestCommitStatuses}} {{$commitLink:= printf "%s/commit/%s" .RepoLink (PathEscape .LatestCommit.ID.String)}} - <span class="grey commit-summary" title="{{.LatestCommit.Summary}}"><span class="message-wrapper">{{ctx.RenderUtils.RenderCommitMessageLinkSubject .LatestCommit.Message $commitLink ($.Repository.ComposeMetas ctx)}}</span> + <span class="grey commit-summary" title="{{.LatestCommit.Summary}}"><span class="message-wrapper">{{ctx.RenderUtils.RenderCommitMessageLinkSubject .LatestCommit.Message $commitLink $.Repository}}</span> {{if IsMultilineCommitMessage .LatestCommit.Message}} - <button class="ui button js-toggle-commit-body ellipsis-button" aria-expanded="false">...</button> - <pre class="commit-body tw-hidden">{{ctx.RenderUtils.RenderCommitBody .LatestCommit.Message ($.Repository.ComposeMetas ctx)}}</pre> + <button class="ui button ellipsis-button" aria-expanded="false" data-global-click="onRepoEllipsisButtonClick">...</button> + <pre class="commit-body tw-hidden">{{ctx.RenderUtils.RenderCommitBody .LatestCommit.Message $.Repository}}</pre> {{end}} </span> {{end}} diff --git a/templates/repo/migrate/codebase.tmpl b/templates/repo/migrate/codebase.tmpl index c8059b7c7b..f4de8ff236 100644 --- a/templates/repo/migrate/codebase.tmpl +++ b/templates/repo/migrate/codebase.tmpl @@ -1,114 +1,114 @@ {{template "base/head" .}} <div role="main" aria-label="{{.Title}}" class="page-content repository new migrate"> - <div class="ui middle very relaxed page grid"> - <div class="column"> - <form class="ui form" action="{{.Link}}" method="post"> + <div class="ui container medium-width"> + <h3 class="ui top attached header"> + {{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}} + </h3> + <div class="ui attached segment"> + {{template "base/alert" .}} + <form class="ui form left-right-form" action="{{.Link}}" method="post"> {{template "base/disable_form_autofill"}} {{.CsrfTokenHtml}} - <h3 class="ui top attached header"> - {{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}} - <input id="service_type" type="hidden" name="service" value="{{.service}}"> - </h3> - <div class="ui attached segment"> - {{template "base/alert" .}} - <div class="inline required field {{if .Err_CloneAddr}}error{{end}}"> - <label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label> - <input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required> - <span class="help"> - {{ctx.Locale.Tr "repo.migrate.clone_address_desc"}}{{if .ContextUser.CanImportLocal}} {{ctx.Locale.Tr "repo.migrate.clone_local_path"}}{{end}} - </span> - </div> - <div class="inline field {{if .Err_Auth}}error{{end}}"> - <label for="auth_username">{{ctx.Locale.Tr "username"}}</label> - <input id="auth_username" name="auth_username" value="{{.auth_username}}" {{if not .auth_username}}data-need-clear="true"{{end}}> - </div> - <div class="inline field {{if .Err_Auth}}error{{end}}"> - <label for="auth_password">{{ctx.Locale.Tr "password"}}</label> - <input id="auth_password" name="auth_password" type="password" value="{{.auth_password}}"> - </div> + <input id="service_type" type="hidden" name="service" value="{{.service}}"> - {{template "repo/migrate/options" .}} + <div class="inline required field {{if .Err_CloneAddr}}error{{end}}"> + <label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label> + <input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required> + <span class="help"> + {{ctx.Locale.Tr "repo.migrate.clone_address_desc"}}{{if .ContextUser.CanImportLocal}} {{ctx.Locale.Tr "repo.migrate.clone_local_path"}}{{end}} + </span> + </div> - <div id="migrate_items"> - <div class="inline field"> - <label>{{ctx.Locale.Tr "repo.migrate_items"}}</label> - <div class="ui checkbox"> - <input name="milestones" type="checkbox" {{if .milestones}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_milestones"}}</label> - </div> - <div class="ui checkbox"> - <input name="labels" type="checkbox" {{if .labels}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_labels"}}</label> - </div> - </div> - <div class="inline field"> - <label></label> - <div class="ui checkbox"> - <input name="issues" type="checkbox" {{if .issues}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_issues"}}</label> - </div> - <div class="ui checkbox"> - <input name="pull_requests" type="checkbox" {{if .pull_requests}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_merge_requests"}}</label> - </div> - </div> - </div> + <div class="inline field {{if .Err_Auth}}error{{end}}"> + <label for="auth_username">{{ctx.Locale.Tr "username"}}</label> + <input id="auth_username" name="auth_username" value="{{.auth_username}}" {{if not .auth_username}}data-need-clear="true"{{end}}> + </div> + <div class="inline field {{if .Err_Auth}}error{{end}}"> + <label for="auth_password">{{ctx.Locale.Tr "password"}}</label> + <input id="auth_password" name="auth_password" type="password" value="{{.auth_password}}"> + </div> - <div class="divider"></div> + {{template "repo/migrate/options" .}} - <div class="inline required field {{if .Err_Owner}}error{{end}}"> - <label>{{ctx.Locale.Tr "repo.owner"}}</label> - <div class="ui selection owner dropdown"> - <input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required> - <span class="text truncated-item-container" title="{{.ContextUser.Name}}"> - {{ctx.AvatarUtils.Avatar .ContextUser 28 "mini"}} - <span class="truncated-item-name">{{.ContextUser.ShortName 40}}</span> - </span> - {{svg "octicon-triangle-down" 14 "dropdown icon"}} - <div class="menu" title="{{.SignedUser.Name}}"> - <div class="item truncated-item-container" data-value="{{.SignedUser.ID}}"> - {{ctx.AvatarUtils.Avatar .SignedUser 28 "mini"}} - <span class="truncated-item-name">{{.SignedUser.ShortName 40}}</span> - </div> - {{range .Orgs}} - <div class="item truncated-item-container" data-value="{{.ID}}" title="{{.Name}}"> - {{ctx.AvatarUtils.Avatar . 28 "mini"}} - <span class="truncated-item-name">{{.ShortName 40}}</span> - </div> - {{end}} - </div> + <div id="migrate_items"> + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.migrate_items"}}</label> + <div class="ui checkbox"> + <input name="milestones" type="checkbox" {{if .milestones}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_milestones"}}</label> + </div> + <div class="ui checkbox"> + <input name="labels" type="checkbox" {{if .labels}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_labels"}}</label> </div> - </div> - - <div class="inline required field {{if .Err_RepoName}}error{{end}}"> - <label for="repo_name">{{ctx.Locale.Tr "repo.repo_name"}}</label> - <input id="repo_name" name="repo_name" value="{{.repo_name}}" required maxlength="100"> </div> <div class="inline field"> - <label>{{ctx.Locale.Tr "repo.visibility"}}</label> + <label></label> <div class="ui checkbox"> - {{if .IsForcedPrivate}} - <input name="private" type="checkbox" checked disabled> - <label>{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</label> - {{else}} - <input name="private" type="checkbox" {{if .private}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> - {{end}} + <input name="issues" type="checkbox" {{if .issues}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_issues"}}</label> + </div> + <div class="ui checkbox"> + <input name="pull_requests" type="checkbox" {{if .pull_requests}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_merge_requests"}}</label> </div> </div> - <div class="inline field {{if .Err_Description}}error{{end}}"> - <label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label> - <textarea id="description" name="description" maxlength="2048">{{.description}}</textarea> + </div> + + <div class="divider"></div> + + <div class="inline required field {{if .Err_Owner}}error{{end}}"> + <label>{{ctx.Locale.Tr "repo.owner"}}</label> + <div class="ui selection owner dropdown ellipsis-text-items"> + <input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required> + <span class="text" title="{{.ContextUser.Name}}"> + {{ctx.AvatarUtils.Avatar .ContextUser 28 "mini"}} + {{.ContextUser.ShortName 40}} + </span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu" title="{{.SignedUser.Name}}"> + <div class="item" data-value="{{.SignedUser.ID}}"> + {{ctx.AvatarUtils.Avatar .SignedUser 28 "mini"}} + {{.SignedUser.ShortName 40}} + </div> + {{range .Orgs}} + <div class="item" data-value="{{.ID}}" title="{{.Name}}"> + {{ctx.AvatarUtils.Avatar . 28 "mini"}} + {{.ShortName 40}} + </div> + {{end}} + </div> </div> + </div> - <div class="inline field"> - <label></label> - <button class="ui primary button"> - {{ctx.Locale.Tr "repo.migrate_repo"}} - </button> + <div class="inline required field {{if .Err_RepoName}}error{{end}}"> + <label for="repo_name">{{ctx.Locale.Tr "repo.repo_name"}}</label> + <input id="repo_name" name="repo_name" value="{{.repo_name}}" required maxlength="100"> + </div> + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.visibility"}}</label> + <div class="ui checkbox"> + {{if .IsForcedPrivate}} + <input name="private" type="checkbox" checked disabled> + <label>{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</label> + {{else}} + <input name="private" type="checkbox" {{if .private}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> + {{end}} </div> </div> + <div class="inline field {{if .Err_Description}}error{{end}}"> + <label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label> + <textarea id="description" name="description" maxlength="2048">{{.description}}</textarea> + </div> + + <div class="inline field"> + <label></label> + <button class="ui primary button"> + {{ctx.Locale.Tr "repo.migrate_repo"}} + </button> + </div> </form> </div> </div> diff --git a/templates/repo/migrate/codecommit.tmpl b/templates/repo/migrate/codecommit.tmpl index d1cebd0e48..275a2aef09 100644 --- a/templates/repo/migrate/codecommit.tmpl +++ b/templates/repo/migrate/codecommit.tmpl @@ -1,115 +1,115 @@ {{template "base/head" .}} <div role="main" aria-label="{{.Title}}" class="page-content repository new migrate"> - <div class="ui middle very relaxed page grid"> - <div class="column"> - <form class="ui form" action="{{.Link}}" method="post"> + <div class="ui container medium-width"> + <h3 class="ui top attached header"> + {{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}} + </h3> + <div class="ui attached segment"> + {{template "base/alert" .}} + <form class="ui form left-right-form" action="{{.Link}}" method="post"> {{template "base/disable_form_autofill"}} {{.CsrfTokenHtml}} - <h3 class="ui top attached header"> - {{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}} - <input id="service_type" type="hidden" name="service" value="{{.service}}"> - </h3> - <div class="ui attached segment"> - {{template "base/alert" .}} - <div class="inline required field {{if .Err_CloneAddr}}error{{end}}"> - <label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label> - <input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required> - <span class="help"> - {{ctx.Locale.Tr "repo.migrate.clone_address_desc"}}{{if .ContextUser.CanImportLocal}} {{ctx.Locale.Tr "repo.migrate.clone_local_path"}}{{end}} - </span> - </div> - <div class="inline required field {{if .Err_Auth}}error{{end}}"> - <label for="aws_access_key_id">{{ctx.Locale.Tr "repo.migrate.codecommit.aws_access_key_id"}}</label> - <input id="aws_access_key_id" name="aws_access_key_id" value="{{.aws_access_key_id}}" required> - </div> - <div class="inline required field {{if .Err_Auth}}error{{end}}"> - <label for="aws_secret_access_key">{{ctx.Locale.Tr "repo.migrate.codecommit.aws_secret_access_key"}}</label> - <input id="aws_secret_access_key" name="aws_secret_access_key" type="password" value="{{.aws_secret_access_key}}" required> - </div> - <div class="inline required field {{if .Err_Auth}}error{{end}}"> - <label for="auth_username">{{ctx.Locale.Tr "repo.migrate.codecommit.https_git_credentials_username"}}</label> - <input id="auth_username" name="auth_username" value="{{.auth_username}}" required> - </div> - <div class="inline required field {{if .Err_Auth}}error{{end}}"> - <label for="auth_password">{{ctx.Locale.Tr "repo.migrate.codecommit.https_git_credentials_password"}}</label> - <input id="auth_password" name="auth_password" type="password" value="{{.auth_password}}" required> + <input id="service_type" type="hidden" name="service" value="{{.service}}"> + + <div class="inline required field {{if .Err_CloneAddr}}error{{end}}"> + <label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label> + <input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required> + <span class="help"> + {{ctx.Locale.Tr "repo.migrate.clone_address_desc"}}{{if .ContextUser.CanImportLocal}} {{ctx.Locale.Tr "repo.migrate.clone_local_path"}}{{end}} + </span> + </div> + + <div class="inline required field {{if .Err_Auth}}error{{end}}"> + <label for="aws_access_key_id">{{ctx.Locale.Tr "repo.migrate.codecommit.aws_access_key_id"}}</label> + <input id="aws_access_key_id" name="aws_access_key_id" value="{{.aws_access_key_id}}" required> + </div> + <div class="inline required field {{if .Err_Auth}}error{{end}}"> + <label for="aws_secret_access_key">{{ctx.Locale.Tr "repo.migrate.codecommit.aws_secret_access_key"}}</label> + <input id="aws_secret_access_key" name="aws_secret_access_key" type="password" value="{{.aws_secret_access_key}}" required> + </div> + <div class="inline required field {{if .Err_Auth}}error{{end}}"> + <label for="auth_username">{{ctx.Locale.Tr "repo.migrate.codecommit.https_git_credentials_username"}}</label> + <input id="auth_username" name="auth_username" value="{{.auth_username}}" required> + </div> + <div class="inline required field {{if .Err_Auth}}error{{end}}"> + <label for="auth_password">{{ctx.Locale.Tr "repo.migrate.codecommit.https_git_credentials_password"}}</label> + <input id="auth_password" name="auth_password" type="password" value="{{.auth_password}}" required> + </div> + + {{if not .DisableNewPullMirrors}} + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.migrate_options"}}</label> + <div class="ui checkbox"> + <input id="mirror" name="mirror" type="checkbox" {{if .mirror}} checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_options_mirror_helper"}}</label> </div> + </div> + {{end}} - {{if not .DisableNewPullMirrors}} + <div id="migrate_items"> <div class="inline field"> - <label>{{ctx.Locale.Tr "repo.migrate_options"}}</label> + <label>{{ctx.Locale.Tr "repo.migrate_items"}}</label> <div class="ui checkbox"> - <input id="mirror" name="mirror" type="checkbox" {{if .mirror}} checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_options_mirror_helper"}}</label> - </div> - </div> - {{end}} - - <div id="migrate_items"> - <div class="inline field"> - <label>{{ctx.Locale.Tr "repo.migrate_items"}}</label> - <div class="ui checkbox"> - <input name="pull_requests" type="checkbox" {{if .pull_requests}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_pullrequests"}}</label> - </div> + <input name="pull_requests" type="checkbox" {{if .pull_requests}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_pullrequests"}}</label> </div> </div> + </div> - <div class="divider"></div> + <div class="divider"></div> - <div class="inline required field {{if .Err_Owner}}error{{end}}"> - <label>{{ctx.Locale.Tr "repo.owner"}}</label> - <div class="ui selection owner dropdown"> - <input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required> - <span class="text truncated-item-container" title="{{.ContextUser.Name}}"> - {{ctx.AvatarUtils.Avatar .ContextUser 28 "mini"}} - <span class="truncated-item-name">{{.ContextUser.ShortName 40}}</span> - </span> - {{svg "octicon-triangle-down" 14 "dropdown icon"}} - <div class="menu" title="{{.SignedUser.Name}}"> - <div class="item truncated-item-container" data-value="{{.SignedUser.ID}}"> - {{ctx.AvatarUtils.Avatar .SignedUser 28 "mini"}} - <span class="truncated-item-name">{{.SignedUser.ShortName 40}}</span> - </div> - {{range .Orgs}} - <div class="item truncated-item-container" data-value="{{.ID}}" title="{{.Name}}"> - {{ctx.AvatarUtils.Avatar . 28 "mini"}} - <span class="truncated-item-name">{{.ShortName 40}}</span> - </div> - {{end}} + <div class="inline required field {{if .Err_Owner}}error{{end}}"> + <label>{{ctx.Locale.Tr "repo.owner"}}</label> + <div class="ui selection owner dropdown ellipsis-text-items"> + <input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required> + <span class="text" title="{{.ContextUser.Name}}"> + {{ctx.AvatarUtils.Avatar .ContextUser 28 "mini"}} + {{.ContextUser.ShortName 40}} + </span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu" title="{{.SignedUser.Name}}"> + <div class="item" data-value="{{.SignedUser.ID}}"> + {{ctx.AvatarUtils.Avatar .SignedUser 28 "mini"}} + {{.SignedUser.ShortName 40}} </div> - </div> - </div> - - <div class="inline required field {{if .Err_RepoName}}error{{end}}"> - <label for="repo_name">{{ctx.Locale.Tr "repo.repo_name"}}</label> - <input id="repo_name" name="repo_name" value="{{.repo_name}}" required maxlength="100"> - </div> - <div class="inline field"> - <label>{{ctx.Locale.Tr "repo.visibility"}}</label> - <div class="ui checkbox"> - {{if .IsForcedPrivate}} - <input name="private" type="checkbox" checked disabled> - <label>{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</label> - {{else}} - <input name="private" type="checkbox" {{if .private}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> + {{range .Orgs}} + <div class="item" data-value="{{.ID}}" title="{{.Name}}"> + {{ctx.AvatarUtils.Avatar . 28 "mini"}} + {{.ShortName 40}} + </div> {{end}} </div> </div> - <div class="inline field {{if .Err_Description}}error{{end}}"> - <label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label> - <textarea id="description" name="description" maxlength="2048">{{.description}}</textarea> - </div> + </div> - <div class="inline field"> - <label></label> - <button class="ui primary button"> - {{ctx.Locale.Tr "repo.migrate_repo"}} - </button> + <div class="inline required field {{if .Err_RepoName}}error{{end}}"> + <label for="repo_name">{{ctx.Locale.Tr "repo.repo_name"}}</label> + <input id="repo_name" name="repo_name" value="{{.repo_name}}" required maxlength="100"> + </div> + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.visibility"}}</label> + <div class="ui checkbox"> + {{if .IsForcedPrivate}} + <input name="private" type="checkbox" checked disabled> + <label>{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</label> + {{else}} + <input name="private" type="checkbox" {{if .private}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> + {{end}} </div> </div> + <div class="inline field {{if .Err_Description}}error{{end}}"> + <label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label> + <textarea id="description" name="description" maxlength="2048">{{.description}}</textarea> + </div> + + <div class="inline field"> + <label></label> + <button class="ui primary button"> + {{ctx.Locale.Tr "repo.migrate_repo"}} + </button> + </div> </form> </div> </div> diff --git a/templates/repo/migrate/git.tmpl b/templates/repo/migrate/git.tmpl index 9c5f0d7d6d..41139d4fd6 100644 --- a/templates/repo/migrate/git.tmpl +++ b/templates/repo/migrate/git.tmpl @@ -1,88 +1,88 @@ {{template "base/head" .}} <div role="main" aria-label="{{.Title}}" class="page-content repository new migrate"> - <div class="ui middle very relaxed page grid"> - <div class="column"> - <form class="ui form" action="{{.Link}}" method="post"> + <div class="ui container medium-width"> + <h3 class="ui top attached header"> + {{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}} + </h3> + <div class="ui attached segment"> + {{template "base/alert" .}} + <form class="ui form left-right-form" action="{{.Link}}" method="post"> {{template "base/disable_form_autofill"}} {{.CsrfTokenHtml}} - <h3 class="ui top attached header"> - {{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}} - <input id="service_type" type="hidden" name="service" value="{{.service}}"> - </h3> - <div class="ui attached segment"> - {{template "base/alert" .}} - <div class="inline required field {{if .Err_CloneAddr}}error{{end}}"> - <label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label> - <input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required> - <span class="help"> - {{ctx.Locale.Tr "repo.migrate.clone_address_desc"}}{{if .ContextUser.CanImportLocal}} {{ctx.Locale.Tr "repo.migrate.clone_local_path"}}{{end}} - </span> - </div> - <div class="inline field {{if .Err_Auth}}error{{end}}"> - <label for="auth_username">{{ctx.Locale.Tr "username"}}</label> - <input id="auth_username" name="auth_username" value="{{.auth_username}}" {{if not .auth_username}}data-need-clear="true"{{end}}> - </div> - <div class="inline field {{if .Err_Auth}}error{{end}}"> - <label for="auth_password">{{ctx.Locale.Tr "password"}}</label> - <input id="auth_password" name="auth_password" type="password" value="{{.auth_password}}"> - </div> - {{template "repo/migrate/options" .}} + <input id="service_type" type="hidden" name="service" value="{{.service}}"> - <div class="divider"></div> + <div class="inline required field {{if .Err_CloneAddr}}error{{end}}"> + <label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label> + <input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required> + <span class="help"> + {{ctx.Locale.Tr "repo.migrate.clone_address_desc"}}{{if .ContextUser.CanImportLocal}} {{ctx.Locale.Tr "repo.migrate.clone_local_path"}}{{end}} + </span> + </div> + <div class="inline field {{if .Err_Auth}}error{{end}}"> + <label for="auth_username">{{ctx.Locale.Tr "username"}}</label> + <input id="auth_username" name="auth_username" value="{{.auth_username}}" {{if not .auth_username}}data-need-clear="true"{{end}}> + </div> + <div class="inline field {{if .Err_Auth}}error{{end}}"> + <label for="auth_password">{{ctx.Locale.Tr "password"}}</label> + <input id="auth_password" name="auth_password" type="password" value="{{.auth_password}}"> + </div> - <div class="inline required field {{if .Err_Owner}}error{{end}}"> - <label>{{ctx.Locale.Tr "repo.owner"}}</label> - <div class="ui selection owner dropdown"> - <input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required> - <span class="text truncated-item-container" title="{{.ContextUser.Name}}"> - {{ctx.AvatarUtils.Avatar .ContextUser}} - <span class="truncated-item-name">{{.ContextUser.ShortName 40}}</span> - </span> - {{svg "octicon-triangle-down" 14 "dropdown icon"}} - <div class="menu" title="{{.SignedUser.Name}}"> - <div class="item truncated-item-container" data-value="{{.SignedUser.ID}}"> - {{ctx.AvatarUtils.Avatar .SignedUser}} - <span class="truncated-item-name">{{.SignedUser.ShortName 40}}</span> - </div> - {{range .Orgs}} - <div class="item truncated-item-container" data-value="{{.ID}}" title="{{.Name}}"> - {{ctx.AvatarUtils.Avatar .}} - <span class="truncated-item-name">{{.ShortName 40}}</span> - </div> - {{end}} - </div> - </div> - </div> + {{template "repo/migrate/options" .}} - <div class="inline required field {{if .Err_RepoName}}error{{end}}"> - <label for="repo_name">{{ctx.Locale.Tr "repo.repo_name"}}</label> - <input id="repo_name" name="repo_name" value="{{.repo_name}}" required maxlength="100"> - </div> - <div class="inline field"> - <label>{{ctx.Locale.Tr "repo.visibility"}}</label> - <div class="ui checkbox"> - {{if .IsForcedPrivate}} - <input name="private" type="checkbox" checked disabled> - <label>{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</label> - {{else}} - <input name="private" type="checkbox" {{if .private}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> + <div class="divider"></div> + + <div class="inline required field {{if .Err_Owner}}error{{end}}"> + <label>{{ctx.Locale.Tr "repo.owner"}}</label> + <div class="ui selection owner dropdown ellipsis-text-items"> + <input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required> + <span class="text" title="{{.ContextUser.Name}}"> + {{ctx.AvatarUtils.Avatar .ContextUser}} + {{.ContextUser.ShortName 40}} + </span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu" title="{{.SignedUser.Name}}"> + <div class="item" data-value="{{.SignedUser.ID}}"> + {{ctx.AvatarUtils.Avatar .SignedUser}} + {{.SignedUser.ShortName 40}} + </div> + {{range .Orgs}} + <div class="item" data-value="{{.ID}}" title="{{.Name}}"> + {{ctx.AvatarUtils.Avatar .}} + {{.ShortName 40}} + </div> {{end}} </div> </div> - <div class="inline field {{if .Err_Description}}error{{end}}"> - <label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label> - <textarea id="description" name="description" maxlength="2048">{{.description}}</textarea> - </div> + </div> - <div class="inline field"> - <label></label> - <button class="ui primary button"> - {{ctx.Locale.Tr "repo.migrate_repo"}} - </button> + <div class="inline required field {{if .Err_RepoName}}error{{end}}"> + <label for="repo_name">{{ctx.Locale.Tr "repo.repo_name"}}</label> + <input id="repo_name" name="repo_name" value="{{.repo_name}}" required maxlength="100"> + </div> + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.visibility"}}</label> + <div class="ui checkbox"> + {{if .IsForcedPrivate}} + <input name="private" type="checkbox" checked disabled> + <label>{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</label> + {{else}} + <input name="private" type="checkbox" {{if .private}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> + {{end}} </div> </div> + <div class="inline field {{if .Err_Description}}error{{end}}"> + <label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label> + <textarea id="description" name="description" maxlength="2048">{{.description}}</textarea> + </div> + + <div class="inline field"> + <label></label> + <button class="ui primary button"> + {{ctx.Locale.Tr "repo.migrate_repo"}} + </button> + </div> </form> </div> </div> diff --git a/templates/repo/migrate/gitbucket.tmpl b/templates/repo/migrate/gitbucket.tmpl index b667fa828a..c89aa6c744 100644 --- a/templates/repo/migrate/gitbucket.tmpl +++ b/templates/repo/migrate/gitbucket.tmpl @@ -1,130 +1,130 @@ {{template "base/head" .}} <div role="main" aria-label="{{.Title}}" class="page-content repository new migrate"> - <div class="ui middle very relaxed page grid"> - <div class="column"> - <form class="ui form" action="{{.Link}}" method="post"> + <div class="ui container medium-width"> + <h3 class="ui top attached header"> + {{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}} + </h3> + <div class="ui attached segment"> + {{template "base/alert" .}} + <form class="ui form left-right-form" action="{{.Link}}" method="post"> {{template "base/disable_form_autofill"}} {{.CsrfTokenHtml}} - <h3 class="ui top attached header"> - {{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}} - <input id="service_type" type="hidden" name="service" value="{{.service}}"> - </h3> - <div class="ui attached segment"> - {{template "base/alert" .}} - <div class="inline required field {{if .Err_CloneAddr}}error{{end}}"> - <label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label> - <input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required> - <span class="help"> - {{ctx.Locale.Tr "repo.migrate.clone_address_desc"}}{{if .ContextUser.CanImportLocal}} {{ctx.Locale.Tr "repo.migrate.clone_local_path"}}{{end}} - </span> - </div> - <div class="inline field {{if .Err_Auth}}error{{end}}"> - <label for="auth_username">{{ctx.Locale.Tr "username"}}</label> - <input id="auth_username" name="auth_username" value="{{.auth_username}}" {{if not .auth_username}}data-need-clear="true"{{end}}> - </div> - <div class="inline field {{if .Err_Auth}}error{{end}}"> - <label for="auth_password">{{ctx.Locale.Tr "password"}}</label> - <input id="auth_password" name="auth_password" type="password" value="{{.auth_password}}"> - </div> + <input id="service_type" type="hidden" name="service" value="{{.service}}"> + + <div class="inline required field {{if .Err_CloneAddr}}error{{end}}"> + <label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label> + <input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required> + <span class="help"> + {{ctx.Locale.Tr "repo.migrate.clone_address_desc"}}{{if .ContextUser.CanImportLocal}} {{ctx.Locale.Tr "repo.migrate.clone_local_path"}}{{end}} + </span> + </div> - {{template "repo/migrate/options" .}} + <div class="inline field {{if .Err_Auth}}error{{end}}"> + <label for="auth_username">{{ctx.Locale.Tr "username"}}</label> + <input id="auth_username" name="auth_username" value="{{.auth_username}}" {{if not .auth_username}}data-need-clear="true"{{end}}> + </div> + <div class="inline field {{if .Err_Auth}}error{{end}}"> + <label for="auth_password">{{ctx.Locale.Tr "password"}}</label> + <input id="auth_password" name="auth_password" type="password" value="{{.auth_password}}"> + </div> + + {{template "repo/migrate/options" .}} + + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.migrate_items"}}</label> + <div class="ui checkbox"> + <input name="wiki" type="checkbox" {{if .wiki}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_wiki"}}</label> + </div> + </div> + <div id="migrate_items" class="inline field"> + <span class="help">{{ctx.Locale.Tr "repo.migrate.migrate_items_options"}}</span> <div class="inline field"> - <label>{{ctx.Locale.Tr "repo.migrate_items"}}</label> + <label></label> + <div class="ui checkbox"> + <input name="labels" type="checkbox" {{if .labels}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_labels"}}</label> + </div> <div class="ui checkbox"> - <input name="wiki" type="checkbox" {{if .wiki}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_wiki"}}</label> + <input name="issues" type="checkbox" {{if .issues}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_issues"}}</label> </div> </div> - - <div id="migrate_items"> - <span class="help">{{ctx.Locale.Tr "repo.migrate.migrate_items_options"}}</span> - <div class="inline field"> - <label></label> - <div class="ui checkbox"> - <input name="labels" type="checkbox" {{if .labels}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_labels"}}</label> - </div> - <div class="ui checkbox"> - <input name="issues" type="checkbox" {{if .issues}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_issues"}}</label> - </div> + <div class="inline field"> + <label></label> + <div class="ui checkbox"> + <input name="pull_requests" type="checkbox" {{if .pull_requests}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_pullrequests"}}</label> </div> - <div class="inline field"> - <label></label> - <div class="ui checkbox"> - <input name="pull_requests" type="checkbox" {{if .pull_requests}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_pullrequests"}}</label> - </div> - <div class="ui checkbox"> - <input name="releases" type="checkbox" {{if .releases}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_releases"}}</label> - </div> + <div class="ui checkbox"> + <input name="releases" type="checkbox" {{if .releases}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_releases"}}</label> </div> - <div class="inline field"> - <label></label> - <div class="ui checkbox"> - <input name="milestones" type="checkbox" {{if .milestones}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_milestones"}}</label> - </div> + </div> + <div class="inline field"> + <label></label> + <div class="ui checkbox"> + <input name="milestones" type="checkbox" {{if .milestones}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_milestones"}}</label> </div> </div> + </div> - <div class="divider"></div> + <div class="divider"></div> - <div class="inline required field {{if .Err_Owner}}error{{end}}"> - <label>{{ctx.Locale.Tr "repo.owner"}}</label> - <div class="ui selection owner dropdown"> - <input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required> - <span class="text truncated-item-container" title="{{.ContextUser.Name}}"> - {{ctx.AvatarUtils.Avatar .ContextUser 28 "mini"}} - <span class="truncated-item-name">{{.ContextUser.ShortName 40}}</span> - </span> - {{svg "octicon-triangle-down" 14 "dropdown icon"}} - <div class="menu" title="{{.SignedUser.Name}}"> - <div class="item truncated-item-container" data-value="{{.SignedUser.ID}}"> - {{ctx.AvatarUtils.Avatar .SignedUser 28 "mini"}} - <span class="truncated-item-name">{{.SignedUser.ShortName 40}}</span> - </div> - {{range .Orgs}} - <div class="item truncated-item-container" data-value="{{.ID}}" title="{{.Name}}"> - {{ctx.AvatarUtils.Avatar . 28 "mini"}} - <span class="truncated-item-name">{{.ShortName 40}}</span> - </div> - {{end}} + <div class="inline required field {{if .Err_Owner}}error{{end}}"> + <label>{{ctx.Locale.Tr "repo.owner"}}</label> + <div class="ui selection owner dropdown ellipsis-text-items"> + <input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required> + <span class="text" title="{{.ContextUser.Name}}"> + {{ctx.AvatarUtils.Avatar .ContextUser 28 "mini"}} + {{.ContextUser.ShortName 40}} + </span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu" title="{{.SignedUser.Name}}"> + <div class="item" data-value="{{.SignedUser.ID}}"> + {{ctx.AvatarUtils.Avatar .SignedUser 28 "mini"}} + {{.SignedUser.ShortName 40}} </div> - </div> - </div> - - <div class="inline required field {{if .Err_RepoName}}error{{end}}"> - <label for="repo_name">{{ctx.Locale.Tr "repo.repo_name"}}</label> - <input id="repo_name" name="repo_name" value="{{.repo_name}}" required maxlength="100"> - </div> - <div class="inline field"> - <label>{{ctx.Locale.Tr "repo.visibility"}}</label> - <div class="ui checkbox"> - {{if .IsForcedPrivate}} - <input name="private" type="checkbox" checked disabled> - <label>{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</label> - {{else}} - <input name="private" type="checkbox" {{if .private}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> + {{range .Orgs}} + <div class="item" data-value="{{.ID}}" title="{{.Name}}"> + {{ctx.AvatarUtils.Avatar . 28 "mini"}} + {{.ShortName 40}} + </div> {{end}} </div> </div> - <div class="inline field {{if .Err_Description}}error{{end}}"> - <label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label> - <textarea id="description" name="description" maxlength="2048">{{.description}}</textarea> - </div> + </div> - <div class="inline field"> - <label></label> - <button class="ui primary button"> - {{ctx.Locale.Tr "repo.migrate_repo"}} - </button> + <div class="inline required field {{if .Err_RepoName}}error{{end}}"> + <label for="repo_name">{{ctx.Locale.Tr "repo.repo_name"}}</label> + <input id="repo_name" name="repo_name" value="{{.repo_name}}" required maxlength="100"> + </div> + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.visibility"}}</label> + <div class="ui checkbox"> + {{if .IsForcedPrivate}} + <input name="private" type="checkbox" checked disabled> + <label>{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</label> + {{else}} + <input name="private" type="checkbox" {{if .private}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> + {{end}} </div> </div> + <div class="inline field {{if .Err_Description}}error{{end}}"> + <label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label> + <textarea id="description" name="description" maxlength="2048">{{.description}}</textarea> + </div> + + <div class="inline field"> + <label></label> + <button class="ui primary button"> + {{ctx.Locale.Tr "repo.migrate_repo"}} + </button> + </div> </form> </div> </div> diff --git a/templates/repo/migrate/gitea.tmpl b/templates/repo/migrate/gitea.tmpl index 3b8f377096..55cf61a77f 100644 --- a/templates/repo/migrate/gitea.tmpl +++ b/templates/repo/migrate/gitea.tmpl @@ -1,126 +1,126 @@ {{template "base/head" .}} <div role="main" aria-label="{{.Title}}" class="page-content repository new migrate"> - <div class="ui middle very relaxed page grid"> - <div class="column"> - <form class="ui form" action="{{.Link}}" method="post"> + <div class="ui container medium-width"> + <h3 class="ui top attached header"> + {{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}} + </h3> + <div class="ui attached segment"> + {{template "base/alert" .}} + <form class="ui form left-right-form" action="{{.Link}}" method="post"> {{.CsrfTokenHtml}} - <h3 class="ui top attached header"> - {{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}} - <input id="service_type" type="hidden" name="service" value="{{.service}}"> - </h3> - <div class="ui attached segment"> - {{template "base/alert" .}} - <div class="inline required field {{if .Err_CloneAddr}}error{{end}}"> - <label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label> - <input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required> - <span class="help"> - {{ctx.Locale.Tr "repo.migrate.clone_address_desc"}}{{if .ContextUser.CanImportLocal}} {{ctx.Locale.Tr "repo.migrate.clone_local_path"}}{{end}} - </span> - </div> - <div class="inline field {{if .Err_Auth}}error{{end}}"> - <label for="auth_token">{{ctx.Locale.Tr "access_token"}}</label> - <input id="auth_token" name="auth_token" type="password" autocomplete="new-password" value="{{.auth_token}}" {{if not .auth_token}} data-need-clear="true" {{end}}> - <a target="_blank" href="https://docs.gitea.com/development/api-usage">{{svg "octicon-question"}}</a> - </div> + <input id="service_type" type="hidden" name="service" value="{{.service}}"> - {{template "repo/migrate/options" .}} + <div class="inline required field {{if .Err_CloneAddr}}error{{end}}"> + <label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label> + <input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required> + <span class="help"> + {{ctx.Locale.Tr "repo.migrate.clone_address_desc"}}{{if .ContextUser.CanImportLocal}} {{ctx.Locale.Tr "repo.migrate.clone_local_path"}}{{end}} + </span> + </div> + + <div class="inline field {{if .Err_Auth}}error{{end}}"> + <label for="auth_token">{{ctx.Locale.Tr "access_token"}}</label> + <input id="auth_token" name="auth_token" type="password" autocomplete="new-password" value="{{.auth_token}}" {{if not .auth_token}} data-need-clear="true" {{end}}> + <a target="_blank" href="https://docs.gitea.com/development/api-usage">{{svg "octicon-question"}}</a> + </div> + {{template "repo/migrate/options" .}} + + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.migrate_items"}}</label> + <div class="ui checkbox"> + <input name="wiki" type="checkbox" {{if .wiki}} checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_wiki"}}</label> + </div> + </div> + + <div id="migrate_items" class="inline field"> + <span class="help">{{ctx.Locale.Tr "repo.migrate.migrate_items_options"}}</span> <div class="inline field"> - <label>{{ctx.Locale.Tr "repo.migrate_items"}}</label> + <label></label> <div class="ui checkbox"> - <input name="wiki" type="checkbox" {{if .wiki}} checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_wiki"}}</label> + <input name="labels" type="checkbox" {{if .labels}} checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_labels"}}</label> + </div> + <div class="ui checkbox"> + <input name="issues" type="checkbox" {{if .issues}} checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_issues"}}</label> </div> </div> - - <div id="migrate_items"> - <span class="help">{{ctx.Locale.Tr "repo.migrate.migrate_items_options"}}</span> - <div class="inline field"> - <label></label> - <div class="ui checkbox"> - <input name="labels" type="checkbox" {{if .labels}} checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_labels"}}</label> - </div> - <div class="ui checkbox"> - <input name="issues" type="checkbox" {{if .issues}} checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_issues"}}</label> - </div> + <div class="inline field"> + <label></label> + <div class="ui checkbox"> + <input name="pull_requests" type="checkbox" {{if .pull_requests}} checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_pullrequests"}}</label> </div> - <div class="inline field"> - <label></label> - <div class="ui checkbox"> - <input name="pull_requests" type="checkbox" {{if .pull_requests}} checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_pullrequests"}}</label> - </div> - <div class="ui checkbox"> - <input name="releases" type="checkbox" {{if .releases}} checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_releases"}}</label> - </div> + <div class="ui checkbox"> + <input name="releases" type="checkbox" {{if .releases}} checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_releases"}}</label> </div> - <div class="inline field"> - <label></label> - <div class="ui checkbox"> - <input name="milestones" type="checkbox" {{if .milestones}} checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_milestones"}}</label> - </div> + </div> + <div class="inline field"> + <label></label> + <div class="ui checkbox"> + <input name="milestones" type="checkbox" {{if .milestones}} checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_milestones"}}</label> </div> </div> + </div> - <div class="divider"></div> + <div class="divider"></div> - <div class="inline required field {{if .Err_Owner}}error{{end}}"> - <label>{{ctx.Locale.Tr "repo.owner"}}</label> - <div class="ui selection owner dropdown"> - <input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required> - <span class="text truncated-item-container" title="{{.ContextUser.Name}}"> - {{ctx.AvatarUtils.Avatar .ContextUser}} - <span class="truncated-item-name">{{.ContextUser.ShortName 40}}</span> - </span> - {{svg "octicon-triangle-down" 14 "dropdown icon"}} - <div class="menu" title="{{.SignedUser.Name}}"> - <div class="item truncated-item-container" data-value="{{.SignedUser.ID}}"> - {{ctx.AvatarUtils.Avatar .SignedUser}} - <span class="truncated-item-name">{{.SignedUser.ShortName 40}}</span> - </div> - {{range .Orgs}} - <div class="item truncated-item-container" data-value="{{.ID}}" title="{{.Name}}"> - {{ctx.AvatarUtils.Avatar .}} - <span class="truncated-item-name">{{.ShortName 40}}</span> - </div> - {{end}} + <div class="inline required field {{if .Err_Owner}}error{{end}}"> + <label>{{ctx.Locale.Tr "repo.owner"}}</label> + <div class="ui selection owner dropdown ellipsis-text-items"> + <input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required> + <span class="text" title="{{.ContextUser.Name}}"> + {{ctx.AvatarUtils.Avatar .ContextUser}} + {{.ContextUser.ShortName 40}} + </span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu" title="{{.SignedUser.Name}}"> + <div class="item" data-value="{{.SignedUser.ID}}"> + {{ctx.AvatarUtils.Avatar .SignedUser}} + {{.SignedUser.ShortName 40}} + </div> + {{range .Orgs}} + <div class="item" data-value="{{.ID}}" title="{{.Name}}"> + {{ctx.AvatarUtils.Avatar .}} + {{.ShortName 40}} </div> - </div> - </div> - - <div class="inline required field {{if .Err_RepoName}}error{{end}}"> - <label for="repo_name">{{ctx.Locale.Tr "repo.repo_name"}}</label> - <input id="repo_name" name="repo_name" value="{{.repo_name}}" required maxlength="100"> - </div> - <div class="inline field"> - <label>{{ctx.Locale.Tr "repo.visibility"}}</label> - <div class="ui checkbox"> - {{if .IsForcedPrivate}} - <input name="private" type="checkbox" checked disabled> - <label>{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</label> - {{else}} - <input name="private" type="checkbox" {{if .private}} checked{{end}}> - <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> {{end}} </div> </div> - <div class="inline field {{if .Err_Description}}error{{end}}"> - <label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label> - <textarea id="description" name="description" maxlength="2048">{{.description}}</textarea> - </div> + </div> - <div class="inline field"> - <label></label> - <button class="ui primary button"> - {{ctx.Locale.Tr "repo.migrate_repo"}} - </button> + <div class="inline required field {{if .Err_RepoName}}error{{end}}"> + <label for="repo_name">{{ctx.Locale.Tr "repo.repo_name"}}</label> + <input id="repo_name" name="repo_name" value="{{.repo_name}}" required maxlength="100"> + </div> + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.visibility"}}</label> + <div class="ui checkbox"> + {{if .IsForcedPrivate}} + <input name="private" type="checkbox" checked disabled> + <label>{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</label> + {{else}} + <input name="private" type="checkbox" {{if .private}} checked{{end}}> + <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> + {{end}} </div> </div> + <div class="inline field {{if .Err_Description}}error{{end}}"> + <label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label> + <textarea id="description" name="description" maxlength="2048">{{.description}}</textarea> + </div> + + <div class="inline field"> + <label></label> + <button class="ui primary button"> + {{ctx.Locale.Tr "repo.migrate_repo"}} + </button> + </div> </form> </div> </div> diff --git a/templates/repo/migrate/github.tmpl b/templates/repo/migrate/github.tmpl index 3535eddfc2..86b585b861 100644 --- a/templates/repo/migrate/github.tmpl +++ b/templates/repo/migrate/github.tmpl @@ -1,128 +1,128 @@ {{template "base/head" .}} <div role="main" aria-label="{{.Title}}" class="page-content repository new migrate"> - <div class="ui middle very relaxed page grid"> - <div class="column"> - <form class="ui form" action="{{.Link}}" method="post"> + <div class="ui container medium-width"> + <h3 class="ui top attached header"> + {{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}} + </h3> + <div class="ui attached segment"> + {{template "base/alert" .}} + <form class="ui form left-right-form" action="{{.Link}}" method="post"> {{.CsrfTokenHtml}} - <h3 class="ui top attached header"> - {{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}} - <input id="service_type" type="hidden" name="service" value="{{.service}}"> - </h3> - <div class="ui attached segment"> - {{template "base/alert" .}} - <div class="inline required field {{if .Err_CloneAddr}}error{{end}}"> - <label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label> - <input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required> - <span class="help"> - {{ctx.Locale.Tr "repo.migrate.clone_address_desc"}} - </span> - </div> - <div class="inline field {{if .Err_Auth}}error{{end}}"> - <label for="auth_token">{{ctx.Locale.Tr "access_token"}}</label> - <input id="auth_token" name="auth_token" type="password" autocomplete="new-password" value="{{.auth_token}}" {{if not .auth_token}}data-need-clear="true"{{end}}> - <a target="_blank" href="https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token">{{svg "octicon-question"}}</a> - <span class="help"> - {{ctx.Locale.Tr "repo.migrate.github_token_desc"}} - </span> - </div> + <input id="service_type" type="hidden" name="service" value="{{.service}}"> - {{template "repo/migrate/options" .}} + <div class="inline required field {{if .Err_CloneAddr}}error{{end}}"> + <label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label> + <input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required> + <span class="help"> + {{ctx.Locale.Tr "repo.migrate.clone_address_desc"}} + </span> + </div> + <div class="inline field {{if .Err_Auth}}error{{end}}"> + <label for="auth_token">{{ctx.Locale.Tr "access_token"}}</label> + <input id="auth_token" name="auth_token" type="password" autocomplete="new-password" value="{{.auth_token}}" {{if not .auth_token}}data-need-clear="true"{{end}}> + <a target="_blank" href="https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token">{{svg "octicon-question"}}</a> + <span class="help"> + {{ctx.Locale.Tr "repo.migrate.github_token_desc"}} + </span> + </div> + + {{template "repo/migrate/options" .}} + + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.migrate_items"}}</label> + <div class="ui checkbox"> + <input name="wiki" type="checkbox" {{if .wiki}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_wiki"}}</label> + </div> + </div> + <div id="migrate_items" class="inline field"> + <span class="help">{{ctx.Locale.Tr "repo.migrate.migrate_items_options"}}</span> <div class="inline field"> - <label>{{ctx.Locale.Tr "repo.migrate_items"}}</label> + <label></label> <div class="ui checkbox"> - <input name="wiki" type="checkbox" {{if .wiki}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_wiki"}}</label> + <input name="labels" type="checkbox" {{if .labels}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_labels"}}</label> + </div> + <div class="ui checkbox"> + <input name="issues" type="checkbox" {{if .issues}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_issues"}}</label> </div> </div> - <div id="migrate_items"> - <span class="help">{{ctx.Locale.Tr "repo.migrate.migrate_items_options"}}</span> - <div class="inline field"> - <label></label> - <div class="ui checkbox"> - <input name="labels" type="checkbox" {{if .labels}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_labels"}}</label> - </div> - <div class="ui checkbox"> - <input name="issues" type="checkbox" {{if .issues}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_issues"}}</label> - </div> + <div class="inline field"> + <label></label> + <div class="ui checkbox"> + <input name="pull_requests" type="checkbox" {{if .pull_requests}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_pullrequests"}}</label> </div> - <div class="inline field"> - <label></label> - <div class="ui checkbox"> - <input name="pull_requests" type="checkbox" {{if .pull_requests}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_pullrequests"}}</label> - </div> - <div class="ui checkbox"> - <input name="releases" type="checkbox" {{if .releases}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_releases"}}</label> - </div> + <div class="ui checkbox"> + <input name="releases" type="checkbox" {{if .releases}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_releases"}}</label> </div> - <div class="inline field"> - <label></label> - <div class="ui checkbox"> - <input name="milestones" type="checkbox" {{if .milestones}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_milestones"}}</label> - </div> + </div> + <div class="inline field"> + <label></label> + <div class="ui checkbox"> + <input name="milestones" type="checkbox" {{if .milestones}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_milestones"}}</label> </div> </div> + </div> - <div class="divider"></div> + <div class="divider"></div> - <div class="inline required field {{if .Err_Owner}}error{{end}}"> - <label>{{ctx.Locale.Tr "repo.owner"}}</label> - <div class="ui selection owner dropdown"> - <input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required> - <span class="text truncated-item-container" title="{{.ContextUser.Name}}"> - {{ctx.AvatarUtils.Avatar .ContextUser 28 "mini"}} - <span class="truncated-item-name">{{.ContextUser.ShortName 40}}</span> - </span> - {{svg "octicon-triangle-down" 14 "dropdown icon"}} - <div class="menu" title="{{.SignedUser.Name}}"> - <div class="item truncated-item-container" data-value="{{.SignedUser.ID}}"> - {{ctx.AvatarUtils.Avatar .SignedUser 28 "mini"}} - <span class="truncated-item-name">{{.SignedUser.ShortName 40}}</span> - </div> - {{range .Orgs}} - <div class="item truncated-item-container" data-value="{{.ID}}" title="{{.Name}}"> - {{ctx.AvatarUtils.Avatar . 28 "mini"}} - <span class="truncated-item-name">{{.ShortName 40}}</span> - </div> - {{end}} + <div class="inline required field {{if .Err_Owner}}error{{end}}"> + <label>{{ctx.Locale.Tr "repo.owner"}}</label> + <div class="ui selection owner dropdown ellipsis-text-items"> + <input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required> + <span class="text" title="{{.ContextUser.Name}}"> + {{ctx.AvatarUtils.Avatar .ContextUser 28 "mini"}} + {{.ContextUser.ShortName 40}} + </span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu" title="{{.SignedUser.Name}}"> + <div class="item" data-value="{{.SignedUser.ID}}"> + {{ctx.AvatarUtils.Avatar .SignedUser 28 "mini"}} + {{.SignedUser.ShortName 40}} </div> - </div> - </div> - - <div class="inline required field {{if .Err_RepoName}}error{{end}}"> - <label for="repo_name">{{ctx.Locale.Tr "repo.repo_name"}}</label> - <input id="repo_name" name="repo_name" value="{{.repo_name}}" required maxlength="100"> - </div> - <div class="inline field"> - <label>{{ctx.Locale.Tr "repo.visibility"}}</label> - <div class="ui checkbox"> - {{if .IsForcedPrivate}} - <input name="private" type="checkbox" checked disabled> - <label>{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</label> - {{else}} - <input name="private" type="checkbox" {{if .private}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> + {{range .Orgs}} + <div class="item" data-value="{{.ID}}" title="{{.Name}}"> + {{ctx.AvatarUtils.Avatar . 28 "mini"}} + {{.ShortName 40}} + </div> {{end}} </div> </div> - <div class="inline field {{if .Err_Description}}error{{end}}"> - <label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label> - <textarea id="description" name="description" maxlength="2048">{{.description}}</textarea> - </div> + </div> - <div class="inline field"> - <label></label> - <button class="ui primary button"> - {{ctx.Locale.Tr "repo.migrate_repo"}} - </button> + <div class="inline required field {{if .Err_RepoName}}error{{end}}"> + <label for="repo_name">{{ctx.Locale.Tr "repo.repo_name"}}</label> + <input id="repo_name" name="repo_name" value="{{.repo_name}}" required maxlength="100"> + </div> + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.visibility"}}</label> + <div class="ui checkbox"> + {{if .IsForcedPrivate}} + <input name="private" type="checkbox" checked disabled> + <label>{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</label> + {{else}} + <input name="private" type="checkbox" {{if .private}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> + {{end}} </div> </div> + <div class="inline field {{if .Err_Description}}error{{end}}"> + <label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label> + <textarea id="description" name="description" maxlength="2048">{{.description}}</textarea> + </div> + + <div class="inline field"> + <label></label> + <button class="ui primary button"> + {{ctx.Locale.Tr "repo.migrate_repo"}} + </button> + </div> </form> </div> </div> diff --git a/templates/repo/migrate/gitlab.tmpl b/templates/repo/migrate/gitlab.tmpl index f705fb3090..edd69f0027 100644 --- a/templates/repo/migrate/gitlab.tmpl +++ b/templates/repo/migrate/gitlab.tmpl @@ -1,125 +1,125 @@ {{template "base/head" .}} <div role="main" aria-label="{{.Title}}" class="page-content repository new migrate"> - <div class="ui middle very relaxed page grid"> - <div class="column"> - <form class="ui form" action="{{.Link}}" method="post"> + <div class="ui container medium-width"> + <h3 class="ui top attached header"> + {{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}} + </h3> + <div class="ui attached segment"> + {{template "base/alert" .}} + <form class="ui form left-right-form" action="{{.Link}}" method="post"> {{.CsrfTokenHtml}} - <h3 class="ui top attached header"> - {{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}} - <input id="service_type" type="hidden" name="service" value="{{.service}}"> - </h3> - <div class="ui attached segment"> - {{template "base/alert" .}} - <div class="inline required field {{if .Err_CloneAddr}}error{{end}}"> - <label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label> - <input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required> - <span class="help"> - {{ctx.Locale.Tr "repo.migrate.clone_address_desc"}}{{if .ContextUser.CanImportLocal}} {{ctx.Locale.Tr "repo.migrate.clone_local_path"}}{{end}} - </span> - </div> - <div class="inline field {{if .Err_Auth}}error{{end}}"> - <label for="auth_token">{{ctx.Locale.Tr "access_token"}}</label> - <input id="auth_token" name="auth_token" type="password" autocomplete="new-password" value="{{.auth_token}}" {{if not .auth_token}}data-need-clear="true"{{end}}> - <a target="_blank" href="https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html">{{svg "octicon-question"}}</a> - </div> + <input id="service_type" type="hidden" name="service" value="{{.service}}"> - {{template "repo/migrate/options" .}} + <div class="inline required field {{if .Err_CloneAddr}}error{{end}}"> + <label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label> + <input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required> + <span class="help"> + {{ctx.Locale.Tr "repo.migrate.clone_address_desc"}}{{if .ContextUser.CanImportLocal}} {{ctx.Locale.Tr "repo.migrate.clone_local_path"}}{{end}} + </span> + </div> + + <div class="inline field {{if .Err_Auth}}error{{end}}"> + <label for="auth_token">{{ctx.Locale.Tr "access_token"}}</label> + <input id="auth_token" name="auth_token" type="password" autocomplete="new-password" value="{{.auth_token}}" {{if not .auth_token}}data-need-clear="true"{{end}}> + <a target="_blank" href="https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html">{{svg "octicon-question"}}</a> + </div> + {{template "repo/migrate/options" .}} + + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.migrate_items"}}</label> + <div class="ui checkbox"> + <input name="wiki" type="checkbox" {{if .wiki}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_wiki"}}</label> + </div> + </div> + <div id="migrate_items" class="inline field"> + <span class="help">{{ctx.Locale.Tr "repo.migrate.migrate_items_options"}}</span> <div class="inline field"> - <label>{{ctx.Locale.Tr "repo.migrate_items"}}</label> + <label></label> + <div class="ui checkbox"> + <input name="labels" type="checkbox" {{if .labels}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_labels"}}</label> + </div> <div class="ui checkbox"> - <input name="wiki" type="checkbox" {{if .wiki}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_wiki"}}</label> + <input name="issues" type="checkbox" {{if .issues}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_issues"}}</label> </div> </div> - <div id="migrate_items"> - <span class="help">{{ctx.Locale.Tr "repo.migrate.migrate_items_options"}}</span> - <div class="inline field"> - <label></label> - <div class="ui checkbox"> - <input name="labels" type="checkbox" {{if .labels}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_labels"}}</label> - </div> - <div class="ui checkbox"> - <input name="issues" type="checkbox" {{if .issues}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_issues"}}</label> - </div> + <div class="inline field"> + <label></label> + <div class="ui checkbox"> + <input name="pull_requests" type="checkbox" {{if .pull_requests}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_merge_requests"}}</label> </div> - <div class="inline field"> - <label></label> - <div class="ui checkbox"> - <input name="pull_requests" type="checkbox" {{if .pull_requests}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_merge_requests"}}</label> - </div> - <div class="ui checkbox"> - <input name="releases" type="checkbox" {{if .releases}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_releases"}}</label> - </div> + <div class="ui checkbox"> + <input name="releases" type="checkbox" {{if .releases}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_releases"}}</label> </div> - <div class="inline field"> - <label></label> - <div class="ui checkbox"> - <input name="milestones" type="checkbox" {{if .milestones}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_milestones"}}</label> - </div> + </div> + <div class="inline field"> + <label></label> + <div class="ui checkbox"> + <input name="milestones" type="checkbox" {{if .milestones}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_milestones"}}</label> </div> </div> + </div> - <div class="divider"></div> + <div class="divider"></div> - <div class="inline required field {{if .Err_Owner}}error{{end}}"> - <label>{{ctx.Locale.Tr "repo.owner"}}</label> - <div class="ui selection owner dropdown"> - <input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required> - <span class="text truncated-item-container" title="{{.ContextUser.Name}}"> - {{ctx.AvatarUtils.Avatar .ContextUser 28 "mini"}} - <span class="truncated-item-name">{{.ContextUser.ShortName 40}}</span> - </span> - {{svg "octicon-triangle-down" 14 "dropdown icon"}} - <div class="menu" title="{{.SignedUser.Name}}"> - <div class="item truncated-item-container" data-value="{{.SignedUser.ID}}"> - {{ctx.AvatarUtils.Avatar .SignedUser 28 "mini"}} - <span class="truncated-item-name">{{.SignedUser.ShortName 40}}</span> - </div> - {{range .Orgs}} - <div class="item truncated-item-container" data-value="{{.ID}}" title="{{.Name}}"> - {{ctx.AvatarUtils.Avatar . 28 "mini"}} - <span class="truncated-item-name">{{.ShortName 40}}</span> - </div> - {{end}} + <div class="inline required field {{if .Err_Owner}}error{{end}}"> + <label>{{ctx.Locale.Tr "repo.owner"}}</label> + <div class="ui selection owner dropdown ellipsis-text-items"> + <input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required> + <span class="text" title="{{.ContextUser.Name}}"> + {{ctx.AvatarUtils.Avatar .ContextUser 28 "mini"}} + {{.ContextUser.ShortName 40}} + </span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu" title="{{.SignedUser.Name}}"> + <div class="item" data-value="{{.SignedUser.ID}}"> + {{ctx.AvatarUtils.Avatar .SignedUser 28 "mini"}} + {{.SignedUser.ShortName 40}} </div> - </div> - </div> - - <div class="inline required field {{if .Err_RepoName}}error{{end}}"> - <label for="repo_name">{{ctx.Locale.Tr "repo.repo_name"}}</label> - <input id="repo_name" name="repo_name" value="{{.repo_name}}" required maxlength="100"> - </div> - <div class="inline field"> - <label>{{ctx.Locale.Tr "repo.visibility"}}</label> - <div class="ui checkbox"> - {{if .IsForcedPrivate}} - <input name="private" type="checkbox" checked disabled> - <label>{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</label> - {{else}} - <input name="private" type="checkbox" {{if .private}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> + {{range .Orgs}} + <div class="item" data-value="{{.ID}}" title="{{.Name}}"> + {{ctx.AvatarUtils.Avatar . 28 "mini"}} + {{.ShortName 40}} + </div> {{end}} </div> </div> - <div class="inline field {{if .Err_Description}}error{{end}}"> - <label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label> - <textarea id="description" name="description" maxlength="2048">{{.description}}</textarea> - </div> + </div> - <div class="inline field"> - <label></label> - <button class="ui primary button"> - {{ctx.Locale.Tr "repo.migrate_repo"}} - </button> + <div class="inline required field {{if .Err_RepoName}}error{{end}}"> + <label for="repo_name">{{ctx.Locale.Tr "repo.repo_name"}}</label> + <input id="repo_name" name="repo_name" value="{{.repo_name}}" required maxlength="100"> + </div> + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.visibility"}}</label> + <div class="ui checkbox"> + {{if .IsForcedPrivate}} + <input name="private" type="checkbox" checked disabled> + <label>{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</label> + {{else}} + <input name="private" type="checkbox" {{if .private}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> + {{end}} </div> </div> + <div class="inline field {{if .Err_Description}}error{{end}}"> + <label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label> + <textarea id="description" name="description" maxlength="2048">{{.description}}</textarea> + </div> + + <div class="inline field"> + <label></label> + <button class="ui primary button"> + {{ctx.Locale.Tr "repo.migrate_repo"}} + </button> + </div> </form> </div> </div> diff --git a/templates/repo/migrate/gogs.tmpl b/templates/repo/migrate/gogs.tmpl index eca83b1636..9149c43239 100644 --- a/templates/repo/migrate/gogs.tmpl +++ b/templates/repo/migrate/gogs.tmpl @@ -1,128 +1,128 @@ {{template "base/head" .}} <div role="main" aria-label="{{.Title}}" class="page-content repository new migrate"> - <div class="ui middle very relaxed page grid"> - <div class="column"> - <form class="ui form" action="{{.Link}}" method="post"> + <div class="ui container medium-width"> + <h3 class="ui top attached header"> + {{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}} + </h3> + <div class="ui attached segment"> + {{template "base/alert" .}} + <form class="ui form left-right-form" action="{{.Link}}" method="post"> {{.CsrfTokenHtml}} - <h3 class="ui top attached header"> - {{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}} - <input id="service_type" type="hidden" name="service" value="{{.service}}"> - </h3> - <div class="ui attached segment"> - {{template "base/alert" .}} - <div class="inline required field {{if .Err_CloneAddr}}error{{end}}"> - <label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label> - <input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required> - <span class="help"> - {{ctx.Locale.Tr "repo.migrate.clone_address_desc"}}{{if .ContextUser.CanImportLocal}} {{ctx.Locale.Tr "repo.migrate.clone_local_path"}}{{end}} - </span> - </div> - <div class="inline field {{if .Err_Auth}}error{{end}}"> - <label for="auth_token">{{ctx.Locale.Tr "access_token"}}</label> - <input id="auth_token" name="auth_token" type="password" autocomplete="new-password" value="{{.auth_token}}" {{if not .auth_token}} data-need-clear="true" {{end}}> - <!-- <a target="_blank" href="https://docs.gitea.com/development/api-usage">{{svg "octicon-question"}}</a> --> - </div> + <input id="service_type" type="hidden" name="service" value="{{.service}}"> - {{template "repo/migrate/options" .}} + <div class="inline required field {{if .Err_CloneAddr}}error{{end}}"> + <label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label> + <input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required> + <span class="help"> + {{ctx.Locale.Tr "repo.migrate.clone_address_desc"}}{{if .ContextUser.CanImportLocal}} {{ctx.Locale.Tr "repo.migrate.clone_local_path"}}{{end}} + </span> + </div> + + <div class="inline field {{if .Err_Auth}}error{{end}}"> + <label for="auth_token">{{ctx.Locale.Tr "access_token"}}</label> + <input id="auth_token" name="auth_token" type="password" autocomplete="new-password" value="{{.auth_token}}" {{if not .auth_token}} data-need-clear="true" {{end}}> + <!-- <a target="_blank" href="https://docs.gitea.com/development/api-usage">{{svg "octicon-question"}}</a> --> + </div> + {{template "repo/migrate/options" .}} + + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.migrate_items"}}</label> + <div class="ui checkbox"> + <input name="wiki" type="checkbox" {{if .wiki}} checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_wiki"}}</label> + </div> + </div> + + <div id="migrate_items" class="inline field"> + <span class="help">{{ctx.Locale.Tr "repo.migrate.migrate_items_options"}}</span> <div class="inline field"> - <label>{{ctx.Locale.Tr "repo.migrate_items"}}</label> + <label></label> <div class="ui checkbox"> - <input name="wiki" type="checkbox" {{if .wiki}} checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_wiki"}}</label> + <input name="labels" type="checkbox" {{if .labels}} checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_labels"}}</label> + </div> + <div class="ui checkbox"> + <input name="issues" type="checkbox" {{if .issues}} checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_issues"}}</label> </div> </div> - - <div id="migrate_items"> - <span class="help">{{ctx.Locale.Tr "repo.migrate.migrate_items_options"}}</span> - <div class="inline field"> - <label></label> - <div class="ui checkbox"> - <input name="labels" type="checkbox" {{if .labels}} checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_labels"}}</label> - </div> - <div class="ui checkbox"> - <input name="issues" type="checkbox" {{if .issues}} checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_issues"}}</label> - </div> + <div class="inline field"> + <label></label> + <div class="ui checkbox"> + <input name="milestones" type="checkbox" {{if .milestones}} checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_milestones"}}</label> </div> - <div class="inline field"> - <label></label> - <div class="ui checkbox"> - <input name="milestones" type="checkbox" {{if .milestones}} checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_milestones"}}</label> - </div> + </div> + <!-- Gogs do not support it + <div class="inline field"> + <label></label> + <div class="ui checkbox"> + <input name="pull_requests" type="checkbox" {{if .pull_requests}} checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_merge_requests"}}</label> </div> - <!-- Gogs do not support it - <div class="inline field"> - <label></label> - <div class="ui checkbox"> - <input name="pull_requests" type="checkbox" {{if .pull_requests}} checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_merge_requests"}}</label> - </div> - <div class="ui checkbox"> - <input name="releases" type="checkbox" {{if .releases}} checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_releases"}}</label> - </div> + <div class="ui checkbox"> + <input name="releases" type="checkbox" {{if .releases}} checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_releases"}}</label> </div> - --> </div> + --> + </div> - <div class="divider"></div> + <div class="divider"></div> - <div class="inline required field {{if .Err_Owner}}error{{end}}"> - <label>{{ctx.Locale.Tr "repo.owner"}}</label> - <div class="ui selection owner dropdown"> - <input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required> - <span class="text truncated-item-container" title="{{.ContextUser.Name}}"> - {{ctx.AvatarUtils.Avatar .ContextUser}} - <span class="truncated-item-name">{{.ContextUser.ShortName 40}}</span> - </span> - {{svg "octicon-triangle-down" 14 "dropdown icon"}} - <div class="menu" title="{{.SignedUser.Name}}"> - <div class="item truncated-item-container" data-value="{{.SignedUser.ID}}"> - {{ctx.AvatarUtils.Avatar .SignedUser}} - <span class="truncated-item-name">{{.SignedUser.ShortName 40}}</span> - </div> - {{range .Orgs}} - <div class="item truncated-item-container" data-value="{{.ID}}" title="{{.Name}}"> - {{ctx.AvatarUtils.Avatar .}} - <span class="truncated-item-name">{{.ShortName 40}}</span> - </div> - {{end}} + <div class="inline required field {{if .Err_Owner}}error{{end}}"> + <label>{{ctx.Locale.Tr "repo.owner"}}</label> + <div class="ui selection owner dropdown ellipsis-text-items"> + <input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required> + <span class="text" title="{{.ContextUser.Name}}"> + {{ctx.AvatarUtils.Avatar .ContextUser}} + {{.ContextUser.ShortName 40}} + </span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu" title="{{.SignedUser.Name}}"> + <div class="item" data-value="{{.SignedUser.ID}}"> + {{ctx.AvatarUtils.Avatar .SignedUser}} + {{.SignedUser.ShortName 40}} + </div> + {{range .Orgs}} + <div class="item" data-value="{{.ID}}" title="{{.Name}}"> + {{ctx.AvatarUtils.Avatar .}} + {{.ShortName 40}} </div> - </div> - </div> - - <div class="inline required field {{if .Err_RepoName}}error{{end}}"> - <label for="repo_name">{{ctx.Locale.Tr "repo.repo_name"}}</label> - <input id="repo_name" name="repo_name" value="{{.repo_name}}" required maxlength="100"> - </div> - <div class="inline field"> - <label>{{ctx.Locale.Tr "repo.visibility"}}</label> - <div class="ui checkbox"> - {{if .IsForcedPrivate}} - <input name="private" type="checkbox" checked disabled> - <label>{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</label> - {{else}} - <input name="private" type="checkbox" {{if .private}} checked{{end}}> - <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> {{end}} </div> </div> - <div class="inline field {{if .Err_Description}}error{{end}}"> - <label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label> - <textarea id="description" name="description" maxlength="2048">{{.description}}</textarea> - </div> + </div> - <div class="inline field"> - <label></label> - <button class="ui primary button"> - {{ctx.Locale.Tr "repo.migrate_repo"}} - </button> + <div class="inline required field {{if .Err_RepoName}}error{{end}}"> + <label for="repo_name">{{ctx.Locale.Tr "repo.repo_name"}}</label> + <input id="repo_name" name="repo_name" value="{{.repo_name}}" required maxlength="100"> + </div> + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.visibility"}}</label> + <div class="ui checkbox"> + {{if .IsForcedPrivate}} + <input name="private" type="checkbox" checked disabled> + <label>{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</label> + {{else}} + <input name="private" type="checkbox" {{if .private}} checked{{end}}> + <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> + {{end}} </div> </div> + <div class="inline field {{if .Err_Description}}error{{end}}"> + <label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label> + <textarea id="description" name="description" maxlength="2048">{{.description}}</textarea> + </div> + + <div class="inline field"> + <label></label> + <button class="ui primary button"> + {{ctx.Locale.Tr "repo.migrate_repo"}} + </button> + </div> </form> </div> </div> diff --git a/templates/repo/migrate/migrate.tmpl b/templates/repo/migrate/migrate.tmpl index c5c697edff..79ac5cc8a1 100644 --- a/templates/repo/migrate/migrate.tmpl +++ b/templates/repo/migrate/migrate.tmpl @@ -19,7 +19,7 @@ <div class="header tw-text-center"> {{.Title}} </div> - <div class="description tw-text-center"> + <div class="description tw-text-center tw-text-balance"> {{ctx.Locale.Tr (printf "repo.migrate.%s.description" .Name)}} </div> </div> diff --git a/templates/repo/migrate/migrating.tmpl b/templates/repo/migrate/migrating.tmpl index bc07b488f2..e73e3a9790 100644 --- a/templates/repo/migrate/migrating.tmpl +++ b/templates/repo/migrate/migrating.tmpl @@ -7,19 +7,19 @@ {{template "base/alert" .}} <div class="home"> <div class="ui stackable middle very relaxed page grid"> - <div id="repo_migrating" class="sixteen wide center aligned centered column" data-migrating-repo-link="{{.Link}}"> + <div id="repo_migrating" class="sixteen wide tw-text-center centered column" data-migrating-repo-link="{{.Link}}"> <div> - <img src="{{AssetUrlPrefix}}/img/loading.png"> + <img alt src="{{AssetUrlPrefix}}/img/loading.png"> </div> </div> - <div id="repo_migrating_failed_image" class="sixteen wide center aligned centered column tw-hidden"> + <div id="repo_migrating_failed_image" class="sixteen wide tw-text-center centered column tw-hidden"> <div> - <img src="{{AssetUrlPrefix}}/img/failed.png"> + <img alt src="{{AssetUrlPrefix}}/img/failed.png"> </div> </div> </div> <div class="ui stackable middle very relaxed page grid"> - <div class="sixteen wide center aligned centered column"> + <div class="sixteen wide tw-text-center centered column"> <div id="repo_migrating_progress"> <p>{{ctx.Locale.Tr "repo.migrate.migrating" .CloneAddr}}</p> <p id="repo_migrating_progress_message"></p> @@ -77,7 +77,7 @@ <input id="repo_name_to_delete" name="repo_name" required> </div> - <div class="text right actions"> + <div class="actions"> <button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button> <button class="ui red button">{{ctx.Locale.Tr "repo.settings.confirm_delete"}}</button> </div> diff --git a/templates/repo/migrate/onedev.tmpl b/templates/repo/migrate/onedev.tmpl index e1aad96ba4..a25ccf9438 100644 --- a/templates/repo/migrate/onedev.tmpl +++ b/templates/repo/migrate/onedev.tmpl @@ -1,114 +1,115 @@ {{template "base/head" .}} <div role="main" aria-label="{{.Title}}" class="page-content repository new migrate"> - <div class="ui middle very relaxed page grid"> - <div class="column"> - <form class="ui form" action="{{.Link}}" method="post"> + <div class="ui container medium-width"> + <h3 class="ui top attached header"> + {{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}} + </h3> + <div class="ui attached segment"> + {{template "base/alert" .}} + <form class="ui form left-right-form" action="{{.Link}}" method="post"> {{template "base/disable_form_autofill"}} {{.CsrfTokenHtml}} - <h3 class="ui top attached header"> - {{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}} - <input id="service_type" type="hidden" name="service" value="{{.service}}"> - </h3> - <div class="ui attached segment"> - {{template "base/alert" .}} - <div class="inline required field {{if .Err_CloneAddr}}error{{end}}"> - <label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label> - <input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required> - <span class="help"> - {{ctx.Locale.Tr "repo.migrate.clone_address_desc"}}{{if .ContextUser.CanImportLocal}} {{ctx.Locale.Tr "repo.migrate.clone_local_path"}}{{end}} - </span> - </div> - <div class="inline field {{if .Err_Auth}}error{{end}}"> - <label for="auth_username">{{ctx.Locale.Tr "username"}}</label> - <input id="auth_username" name="auth_username" value="{{.auth_username}}" {{if not .auth_username}}data-need-clear="true"{{end}}> - </div> - <div class="inline field {{if .Err_Auth}}error{{end}}"> - <label for="auth_password">{{ctx.Locale.Tr "password"}}</label> - <input id="auth_password" name="auth_password" type="password" value="{{.auth_password}}"> - </div> + <input id="service_type" type="hidden" name="service" value="{{.service}}"> - {{template "repo/migrate/options" .}} + <div class="inline required field {{if .Err_CloneAddr}}error{{end}}"> + <label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label> + <input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required> + <span class="help"> + {{ctx.Locale.Tr "repo.migrate.clone_address_desc"}}{{if .ContextUser.CanImportLocal}} {{ctx.Locale.Tr "repo.migrate.clone_local_path"}}{{end}} + </span> + </div> - <div id="migrate_items"> - <div class="inline field"> - <label>{{ctx.Locale.Tr "repo.migrate_items"}}</label> - <div class="ui checkbox"> - <input name="milestones" type="checkbox" {{if .milestones}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_milestones"}}</label> - </div> - <div class="ui checkbox"> - <input name="labels" type="checkbox" {{if .labels}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_labels"}}</label> - </div> - </div> - <div class="inline field"> - <label></label> - <div class="ui checkbox"> - <input name="issues" type="checkbox" {{if .issues}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_issues"}}</label> - </div> - <div class="ui checkbox"> - <input name="pull_requests" type="checkbox" {{if .pull_requests}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_pullrequests"}}</label> - </div> - </div> - </div> + <div class="inline field {{if .Err_Auth}}error{{end}}"> + <label for="auth_username">{{ctx.Locale.Tr "username"}}</label> + <input id="auth_username" name="auth_username" value="{{.auth_username}}" {{if not .auth_username}}data-need-clear="true"{{end}}> + </div> + <div class="inline field {{if .Err_Auth}}error{{end}}"> + <label for="auth_password">{{ctx.Locale.Tr "password"}}</label> + <input id="auth_password" name="auth_password" type="password" value="{{.auth_password}}"> + </div> - <div class="divider"></div> + {{template "repo/migrate/options" .}} - <div class="inline required field {{if .Err_Owner}}error{{end}}"> - <label>{{ctx.Locale.Tr "repo.owner"}}</label> - <div class="ui selection owner dropdown"> - <input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required> - <span class="text truncated-item-container" title="{{.ContextUser.Name}}"> - {{ctx.AvatarUtils.Avatar .ContextUser 28 "mini"}} - <span class="truncated-item-name">{{.ContextUser.ShortName 40}}</span> - </span> - {{svg "octicon-triangle-down" 14 "dropdown icon"}} - <div class="menu" title="{{.SignedUser.Name}}"> - <div class="item truncated-item-container" data-value="{{.SignedUser.ID}}"> - {{ctx.AvatarUtils.Avatar .SignedUser 28 "mini"}} - <span class="truncated-item-name">{{.SignedUser.ShortName 40}}</span> - </div> - {{range .Orgs}} - <div class="item truncated-item-container" data-value="{{.ID}}" title="{{.Name}}"> - {{ctx.AvatarUtils.Avatar . 28 "mini"}} - <span class="truncated-item-name">{{.ShortName 40}}</span> - </div> - {{end}} - </div> + <div id="migrate_items" class="inline field"> + <label></label> + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.migrate_items"}}</label> + <div class="ui checkbox"> + <input name="milestones" type="checkbox" {{if .milestones}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_milestones"}}</label> + </div> + <div class="ui checkbox"> + <input name="labels" type="checkbox" {{if .labels}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_labels"}}</label> </div> - </div> - - <div class="inline required field {{if .Err_RepoName}}error{{end}}"> - <label for="repo_name">{{ctx.Locale.Tr "repo.repo_name"}}</label> - <input id="repo_name" name="repo_name" value="{{.repo_name}}" required maxlength="100"> </div> <div class="inline field"> - <label>{{ctx.Locale.Tr "repo.visibility"}}</label> + <label></label> <div class="ui checkbox"> - {{if .IsForcedPrivate}} - <input name="private" type="checkbox" checked disabled> - <label>{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</label> - {{else}} - <input name="private" type="checkbox" {{if .private}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> - {{end}} + <input name="issues" type="checkbox" {{if .issues}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_issues"}}</label> + </div> + <div class="ui checkbox"> + <input name="pull_requests" type="checkbox" {{if .pull_requests}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_pullrequests"}}</label> </div> </div> - <div class="inline field {{if .Err_Description}}error{{end}}"> - <label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label> - <textarea id="description" name="description" maxlength="2048">{{.description}}</textarea> + </div> + + <div class="divider"></div> + + <div class="inline required field {{if .Err_Owner}}error{{end}}"> + <label>{{ctx.Locale.Tr "repo.owner"}}</label> + <div class="ui selection owner dropdown ellipsis-text-items"> + <input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required> + <span class="text" title="{{.ContextUser.Name}}"> + {{ctx.AvatarUtils.Avatar .ContextUser 28 "mini"}} + {{.ContextUser.ShortName 40}} + </span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu" title="{{.SignedUser.Name}}"> + <div class="item" data-value="{{.SignedUser.ID}}"> + {{ctx.AvatarUtils.Avatar .SignedUser 28 "mini"}} + {{.SignedUser.ShortName 40}} + </div> + {{range .Orgs}} + <div class="item" data-value="{{.ID}}" title="{{.Name}}"> + {{ctx.AvatarUtils.Avatar . 28 "mini"}} + {{.ShortName 40}} + </div> + {{end}} + </div> </div> + </div> - <div class="inline field"> - <label></label> - <button class="ui primary button"> - {{ctx.Locale.Tr "repo.migrate_repo"}} - </button> + <div class="inline required field {{if .Err_RepoName}}error{{end}}"> + <label for="repo_name">{{ctx.Locale.Tr "repo.repo_name"}}</label> + <input id="repo_name" name="repo_name" value="{{.repo_name}}" required maxlength="100"> + </div> + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.visibility"}}</label> + <div class="ui checkbox"> + {{if .IsForcedPrivate}} + <input name="private" type="checkbox" checked disabled> + <label>{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</label> + {{else}} + <input name="private" type="checkbox" {{if .private}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> + {{end}} </div> </div> + <div class="inline field {{if .Err_Description}}error{{end}}"> + <label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label> + <textarea id="description" name="description" maxlength="2048">{{.description}}</textarea> + </div> + + <div class="inline field"> + <label></label> + <button class="ui primary button"> + {{ctx.Locale.Tr "repo.migrate_repo"}} + </button> + </div> </form> </div> </div> diff --git a/templates/repo/navbar.tmpl b/templates/repo/navbar.tmpl index b2471dc17e..e004c5254b 100644 --- a/templates/repo/navbar.tmpl +++ b/templates/repo/navbar.tmpl @@ -1,14 +1,19 @@ +{{$canReadCode := $.Permission.CanRead ctx.Consts.RepoUnitTypeCode}} + <div class="ui fluid vertical menu"> + {{/* the default activity page "pulse" could work with any permission: code, issue, pr, release*/}} <a class="{{if .PageIsPulse}}active {{end}}item" href="{{.RepoLink}}/activity"> {{ctx.Locale.Tr "repo.activity.navbar.pulse"}} </a> - <a class="{{if .PageIsContributors}}active {{end}}item" href="{{.RepoLink}}/activity/contributors"> - {{ctx.Locale.Tr "repo.activity.navbar.contributors"}} - </a> - <a class="{{if .PageIsCodeFrequency}}active{{end}} item" href="{{.RepoLink}}/activity/code-frequency"> - {{ctx.Locale.Tr "repo.activity.navbar.code_frequency"}} - </a> - <a class="{{if .PageIsRecentCommits}}active{{end}} item" href="{{.RepoLink}}/activity/recent-commits"> - {{ctx.Locale.Tr "repo.activity.navbar.recent_commits"}} - </a> + {{if $canReadCode}} + <a class="{{if .PageIsContributors}}active {{end}}item" href="{{.RepoLink}}/activity/contributors"> + {{ctx.Locale.Tr "repo.activity.navbar.contributors"}} + </a> + <a class="{{if .PageIsCodeFrequency}}active{{end}} item" href="{{.RepoLink}}/activity/code-frequency"> + {{ctx.Locale.Tr "repo.activity.navbar.code_frequency"}} + </a> + <a class="{{if .PageIsRecentCommits}}active{{end}} item" href="{{.RepoLink}}/activity/recent-commits"> + {{ctx.Locale.Tr "repo.activity.navbar.recent_commits"}} + </a> + {{end}} </div> diff --git a/templates/repo/projects/view.tmpl b/templates/repo/projects/view.tmpl index 05ad7264bf..1acaaf8b4b 100644 --- a/templates/repo/projects/view.tmpl +++ b/templates/repo/projects/view.tmpl @@ -2,14 +2,13 @@ <div role="main" aria-label="{{.Title}}" class="page-content repository projects view-project"> {{template "repo/header" .}} <div class="ui container padded"> - <div class="tw-flex tw-justify-between tw-items-center tw-mb-4"> - {{template "repo/issue/navbar" .}} + <div class="flex-text-block tw-justify-end tw-mb-4"> + <a class="ui small button" href="{{.RepoLink}}/labels">{{ctx.Locale.Tr "repo.labels"}}</a> + <a class="ui small button" href="{{.RepoLink}}/milestones">{{ctx.Locale.Tr "repo.milestones"}}</a> <a class="ui small primary button" href="{{.RepoLink}}/issues/new/choose?project={{.Project.ID}}">{{ctx.Locale.Tr "repo.issues.new"}}</a> </div> </div> - <div class="ui container fluid padded"> - {{template "projects/view" .}} - </div> + {{template "projects/view" .}} </div> {{template "base/footer" .}} diff --git a/templates/repo/pulls/fork.tmpl b/templates/repo/pulls/fork.tmpl index 7af535f1d3..0d775ed6a0 100644 --- a/templates/repo/pulls/fork.tmpl +++ b/templates/repo/pulls/fork.tmpl @@ -1,85 +1,83 @@ {{template "base/head" .}} <div role="main" aria-label="{{.Title}}" class="page-content repository new fork"> - <div class="ui middle very relaxed page grid"> - <div class="column"> - <form class="ui form" action="{{.Link}}" method="post"> + <div class="ui container medium-width"> + <h3 class="ui top attached header"> + {{ctx.Locale.Tr "new_fork"}} + </h3> + <div class="ui attached segment"> + {{template "base/alert" .}} + <form class="ui form form-fetch-action left-right-form" action="{{.Link}}" method="post"> {{.CsrfTokenHtml}} - <h3 class="ui top attached header"> - {{ctx.Locale.Tr "new_fork"}} - </h3> - <div class="ui attached segment"> - {{template "base/alert" .}} - <div class="inline required field {{if .Err_Owner}}error{{end}}"> - <label>{{ctx.Locale.Tr "repo.owner"}}</label> - <div class="ui selection owner dropdown"> - <input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required> - <span class="text truncated-item-container" title="{{.ContextUser.Name}}"> - {{ctx.AvatarUtils.Avatar .ContextUser 28 "mini"}} - <span class="truncated-item-name">{{.ContextUser.ShortName 40}}</span> - </span> - {{svg "octicon-triangle-down" 14 "dropdown icon"}} - <div class="menu"> - {{if .CanForkToUser}} - <div class="item truncated-item-container" data-value="{{.SignedUser.ID}}" title="{{.SignedUser.Name}}"> - {{ctx.AvatarUtils.Avatar .SignedUser 28 "mini"}} - <span class="truncated-item-name">{{.SignedUser.ShortName 40}}</span> - </div> - {{end}} - {{range .Orgs}} - <div class="item truncated-item-container" data-value="{{.ID}}" title="{{.Name}}"> - {{ctx.AvatarUtils.Avatar . 28 "mini"}} - <span class="truncated-item-name">{{.ShortName 40}}</span> - </div> - {{end}} - </div> + <div class="inline required field {{if .Err_Owner}}error{{end}}"> + <label>{{ctx.Locale.Tr "repo.owner"}}</label> + <div class="ui selection owner dropdown ellipsis-text-items"> + <input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required> + <span class="text" title="{{.ContextUser.Name}}"> + {{ctx.AvatarUtils.Avatar .ContextUser 28 "mini"}} + {{.ContextUser.ShortName 40}} + </span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + {{if .CanForkToUser}} + <div class="item" data-value="{{.SignedUser.ID}}" title="{{.SignedUser.Name}}"> + {{ctx.AvatarUtils.Avatar .SignedUser 28 "mini"}} + {{.SignedUser.ShortName 40}} + </div> + {{end}} + {{range .Orgs}} + <div class="item" data-value="{{.ID}}" title="{{.Name}}"> + {{ctx.AvatarUtils.Avatar . 28 "mini"}} + {{.ShortName 40}} + </div> + {{end}} </div> </div> + </div> - <div class="inline field"> - <label>{{ctx.Locale.Tr "repo.fork_from"}}</label> - <a href="{{.ForkRepo.Link}}" class="tw-inline-block">{{.ForkRepo.FullName}}</a> - </div> - <div class="inline required field {{if .Err_RepoName}}error{{end}}"> - <label for="repo_name">{{ctx.Locale.Tr "repo.repo_name"}}</label> - <input id="repo_name" name="repo_name" value="{{.repo_name}}" required> + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.fork_from"}}</label> + <a href="{{.ForkRepo.Link}}" class="tw-inline-block">{{.ForkRepo.FullName}}</a> + </div> + <div class="inline required field {{if .Err_RepoName}}error{{end}}"> + <label for="repo_name">{{ctx.Locale.Tr "repo.repo_name"}}</label> + <input id="repo_name" name="repo_name" value="{{.repo_name}}" required> + </div> + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.visibility"}}</label> + <div class="ui disabled checkbox"> + <input type="checkbox" disabled {{if .IsPrivate}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> </div> - <div class="inline field"> - <label>{{ctx.Locale.Tr "repo.visibility"}}</label> - <div class="ui disabled checkbox"> - <input type="checkbox" disabled {{if .IsPrivate}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> + <span class="help">{{ctx.Locale.Tr "repo.fork_visibility_helper"}}</span> + </div> + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.fork_branch"}}</label> + <div class="ui selection dropdown ellipsis-text-items"> + <input type="hidden" id="fork_single_branch" name="fork_single_branch" value="" required> + <div class="text" title="{{ctx.Locale.Tr "repo.all_branches"}}"> + {{ctx.Locale.Tr "repo.all_branches"}} </div> - <span class="help">{{ctx.Locale.Tr "repo.fork_visibility_helper"}}</span> - </div> - <div class="inline field"> - <label>{{ctx.Locale.Tr "repo.fork_branch"}}</label> - <div class="ui selection dropdown ellipsis-items-nowrap"> - <input type="hidden" id="fork_single_branch" name="fork_single_branch" value="" required> - <div class="text" title="{{ctx.Locale.Tr "repo.all_branches"}}"> - <span class="truncated-item-name">{{ctx.Locale.Tr "repo.all_branches"}}</span> - </div> - {{svg "octicon-triangle-down" 14 "dropdown icon"}} - <div class="menu"> - <div class="item" data-value="" title="{{ctx.Locale.Tr "repo.all_branches"}}"> - {{ctx.Locale.Tr "repo.all_branches"}} - </div> - {{range .Branches}} - <div class="item" data-value="{{.}}" title="{{.}}">{{.}}</div> - {{end}} + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + <div class="item" data-value="" title="{{ctx.Locale.Tr "repo.all_branches"}}"> + {{ctx.Locale.Tr "repo.all_branches"}} </div> + {{range .Branches}} + <div class="item" data-value="{{.}}" title="{{.}}">{{.}}</div> + {{end}} </div> </div> - <div class="inline field {{if .Err_Description}}error{{end}}"> - <label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label> - <textarea id="description" name="description">{{.description}}</textarea> - </div> + </div> + <div class="inline field {{if .Err_Description}}error{{end}}"> + <label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label> + <textarea id="description" name="description">{{.description}}</textarea> + </div> - <div class="inline field"> - <label></label> - <button class="ui primary button{{if not .CanForkRepo}} disabled{{end}}"> - {{ctx.Locale.Tr "repo.fork_repo"}} - </button> - </div> + <div class="inline field"> + <label></label> + <button class="ui primary button{{if not .CanForkRepoInNewOwner}} disabled{{end}}"> + {{ctx.Locale.Tr "repo.fork_repo"}} + </button> </div> </form> </div> diff --git a/templates/repo/pulls/tab_menu.tmpl b/templates/repo/pulls/tab_menu.tmpl index 8b192c44db..a0ecdf96cd 100644 --- a/templates/repo/pulls/tab_menu.tmpl +++ b/templates/repo/pulls/tab_menu.tmpl @@ -15,11 +15,11 @@ {{template "shared/misc/tabtitle" (ctx.Locale.Tr "repo.pulls.tab_files")}} <span class="ui small label">{{if .NumFiles}}{{.NumFiles}}{{else}}-{{end}}</span> </a> - {{if or .Diff.TotalAddition .Diff.TotalDeletion}} + {{if or .DiffShortStat.TotalAddition .DiffShortStat.TotalDeletion}} <span class="tw-ml-auto tw-pl-3 tw-whitespace-nowrap tw-pr-0 tw-font-bold tw-flex tw-items-center tw-gap-2"> - <span><span class="text green">{{if .Diff.TotalAddition}}+{{.Diff.TotalAddition}}{{end}}</span> <span class="text red">{{if .Diff.TotalDeletion}}-{{.Diff.TotalDeletion}}{{end}}</span></span> + <span><span class="text green">{{if .DiffShortStat.TotalAddition}}+{{.DiffShortStat.TotalAddition}}{{end}}</span> <span class="text red">{{if .DiffShortStat.TotalDeletion}}-{{.DiffShortStat.TotalDeletion}}{{end}}</span></span> <span class="diff-stats-bar"> - <div class="diff-stats-add-bar" style="width: {{Eval 100 "*" .Diff.TotalAddition "/" "(" .Diff.TotalAddition "+" .Diff.TotalDeletion "+" 0.0 ")"}}%"></div> + <div class="diff-stats-add-bar" style="width: {{Eval 100 "*" .DiffShortStat.TotalAddition "/" "(" .DiffShortStat.TotalAddition "+" .DiffShortStat.TotalDeletion "+" 0.0 ")"}}%"></div> </span> </span> {{end}} diff --git a/templates/repo/pulse.tmpl b/templates/repo/pulse.tmpl index 5222633507..cbafee9ba9 100644 --- a/templates/repo/pulse.tmpl +++ b/templates/repo/pulse.tmpl @@ -1,12 +1,12 @@ <h2 class="ui header activity-header"> <span>{{DateUtils.AbsoluteLong .DateFrom}} - {{DateUtils.AbsoluteLong .DateUntil}}</span> <!-- Period --> - <div class="ui floating dropdown jump filter"> + <div class="ui floating dropdown jump"> <div class="ui basic compact button"> {{ctx.Locale.Tr "repo.activity.period.filter_label"}} <strong>{{.PeriodText}}</strong> {{svg "octicon-triangle-down" 14 "dropdown icon"}} </div> - <div class="menu"> + <div class="left menu"> <a class="{{if eq .Period "daily"}}active {{end}}item" href="{{$.RepoLink}}/activity/daily">{{ctx.Locale.Tr "repo.activity.period.daily"}}</a> <a class="{{if eq .Period "halfweekly"}}active {{end}}item" href="{{$.RepoLink}}/activity/halfweekly">{{ctx.Locale.Tr "repo.activity.period.halfweekly"}}</a> <a class="{{if eq .Period "weekly"}}active {{end}}item" href="{{$.RepoLink}}/activity/weekly">{{ctx.Locale.Tr "repo.activity.period.weekly"}}</a> @@ -49,7 +49,7 @@ </div> {{else}} <div class="stats-table"> - <a class="table-cell tiny background light grey"></a> + <a class="table-cell tiny tw-bg-grey"></a> </div> {{end}} {{ctx.Locale.TrN .Activity.ActiveIssueCount "repo.activity.active_issues_count_1" "repo.activity.active_issues_count_n" .Activity.ActiveIssueCount}} @@ -82,7 +82,7 @@ {{if .Permission.CanRead ctx.Consts.RepoUnitTypeCode}} {{if eq .Activity.Code.CommitCountInAllBranches 0}} - <div class="ui center aligned segment"> + <div class="ui tw-text-center segment"> <h4 class="ui header">{{ctx.Locale.Tr "repo.activity.no_git_activity"}}</h4> </div> {{end}} diff --git a/templates/repo/release/list.tmpl b/templates/repo/release/list.tmpl index 99934d2118..882ffe40b7 100644 --- a/templates/repo/release/list.tmpl +++ b/templates/repo/release/list.tmpl @@ -21,10 +21,11 @@ {{$compareTarget = $release.Sha1}} {{end}} {{template "repo/branch_dropdown" dict + "ContainerClasses" "release-branch-tag-selector" "Repository" $.Repository "ShowTabTags" true "DropdownFixedText" (ctx.Locale.Tr "repo.release.compare") - "RefLinkTemplate" (print "{RepoLink}/compare/{RefShortName}..." (PathEscapeSegments $compareTarget)) + "RefLinkTemplate" (print "{RepoLink}/compare/{RefShortName}" "..." (PathEscapeSegments $compareTarget)) }} {{end}} </div> @@ -49,7 +50,11 @@ {{svg (MigrationIcon $release.Repo.GetOriginalURLHostname) 20 "tw-mr-1"}}{{$release.OriginalAuthor}} {{else if $release.Publisher}} {{ctx.AvatarUtils.Avatar $release.Publisher 20 "tw-mr-1"}} - <a href="{{$release.Publisher.HomeLink}}">{{$release.Publisher.GetDisplayName}}</a> + {{if gt $release.PublisherID 0}} + <a href="{{$release.Publisher.HomeLink}}">{{$release.Publisher.GetDisplayName}}</a> + {{else}} + {{$release.Publisher.GetDisplayName}} + {{end}} {{else}} Ghost {{end}} @@ -60,11 +65,11 @@ {{if $release.CreatedUnix}} <span class="time">{{DateUtils.TimeSince $release.CreatedUnix}}</span> {{end}} - {{if and (not $release.IsDraft) ($.Permission.CanRead ctx.Consts.RepoUnitTypeCode)}} + {{if and (gt $release.NumCommits 0) (not $release.IsDraft) ($.Permission.CanRead ctx.Consts.RepoUnitTypeCode)}} | <span class="ahead"><a href="{{$.RepoLink}}/compare/{{$release.TagName | PathEscapeSegments}}...{{$release.TargetBehind | PathEscapeSegments}}">{{ctx.Locale.Tr "repo.release.ahead.commits" $release.NumCommitsBehind}}</a> {{ctx.Locale.Tr "repo.release.ahead.target" $release.TargetBehind}}</span> {{end}} </p> - <div class="markup desc"> + <div class="render-content markup"> {{$release.RenderedNote}} </div> <div class="divider"></div> @@ -72,25 +77,31 @@ <summary> {{ctx.Locale.Tr "repo.release.downloads"}} </summary> - <ul class="list"> + <ul class="ui divided list attachment-list"> {{if and (not $.DisableDownloadSourceArchives) (not $release.IsDraft) ($.Permission.CanRead ctx.Consts.RepoUnitTypeCode)}} - <li> - <a class="archive-link" href="{{$.RepoLink}}/archive/{{$release.TagName | PathEscapeSegments}}.zip" rel="nofollow"><strong>{{svg "octicon-file-zip" 16 "download-icon"}}{{ctx.Locale.Tr "repo.release.source_code"}} (ZIP)</strong></a> + <li class="item"> + <a class="archive-link" download href="{{$.RepoLink}}/archive/{{$release.TagName | PathEscapeSegments}}.zip" rel="nofollow"> + <strong class="flex-text-inline">{{svg "octicon-file-zip" 16 "download-icon"}}{{ctx.Locale.Tr "repo.release.source_code"}} (ZIP)</strong> + </a> </li> - <li> - <a class="archive-link" href="{{$.RepoLink}}/archive/{{$release.TagName | PathEscapeSegments}}.tar.gz" rel="nofollow"><strong>{{svg "octicon-file-zip" 16 "download-icon"}}{{ctx.Locale.Tr "repo.release.source_code"}} (TAR.GZ)</strong></a> + <li class="item"> + <a class="archive-link" download href="{{$.RepoLink}}/archive/{{$release.TagName | PathEscapeSegments}}.tar.gz" rel="nofollow"> + <strong class="flex-text-inline">{{svg "octicon-file-zip" 16 "download-icon"}}{{ctx.Locale.Tr "repo.release.source_code"}} (TAR.GZ)</strong> + </a> </li> {{end}} - {{range $release.Attachments}} - <li> - <a target="_blank" rel="nofollow" href="{{.DownloadURL}}" download> - <strong>{{svg "octicon-package" 16 "download-icon"}}{{.Name}}</strong> + {{range $att := $release.Attachments}} + <li class="item"> + <a target="_blank" class="tw-flex-1 gt-ellipsis" rel="nofollow" download href="{{$att.DownloadURL}}"> + <strong class="flex-text-inline">{{svg "octicon-package" 16 "download-icon"}}<span class="gt-ellipsis">{{$att.Name}}</span></strong> </a> - <div> - <span class="text grey">{{.Size | FileSize}}</span> - <span data-tooltip-content="{{ctx.Locale.Tr "repo.release.download_count" (ctx.Locale.PrettyNumber .DownloadCount)}}"> + <div class="attachment-right-info flex-text-inline"> + <span class="tw-pl-5">{{$att.Size | FileSize}}</span> + <span class="flex-text-inline" data-tooltip-content="{{ctx.Locale.Tr "repo.release.download_count" (ctx.Locale.PrettyNumber $att.DownloadCount)}}"> {{svg "octicon-info"}} </span> + <div class="tw-flex-1"></div> + {{DateUtils.TimeSince $att.CreatedUnix}} </div> </li> {{end}} diff --git a/templates/repo/release/new.tmpl b/templates/repo/release/new.tmpl index 574b0d0311..109a18fa0e 100644 --- a/templates/repo/release/new.tmpl +++ b/templates/repo/release/new.tmpl @@ -100,32 +100,26 @@ </div> <span class="help">{{ctx.Locale.Tr "repo.release.prerelease_helper"}}</span> <div class="divider tw-mt-0"></div> - <div class="tw-flex tw-justify-end"> + <div class="flex-text-block tw-justify-end"> {{if .PageIsEditRelease}} <a class="ui small button" href="{{.RepoLink}}/releases"> {{ctx.Locale.Tr "repo.release.cancel"}} </a> - <a class="ui small red button delete-button" data-url="{{$.RepoLink}}/releases/delete" data-id="{{.ID}}"> + <a class="ui small red button link-action" data-modal-confirm="#repo-release-delete-modal" data-url="{{$.RepoLink}}/releases/delete?id={{.ID}}"> {{ctx.Locale.Tr "repo.release.delete_release"}} </a> {{if .IsDraft}} - <button class="ui small button" type="submit" name="draft" value="{{ctx.Locale.Tr "repo.release.save_draft"}}">{{ctx.Locale.Tr "repo.release.save_draft"}}</button> - <button class="ui small primary button"> - {{ctx.Locale.Tr "repo.release.publish"}} - </button> + <button class="ui small button" type="submit" name="draft" value="1">{{ctx.Locale.Tr "repo.release.save_draft"}}</button> + <button class="ui small primary button">{{ctx.Locale.Tr "repo.release.publish"}}</button> {{else}} - <button class="ui small primary button"> - {{ctx.Locale.Tr "repo.release.edit_release"}} - </button> + <button class="ui small primary button">{{ctx.Locale.Tr "repo.release.edit_release"}}</button> {{end}} {{else}} - {{if not .tag_name}} + {{if .ShowCreateTagOnlyButton}} <button class="ui small button" name="tag_only" value="1">{{ctx.Locale.Tr "repo.release.add_tag"}}</button> {{end}} <button class="ui small button" name="draft" value="1">{{ctx.Locale.Tr "repo.release.save_draft"}}</button> - <button class="ui small primary button"> - {{ctx.Locale.Tr "repo.release.publish"}} - </button> + <button class="ui small primary button">{{ctx.Locale.Tr "repo.release.publish"}}</button> {{end}} </div> </div> @@ -135,15 +129,11 @@ </div> {{if .PageIsEditRelease}} - <div class="ui g-modal-confirm delete modal"> - <div class="header"> - {{svg "octicon-trash"}} - {{ctx.Locale.Tr "repo.release.deletion"}} - </div> - <div class="content"> - <p>{{ctx.Locale.Tr "repo.release.deletion_desc"}}</p> - </div> + <div class="ui small modal" id="repo-release-delete-modal"> + <div class="header">{{svg "octicon-trash"}} {{ctx.Locale.Tr "repo.release.deletion"}}</div> + <div class="content"><p>{{ctx.Locale.Tr "repo.release.deletion_desc"}}</p></div> {{template "base/modal_actions_confirm" .}} </div> {{end}} + {{template "base/footer" .}} diff --git a/templates/repo/release_tag_header.tmpl b/templates/repo/release_tag_header.tmpl index f96c76864f..12acf4bfeb 100644 --- a/templates/repo/release_tag_header.tmpl +++ b/templates/repo/release_tag_header.tmpl @@ -2,7 +2,7 @@ {{$canReadCode := $.Permission.CanRead ctx.Consts.RepoUnitTypeCode}} {{if $canReadReleases}} - <div class="tw-flex"> + <div class="flex-text-block"> <div class="tw-flex-1 tw-flex tw-items-center"> <h2 class="ui compact small menu small-menu-items"> <a class="{{if and .PageIsReleaseList (not .PageIsSingleTag)}}active {{end}}item" href="{{.RepoLink}}/releases">{{ctx.Locale.PrettyNumber .NumReleases}} {{ctx.Locale.TrN .NumReleases "repo.release" "repo.releases"}}</a> @@ -17,7 +17,7 @@ </a> {{end}} {{if and (not .PageIsTagList) .CanCreateRelease}} - <a class="ui small primary button" href="{{$.RepoLink}}/releases/new{{if .PageIsSingleTag}}?tag={{.TagName}}{{end}}"> + <a class="ui small primary button" href="{{$.RepoLink}}/releases/new{{if .PageIsSingleTag}}?tag={{.SingleReleaseTagName}}{{end}}"> {{ctx.Locale.Tr "repo.release.new_release"}} </a> {{end}} diff --git a/templates/repo/settings/branches.tmpl b/templates/repo/settings/branches.tmpl index 57d9f2c5a8..e8e7a3f1c2 100644 --- a/templates/repo/settings/branches.tmpl +++ b/templates/repo/settings/branches.tmpl @@ -49,14 +49,14 @@ </div> </div> <div class="flex-item-trailing"> - <a class="rm ui tiny button" href="{{$.Repository.Link}}/settings/branches/edit?rule_name={{.RuleName}}">{{ctx.Locale.Tr "repo.settings.edit_protected_branch"}}</a> - <button class="ui red tiny button delete-button" data-url="{{$.Repository.Link}}/settings/branches/{{.ID}}/delete" data-id="{{.ID}}"> + <a class="ui tiny button" href="{{$.Repository.Link}}/settings/branches/edit?rule_name={{.RuleName}}">{{ctx.Locale.Tr "repo.settings.edit_protected_branch"}}</a> + <button class="ui red tiny button link-action" data-modal-confirm="#repo-branch-protection-delete-modal" data-url="{{$.Repository.Link}}/settings/branches/{{.ID}}/delete?id={{.ID}}"> {{ctx.Locale.Tr "repo.settings.protected_branch.delete_rule"}} </button> </div> </div> {{else}} - <div class="flex-item center aligned"> + <div class="flex-item tw-text-center"> {{ctx.Locale.Tr "repo.settings.no_protected_branch"}} </div> {{end}} @@ -65,14 +65,9 @@ {{end}} </div> -<div class="ui g-modal-confirm delete modal"> - <div class="header"> - {{svg "octicon-trash"}} - {{ctx.Locale.Tr "repo.settings.protected_branch_deletion"}} - </div> - <div class="content"> - <p>{{ctx.Locale.Tr "repo.settings.protected_branch_deletion_desc"}}</p> - </div> +<div class="ui small modal" id="repo-branch-protection-delete-modal"> + <div class="header">{{svg "octicon-trash"}} {{ctx.Locale.Tr "repo.settings.protected_branch_deletion"}}</div> + <div class="content"><p>{{ctx.Locale.Tr "repo.settings.protected_branch_deletion_desc"}}</p></div> {{template "base/modal_actions_confirm" .}} </div> diff --git a/templates/repo/settings/collaboration.tmpl b/templates/repo/settings/collaboration.tmpl index 9f90f0a2b9..62903e1cfb 100644 --- a/templates/repo/settings/collaboration.tmpl +++ b/templates/repo/settings/collaboration.tmpl @@ -29,7 +29,7 @@ </div> </div> </div> - <button class="ui red tiny button inline delete-button" data-url="{{$.Link}}/delete" data-id="{{.ID}}"> + <button class="ui red tiny button link-action" data-modal-confirm="#repo-collaborator-delete-modal" data-url="{{$.Link}}/delete?id={{.ID}}"> {{ctx.Locale.Tr "repo.settings.delete_collaborator"}} </button> </div> @@ -48,69 +48,84 @@ </form> </div> - {{if .RepoOwnerIsOrganization}} - <h4 class="ui top attached header"> - {{ctx.Locale.Tr "repo.settings.teams"}} - </h4> - {{$allowedToChangeTeams := (or (.Org.RepoAdminChangeTeamAccess) (.Permission.IsOwner))}} - {{if .Teams}} - <div class="ui attached segment"> - <div class="flex-list"> - {{range $t, $team := .Teams}} - <div class="flex-item"> - <div class="flex-item-main"> - <a class="flex-item-title text primary" href="{{AppSubUrl}}/org/{{$.OrgName|PathEscape}}/teams/{{.LowerName|PathEscape}}"> - {{.Name}} - </a> - <div class="flex-item-body flex-text-block"> - {{svg "octicon-shield-lock"}} - {{if eq .AccessMode 1}}{{ctx.Locale.Tr "repo.settings.collaboration.read"}}{{else if eq .AccessMode 2}}{{ctx.Locale.Tr "repo.settings.collaboration.write"}}{{else if eq .AccessMode 3}}{{ctx.Locale.Tr "repo.settings.collaboration.admin"}}{{else if eq .AccessMode 4}}{{ctx.Locale.Tr "repo.settings.collaboration.owner"}}{{else}}{{ctx.Locale.Tr "repo.settings.collaboration.undefined"}}{{end}} + {{if $.Repository.Owner.IsOrganization}} + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "repo.settings.teams"}} + </h4> + {{$allowedToChangeTeams := (or (.Org.RepoAdminChangeTeamAccess) (.Permission.IsOwner))}} + {{if .Teams}} + <div class="ui attached segment"> + <div class="flex-list"> + {{range $t, $team := .Teams}} + <div class="flex-item"> + <div class="flex-item-main"> + <a class="flex-item-title text primary" href="{{AppSubUrl}}/org/{{$.OrgName|PathEscape}}/teams/{{.LowerName|PathEscape}}"> + {{.Name}} + </a> + <div class="flex-item-body flex-text-block"> + {{/*FIXME: TEAM-UNIT-PERMISSION this display is not right, search the fixme keyword to see more details */}} + {{svg "octicon-shield-lock"}} + {{if eq .AccessMode 0}} + {{ctx.Locale.Tr "repo.settings.collaboration.per_unit"}} + {{else if eq .AccessMode 1}} + {{ctx.Locale.Tr "repo.settings.collaboration.read"}} + {{else if eq .AccessMode 2}} + {{ctx.Locale.Tr "repo.settings.collaboration.write"}} + {{else if eq .AccessMode 3}} + {{ctx.Locale.Tr "repo.settings.collaboration.admin"}} + {{else if eq .AccessMode 4}} + {{ctx.Locale.Tr "repo.settings.collaboration.owner"}} + {{else}} + {{ctx.Locale.Tr "repo.settings.collaboration.undefined"}} + {{end}} + </div> + {{if or (eq .AccessMode 0) (eq .AccessMode 1) (eq .AccessMode 2)}} + {{$first := true}} + <div class="flex-item-body" data-tooltip-content="{{ctx.Locale.Tr "repo.settings.change_team_permission_tip"}}"> + Units: + {{range $u, $unit := $.Units}} + {{- if and ($.Repo.UnitEnabled ctx $unit.Type) ($team.UnitEnabled ctx $unit.Type) -}} + {{- Iif $first "" ", "}}{{ctx.Locale.Tr $unit.NameKey -}} + {{- $first = false -}} + {{- end -}} + {{end}} + {{if $first}}None{{end}} + </div> + {{end}} </div> - {{if or (eq .AccessMode 1) (eq .AccessMode 2)}} - {{$first := true}} - <div class="flex-item-body" data-tooltip-content="{{ctx.Locale.Tr "repo.settings.change_team_permission_tip"}}"> - Sections: {{range $u, $unit := $.Units}}{{if and ($.Repo.UnitEnabled ctx $unit.Type) ($team.UnitEnabled ctx $unit.Type)}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{ctx.Locale.Tr $unit.NameKey}}{{end}}{{end}} {{if $first}}None{{end}} + {{if $allowedToChangeTeams}} + <div class="flex-item-trailing" {{if .IncludesAllRepositories}} data-tooltip-content="{{ctx.Locale.Tr "repo.settings.delete_team_tip"}}"{{end}}> + <button class="ui red tiny button link-action {{if .IncludesAllRepositories}}disabled{{end}}" data-modal-confirm="#repo-collaborator-delete-modal" data-url="{{$.Link}}/team/delete?id={{.ID}}"> + {{ctx.Locale.Tr "repo.settings.delete_collaborator"}} + </button> </div> {{end}} </div> - {{if $allowedToChangeTeams}} - <div class="flex-item-trailing" {{if .IncludesAllRepositories}} data-tooltip-content="{{ctx.Locale.Tr "repo.settings.delete_team_tip"}}"{{end}}> - <button class="ui red tiny button inline delete-button {{if .IncludesAllRepositories}}disabled{{end}}" data-url="{{$.Link}}/team/delete" data-id="{{.ID}}"> - {{ctx.Locale.Tr "repo.settings.delete_collaborator"}} - </button> - </div> - {{end}} + {{end}} + </div> + </div> + {{end}} + <div class="ui bottom attached segment"> + {{if $allowedToChangeTeams}} + <form class="ui form" id="repo-collab-team-form" action="{{.Link}}/team" method="post"> + {{.CsrfTokenHtml}} + <div id="search-team-box" class="ui search input tw-align-middle" data-org-name="{{.OrgName}}"> + <input class="prompt" name="team" placeholder="{{ctx.Locale.Tr "search.team_kind"}}" autocomplete="off" required> + </div> + <button class="ui primary button">{{ctx.Locale.Tr "repo.settings.add_team"}}</button> + </form> + {{else}} + <div class="item"> + {{ctx.Locale.Tr "repo.settings.change_team_access_not_allowed"}} </div> {{end}} </div> - </div> - {{end}} - <div class="ui bottom attached segment"> - {{if $allowedToChangeTeams}} - <form class="ui form" id="repo-collab-team-form" action="{{.Link}}/team" method="post"> - {{.CsrfTokenHtml}} - <div id="search-team-box" class="ui search input tw-align-middle" data-org-name="{{.OrgName}}"> - <input class="prompt" name="team" placeholder="{{ctx.Locale.Tr "search.team_kind"}}" autocomplete="off" autofocus required> - </div> - <button class="ui primary button">{{ctx.Locale.Tr "repo.settings.add_team"}}</button> - </form> - {{else}} - <div class="item"> - {{ctx.Locale.Tr "repo.settings.change_team_access_not_allowed"}} - </div> - {{end}} - </div> {{end}} </div> -<div class="ui g-modal-confirm delete modal"> - <div class="header"> - {{svg "octicon-trash"}} - {{ctx.Locale.Tr "repo.settings.collaborator_deletion"}} - </div> - <div class="content"> - <p>{{ctx.Locale.Tr "repo.settings.collaborator_deletion_desc"}}</p> - </div> +<div class="ui small modal" id="repo-collaborator-delete-modal"> + <div class="header">{{svg "octicon-trash"}} {{ctx.Locale.Tr "repo.settings.collaborator_deletion"}}</div> + <div class="content"><p>{{ctx.Locale.Tr "repo.settings.collaborator_deletion_desc"}}</p></div> {{template "base/modal_actions_confirm" .}} </div> diff --git a/templates/repo/settings/deploy_keys.tmpl b/templates/repo/settings/deploy_keys.tmpl index 5eb2a47e5a..b82d584b22 100644 --- a/templates/repo/settings/deploy_keys.tmpl +++ b/templates/repo/settings/deploy_keys.tmpl @@ -59,7 +59,7 @@ </div> </div> <div class="flex-item-trailing"> - <button class="ui red tiny button delete-button" data-url="{{$.Link}}/delete" data-id="{{.ID}}"> + <button class="ui red tiny button link-action" data-modal-confirm="#repo-deploy-key-delete-modal" data-url="{{$.Link}}/delete?id={{.ID}}"> {{ctx.Locale.Tr "settings.delete_key"}} </button> </div> @@ -72,14 +72,9 @@ </div> </div> -<div class="ui g-modal-confirm delete modal"> - <div class="header"> - {{svg "octicon-trash"}} - {{ctx.Locale.Tr "repo.settings.deploy_key_deletion"}} - </div> - <div class="content"> - <p>{{ctx.Locale.Tr "repo.settings.deploy_key_deletion_desc"}}</p> - </div> +<div class="ui small modal" id="repo-deploy-key-delete-modal"> + <div class="header">{{svg "octicon-trash"}} {{ctx.Locale.Tr "repo.settings.deploy_key_deletion"}}</div> + <div class="content"><p>{{ctx.Locale.Tr "repo.settings.deploy_key_deletion_desc"}}</p></div> {{template "base/modal_actions_confirm" .}} </div> diff --git a/templates/repo/settings/githooks.tmpl b/templates/repo/settings/githooks.tmpl index 1a603f9fe8..9b17af1406 100644 --- a/templates/repo/settings/githooks.tmpl +++ b/templates/repo/settings/githooks.tmpl @@ -4,18 +4,14 @@ {{ctx.Locale.Tr "repo.settings.githooks"}} </h4> <div class="ui attached segment"> - <div class="ui list"> + <div class="ui list flex-items-block"> + <div class="item"><span>{{ctx.Locale.Tr "repo.settings.githooks_desc"}}</span></div> + {{range .Hooks}} <div class="item"> - {{ctx.Locale.Tr "repo.settings.githooks_desc"}} + <span class="text {{if .IsActive}}green{{else}}grey{{end}}">{{svg "octicon-dot-fill" 22}}</span> + <span class="gt-ellipsis tw-flex-1">{{.Name}}</span> + <a class="muted tw-p-2" href="{{$.RepoLink}}/settings/hooks/git/{{.Name|PathEscape}}">{{svg "octicon-pencil"}}</a> </div> - {{range .Hooks}} - <div class="item truncated-item-container"> - <span class="text {{if .IsActive}}green{{else}}grey{{end}} tw-mr-2">{{svg "octicon-dot-fill" 22}}</span> - <span class="text truncate tw-flex-1 tw-mr-2">{{.Name}}</span> - <a class="muted tw-float-right tw-p-2" href="{{$.RepoLink}}/settings/hooks/git/{{.Name|PathEscape}}"> - {{svg "octicon-pencil"}} - </a> - </div> {{end}} </div> </div> diff --git a/templates/repo/settings/lfs.tmpl b/templates/repo/settings/lfs.tmpl index c1878d2853..4b46aeed95 100644 --- a/templates/repo/settings/lfs.tmpl +++ b/templates/repo/settings/lfs.tmpl @@ -12,13 +12,13 @@ {{range .LFSFiles}} <tr> <td> - <a href="{{$.Link}}/show/{{.Oid}}" title="{{.Oid}}" class="ui brown button tw-font-mono"> + <a href="{{$.Link}}/show/{{.Oid}}" title="{{.Oid}}" class="ui button tw-font-mono"> {{ShortSha .Oid}} </a> </td> <td>{{FileSize .Size}}</td> <td>{{DateUtils.TimeSince .CreatedUnix}}</td> - <td class="right aligned"> + <td class="tw-text-right"> <a class="ui primary button" href="{{$.Link}}/find?oid={{.Oid}}&size={{.Size}}">{{ctx.Locale.Tr "repo.settings.lfs_findcommits"}}</a> <button class="ui basic show-modal icon button red" data-modal="#delete-{{.Oid}}"> <span class="btn-octicon btn-octicon-danger" data-tooltip-content="{{ctx.Locale.Tr "repo.editor.delete_this_file"}}">{{svg "octicon-trash"}}</span> diff --git a/templates/repo/settings/lfs_file.tmpl b/templates/repo/settings/lfs_file.tmpl index f6fac05b69..cd1b168401 100644 --- a/templates/repo/settings/lfs_file.tmpl +++ b/templates/repo/settings/lfs_file.tmpl @@ -13,7 +13,7 @@ </h4> <div class="ui bottom attached table unstackable segment"> {{template "repo/unicode_escape_prompt" dict "EscapeStatus" .EscapeStatus "root" $}} - <div class="file-view{{if .IsMarkup}} markup {{.MarkupType}}{{else if .IsPlainText}} plain-text{{else if .IsTextFile}} code-view{{end}}"> + <div class="file-view {{if .IsPlainText}}plain-text{{else if .IsTextFile}}code-view{{end}}"> {{if .IsFileTooLarge}} {{template "shared/filetoolarge" dict "RawFileLink" .RawFileLink}} {{else if not .FileSize}} @@ -21,7 +21,7 @@ {{else if not .IsTextFile}} <div class="view-raw"> {{if .IsImageFile}} - <img src="{{$.RawFileLink}}"> + <img loading="lazy" alt="{{$.RawFileLink}}" src="{{$.RawFileLink}}"> {{else if .IsVideoFile}} <video controls src="{{$.RawFileLink}}"> <strong>{{ctx.Locale.Tr "repo.video_not_supported_in_browser"}}</strong> @@ -30,8 +30,6 @@ <audio controls src="{{$.RawFileLink}}"> <strong>{{ctx.Locale.Tr "repo.audio_not_supported_in_browser"}}</strong> </audio> - {{else if .IsPDFFile}} - <div class="pdf-content is-loading" data-src="{{$.RawFileLink}}" data-fallback-button-text="{{ctx.Locale.Tr "diff.view_file"}}"></div> {{else}} <a href="{{$.RawFileLink}}" rel="nofollow" class="tw-p-4">{{ctx.Locale.Tr "repo.file_view_raw"}}</a> {{end}} diff --git a/templates/repo/settings/lfs_locks.tmpl b/templates/repo/settings/lfs_locks.tmpl index 64c6b3a550..dfbae0633e 100644 --- a/templates/repo/settings/lfs_locks.tmpl +++ b/templates/repo/settings/lfs_locks.tmpl @@ -36,7 +36,7 @@ </a> </td> <td>{{DateUtils.TimeSince .Created}}</td> - <td class="right aligned"> + <td class="tw-text-right"> <form action="{{$.LFSFilesLink}}/locks/{{$lock.ID}}/unlock" method="post"> {{$.CsrfTokenHtml}} <button class="ui primary button"><span class="btn-octicon">{{svg "octicon-lock"}}</span>{{ctx.Locale.Tr "repo.settings.lfs_force_unlock"}}</button> diff --git a/templates/repo/settings/navbar.tmpl b/templates/repo/settings/navbar.tmpl index 3e127ccbb3..3dd86d1f6a 100644 --- a/templates/repo/settings/navbar.tmpl +++ b/templates/repo/settings/navbar.tmpl @@ -4,6 +4,11 @@ <a class="{{if .PageIsSettingsOptions}}active {{end}}item" href="{{.RepoLink}}/settings"> {{ctx.Locale.Tr "repo.settings.options"}} </a> + {{if or .Repository.IsPrivate .Permission.HasAnyUnitPublicAccess}} + <a class="{{if .PageIsSettingsPublicAccess}}active {{end}}item" href="{{.RepoLink}}/settings/public_access"> + {{ctx.Locale.Tr "repo.settings.public_access"}} + </a> + {{end}} <a class="{{if .PageIsSettingsCollaboration}}active {{end}}item" href="{{.RepoLink}}/settings/collaboration"> {{ctx.Locale.Tr "repo.settings.collaboration"}} </a> diff --git a/templates/repo/settings/options.tmpl b/templates/repo/settings/options.tmpl index 21eaf6a651..fc42056e0a 100644 --- a/templates/repo/settings/options.tmpl +++ b/templates/repo/settings/options.tmpl @@ -10,7 +10,7 @@ <input type="hidden" name="action" value="update"> <div class="required field {{if .Err_RepoName}}error{{end}}"> <label>{{ctx.Locale.Tr "repo.repo_name"}}</label> - <input name="repo_name" value="{{.Repository.Name}}" data-repo-name="{{.Repository.Name}}" autofocus required> + <input name="repo_name" value="{{.Repository.Name}}" data-repo-name="{{.Repository.Name}}" required> </div> <div class="inline field"> <label>{{ctx.Locale.Tr "repo.repo_size"}}</label> @@ -40,8 +40,7 @@ <form class="ui form" action="{{.Link}}/avatar" method="post" enctype="multipart/form-data"> {{.CsrfTokenHtml}} <div class="inline field"> - <label for="avatar">{{ctx.Locale.Tr "settings.choose_new_avatar"}}</label> - <input name="avatar" type="file" accept="image/png,image/jpeg,image/gif,image/webp"> + {{template "shared/avatar_upload_crop" dict "LabelText" (ctx.Locale.Tr "settings.choose_new_avatar")}} </div> <div class="field"> <button class="ui primary button">{{ctx.Locale.Tr "settings.update_avatar"}}</button> @@ -118,7 +117,7 @@ <td>{{.PullMirror.RemoteAddress}}</td> <td>{{ctx.Locale.Tr "repo.settings.mirror_settings.direction.pull"}}</td> <td>{{DateUtils.FullTime .PullMirror.UpdatedUnix}}</td> - <td class="right aligned"> + <td class="tw-text-right"> <form method="post" class="tw-inline-block"> {{.CsrfTokenHtml}} <input type="hidden" name="action" value="mirror-sync"> @@ -204,9 +203,18 @@ {{range .PushMirrors}} <tr> <td class="tw-break-anywhere">{{.RemoteAddress}}</td> - <td>{{ctx.Locale.Tr "repo.settings.mirror_settings.direction.push"}}</td> - <td>{{if .LastUpdateUnix}}{{DateUtils.FullTime .LastUpdateUnix}}{{else}}{{ctx.Locale.Tr "never"}}{{end}} {{if .LastError}}<div class="ui red label" data-tooltip-content="{{.LastError}}">{{ctx.Locale.Tr "error"}}</div>{{end}}</td> - <td class="right aligned"> + <td>{{ctx.Locale.Tr "repo.settings.mirror_settings.direction.push"}} ({{.Interval}})</td> + <td> + <span class="flex-text-block"> + {{if .LastUpdateUnix}} + {{DateUtils.FullTime .LastUpdateUnix}} + {{else}} + {{ctx.Locale.Tr "never"}} + {{end}} + {{if .LastError}}<span class="ui red label" data-tooltip-content="{{.LastError}}">{{ctx.Locale.Tr "error"}}</span>{{end}} + </span> + </td> + <td class="tw-text-right"> <button class="ui tiny button show-modal" data-modal="#push-mirror-edit-modal" @@ -329,16 +337,6 @@ <label>{{ctx.Locale.Tr "repo.settings.default_wiki_branch_name"}}</label> <input name="default_wiki_branch" value="{{.Repository.DefaultWikiBranch}}"> </div> - <div class="inline field"> - {{$unitInternalWiki := .Repository.MustGetUnit ctx ctx.Consts.RepoUnitTypeWiki}} - <label>{{ctx.Locale.Tr "repo.settings.default_wiki_everyone_access"}}</label> - <select name="default_wiki_everyone_access" class="ui selection dropdown"> - {{/* everyone access mode is different from others, none means it is unset and won't be applied */}} - <option value="none" {{Iif (eq $unitInternalWiki.EveryoneAccessMode 0) "selected"}}>{{ctx.Locale.Tr "settings.permission_not_set"}}</option> - <option value="read" {{Iif (eq $unitInternalWiki.EveryoneAccessMode 1) "selected"}}>{{ctx.Locale.Tr "settings.permission_read"}}</option> - <option value="write" {{Iif (eq $unitInternalWiki.EveryoneAccessMode 2) "selected"}}>{{ctx.Locale.Tr "settings.permission_write"}}</option> - </select> - </div> </div> <div class="field"> <div class="ui radio checkbox{{if $isExternalWikiGlobalDisabled}} disabled{{end}}"{{if $isExternalWikiGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}> @@ -804,7 +802,7 @@ </div> </div> {{end}} - {{if and .Repository.IsFork .Repository.Owner.CanCreateRepo}} + {{if .CanConvertFork}} <div class="flex-item"> <div class="flex-item-main"> <div class="flex-item-title">{{ctx.Locale.Tr "repo.settings.convert_fork"}}</div> @@ -910,7 +908,7 @@ <input name="repo_name" required maxlength="100"> </div> - <div class="text right actions"> + <div class="actions"> <button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button> <button class="ui red button">{{ctx.Locale.Tr "repo.settings.convert_confirm"}}</button> </div> @@ -918,7 +916,7 @@ </div> </div> {{end}} - {{if and .Repository.IsFork .Repository.Owner.CanCreateRepo}} + {{if .CanConvertFork}} <div class="ui small modal" id="convert-fork-repo-modal"> <div class="header"> {{ctx.Locale.Tr "repo.settings.convert_fork"}} @@ -941,7 +939,7 @@ <input name="repo_name" required> </div> - <div class="text right actions"> + <div class="actions"> <button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button> <button class="ui red button">{{ctx.Locale.Tr "repo.settings.convert_fork_confirm"}}</button> </div> @@ -978,7 +976,7 @@ <input id="new_owner_name" name="new_owner_name" required> </div> - <div class="text right actions"> + <div class="actions"> <button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button> <button class="ui red button">{{ctx.Locale.Tr "repo.settings.transfer_perform"}}</button> </div> @@ -1012,7 +1010,7 @@ <input id="repo_name_to_delete" name="repo_name" required> </div> - <div class="text right actions"> + <div class="actions"> <button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button> <button class="ui red button">{{ctx.Locale.Tr "repo.settings.confirm_delete"}}</button> </div> @@ -1072,7 +1070,7 @@ <input name="repo_name" required> </div> - <div class="text right actions"> + <div class="actions"> <button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button> <button class="ui red button">{{ctx.Locale.Tr "repo.settings.confirm_wiki_delete"}}</button> </div> diff --git a/templates/repo/settings/protected_branch.tmpl b/templates/repo/settings/protected_branch.tmpl index 61cc6077a1..3c311c18c3 100644 --- a/templates/repo/settings/protected_branch.tmpl +++ b/templates/repo/settings/protected_branch.tmpl @@ -2,13 +2,17 @@ <div class="repo-setting-content"> <form class="ui form" action="{{.Link}}" method="post"> <h4 class="ui top attached header"> - {{ctx.Locale.Tr "repo.settings.branch_protection" .Rule.RuleName}} + {{if .Rule.RuleName}} + {{ctx.Locale.Tr "repo.settings.branch_protection" .Rule.RuleName}} + {{else}} + {{ctx.Locale.Tr "repo.settings.branches.add_new_rule"}} + {{end}} </h4> <div class="ui attached segment branch-protection"> <h5 class="ui dividing header">{{ctx.Locale.Tr "repo.settings.protect_patterns"}}</h5> - <div class="field"> + <div class="field required"> <label>{{ctx.Locale.Tr "repo.settings.protect_branch_name_pattern"}}</label> - <input name="rule_name" type="text" value="{{.Rule.RuleName}}"> + <input name="rule_name" type="text" value="{{.Rule.RuleName}}" required> <input name="rule_id" type="hidden" value="{{.Rule.ID}}"> <p class="help tw-ml-0">{{ctx.Locale.Tr "repo.settings.protect_branch_name_pattern_desc" "https://github.com/gobwas/glob"}}</p> </div> diff --git a/templates/repo/settings/public_access.tmpl b/templates/repo/settings/public_access.tmpl new file mode 100644 index 0000000000..c1c198bcce --- /dev/null +++ b/templates/repo/settings/public_access.tmpl @@ -0,0 +1,54 @@ +{{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings")}} +<div class="repo-setting-content"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "repo.settings.public_access"}} + </h4> + <div class="ui attached segment"> + <p> + {{ctx.Locale.Tr "repo.settings.public_access_desc"}} + </p> + {{$paNotSet := "not-set"}} + {{$paAnonymousRead := "anonymous-read"}} + {{$paEveryoneRead := "everyone-read"}} + {{$paEveryoneWrite := "everyone-write"}} + <form class="ui form" method="post"> + {{.CsrfTokenHtml}} + <table class="ui table unstackable tw-my-2"> + <thead> + <tr> + <th>{{ctx.Locale.Tr "units.unit"}}</th> + <th class="tw-text-center">{{ctx.Locale.Tr "settings.permission_not_set"}}</th> + <th class="tw-text-center">{{ctx.Locale.Tr "settings.permission_anonymous_read"}}</th> + <th class="tw-text-center">{{ctx.Locale.Tr "settings.permission_everyone_read"}}</th> + <th class="tw-text-center">{{ctx.Locale.Tr "settings.permission_everyone_write"}}</th> + </tr> + </thead> + <tbody> + {{range $ua := .RepoUnitPublicAccesses}} + <tr> + <td>{{$ua.DisplayName}}</td> + <td class="tw-text-center"><label><input type="radio" name="{{$ua.FormKey}}" value="{{$paNotSet}}" {{Iif (eq $paNotSet $ua.UnitPublicAccess) "checked"}}></label></td> + <td class="tw-text-center"><label><input type="radio" name="{{$ua.FormKey}}" value="{{$paAnonymousRead}}" {{Iif (eq $paAnonymousRead $ua.UnitPublicAccess) "checked"}}></label></td> + <td class="tw-text-center"><label><input type="radio" name="{{$ua.FormKey}}" value="{{$paEveryoneRead}}" {{Iif (eq $paEveryoneRead $ua.UnitPublicAccess) "checked"}}></label></td> + <td class="tw-text-center"> + {{if SliceUtils.Contains $ua.PublicAccessTypes $paEveryoneWrite}} + <label><input type="radio" name="{{$ua.FormKey}}" value="{{$paEveryoneWrite}}" {{Iif (eq $paEveryoneWrite $ua.UnitPublicAccess) "checked"}}></label> + {{else}} + - + {{end}} + </td> + </tr> + {{end}} + </tbody> + </table> + <ul class="tw-my-3 tw-pl-5 tw-flex tw-flex-col tw-gap-3"> + <li>{{ctx.Locale.Tr "repo.settings.public_access.docs.not_set"}}</li> + <li>{{ctx.Locale.Tr "repo.settings.public_access.docs.anonymous_read"}}</li> + <li>{{ctx.Locale.Tr "repo.settings.public_access.docs.everyone_read"}}</li> + <li>{{ctx.Locale.Tr "repo.settings.public_access.docs.everyone_write"}}</li> + </ul> + <button class="ui primary button {{if .GlobalForcePrivate}}disabled{{end}}">{{ctx.Locale.Tr "repo.settings.update_settings"}}</button> + </form> + </div> +</div> +{{template "repo/settings/layout_footer" .}} diff --git a/templates/repo/settings/push_mirror_sync_modal.tmpl b/templates/repo/settings/push_mirror_sync_modal.tmpl index e8dad61a48..3bd624fab7 100644 --- a/templates/repo/settings/push_mirror_sync_modal.tmpl +++ b/templates/repo/settings/push_mirror_sync_modal.tmpl @@ -2,31 +2,27 @@ <div class="header"> {{ctx.Locale.Tr "repo.settings.mirror_settings.push_mirror.edit_sync_time"}} </div> - <div class="content"> - <form class="ui form ignore-dirty" method="post"> - {{.CsrfTokenHtml}} - <input type="hidden" name="action" value="push-mirror-update"> - <input type="hidden" name="push_mirror_id" id="push-mirror-edit-id"> - <div class="field"> - <label for="name">{{ctx.Locale.Tr "repo.settings.mirror_settings.mirrored_repository"}}</label> - <div class="ui small input"> - <input id="push-mirror-edit-address" readonly> - </div> - </div> - <div class="inline field"> - <label for="push-mirror-edit-interval">{{ctx.Locale.Tr "repo.mirror_interval" .MinimumMirrorInterval}}</label> - <input id="push-mirror-edit-interval" name="push_mirror_interval" autofocus> - </div> - <div class="actions"> - <button class="ui small basic cancel button"> - {{svg "octicon-x"}} - {{ctx.Locale.Tr "cancel"}} - </button> - <button class="ui primary small approve button"> - {{svg "fontawesome-save"}} - {{ctx.Locale.Tr "save"}} - </button> - </div> - </form> - </div> + <form class="content ui form ignore-dirty" method="post"> + {{.CsrfTokenHtml}} + <input type="hidden" name="action" value="push-mirror-update"> + <input type="hidden" name="push_mirror_id" id="push-mirror-edit-id"> + <div class="field"> + <label>{{ctx.Locale.Tr "repo.settings.mirror_settings.mirrored_repository"}}</label> + <span id="push-mirror-edit-address"></span> + </div> + <div class="field"> + <label for="push-mirror-edit-interval">{{ctx.Locale.Tr "repo.mirror_interval" .MinimumMirrorInterval}}</label> + <input id="push-mirror-edit-interval" name="push_mirror_interval" class="tw-w-auto"> + </div> + <div class="actions"> + <button class="ui small basic cancel button"> + {{svg "octicon-x"}} + {{ctx.Locale.Tr "cancel"}} + </button> + <button class="ui primary small approve button"> + {{svg "fontawesome-save"}} + {{ctx.Locale.Tr "save"}} + </button> + </div> + </form> </div> diff --git a/templates/repo/settings/tags.tmpl b/templates/repo/settings/tags.tmpl index 27b0f519a8..12ec9102b7 100644 --- a/templates/repo/settings/tags.tmpl +++ b/templates/repo/settings/tags.tmpl @@ -104,7 +104,7 @@ {{ctx.Locale.Tr "repo.settings.tags.protection.allowed.noone"}} {{end}} </td> - <td class="right aligned"> + <td class="tw-text-right"> <a class="ui tiny primary button" href="{{$.RepoLink}}/settings/tags/{{.ID}}">{{ctx.Locale.Tr "edit"}}</a> <form class="tw-inline-block" action="{{$.RepoLink}}/settings/tags/delete" method="post"> {{$.CsrfTokenHtml}} @@ -114,7 +114,7 @@ </td> </tr> {{else}} - <tr class="center aligned"><td colspan="3">{{ctx.Locale.Tr "repo.settings.tags.protection.none"}}</td></tr> + <tr class="tw-text-center"><td colspan="3">{{ctx.Locale.Tr "repo.settings.tags.protection.none"}}</td></tr> {{end}} </tbody> </table> diff --git a/templates/repo/settings/webhook/base.tmpl b/templates/repo/settings/webhook/base.tmpl index d524722454..39bb7a9fe0 100644 --- a/templates/repo/settings/webhook/base.tmpl +++ b/templates/repo/settings/webhook/base.tmpl @@ -1,5 +1,5 @@ {{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings webhooks")}} <div class="repo-setting-content"> - {{template "repo/settings/webhook/list" .}} + {{template "repo/settings/webhook/base_list" .}} </div> {{template "repo/settings/layout_footer" .}} diff --git a/templates/repo/settings/webhook/base_list.tmpl b/templates/repo/settings/webhook/base_list.tmpl index 36e75a7eb5..a808d4122f 100644 --- a/templates/repo/settings/webhook/base_list.tmpl +++ b/templates/repo/settings/webhook/base_list.tmpl @@ -8,18 +8,19 @@ </div> </h4> <div class="ui attached segment"> - <div class="ui list"> - <div class="item"> - {{.Description}} - </div> + <div class="ui list flex-items-block"> + <div class="item"><span>{{.Description}}</span></div> {{range .Webhooks}} - <div class="item truncated-item-container"> - <span class="text {{if eq .LastStatus 1}}green{{else if eq .LastStatus 2}}red{{else}}grey{{end}} tw-mr-2">{{svg "octicon-dot-fill" 22}}</span> - <div class="text truncate tw-flex-1 tw-mr-2"> + <div class="item"> + <span class="text {{if eq .LastStatus 1}}green{{else if eq .LastStatus 2}}red{{else}}grey{{end}}">{{svg "octicon-dot-fill" 22}}</span> + <div class="gt-ellipsis tw-flex-1"> <a title="{{.URL}}" href="{{$.BaseLink}}/{{.ID}}">{{.URL}}</a> </div> <a class="muted tw-p-2" href="{{$.BaseLink}}/{{.ID}}">{{svg "octicon-pencil"}}</a> - <a class="delete-button tw-p-2" data-url="{{$.Link}}/delete" data-id="{{.ID}}">{{svg "octicon-trash"}}</a> + <a class="text red tw-p-2 link-action" + data-url="{{$.Link}}/delete?id={{.ID}}" + data-modal-confirm="{{ctx.Locale.Tr "repo.settings.webhook_deletion_desc"}}" + >{{svg "octicon-trash"}}</a> </div> {{end}} </div> diff --git a/templates/repo/settings/webhook/delete_modal.tmpl b/templates/repo/settings/webhook/delete_modal.tmpl deleted file mode 100644 index 9955ed3a2f..0000000000 --- a/templates/repo/settings/webhook/delete_modal.tmpl +++ /dev/null @@ -1,10 +0,0 @@ -<div class="ui g-modal-confirm delete modal"> - <div class="header"> - {{svg "octicon-trash"}} - {{ctx.Locale.Tr "repo.settings.webhook_deletion"}} - </div> - <div class="content"> - <p>{{ctx.Locale.Tr "repo.settings.webhook_deletion_desc"}}</p> - </div> - {{template "base/modal_actions_confirm" .}} -</div> diff --git a/templates/repo/settings/webhook/dingtalk.tmpl b/templates/repo/settings/webhook/dingtalk.tmpl index 0ba99e98ee..dd208cde17 100644 --- a/templates/repo/settings/webhook/dingtalk.tmpl +++ b/templates/repo/settings/webhook/dingtalk.tmpl @@ -6,6 +6,7 @@ <label for="payload_url">{{ctx.Locale.Tr "repo.settings.payload_url"}}</label> <input id="payload_url" name="payload_url" type="url" value="{{.Webhook.URL}}" autofocus required> </div> - {{template "repo/settings/webhook/settings" .}} + {{/* FIXME: support authorization header or not? */}} + {{template "repo/settings/webhook/settings" dict "BaseLink" .BaseLink "Webhook" .Webhook "UseAuthorizationHeader" "optional"}} </form> {{end}} diff --git a/templates/repo/settings/webhook/discord.tmpl b/templates/repo/settings/webhook/discord.tmpl index 104346e042..fa66249fa5 100644 --- a/templates/repo/settings/webhook/discord.tmpl +++ b/templates/repo/settings/webhook/discord.tmpl @@ -14,6 +14,7 @@ <label for="icon_url">{{ctx.Locale.Tr "repo.settings.discord_icon_url"}}</label> <input id="icon_url" name="icon_url" value="{{.DiscordHook.IconURL}}" placeholder="https://example.com/assets/img/logo.svg"> </div> - {{template "repo/settings/webhook/settings" .}} + {{/* FIXME: support authorization header or not? */}} + {{template "repo/settings/webhook/settings" dict "BaseLink" .BaseLink "Webhook" .Webhook "UseAuthorizationHeader" "optional"}} </form> {{end}} diff --git a/templates/repo/settings/webhook/feishu.tmpl b/templates/repo/settings/webhook/feishu.tmpl index d80deab26f..13bd0d92a1 100644 --- a/templates/repo/settings/webhook/feishu.tmpl +++ b/templates/repo/settings/webhook/feishu.tmpl @@ -1,12 +1,14 @@ {{if eq .HookType "feishu"}} - <p>{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://feishu.cn" (ctx.Locale.Tr "repo.settings.web_hook_name_feishu")}}</p> - <p>{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://larksuite.com" (ctx.Locale.Tr "repo.settings.web_hook_name_larksuite")}}</p> + <p> + {{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://feishu.cn" (ctx.Locale.Tr "repo.settings.web_hook_name_feishu")}} + {{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://larksuite.com" (ctx.Locale.Tr "repo.settings.web_hook_name_larksuite")}} + </p> <form class="ui form" action="{{.BaseLink}}/feishu/{{or .Webhook.ID "new"}}" method="post"> {{.CsrfTokenHtml}} <div class="required field {{if .Err_PayloadURL}}error{{end}}"> <label for="payload_url">{{ctx.Locale.Tr "repo.settings.payload_url"}}</label> <input id="payload_url" name="payload_url" type="url" value="{{.Webhook.URL}}" autofocus required> </div> - {{template "repo/settings/webhook/settings" .}} + {{template "repo/settings/webhook/settings" dict "BaseLink" .BaseLink "Webhook" .Webhook "UseRequestSecret" "optional"}} </form> {{end}} diff --git a/templates/repo/settings/webhook/gitea.tmpl b/templates/repo/settings/webhook/gitea.tmpl index e6eb61ea92..30f14d609b 100644 --- a/templates/repo/settings/webhook/gitea.tmpl +++ b/templates/repo/settings/webhook/gitea.tmpl @@ -31,10 +31,11 @@ </div> </div> </div> - <div class="field {{if .Err_Secret}}error{{end}}"> - <label for="secret">{{ctx.Locale.Tr "repo.settings.secret"}}</label> - <input id="secret" name="secret" type="password" value="{{.Webhook.Secret}}" autocomplete="off"> - </div> - {{template "repo/settings/webhook/settings" .}} + {{template "repo/settings/webhook/settings" dict + "BaseLink" .BaseLink + "Webhook" .Webhook + "UseAuthorizationHeader" "optional" + "UseRequestSecret" "optional" + }} </form> {{end}} diff --git a/templates/repo/settings/webhook/gogs.tmpl b/templates/repo/settings/webhook/gogs.tmpl index e91a3279e4..c0e054602a 100644 --- a/templates/repo/settings/webhook/gogs.tmpl +++ b/templates/repo/settings/webhook/gogs.tmpl @@ -19,10 +19,11 @@ </div> </div> </div> - <div class="field {{if .Err_Secret}}error{{end}}"> - <label for="secret">{{ctx.Locale.Tr "repo.settings.secret"}}</label> - <input id="secret" name="secret" type="password" value="{{.Webhook.Secret}}" autocomplete="off"> - </div> - {{template "repo/settings/webhook/settings" .}} + {{template "repo/settings/webhook/settings" dict + "BaseLink" .BaseLink + "Webhook" .Webhook + "UseAuthorizationHeader" "optional" + "UseRequestSecret" "optional" + }} </form> {{end}} diff --git a/templates/repo/settings/webhook/history.tmpl b/templates/repo/settings/webhook/history.tmpl index ea3c037813..953ba69670 100644 --- a/templates/repo/settings/webhook/history.tmpl +++ b/templates/repo/settings/webhook/history.tmpl @@ -26,7 +26,7 @@ {{else}} <span class="text red">{{svg "octicon-alert"}}</span> {{end}} - <a class="ui primary sha label toggle button show-panel" data-panel="#info-{{.ID}}">{{.UUID}}</a> + <button class="btn interact-bg tw-p-2 toggle show-panel" data-panel="#info-{{.ID}}">{{.UUID}}</button> </div> <span class="text grey"> {{DateUtils.TimeSince .Delivered}} diff --git a/templates/repo/settings/webhook/list.tmpl b/templates/repo/settings/webhook/list.tmpl deleted file mode 100644 index b24159fccb..0000000000 --- a/templates/repo/settings/webhook/list.tmpl +++ /dev/null @@ -1,4 +0,0 @@ - -{{template "repo/settings/webhook/base_list" .}} - -{{template "repo/settings/webhook/delete_modal" .}} diff --git a/templates/repo/settings/webhook/matrix.tmpl b/templates/repo/settings/webhook/matrix.tmpl index 7f1c9f08e6..e0aad2d807 100644 --- a/templates/repo/settings/webhook/matrix.tmpl +++ b/templates/repo/settings/webhook/matrix.tmpl @@ -22,6 +22,6 @@ </div> </div> </div> - {{template "repo/settings/webhook/settings" .}} + {{template "repo/settings/webhook/settings" dict "BaseLink" .BaseLink "Webhook" .Webhook "UseAuthorizationHeader" "required"}} </form> {{end}} diff --git a/templates/repo/settings/webhook/msteams.tmpl b/templates/repo/settings/webhook/msteams.tmpl index 62ea24e763..17718a1064 100644 --- a/templates/repo/settings/webhook/msteams.tmpl +++ b/templates/repo/settings/webhook/msteams.tmpl @@ -6,6 +6,7 @@ <label for="payload_url">{{ctx.Locale.Tr "repo.settings.payload_url"}}</label> <input id="payload_url" name="payload_url" type="url" value="{{.Webhook.URL}}" autofocus required> </div> - {{template "repo/settings/webhook/settings" .}} + {{/* FIXME: support authorization header or not? */}} + {{template "repo/settings/webhook/settings" dict "BaseLink" .BaseLink "Webhook" .Webhook "UseAuthorizationHeader" "optional"}} </form> {{end}} diff --git a/templates/repo/settings/webhook/packagist.tmpl b/templates/repo/settings/webhook/packagist.tmpl index 25aba2a435..c813e7c2af 100644 --- a/templates/repo/settings/webhook/packagist.tmpl +++ b/templates/repo/settings/webhook/packagist.tmpl @@ -14,6 +14,7 @@ <label for="package_url">{{ctx.Locale.Tr "repo.settings.packagist_package_url"}}</label> <input id="package_url" name="package_url" value="{{.PackagistHook.PackageURL}}" placeholder="https://packagist.org/packages/laravel/framework" required> </div> - {{template "repo/settings/webhook/settings" .}} + {{/* FIXME: support authorization header or not? */}} + {{template "repo/settings/webhook/settings" dict "BaseLink" .BaseLink "Webhook" .Webhook "UseAuthorizationHeader" "optional"}} </form> {{end}} diff --git a/templates/repo/settings/webhook/settings.tmpl b/templates/repo/settings/webhook/settings.tmpl index cf3b0eb053..a8ad1d6c9e 100644 --- a/templates/repo/settings/webhook/settings.tmpl +++ b/templates/repo/settings/webhook/settings.tmpl @@ -1,4 +1,52 @@ -{{$isNew:=or .PageIsSettingsHooksNew .PageIsAdminDefaultHooksNew .PageIsAdminSystemHooksNew}} +{{/* Template attributes: +- BaseLink: Base URL for the repository settings +- WebHook: Webhook object containing details about the webhook +- UseAuthorizationHeader: optional or required +- UseRequestSecret: optional or required +*/}} +{{$isNew := not .Webhook.ID}} + +<div class="inline field"> + <div class="ui checkbox"> + <input name="active" type="checkbox" {{if or $isNew .Webhook.IsActive}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.active"}}</label> + <span class="help">{{ctx.Locale.Tr "repo.settings.active_helper"}}</span> + </div> +</div> + +<!-- Authorization Header --> +{{if .UseAuthorizationHeader}} + {{$attributeValid := or (eq .UseAuthorizationHeader "optional") (eq .UseAuthorizationHeader "required")}} + {{if not $attributeValid}}<div class="ui error message">Invalid UseAuthorizationHeader: {{.UseAuthorizationHeader}}}</div>{{end}} + {{$required := eq .UseAuthorizationHeader "required"}} + <div class="field {{if $required}}required{{end}}"> + <label>{{ctx.Locale.Tr "repo.settings.authorization_header"}}</label> + <input name="authorization_header" type="text" value="{{.Webhook.HeaderAuthorization}}" {{if $required}}required placeholder="Bearer $access_token"{{end}}> + {{if not $required}} + <span class="help">{{ctx.Locale.Tr "repo.settings.authorization_header_desc" (HTMLFormat "<code>%s</code>, <code>%s</code>" "Bearer token123456" "Basic YWxhZGRpbjpvcGVuc2VzYW1l")}}</span> + {{end}} + </div> +{{end}} + +<!-- Secret --> +{{if .UseRequestSecret}} + {{$attributeValid := or (eq .UseRequestSecret "optional") (eq .UseRequestSecret "required")}} + {{if not $attributeValid}}<div class="ui error message">Invalid UseRequestSecret: {{.UseRequestSecret}}}</div>{{end}} + {{$required := eq .UseRequestSecret "required"}} + <div class="field {{if $required}}required{{end}}"> + <label>{{ctx.Locale.Tr "repo.settings.secret"}}</label> + <input name="secret" type="password" value="{{.Webhook.Secret}}" autocomplete="off" {{if $required}}required{{end}}> + <span class="help">{{ctx.Locale.Tr "repo.settings.webhook_secret_desc"}}</span> + </div> +{{end}} + +<!-- Branch filter --> +<div class="field"> + <label>{{ctx.Locale.Tr "repo.settings.branch_filter"}}</label> + <input name="branch_filter" type="text" value="{{or .Webhook.BranchFilter "*"}}"> + <span class="help">{{ctx.Locale.Tr "repo.settings.branch_filter_desc" "https://pkg.go.dev/github.com/gobwas/glob#Compile" "github.com/gobwas/glob"}}</span> +</div> + <div class="field"> <h4>{{ctx.Locale.Tr "repo.settings.event_desc"}}</h4> <div class="grouped event type fields"> @@ -31,7 +79,7 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="create" type="checkbox" {{if .Webhook.Create}}checked{{end}}> + <input name="create" type="checkbox" {{if .Webhook.HookEvents.Get "create"}}checked{{end}}> <label>{{ctx.Locale.Tr "repo.settings.event_create"}}</label> <span class="help">{{ctx.Locale.Tr "repo.settings.event_create_desc"}}</span> </div> @@ -41,7 +89,7 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="delete" type="checkbox" {{if .Webhook.Delete}}checked{{end}}> + <input name="delete" type="checkbox" {{if .Webhook.HookEvents.Get "delete"}}checked{{end}}> <label>{{ctx.Locale.Tr "repo.settings.event_delete"}}</label> <span class="help">{{ctx.Locale.Tr "repo.settings.event_delete_desc"}}</span> </div> @@ -51,7 +99,7 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="fork" type="checkbox" {{if .Webhook.Fork}}checked{{end}}> + <input name="fork" type="checkbox" {{if .Webhook.HookEvents.Get "fork"}}checked{{end}}> <label>{{ctx.Locale.Tr "repo.settings.event_fork"}}</label> <span class="help">{{ctx.Locale.Tr "repo.settings.event_fork_desc"}}</span> </div> @@ -61,7 +109,7 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="push" type="checkbox" {{if .Webhook.Push}}checked{{end}}> + <input name="push" type="checkbox" {{if .Webhook.HookEvents.Get "push"}}checked{{end}}> <label>{{ctx.Locale.Tr "repo.settings.event_push"}}</label> <span class="help">{{ctx.Locale.Tr "repo.settings.event_push_desc"}}</span> </div> @@ -71,7 +119,7 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="repository" type="checkbox" {{if .Webhook.Repository}}checked{{end}}> + <input name="repository" type="checkbox" {{if .Webhook.HookEvents.Get "repository"}}checked{{end}}> <label>{{ctx.Locale.Tr "repo.settings.event_repository"}}</label> <span class="help">{{ctx.Locale.Tr "repo.settings.event_repository_desc"}}</span> </div> @@ -81,7 +129,7 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="release" type="checkbox" {{if .Webhook.Release}}checked{{end}}> + <input name="release" type="checkbox" {{if .Webhook.HookEvents.Get "release"}}checked{{end}}> <label>{{ctx.Locale.Tr "repo.settings.event_release"}}</label> <span class="help">{{ctx.Locale.Tr "repo.settings.event_release_desc"}}</span> </div> @@ -91,7 +139,7 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="package" type="checkbox" {{if .Webhook.Package}}checked{{end}}> + <input name="package" type="checkbox" {{if .Webhook.HookEvents.Get "package"}}checked{{end}}> <label>{{ctx.Locale.Tr "repo.settings.event_package"}}</label> <span class="help">{{ctx.Locale.Tr "repo.settings.event_package_desc"}}</span> </div> @@ -102,13 +150,24 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="wiki" type="checkbox" {{if .Webhook.Wiki}}checked{{end}}> + <input name="wiki" type="checkbox" {{if .Webhook.HookEvents.Get "wiki"}}checked{{end}}> <label>{{ctx.Locale.Tr "repo.settings.event_wiki"}}</label> <span class="help">{{ctx.Locale.Tr "repo.settings.event_wiki_desc"}}</span> </div> </div> </div> + <!-- Status --> + <div class="seven wide column"> + <div class="field"> + <div class="ui checkbox"> + <input name="status" type="checkbox" {{if .Webhook.HookEvents.Get "status"}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.event_statuses"}}</label> + <span class="help">{{ctx.Locale.Tr "repo.settings.event_statuses_desc"}}</span> + </div> + </div> + </div> + <!-- Issue Events --> <div class="fourteen wide column"> <label>{{ctx.Locale.Tr "repo.settings.event_header_issue"}}</label> @@ -117,7 +176,7 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="issues" type="checkbox" {{if .Webhook.Issues}}checked{{end}}> + <input name="issues" type="checkbox" {{if .Webhook.HookEvents.Get "issues"}}checked{{end}}> <label>{{ctx.Locale.Tr "repo.settings.event_issues"}}</label> <span class="help">{{ctx.Locale.Tr "repo.settings.event_issues_desc"}}</span> </div> @@ -127,7 +186,7 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="issue_assign" type="checkbox" {{if .Webhook.IssueAssign}}checked{{end}}> + <input name="issue_assign" type="checkbox" {{if .Webhook.HookEvents.Get "issue_assign"}}checked{{end}}> <label>{{ctx.Locale.Tr "repo.settings.event_issue_assign"}}</label> <span class="help">{{ctx.Locale.Tr "repo.settings.event_issue_assign_desc"}}</span> </div> @@ -137,7 +196,7 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="issue_label" type="checkbox" {{if .Webhook.IssueLabel}}checked{{end}}> + <input name="issue_label" type="checkbox" {{if .Webhook.HookEvents.Get "issue_label"}}checked{{end}}> <label>{{ctx.Locale.Tr "repo.settings.event_issue_label"}}</label> <span class="help">{{ctx.Locale.Tr "repo.settings.event_issue_label_desc"}}</span> </div> @@ -147,7 +206,7 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="issue_milestone" type="checkbox" {{if .Webhook.IssueMilestone}}checked{{end}}> + <input name="issue_milestone" type="checkbox" {{if .Webhook.HookEvents.Get "issue_milestone"}}checked{{end}}> <label>{{ctx.Locale.Tr "repo.settings.event_issue_milestone"}}</label> <span class="help">{{ctx.Locale.Tr "repo.settings.event_issue_milestone_desc"}}</span> </div> @@ -157,7 +216,7 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="issue_comment" type="checkbox" {{if .Webhook.IssueComment}}checked{{end}}> + <input name="issue_comment" type="checkbox" {{if .Webhook.HookEvents.Get "issue_comment"}}checked{{end}}> <label>{{ctx.Locale.Tr "repo.settings.event_issue_comment"}}</label> <span class="help">{{ctx.Locale.Tr "repo.settings.event_issue_comment_desc"}}</span> </div> @@ -172,7 +231,7 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="pull_request" type="checkbox" {{if .Webhook.PullRequest}}checked{{end}}> + <input name="pull_request" type="checkbox" {{if .Webhook.HookEvents.Get "pull_request"}}checked{{end}}> <label>{{ctx.Locale.Tr "repo.settings.event_pull_request"}}</label> <span class="help">{{ctx.Locale.Tr "repo.settings.event_pull_request_desc"}}</span> </div> @@ -182,7 +241,7 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="pull_request_assign" type="checkbox" {{if .Webhook.PullRequestAssign}}checked{{end}}> + <input name="pull_request_assign" type="checkbox" {{if .Webhook.HookEvents.Get "pull_request_assign"}}checked{{end}}> <label>{{ctx.Locale.Tr "repo.settings.event_pull_request_assign"}}</label> <span class="help">{{ctx.Locale.Tr "repo.settings.event_pull_request_assign_desc"}}</span> </div> @@ -192,7 +251,7 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="pull_request_label" type="checkbox" {{if .Webhook.PullRequestLabel}}checked{{end}}> + <input name="pull_request_label" type="checkbox" {{if .Webhook.HookEvents.Get "pull_request_label"}}checked{{end}}> <label>{{ctx.Locale.Tr "repo.settings.event_pull_request_label"}}</label> <span class="help">{{ctx.Locale.Tr "repo.settings.event_pull_request_label_desc"}}</span> </div> @@ -202,7 +261,7 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="pull_request_milestone" type="checkbox" {{if .Webhook.PullRequestMilestone}}checked{{end}}> + <input name="pull_request_milestone" type="checkbox" {{if .Webhook.HookEvents.Get "pull_request_milestone"}}checked{{end}}> <label>{{ctx.Locale.Tr "repo.settings.event_pull_request_milestone"}}</label> <span class="help">{{ctx.Locale.Tr "repo.settings.event_pull_request_milestone_desc"}}</span> </div> @@ -212,7 +271,7 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="pull_request_comment" type="checkbox" {{if .Webhook.PullRequestComment}}checked{{end}}> + <input name="pull_request_comment" type="checkbox" {{if .Webhook.HookEvents.Get "pull_request_comment"}}checked{{end}}> <label>{{ctx.Locale.Tr "repo.settings.event_pull_request_comment"}}</label> <span class="help">{{ctx.Locale.Tr "repo.settings.event_pull_request_comment_desc"}}</span> </div> @@ -222,7 +281,7 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="pull_request_review" type="checkbox" {{if .Webhook.PullRequestReview}}checked{{end}}> + <input name="pull_request_review" type="checkbox" {{if .Webhook.HookEvents.Get "pull_request_review"}}checked{{end}}> <label>{{ctx.Locale.Tr "repo.settings.event_pull_request_review"}}</label> <span class="help">{{ctx.Locale.Tr "repo.settings.event_pull_request_review_desc"}}</span> </div> @@ -232,7 +291,7 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="pull_request_sync" type="checkbox" {{if .Webhook.PullRequestSync}}checked{{end}}> + <input name="pull_request_sync" type="checkbox" {{if .Webhook.HookEvents.Get "pull_request_sync"}}checked{{end}}> <label>{{ctx.Locale.Tr "repo.settings.event_pull_request_sync"}}</label> <span class="help">{{ctx.Locale.Tr "repo.settings.event_pull_request_sync_desc"}}</span> </div> @@ -242,47 +301,47 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="pull_request_review_request" type="checkbox" {{if .Webhook.PullRequestReviewRequest}}checked{{end}}> + <input name="pull_request_review_request" type="checkbox" {{if .Webhook.HookEvents.Get "pull_request_review_request"}}checked{{end}}> <label>{{ctx.Locale.Tr "repo.settings.event_pull_request_review_request"}}</label> <span class="help">{{ctx.Locale.Tr "repo.settings.event_pull_request_review_request_desc"}}</span> </div> </div> </div> + <!-- Workflow Events --> + <div class="fourteen wide column"> + <label>{{ctx.Locale.Tr "repo.settings.event_header_workflow"}}</label> + </div> + <!-- Workflow Run Event --> + <div class="seven wide column"> + <div class="field"> + <div class="ui checkbox"> + <input name="workflow_run" type="checkbox" {{if .Webhook.HookEvents.Get "workflow_run"}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.event_workflow_run"}}</label> + <span class="help">{{ctx.Locale.Tr "repo.settings.event_workflow_run_desc"}}</span> + </div> + </div> + </div> + <!-- Workflow Job Event --> + <div class="seven wide column"> + <div class="field"> + <div class="ui checkbox"> + <input name="workflow_job" type="checkbox" {{if .Webhook.HookEvents.Get "workflow_job"}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.event_workflow_job"}}</label> + <span class="help">{{ctx.Locale.Tr "repo.settings.event_workflow_job_desc"}}</span> + </div> + </div> + </div> </div> </div> -<!-- Branch filter --> -<div class="field"> - <label for="branch_filter">{{ctx.Locale.Tr "repo.settings.branch_filter"}}</label> - <input id="branch_filter" name="branch_filter" type="text" value="{{or .Webhook.BranchFilter "*"}}"> - <span class="help">{{ctx.Locale.Tr "repo.settings.branch_filter_desc" "https://pkg.go.dev/github.com/gobwas/glob#Compile" "github.com/gobwas/glob"}}</span> -</div> - -<!-- Authorization Header --> -<div class="field{{if eq .HookType "matrix"}} required{{end}}"> - <label for="authorization_header">{{ctx.Locale.Tr "repo.settings.authorization_header"}}</label> - <input id="authorization_header" name="authorization_header" type="text" value="{{.Webhook.HeaderAuthorization}}"{{if eq .HookType "matrix"}} placeholder="Bearer $access_token" required{{end}}> - {{if ne .HookType "matrix"}}{{/* Matrix doesn't make the authorization optional but it is implied by the help string, should be changed.*/}} - <span class="help">{{ctx.Locale.Tr "repo.settings.authorization_header_desc" ("<code>Bearer token123456</code>, <code>Basic YWxhZGRpbjpvcGVuc2VzYW1l</code>" | SafeHTML)}}</span> - {{end}} -</div> - -<div class="divider"></div> - -<div class="inline field"> - <div class="ui checkbox"> - <input name="active" type="checkbox" {{if or $isNew .Webhook.IsActive}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.settings.active"}}</label> - <span class="help">{{ctx.Locale.Tr "repo.settings.active_helper"}}</span> - </div> -</div> <div class="field"> {{if $isNew}} <button class="ui primary button">{{ctx.Locale.Tr "repo.settings.add_webhook"}}</button> {{else}} <button class="ui primary button">{{ctx.Locale.Tr "repo.settings.update_webhook"}}</button> - <a class="ui red delete-button button" data-url="{{.BaseLink}}/delete" data-id="{{.Webhook.ID}}">{{ctx.Locale.Tr "repo.settings.delete_webhook"}}</a> + <a class="ui red button link-action" + data-url="{{.BaseLink}}/delete?id={{.Webhook.ID}}" + data-modal-confirm="{{ctx.Locale.Tr "repo.settings.webhook_deletion_desc"}}" + >{{ctx.Locale.Tr "repo.settings.delete_webhook"}}</a> {{end}} </div> - -{{template "repo/settings/webhook/delete_modal" .}} diff --git a/templates/repo/settings/webhook/slack.tmpl b/templates/repo/settings/webhook/slack.tmpl index e7cae92d4b..519d6afa1a 100644 --- a/templates/repo/settings/webhook/slack.tmpl +++ b/templates/repo/settings/webhook/slack.tmpl @@ -23,6 +23,7 @@ <label for="color">{{ctx.Locale.Tr "repo.settings.slack_color"}}</label> <input id="color" name="color" value="{{.SlackHook.Color}}" placeholder="#dd4b39, good, warning, danger"> </div> - {{template "repo/settings/webhook/settings" .}} + {{/* FIXME: support authorization header or not? */}} + {{template "repo/settings/webhook/settings" dict "BaseLink" .BaseLink "Webhook" .Webhook "UseAuthorizationHeader" "optional"}} </form> {{end}} diff --git a/templates/repo/settings/webhook/telegram.tmpl b/templates/repo/settings/webhook/telegram.tmpl index f92c2be0db..5ab89b72cc 100644 --- a/templates/repo/settings/webhook/telegram.tmpl +++ b/templates/repo/settings/webhook/telegram.tmpl @@ -14,6 +14,7 @@ <label for="thread_id">{{ctx.Locale.Tr "repo.settings.thread_id"}}</label> <input id="thread_id" name="thread_id" type="text" value="{{.TelegramHook.ThreadID}}"> </div> - {{template "repo/settings/webhook/settings" .}} + {{/* FIXME: support authorization header or not? */}} + {{template "repo/settings/webhook/settings" dict "BaseLink" .BaseLink "Webhook" .Webhook "UseAuthorizationHeader" "optional"}} </form> {{end}} diff --git a/templates/repo/settings/webhook/wechatwork.tmpl b/templates/repo/settings/webhook/wechatwork.tmpl index 78a1617123..cbc29b4610 100644 --- a/templates/repo/settings/webhook/wechatwork.tmpl +++ b/templates/repo/settings/webhook/wechatwork.tmpl @@ -6,6 +6,7 @@ <label for="payload_url">{{ctx.Locale.Tr "repo.settings.payload_url"}}</label> <input id="payload_url" name="payload_url" type="url" value="{{.Webhook.URL}}" autofocus required> </div> - {{template "repo/settings/webhook/settings" .}} + {{/* FIXME: support authorization header or not? */}} + {{template "repo/settings/webhook/settings" dict "BaseLink" .BaseLink "Webhook" .Webhook "UseAuthorizationHeader" "optional"}} </form> {{end}} diff --git a/templates/repo/star_unstar.tmpl b/templates/repo/star_unstar.tmpl index 9234a0d196..dea965ab30 100644 --- a/templates/repo/star_unstar.tmpl +++ b/templates/repo/star_unstar.tmpl @@ -1,10 +1,10 @@ -<form hx-boost="true" hx-target="this" method="post" action="{{$.RepoLink}}/action/{{if $.IsStaringRepo}}unstar{{else}}star{{end}}"> +<form class="flex-text-inline" hx-boost="true" hx-target="this" method="post" action="{{$.RepoLink}}/action/{{if $.IsStaringRepo}}unstar{{else}}star{{end}}"> <div class="ui labeled button" {{if not $.IsSigned}}data-tooltip-content="{{ctx.Locale.Tr "repo.star_guest_user"}}"{{end}}> {{$buttonText := ctx.Locale.Tr "repo.star"}} {{if $.IsStaringRepo}}{{$buttonText = ctx.Locale.Tr "repo.unstar"}}{{end}} <button type="submit" class="ui compact small basic button"{{if not $.IsSigned}} disabled{{end}} aria-label="{{$buttonText}}"> {{svg (Iif $.IsStaringRepo "octicon-star-fill" "octicon-star")}} - <span aria-hidden="true">{{$buttonText}}</span> + <span class="not-mobile" aria-hidden="true">{{$buttonText}}</span> </button> <a hx-boost="false" class="ui basic label" href="{{$.RepoLink}}/stars"> {{CountFmt .Repository.NumStars}} diff --git a/templates/repo/sub_menu.tmpl b/templates/repo/sub_menu.tmpl index ccb98b94ad..66ab86cb55 100644 --- a/templates/repo/sub_menu.tmpl +++ b/templates/repo/sub_menu.tmpl @@ -1,8 +1,8 @@ {{if and (not .HideRepoInfo) (not .IsBlame)}} -<div class="ui segments repository-summary tw-mt-1 tw-mb-0"> +<div class="ui segments repository-summary tw-my-0"> <div class="ui segment sub-menu repository-menu"> {{if and (.Permission.CanRead ctx.Consts.RepoUnitTypeCode) (not .IsEmptyRepo)}} - <a class="item muted {{if .PageIsCommits}}active{{end}}" href="{{.RepoLink}}/commits/{{.BranchNameSubURL}}"> + <a class="item muted {{if .PageIsCommits}}active{{end}}" href="{{.RepoLink}}/commits/{{.RefFullName.RefWebLinkPath}}"> {{svg "octicon-history"}} <b>{{ctx.Locale.PrettyNumber .CommitsCount}}</b> {{ctx.Locale.TrN .CommitsCount "repo.commit" "repo.commits"}} </a> <a class="item muted {{if .PageIsBranches}}active{{end}}" href="{{.RepoLink}}/branches"> @@ -13,11 +13,6 @@ {{svg "octicon-tag"}} <b>{{ctx.Locale.PrettyNumber .NumTags}}</b> {{ctx.Locale.TrN .NumTags "repo.tag" "repo.tags"}} </a> {{end}} - <span class="item not-mobile" {{if not (eq .Repository.Size 0)}}data-tooltip-placement="top" data-tooltip-content="{{.Repository.SizeDetailsString}}"{{end}}> - {{$fileSizeFormatted := FileSize .Repository.Size}}{{/* the formatted string is always "{val} {unit}" */}} - {{$fileSizeFields := StringUtils.Split $fileSizeFormatted " "}} - {{svg "octicon-database"}} <b>{{ctx.Locale.PrettyNumber (index $fileSizeFields 0)}}</b> {{index $fileSizeFields 1}} - </span> {{end}} </div> </div> diff --git a/templates/repo/tag/list.tmpl b/templates/repo/tag/list.tmpl index 9789943b49..8b33b96f86 100644 --- a/templates/repo/tag/list.tmpl +++ b/templates/repo/tag/list.tmpl @@ -5,9 +5,7 @@ {{template "base/alert" .}} {{template "repo/release_tag_header" .}} <h4 class="ui top attached header"> - <div class="five wide column tw-flex tw-items-center"> - {{.TagCount}} {{ctx.Locale.Tr "repo.release.tags"}} - </div> + {{.TagCount}} {{ctx.Locale.Tr "repo.release.tags"}} </h4> {{$canReadReleases := $.Permission.CanRead ctx.Consts.RepoUnitTypeReleases}} <div class="ui attached segment"> @@ -15,53 +13,49 @@ {{template "shared/search/combo" dict "Value" .Keyword "Placeholder" (ctx.Locale.Tr "search.tag_kind") "Tooltip" (ctx.Locale.Tr "search.tag_tooltip")}} </form> </div> - <div class="ui attached table segment"> + <div class="ui attached segment tw-p-0"> {{if .Releases}} - <table class="ui very basic striped fixed table single line" id="tags-table"> - <tbody class="tag-list"> - {{range $idx, $release := .Releases}} - <tr> - <td class="tag-list-row"> - <h3 class="tag-list-row-title tw-mb-2"> - {{if $canReadReleases}} - <a class="tag-list-row-link tw-flex tw-items-center" href="{{$.RepoLink}}/releases/tag/{{.TagName | PathEscapeSegments}}" rel="nofollow">{{.TagName}}</a> - {{else}} - <a class="tag-list-row-link tw-flex tw-items-center" href="{{$.RepoLink}}/src/tag/{{.TagName | PathEscapeSegments}}" rel="nofollow">{{.TagName}}</a> - {{end}} - </h3> - <div class="download tw-flex tw-items-center"> - {{if $.Permission.CanRead ctx.Consts.RepoUnitTypeCode}} - {{if .CreatedUnix}} - <span class="tw-mr-2">{{svg "octicon-clock" 16 "tw-mr-1"}}{{DateUtils.TimeSince .CreatedUnix}}</span> - {{end}} + <div class="ui divided list" id="tags-table"> + {{range $idx, $release := .Releases}} + <div class="item tag-list-row tw-p-4"> + <h3 class="tag-list-row-title tw-mb-2"> + {{if $canReadReleases}} + <a class="tag-list-row-link" href="{{$.RepoLink}}/releases/tag/{{.TagName | PathEscapeSegments}}" rel="nofollow">{{.TagName}}</a> + {{else}} + <a class="tag-list-row-link" href="{{$.RepoLink}}/src/tag/{{.TagName | PathEscapeSegments}}" rel="nofollow">{{.TagName}}</a> + {{end}} + </h3> + <div class="flex-text-block muted-links tw-gap-4 tw-flex-wrap"> + {{if $.Permission.CanRead ctx.Consts.RepoUnitTypeCode}} + {{if .CreatedUnix}} + <span class="flex-text-inline">{{svg "octicon-clock"}}{{DateUtils.TimeSince .CreatedUnix}}</span> + {{end}} - <a class="tw-mr-2 tw-font-mono muted" href="{{$.RepoLink}}/src/commit/{{.Sha1}}" rel="nofollow">{{svg "octicon-git-commit" 16 "tw-mr-1"}}{{ShortSha .Sha1}}</a> + <a class="flex-text-inline tw-font-mono" href="{{$.RepoLink}}/src/commit/{{.Sha1}}" rel="nofollow">{{svg "octicon-git-commit"}}{{ShortSha .Sha1}}</a> - {{if not $.DisableDownloadSourceArchives}} - <a class="archive-link tw-mr-2 muted" href="{{$.RepoLink}}/archive/{{.TagName | PathEscapeSegments}}.zip" rel="nofollow">{{svg "octicon-file-zip" 16 "tw-mr-1"}}ZIP</a> - <a class="archive-link tw-mr-2 muted" href="{{$.RepoLink}}/archive/{{.TagName | PathEscapeSegments}}.tar.gz" rel="nofollow">{{svg "octicon-file-zip" 16 "tw-mr-1"}}TAR.GZ</a> - {{end}} + {{if not $.DisableDownloadSourceArchives}} + <a class="archive-link flex-text-inline" href="{{$.RepoLink}}/archive/{{.TagName | PathEscapeSegments}}.zip" rel="nofollow">{{svg "octicon-file-zip"}}ZIP</a> + <a class="archive-link flex-text-inline" href="{{$.RepoLink}}/archive/{{.TagName | PathEscapeSegments}}.tar.gz" rel="nofollow">{{svg "octicon-file-zip"}}TAR.GZ</a> + {{end}} - {{if (and $canReadReleases $.CanCreateRelease $release.IsTag)}} - <a class="tw-mr-2 muted" href="{{$.RepoLink}}/releases/new?tag={{.TagName}}">{{svg "octicon-tag" 16 "tw-mr-1"}}{{ctx.Locale.Tr "repo.release.new_release"}}</a> - {{end}} + {{if (and $canReadReleases $.CanCreateRelease $release.IsTag)}} + <a class="flex-text-inline" href="{{$.RepoLink}}/releases/new?tag={{.TagName}}">{{svg "octicon-tag"}}{{ctx.Locale.Tr "repo.release.new_release"}}</a> + {{end}} - {{if (and ($.Permission.CanWrite ctx.Consts.RepoUnitTypeCode) $release.IsTag)}} - <a class="ui delete-button tw-mr-2 muted" data-url="{{$.RepoLink}}/tags/delete" data-id="{{.ID}}"> - {{svg "octicon-trash" 16 "tw-mr-1"}}{{ctx.Locale.Tr "repo.release.delete_tag"}} - </a> - {{end}} + {{if (and ($.Permission.CanWrite ctx.Consts.RepoUnitTypeCode) $release.IsTag)}} + <a class="flex-text-inline link-action" data-url="{{$.RepoLink}}/tags/delete?id={{.ID}}" data-modal-confirm="#confirm-delete-tag-modal"> + {{svg "octicon-trash"}}{{ctx.Locale.Tr "repo.release.delete_tag"}} + </a> + {{end}} - {{if and $canReadReleases (not $release.IsTag)}} - <a class="tw-mr-2 muted" href="{{$.RepoLink}}/releases/tag/{{.TagName | PathEscapeSegments}}">{{svg "octicon-tag" 16 "tw-mr-1"}}{{ctx.Locale.Tr "repo.release.detail"}}</a> - {{end}} - {{end}} - </div> - </td> - </tr> - {{end}} - </tbody> - </table> + {{if and $canReadReleases (not $release.IsTag)}} + <a class="flex-text-inline" href="{{$.RepoLink}}/releases/tag/{{.TagName | PathEscapeSegments}}">{{svg "octicon-tag"}}{{ctx.Locale.Tr "repo.release.detail"}}</a> + {{end}} + {{end}} + </div> + </div> + {{end}} + </div> {{else}} {{if .NumTags}} <p class="tw-p-4">{{ctx.Locale.Tr "no_results_found"}}</p> @@ -73,9 +67,8 @@ </div> {{if $.Permission.CanWrite ctx.Consts.RepoUnitTypeCode}} -<div class="ui g-modal-confirm delete modal"> +<div id="confirm-delete-tag-modal" class="ui small modal"> <div class="header"> - {{svg "octicon-trash"}} {{ctx.Locale.Tr "repo.release.delete_tag"}} </div> <div class="content"> diff --git a/templates/repo/tag/name.tmpl b/templates/repo/tag/name.tmpl index c3042014d3..24e7de046d 100644 --- a/templates/repo/tag/name.tmpl +++ b/templates/repo/tag/name.tmpl @@ -1,3 +1,3 @@ -<a class="ui label basic tiny button{{if .IsRelease}} primary{{end}}" href="{{.RepoLink}}/src/tag/{{.TagName|PathEscape}}"> +<a class="ui basic label {{if .IsRelease}}primary{{end}} {{.AdditionalClasses}}" href="{{.RepoLink}}/src/tag/{{.TagName|PathEscape}}"> {{svg "octicon-tag"}} {{.TagName}} </a> diff --git a/templates/repo/unicode_escape_prompt.tmpl b/templates/repo/unicode_escape_prompt.tmpl index 8bceafa8bb..f8226ec728 100644 --- a/templates/repo/unicode_escape_prompt.tmpl +++ b/templates/repo/unicode_escape_prompt.tmpl @@ -1,22 +1,22 @@ {{if .EscapeStatus}} {{if .EscapeStatus.HasInvisible}} - <div class="ui warning message unicode-escape-prompt tw-text-left"> + <div class="ui warning message unicode-escape-prompt"> <button class="btn close icon hide-panel" data-panel-closest=".message">{{svg "octicon-x" 16 "close inside"}}</button> <div class="header"> {{ctx.Locale.Tr "repo.invisible_runes_header"}} </div> - <p>{{ctx.Locale.Tr "repo.invisible_runes_description"}}</p> + <div>{{ctx.Locale.Tr "repo.invisible_runes_description"}}</div> {{if .EscapeStatus.HasAmbiguous}} - <p>{{ctx.Locale.Tr "repo.ambiguous_runes_description"}}</p> + <div>{{ctx.Locale.Tr "repo.ambiguous_runes_description"}}</div> {{end}} </div> {{else if .EscapeStatus.HasAmbiguous}} - <div class="ui warning message unicode-escape-prompt tw-text-left"> + <div class="ui warning message unicode-escape-prompt"> <button class="btn close icon hide-panel" data-panel-closest=".message">{{svg "octicon-x" 16 "close inside"}}</button> <div class="header"> {{ctx.Locale.Tr "repo.ambiguous_runes_header"}} </div> - <p>{{ctx.Locale.Tr "repo.ambiguous_runes_description"}}</p> + <div>{{ctx.Locale.Tr "repo.ambiguous_runes_description"}}</div> </div> {{end}} {{end}} diff --git a/templates/repo/view.tmpl b/templates/repo/view.tmpl new file mode 100644 index 0000000000..f99fe2f57a --- /dev/null +++ b/templates/repo/view.tmpl @@ -0,0 +1,29 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content repository file list {{if .IsBlame}}blame{{end}}"> + {{template "repo/header" .}} + <div class="ui container {{if or .TreeNames .IsBlame}}fluid padded{{end}}"> + {{template "base/alert" .}} + + {{if .Repository.IsArchived}} + <div class="ui warning message tw-text-center"> + {{if .Repository.ArchivedUnix.IsZero}} + {{ctx.Locale.Tr "repo.archive.title"}} + {{else}} + {{ctx.Locale.Tr "repo.archive.title_date" (DateUtils.AbsoluteLong .Repository.ArchivedUnix)}} + {{end}} + </div> + {{end}} + + {{template "repo/code/recently_pushed_new_branches" dict "RecentBranchesPromptData" .RecentBranchesPromptData}} + + <div class="repo-view-container"> + <div class="tw-flex tw-flex-col repo-view-file-tree-container not-mobile {{if not .UserSettingCodeViewShowFileTree}}tw-hidden{{end}}" {{if .IsSigned}}data-user-is-signed-in{{end}}> + {{template "repo/view_file_tree" .}} + </div> + <div class="repo-view-content"> + {{template "repo/view_content" .}} + </div> + </div> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/repo/view_content.tmpl b/templates/repo/view_content.tmpl new file mode 100644 index 0000000000..3ba04a9974 --- /dev/null +++ b/templates/repo/view_content.tmpl @@ -0,0 +1,111 @@ +{{$isTreePathRoot := not .TreeNames}} + +{{template "repo/sub_menu" .}} +<div class="repo-button-row"> + <div class="repo-button-row-left"> + {{if not $isTreePathRoot}} + <button class="repo-view-file-tree-toggle-show ui compact basic button icon not-mobile {{if .UserSettingCodeViewShowFileTree}}tw-hidden{{end}}" + data-global-click="onRepoViewFileTreeToggle" data-toggle-action="show" + data-tooltip-content="{{ctx.Locale.Tr "repo.diff.show_file_tree"}}"> + {{svg "octicon-sidebar-collapse"}} + </button> + {{end}} + + {{template "repo/branch_dropdown" dict + "Repository" .Repository + "ShowTabBranches" true + "ShowTabTags" true + "CurrentRefType" .RefFullName.RefType + "CurrentRefShortName" .RefFullName.ShortName + "CurrentTreePath" .TreePath + "RefLinkTemplate" "{RepoLink}/src/{RefType}/{RefShortName}/{TreePath}" + "AllowCreateNewRef" .CanCreateBranch + "ShowViewAllRefsEntry" true + }} + + {{if and .CanCompareOrPull .RefFullName.IsBranch (not .Repository.IsArchived)}} + {{$cmpBranch := ""}} + {{if ne .Repository.ID .BaseRepo.ID}} + {{$cmpBranch = printf "%s/%s:" (.Repository.OwnerName|PathEscape) (.Repository.Name|PathEscape)}} + {{end}} + {{$cmpBranch = print $cmpBranch (.BranchName|PathEscapeSegments)}} + {{$compareLink := printf "%s/compare/%s...%s" .BaseRepo.Link (.BaseRepo.DefaultBranch|PathEscapeSegments) $cmpBranch}} + <a id="new-pull-request" role="button" class="ui compact basic button" href="{{QueryBuild $compareLink "expand" 1}}" + data-tooltip-content="{{if .PullRequestCtx.Allowed}}{{ctx.Locale.Tr "repo.pulls.compare_changes"}}{{else}}{{ctx.Locale.Tr "action.compare_branch"}}{{end}}"> + {{svg "octicon-git-pull-request"}} + </a> + {{end}} + + <!-- Show go to file if on home page --> + {{if $isTreePathRoot}} + <a href="{{.Repository.Link}}/find/{{.RefTypeNameSubURL}}" class="ui compact basic button">{{ctx.Locale.Tr "repo.find_file.go_to_file"}}</a> + {{end}} + + {{if and .RefFullName.IsBranch (not .IsViewFile)}} + <button class="ui dropdown basic compact jump button repo-add-file" {{if not .Repository.CanEnableEditor}}disabled{{end}}> + {{ctx.Locale.Tr "repo.editor.add_file"}} + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + <a class="item" href="{{.RepoLink}}/_new/{{.BranchName | PathEscapeSegments}}/{{.TreePath | PathEscapeSegments}}"> + {{ctx.Locale.Tr "repo.editor.new_file"}} + </a> + {{if .RepositoryUploadEnabled}} + <a class="item" href="{{.RepoLink}}/_upload/{{.BranchName | PathEscapeSegments}}/{{.TreePath | PathEscapeSegments}}"> + {{ctx.Locale.Tr "repo.editor.upload_file"}} + </a> + {{end}} + <a class="item" href="{{.RepoLink}}/_diffpatch/{{.BranchName | PathEscapeSegments}}/{{.TreePath | PathEscapeSegments}}"> + {{ctx.Locale.Tr "repo.editor.patch"}} + </a> + </div> + </button> + {{end}} + + {{if and $isTreePathRoot .Repository.IsTemplate}} + <a role="button" class="ui primary compact button" href="{{AppSubUrl}}/repo/create?template_id={{.Repository.ID}}"> + {{ctx.Locale.Tr "repo.use_template"}} + </a> + {{end}} + + {{if not $isTreePathRoot}} + {{$treeNameIdxLast := Eval (len .TreeNames) "-" 1}} + <span class="breadcrumb"> + <a class="section" href="{{.RepoLink}}/src/{{.RefTypeNameSubURL}}" title="{{.Repository.Name}}">{{StringUtils.EllipsisString .Repository.Name 30}}</a> + {{- range $i, $v := .TreeNames -}} + <span class="breadcrumb-divider">/</span> + {{- if eq $i $treeNameIdxLast -}} + <span class="active section" title="{{$v}}">{{$v}}</span> + <button class="btn interact-fg tw-mx-1" data-clipboard-text="{{$.TreePath}}" data-tooltip-content="{{ctx.Locale.Tr "copy_path"}}">{{svg "octicon-copy" 14}}</button> + {{- else -}} + {{$p := index $.Paths $i}}<span class="section"><a href="{{$.BranchLink}}/{{PathEscapeSegments $p}}" title="{{$v}}">{{$v}}</a></span> + {{- end -}} + {{- end -}} + </span> + {{end}} + </div> + + <div class="repo-button-row-right"> + <!-- Only show clone panel in repository home page --> + {{if $isTreePathRoot}} + {{template "repo/clone_panel" .}} + {{end}} + {{if and (not $isTreePathRoot) (not .IsViewFile) (not .IsBlame)}}{{/* IsViewDirectory (not home), TODO: split the templates, avoid using "if" tricks */}} + <a class="ui button" href="{{.RepoLink}}/commits/{{.RefTypeNameSubURL}}/{{.TreePath | PathEscapeSegments}}"> + {{svg "octicon-history" 16 "tw-mr-2"}}{{ctx.Locale.Tr "repo.file_history"}} + </a> + {{end}} + </div> +</div> +{{if .IsViewFile}} + {{template "repo/view_file" .}} +{{else if .IsBlame}} + {{template "repo/blame" .}} +{{else}}{{/* IsViewDirectory */}} + {{if $isTreePathRoot}} + {{template "repo/code/upstream_diverging_info" .}} + {{end}} + {{template "repo/view_list" .}} + {{if and .ReadmeExist (or .IsMarkup .IsPlainText)}} + {{template "repo/view_file" .}} + {{end}} +{{end}} diff --git a/templates/repo/view_file.tmpl b/templates/repo/view_file.tmpl index 0a43e3db54..1486d7181d 100644 --- a/templates/repo/view_file.tmpl +++ b/templates/repo/view_file.tmpl @@ -1,4 +1,6 @@ -<div {{if .ReadmeInList}}id="readme" {{end}}class="{{TabSizeClass .Editorconfig .FileName}} non-diff-file-content"> +<div {{if .ReadmeInList}}id="readme"{{end}} class="{{TabSizeClass .Editorconfig .FileTreePath}} non-diff-file-content" + data-global-init="initRepoFileView" data-raw-file-link="{{.RawFileLink}}"> + {{- if .FileError}} <div class="ui error message"> <div class="text left tw-whitespace-pre">{{.FileError}}</div> @@ -27,37 +29,41 @@ <div class="file-header-left tw-flex tw-items-center tw-py-2 tw-pr-4"> {{if .ReadmeInList}} {{svg "octicon-book" 16 "tw-mr-2"}} - <strong><a class="muted" href="#readme">{{.FileName}}</a></strong> + <strong><a class="muted" href="#readme">{{.ReadmeInList}}</a></strong> {{else}} {{template "repo/file_info" .}} {{end}} </div> - <div class="file-header-right file-actions tw-flex tw-items-center tw-flex-wrap"> - {{if .HasSourceRenderedToggle}} - <div class="ui compact icon buttons"> - <a href="?display=source" class="ui mini basic button {{if .IsDisplayingSource}}active{{end}}" data-tooltip-content="{{ctx.Locale.Tr "repo.file_view_source"}}">{{svg "octicon-code" 15}}</a> - <a href="{{$.Link}}" class="ui mini basic button {{if .IsDisplayingRendered}}active{{end}}" data-tooltip-content="{{ctx.Locale.Tr "repo.file_view_rendered"}}">{{svg "octicon-file" 15}}</a> - </div> - {{end}} + <div class="file-header-right file-actions flex-text-block tw-flex-wrap"> + {{/* this componment is also controlled by frontend plugin renders */}} + <div class="ui compact icon buttons file-view-toggle-buttons {{Iif .HasSourceRenderedToggle "" "tw-hidden"}}"> + {{if .IsRepresentableAsText}} + <a href="?display=source" class="ui mini basic button file-view-toggle-source {{if .IsDisplayingSource}}active{{end}}" data-tooltip-content="{{ctx.Locale.Tr "repo.file_view_source"}}">{{svg "octicon-code" 15}}</a> + {{end}} + <a href="?display=rendered" class="ui mini basic button file-view-toggle-rendered {{if not .IsDisplayingSource}}active{{end}}" data-tooltip-content="{{ctx.Locale.Tr "repo.file_view_rendered"}}">{{svg "octicon-file" 15}}</a> + </div> {{if not .ReadmeInList}} <div class="ui buttons tw-mr-1"> <a class="ui mini basic button" href="{{$.RawFileLink}}">{{ctx.Locale.Tr "repo.file_raw"}}</a> - {{if not .IsViewCommit}} + {{if or .RefFullName.IsBranch .RefFullName.IsTag}} <a class="ui mini basic button" href="{{.RepoLink}}/src/commit/{{PathEscape .CommitID}}/{{PathEscapeSegments .TreePath}}">{{ctx.Locale.Tr "repo.file_permalink"}}</a> {{end}} {{if .IsRepresentableAsText}} - <a class="ui mini basic button" href="{{.RepoLink}}/blame/{{.BranchNameSubURL}}/{{PathEscapeSegments .TreePath}}">{{ctx.Locale.Tr "repo.blame"}}</a> + <a class="ui mini basic button" href="{{.RepoLink}}/blame/{{.RefTypeNameSubURL}}/{{PathEscapeSegments .TreePath}}">{{ctx.Locale.Tr "repo.blame"}}</a> {{end}} - <a class="ui mini basic button" href="{{.RepoLink}}/commits/{{.BranchNameSubURL}}/{{PathEscapeSegments .TreePath}}">{{ctx.Locale.Tr "repo.file_history"}}</a> + <a class="ui mini basic button" href="{{.RepoLink}}/commits/{{.RefTypeNameSubURL}}/{{PathEscapeSegments .TreePath}}">{{ctx.Locale.Tr "repo.file_history"}}</a> {{if .EscapeStatus.Escaped}} <button class="ui mini basic button unescape-button tw-hidden">{{ctx.Locale.Tr "repo.unescape_control_characters"}}</button> <button class="ui mini basic button escape-button">{{ctx.Locale.Tr "repo.escape_control_characters"}}</button> {{end}} </div> <a download class="btn-octicon" data-tooltip-content="{{ctx.Locale.Tr "repo.download_file"}}" href="{{$.RawFileLink}}">{{svg "octicon-download"}}</a> - <a id="copy-content" class="btn-octicon {{if not .CanCopyContent}} disabled{{end}}"{{if or .IsImageFile (and .HasSourceRenderedToggle (not .IsDisplayingSource))}} data-link="{{$.RawFileLink}}"{{end}} data-tooltip-content="{{if .CanCopyContent}}{{ctx.Locale.Tr "copy_content"}}{{else}}{{ctx.Locale.Tr "copy_type_unsupported"}}{{end}}">{{svg "octicon-copy"}}</a> + <a class="btn-octicon {{if not .CanCopyContent}}disabled{{end}}" data-global-click="onCopyContentButtonClick" + {{if not .IsDisplayingSource}}data-raw-file-link="{{$.RawFileLink}}"{{end}} + data-tooltip-content="{{if .CanCopyContent}}{{ctx.Locale.Tr "copy_content"}}{{else}}{{ctx.Locale.Tr "copy_type_unsupported"}}{{end}}" + >{{svg "octicon-copy"}}</a> {{if .EnableFeed}} - <a class="btn-octicon" href="{{$.FeedURL}}/rss/{{$.BranchNameSubURL}}/{{PathEscapeSegments .TreePath}}" data-tooltip-content="{{ctx.Locale.Tr "rss_feed"}}"> + <a class="btn-octicon" href="{{$.RepoLink}}/rss/{{$.RefTypeNameSubURL}}/{{PathEscapeSegments .TreePath}}" data-tooltip-content="{{ctx.Locale.Tr "rss_feed"}}"> {{svg "octicon-rss"}} </a> {{end}} @@ -78,45 +84,28 @@ <button class="ui mini basic button escape-button tw-mr-1">{{ctx.Locale.Tr "repo.escape_control_characters"}}</button> {{end}} {{if and .ReadmeInList .CanEditReadmeFile}} - <a class="btn-octicon" data-tooltip-content="{{ctx.Locale.Tr "repo.editor.edit_this_file"}}" href="{{.RepoLink}}/_edit/{{PathEscapeSegments .BranchName}}/{{PathEscapeSegments .TreePath}}/{{PathEscapeSegments .FileName}}">{{svg "octicon-pencil"}}</a> + <a class="btn-octicon" data-tooltip-content="{{ctx.Locale.Tr "repo.editor.edit_this_file"}}" href="{{.RepoLink}}/_edit/{{PathEscapeSegments .BranchName}}/{{PathEscapeSegments .FileTreePath}}">{{svg "octicon-pencil"}}</a> {{end}} </div> </h4> + <div class="ui bottom attached table unstackable segment"> - {{if not (or .IsMarkup .IsRenderedHTML)}} - {{template "repo/unicode_escape_prompt" dict "EscapeStatus" .EscapeStatus "root" $}} + {{if not .IsMarkup}} + {{template "repo/unicode_escape_prompt" dict "EscapeStatus" .EscapeStatus}} {{end}} - <div class="file-view{{if .IsMarkup}} markup {{.MarkupType}}{{else if .IsPlainText}} plain-text{{else if .IsTextSource}} code-view{{end}}"> + <div class="file-view {{if .IsMarkup}}markup {{.MarkupType}}{{else if .IsPlainText}}plain-text{{else if .IsDisplayingSource}}code-view{{end}}"> {{if .IsFileTooLarge}} {{template "shared/filetoolarge" dict "RawFileLink" .RawFileLink}} {{else if not .FileSize}} {{template "shared/fileisempty"}} {{else if .IsMarkup}} - {{if .FileContent}}{{.FileContent}}{{end}} + {{.FileContent}} {{else if .IsPlainText}} <pre>{{if .FileContent}}{{.FileContent}}{{end}}</pre> - {{else if not .IsTextSource}} - <div class="view-raw"> - {{if .IsImageFile}} - <img src="{{$.RawFileLink}}"> - {{else if .IsVideoFile}} - <video controls src="{{$.RawFileLink}}"> - <strong>{{ctx.Locale.Tr "repo.video_not_supported_in_browser"}}</strong> - </video> - {{else if .IsAudioFile}} - <audio controls src="{{$.RawFileLink}}"> - <strong>{{ctx.Locale.Tr "repo.audio_not_supported_in_browser"}}</strong> - </audio> - {{else if .IsPDFFile}} - <div class="pdf-content is-loading" data-src="{{$.RawFileLink}}" data-fallback-button-text="{{ctx.Locale.Tr "repo.diff.view_file"}}"></div> - {{else}} - <a href="{{$.RawFileLink}}" rel="nofollow" class="tw-p-4">{{ctx.Locale.Tr "repo.file_view_raw"}}</a> - {{end}} - </div> - {{else if .FileSize}} + {{else if .FileContent}} <table> <tbody> - {{range $idx, $code := .FileContent}} + {{range $idx, $code := .FileContent}} {{$line := Eval $idx "+" 1}} <tr> <td id="L{{$line}}" class="lines-num"><span id="L{{$line}}" data-line-number="{{$line}}"></span></td> @@ -125,17 +114,38 @@ {{end}} <td rel="L{{$line}}" class="lines-code chroma"><code class="code-inner">{{$code}}</code></td> </tr> - {{end}} + {{end}} </tbody> </table> - <div class="code-line-menu tippy-target"> - {{if $.Permission.CanRead ctx.Consts.RepoUnitTypeIssues}} - <a class="item ref-in-new-issue" role="menuitem" data-url-issue-new="{{.RepoLink}}/issues/new" data-url-param-body-link="{{.Repository.Link}}/src/commit/{{PathEscape .CommitID}}/{{PathEscapeSegments .TreePath}}{{if $.HasSourceRenderedToggle}}?display=source{{end}}" rel="nofollow noindex">{{ctx.Locale.Tr "repo.issues.context.reference_issue"}}</a> + {{else}} + <div class="view-raw"> + {{if .IsImageFile}} + <img alt="{{$.RawFileLink}}" src="{{$.RawFileLink}}"> + {{else if .IsVideoFile}} + <video controls src="{{$.RawFileLink}}"> + <strong>{{ctx.Locale.Tr "repo.video_not_supported_in_browser"}}</strong> + </video> + {{else if .IsAudioFile}} + <audio controls src="{{$.RawFileLink}}"> + <strong>{{ctx.Locale.Tr "repo.audio_not_supported_in_browser"}}</strong> + </audio> + {{else}} + <div class="file-view-render-container"> + <div class="file-view-raw-prompt tw-p-4"> + <a href="{{$.RawFileLink}}" rel="nofollow">{{ctx.Locale.Tr "repo.file_view_raw"}}</a> + </div> + </div> {{end}} - <a class="item view_git_blame" role="menuitem" href="{{.Repository.Link}}/blame/commit/{{PathEscape .CommitID}}/{{PathEscapeSegments .TreePath}}">{{ctx.Locale.Tr "repo.view_git_blame"}}</a> - <a class="item copy-line-permalink" role="menuitem" data-url="{{.Repository.Link}}/src/commit/{{PathEscape .CommitID}}/{{PathEscapeSegments .TreePath}}{{if $.HasSourceRenderedToggle}}?display=source{{end}}">{{ctx.Locale.Tr "repo.file_copy_permalink"}}</a> </div> {{end}} </div> + + <div class="code-line-menu tippy-target"> + {{if $.Permission.CanRead ctx.Consts.RepoUnitTypeIssues}} + <a class="item ref-in-new-issue" role="menuitem" data-url-issue-new="{{.RepoLink}}/issues/new" data-url-param-body-link="{{.Repository.Link}}/src/commit/{{PathEscape .CommitID}}/{{PathEscapeSegments .TreePath}}{{if $.HasSourceRenderedToggle}}?display=source{{end}}" rel="nofollow noindex">{{ctx.Locale.Tr "repo.issues.context.reference_issue"}}</a> + {{end}} + <a class="item view_git_blame" role="menuitem" href="{{.Repository.Link}}/blame/commit/{{PathEscape .CommitID}}/{{PathEscapeSegments .TreePath}}">{{ctx.Locale.Tr "repo.view_git_blame"}}</a> + <a class="item copy-line-permalink" role="menuitem" data-url="{{.Repository.Link}}/src/commit/{{PathEscape .CommitID}}/{{PathEscapeSegments .TreePath}}{{if $.HasSourceRenderedToggle}}?display=source{{end}}">{{ctx.Locale.Tr "repo.file_copy_permalink"}}</a> + </div> </div> </div> diff --git a/templates/repo/view_file_tree.tmpl b/templates/repo/view_file_tree.tmpl new file mode 100644 index 0000000000..8aed05f346 --- /dev/null +++ b/templates/repo/view_file_tree.tmpl @@ -0,0 +1,15 @@ +<div class="flex-text-block repo-button-row"> + <button class="ui compact basic icon button" + data-global-click="onRepoViewFileTreeToggle" data-toggle-action="hide" + data-tooltip-content="{{ctx.Locale.Tr "repo.diff.hide_file_tree"}}"> + {{svg "octicon-sidebar-expand"}} + </button> + <b>{{ctx.Locale.Tr "files"}}</b> +</div> + +{{/* TODO: Dynamically move components such as refSelector and createPR here */}} +<div id="view-file-tree" class="tw-overflow-auto tw-h-full is-loading" + data-repo-link="{{.RepoLink}}" + data-tree-path="{{$.TreePath}}" + data-current-ref-name-sub-url="{{.RefTypeNameSubURL}}" +></div> diff --git a/templates/repo/view_list.tmpl b/templates/repo/view_list.tmpl index c8e97d2617..b655f735a3 100644 --- a/templates/repo/view_list.tmpl +++ b/templates/repo/view_list.tmpl @@ -4,30 +4,32 @@ {{template "repo/latest_commit" .}} <div>{{if and .LatestCommit .LatestCommit.Committer}}{{DateUtils.TimeSince .LatestCommit.Committer.When}}{{end}}</div> </div> + {{$.FileIconPoolHTML}} {{if .HasParentPath}} <a class="repo-file-line parent-link silenced" href="{{.BranchLink}}{{if .ParentPath}}{{PathEscapeSegments .ParentPath}}{{end}}"> - {{svg "octicon-file-directory-fill"}} .. + {{index $.FileIcons ".."}} .. </a> {{end}} {{range $item := .Files}} <div class="repo-file-item"> {{$entry := $item.Entry}} {{$commit := $item.Commit}} - {{$subModuleFile := $item.SubModuleFile}} - <div class="repo-file-cell name {{if not $commit}}notready{{end}}"> + {{$submoduleFile := $item.SubmoduleFile}} + <div class="repo-file-cell name muted-links {{if not $commit}}notready{{end}}"> + {{index $.FileIcons $entry.Name}} {{if $entry.IsSubModule}} - {{svg "octicon-file-submodule"}} - {{$refURL := $subModuleFile.RefURL AppUrl $.Repository.FullName $.SSHDomain}} {{/* FIXME: the usage of AppUrl seems incorrect, it would be fixed in the future, use AppSubUrl instead */}} - {{if $refURL}} - <a class="muted" href="{{$refURL}}">{{$entry.Name}}</a> <span class="at">@</span> <a href="{{$refURL}}/commit/{{PathEscape $subModuleFile.RefID}}">{{ShortSha $subModuleFile.RefID}}</a> + {{$submoduleLink := $submoduleFile.SubmoduleWebLink ctx}} + {{if $submoduleLink}} + <a class="entry-name" href="{{$submoduleLink.RepoWebLink}}" title="{{$entry.Name}}">{{$entry.Name}}</a> + @ <a class="text primary" href="{{$submoduleLink.CommitWebLink}}">{{ShortSha $submoduleFile.RefID}}</a> {{else}} - {{$entry.Name}} <span class="at">@</span> {{ShortSha $subModuleFile.RefID}} + <span class="entry-name" title="{{$entry.Name}}">{{$entry.Name}}</span> + @ {{ShortSha $submoduleFile.RefID}} {{end}} {{else}} {{if $entry.IsDir}} {{$subJumpablePathName := $entry.GetSubJumpablePathName}} - {{svg "octicon-file-directory-fill"}} - <a class="muted" href="{{$.TreeLink}}/{{PathEscapeSegments $subJumpablePathName}}" title="{{$subJumpablePathName}}"> + <a class="entry-name" href="{{$.TreeLink}}/{{PathEscapeSegments $subJumpablePathName}}" title="{{$subJumpablePathName}}"> {{$subJumpablePathFields := StringUtils.Split $subJumpablePathName "/"}} {{$subJumpablePathFieldLast := (Eval (len $subJumpablePathFields) "-" 1)}} {{if eq $subJumpablePathFieldLast 0}} @@ -38,15 +40,17 @@ {{end}} </a> {{else}} - {{svg (printf "octicon-%s" (EntryIcon $entry))}} - <a class="muted" href="{{$.TreeLink}}/{{PathEscapeSegments $entry.Name}}" title="{{$entry.Name}}">{{$entry.Name}}</a> + <a class="entry-name" href="{{$.TreeLink}}/{{PathEscapeSegments $entry.Name}}" title="{{$entry.Name}}">{{$entry.Name}}</a> + {{if $entry.IsLink}} + <a class="entry-symbol-link flex-text-inline" data-tooltip-content title="{{ctx.Locale.Tr "repo.find_file.follow_symlink"}}" href="{{$.TreeLink}}/{{PathEscapeSegments $entry.Name}}?follow_symlink=1">{{svg "octicon-link" 12}}</a> + {{end}} {{end}} {{end}} </div> <div class="repo-file-cell message loading-icon-2px"> {{if $commit}} {{$commitLink := printf "%s/commit/%s" $.RepoLink (PathEscape $commit.ID.String)}} - {{ctx.RenderUtils.RenderCommitMessageLinkSubject $commit.Message $commitLink ($.Repository.ComposeMetas ctx)}} + {{ctx.RenderUtils.RenderCommitMessageLinkSubject $commit.Message $commitLink $.Repository}} {{else}} … {{/* will be loaded again by LastCommitLoaderURL */}} {{end}} diff --git a/templates/repo/watch_unwatch.tmpl b/templates/repo/watch_unwatch.tmpl index 465cd91c2b..6f2e5b7a19 100644 --- a/templates/repo/watch_unwatch.tmpl +++ b/templates/repo/watch_unwatch.tmpl @@ -1,10 +1,10 @@ -<form hx-boost="true" hx-target="this" method="post" action="{{$.RepoLink}}/action/{{if $.IsWatchingRepo}}unwatch{{else}}watch{{end}}"> +<form class="flex-text-inline" hx-boost="true" hx-target="this" method="post" action="{{$.RepoLink}}/action/{{if $.IsWatchingRepo}}unwatch{{else}}watch{{end}}"> <div class="ui labeled button" {{if not $.IsSigned}}data-tooltip-content="{{ctx.Locale.Tr "repo.watch_guest_user"}}"{{end}}> {{$buttonText := ctx.Locale.Tr "repo.watch"}} {{if $.IsWatchingRepo}}{{$buttonText = ctx.Locale.Tr "repo.unwatch"}}{{end}} <button type="submit" class="ui compact small basic button"{{if not $.IsSigned}} disabled{{end}} aria-label="{{$buttonText}}"> {{svg "octicon-eye"}} - <span aria-hidden="true">{{$buttonText}}</span> + <span class="not-mobile" aria-hidden="true">{{$buttonText}}</span> </button> <a hx-boost="false" class="ui basic label" href="{{.RepoLink}}/watchers"> {{CountFmt .Repository.NumWatches}} diff --git a/templates/repo/wiki/new.tmpl b/templates/repo/wiki/new.tmpl index ea2913c0fd..12f0983904 100644 --- a/templates/repo/wiki/new.tmpl +++ b/templates/repo/wiki/new.tmpl @@ -18,7 +18,7 @@ {{ctx.Locale.Tr "repo.wiki.page_name_desc"}} </div> - {{$content := .content}} + {{$content := .WikiEditContent}} {{if not .PageIsWikiEdit}} {{$content = ctx.Locale.Tr "repo.wiki.welcome"}} {{end}} @@ -35,7 +35,7 @@ <input name="message" aria-label="{{ctx.Locale.Tr "repo.wiki.default_commit_message"}}" placeholder="{{ctx.Locale.Tr "repo.wiki.default_commit_message"}}"> </div> <div class="divider"></div> - <div class="text right"> + <div class="flex-text-block tw-justify-end"> <a class="ui basic cancel button" href="{{.Link}}">{{ctx.Locale.Tr "cancel"}}</a> <button class="ui primary button">{{ctx.Locale.Tr "repo.wiki.save_page"}}</button> </div> diff --git a/templates/repo/wiki/pages.tmpl b/templates/repo/wiki/pages.tmpl index 38d6d6f944..5ceb8a4d5b 100644 --- a/templates/repo/wiki/pages.tmpl +++ b/templates/repo/wiki/pages.tmpl @@ -10,7 +10,7 @@ {{end}} </span> </h2> - {{if .IsRepositoryAdmin}}<div>{{ctx.Locale.Tr "repo.default_branch"}}: {{.Repository.DefaultWikiBranch}}</div>{{end}} + {{if $.Permission.IsAdmin}}<div>{{ctx.Locale.Tr "repo.default_branch"}}: {{.Repository.DefaultWikiBranch}}</div>{{end}} <table class="ui table wiki-pages-list"> <tbody> {{range .Pages}} @@ -21,7 +21,7 @@ <a class="wiki-git-entry" href="{{$.RepoLink}}/wiki/{{.GitEntryName | PathEscape}}" data-tooltip-content="{{ctx.Locale.Tr "repo.wiki.original_git_entry_tooltip"}}">{{svg "octicon-chevron-right"}}</a> </td> {{$timeSince := DateUtils.TimeSince .UpdatedUnix}} - <td class="text right">{{ctx.Locale.Tr "repo.wiki.last_updated" $timeSince}}</td> + <td class="tw-text-right">{{ctx.Locale.Tr "repo.wiki.last_updated" $timeSince}}</td> </tr> {{end}} </tbody> diff --git a/templates/repo/wiki/revision.tmpl b/templates/repo/wiki/revision.tmpl index ca8954928d..108e378937 100644 --- a/templates/repo/wiki/revision.tmpl +++ b/templates/repo/wiki/revision.tmpl @@ -3,18 +3,18 @@ {{template "repo/header" .}} {{$title := .title}} <div class="ui container"> - <div class="ui stackable grid"> - <div class="ui eight wide column"> - <div class="ui header"> - <a class="file-revisions-btn ui basic button" title="{{ctx.Locale.Tr "repo.wiki.back_to_wiki"}}" href="{{.RepoLink}}/wiki/{{.PageURL}}"><span>{{.revision}}</span> {{svg "octicon-home"}}</a> + <div class="ui dividing header flex-text-block tw-flex-wrap tw-justify-between"> + <div class="flex-text-block"> + <a class="ui basic button tw-px-3" title="{{ctx.Locale.Tr "repo.wiki.back_to_wiki"}}" href="{{.RepoLink}}/wiki/{{.PageURL}}">{{svg "octicon-home"}}</a> + <div class="tw-flex-1 gt-ellipsis"> {{$title}} - <div class="ui sub header tw-break-anywhere"> + <div class="ui sub header gt-ellipsis"> {{$timeSince := DateUtils.TimeSince .Author.When}} {{ctx.Locale.Tr "repo.wiki.last_commit_info" .Author.Name $timeSince}} </div> </div> </div> - <div class="ui eight wide column text right"> + <div class="flex-text-block"> {{template "repo/clone_panel" .}} </div> </div> diff --git a/templates/repo/wiki/start.tmpl b/templates/repo/wiki/start.tmpl index 1b3c3d538a..e622db5eb5 100644 --- a/templates/repo/wiki/start.tmpl +++ b/templates/repo/wiki/start.tmpl @@ -7,7 +7,7 @@ <h2>{{ctx.Locale.Tr "repo.wiki.welcome"}}</h2> <p>{{ctx.Locale.Tr "repo.wiki.welcome_desc"}}</p> {{if and .CanWriteWiki (not .Repository.IsMirror)}} - <a class="ui primary button" href="{{.RepoLink}}/wiki?action=_new">{{ctx.Locale.Tr "repo.wiki.create_first_page"}}</a> + <a class="ui primary button tw-mr-0" href="{{.RepoLink}}/wiki?action=_new">{{ctx.Locale.Tr "repo.wiki.create_first_page"}}</a> {{end}} </div> </div> diff --git a/templates/repo/wiki/view.tmpl b/templates/repo/wiki/view.tmpl index 843a977e3e..4c7ef364d2 100644 --- a/templates/repo/wiki/view.tmpl +++ b/templates/repo/wiki/view.tmpl @@ -33,7 +33,7 @@ <div class="ui dividing header"> <div class="flex-text-block tw-flex-wrap tw-justify-end"> <div class="flex-text-block tw-flex-1 tw-min-w-[300px]"> - <a class="file-revisions-btn ui basic button" title="{{ctx.Locale.Tr "repo.wiki.file_revision"}}" href="{{.RepoLink}}/wiki/{{.PageURL}}?action=_revision" ><span>{{.CommitCount}}</span> {{svg "octicon-history"}}</a> + <a class="ui basic button tw-px-3 tw-gap-3" title="{{ctx.Locale.Tr "repo.wiki.file_revision"}}" href="{{.RepoLink}}/wiki/{{.PageURL}}?action=_revision" >{{if .CommitCount}}<span>{{.CommitCount}}</span> {{end}}{{svg "octicon-history"}}</a> <div class="tw-flex-1 gt-ellipsis"> {{$title}} <div class="ui sub header gt-ellipsis"> @@ -50,7 +50,7 @@ {{if and .CanWriteWiki (not .Repository.IsMirror)}} <a class="ui small button" href="{{.RepoLink}}/wiki/{{.PageURL}}?action=_edit">{{ctx.Locale.Tr "repo.wiki.edit_page_button"}}</a> <a class="ui small primary button" href="{{.RepoLink}}/wiki?action=_new">{{ctx.Locale.Tr "repo.wiki.new_page_button"}}</a> - <a class="ui small red button delete-button" href="" data-url="{{.RepoLink}}/wiki/{{.PageURL}}?action=_delete" data-id="{{.PageURL}}">{{ctx.Locale.Tr "repo.wiki.delete_page_button"}}</a> + <a class="ui small red button link-action" href data-modal-confirm="#repo-wiki-delete-page-modal" data-url="{{.RepoLink}}/wiki/{{.PageURL}}?action=_delete">{{ctx.Locale.Tr "repo.wiki.delete_page_button"}}</a> {{end}} </div> </div> @@ -62,50 +62,43 @@ {{end}} <div class="wiki-content-parts"> - {{if .sidebarTocContent}} - <div class="markup wiki-content-sidebar wiki-content-toc"> - {{.sidebarTocContent | SafeHTML}} + {{if .WikiSidebarTocHTML}} + <div class="render-content markup wiki-content-sidebar wiki-content-toc"> + {{.WikiSidebarTocHTML}} </div> {{end}} - <div class="markup wiki-content-main {{if or .sidebarTocContent .sidebarPresent}}with-sidebar{{end}}"> - {{template "repo/unicode_escape_prompt" dict "EscapeStatus" .EscapeStatus "root" $}} - {{.content | SafeHTML}} + <div class="render-content markup wiki-content-main {{if or .WikiSidebarTocHTML .WikiSidebarHTML}}with-sidebar{{end}}"> + {{template "repo/unicode_escape_prompt" dict "EscapeStatus" .EscapeStatus}} + {{.WikiContentHTML}} </div> - {{if .sidebarPresent}} - <div class="markup wiki-content-sidebar"> + {{if .WikiSidebarHTML}} + <div class="render-content markup wiki-content-sidebar"> {{if and .CanWriteWiki (not .Repository.IsMirror)}} <a class="tw-float-right muted" href="{{.RepoLink}}/wiki/_Sidebar?action=_edit" aria-label="{{ctx.Locale.Tr "repo.wiki.edit_page_button"}}">{{svg "octicon-pencil"}}</a> {{end}} - {{template "repo/unicode_escape_prompt" dict "EscapeStatus" .sidebarEscapeStatus "root" $}} - {{.sidebarContent | SafeHTML}} + {{.WikiSidebarHTML}} </div> {{end}} <div class="tw-clear-both"></div> - {{if .footerPresent}} - <div class="markup wiki-content-footer"> + {{if .WikiFooterHTML}} + <div class="render-content markup wiki-content-footer"> {{if and .CanWriteWiki (not .Repository.IsMirror)}} <a class="tw-float-right muted" href="{{.RepoLink}}/wiki/_Footer?action=_edit" aria-label="{{ctx.Locale.Tr "repo.wiki.edit_page_button"}}">{{svg "octicon-pencil"}}</a> {{end}} - {{template "repo/unicode_escape_prompt" dict "footerEscapeStatus" .sidebarEscapeStatus "root" $}} - {{.footerContent | SafeHTML}} + {{.WikiFooterHTML}} </div> {{end}} </div> </div> </div> -<div class="ui g-modal-confirm delete modal"> - <div class="header"> - {{svg "octicon-trash"}} - {{ctx.Locale.Tr "repo.wiki.delete_page_button"}} - </div> - <div class="content"> - <p>{{ctx.Locale.Tr "repo.wiki.delete_page_notice_1" $title}}</p> - </div> +<div class="ui small modal" id="repo-wiki-delete-page-modal"> + <div class="header">{{svg "octicon-trash"}} {{ctx.Locale.Tr "repo.wiki.delete_page_button"}}</div> + <div class="content"><p>{{ctx.Locale.Tr "repo.wiki.delete_page_notice_1" $title}}</p></div> {{template "base/modal_actions_confirm" .}} </div> |