return
}
- if diff.NumFiles == 0 {
- ctx.PlainText(http.StatusOK, ctx.Locale.TrString("repo.editor.no_changes_to_show"))
- return
+ if diff.NumFiles != 0 {
+ ctx.Data["File"] = diff.Files[0]
}
- ctx.Data["File"] = diff.Files[0]
ctx.HTML(http.StatusOK, tplEditDiffPreview)
}
<div class="ui ten wide column">
{{template "org/team/navbar" .}}
{{if .IsOrganizationOwner}}
- <div class="ui attached segment">
+ <div class="ui top attached segment">
<form class="ui form ignore-dirty tw-flex tw-flex-wrap tw-gap-2" action="{{$.OrgLink}}/teams/{{$.Team.LowerName | PathEscape}}/action/add" method="post">
{{.CsrfTokenHtml}}
<input type="hidden" name="uid" value="{{.SignedUser.ID}}">
</form>
</div>
{{end}}
- <div class="ui attached segment">
+ <div class="ui{{if not .IsOrganizationOwner}} top{{end}} attached segment">
<div class="flex-list">
{{range .Team.Members}}
<div class="flex-item tw-items-center">
-<div class="ui top attached tabular menu org-team-navbar">
+<div class="ui compact small menu small-menu-items org-team-navbar">
<a class="item{{if .PageIsOrgTeamMembers}} active{{end}}" href="{{.OrgLink}}/teams/{{.Team.LowerName | PathEscape}}">{{svg "octicon-person"}} <strong>{{.Team.NumMembers}}</strong> {{ctx.Locale.Tr "org.lower_members"}}</a>
<a class="item{{if .PageIsOrgTeamRepos}} active{{end}}" href="{{.OrgLink}}/teams/{{.Team.LowerName | PathEscape}}/repositories">{{svg "octicon-repo"}} <strong>{{.Team.NumRepos}}</strong> {{ctx.Locale.Tr "org.lower_repositories"}}</a>
</div>
</div>
</div>
{{end}}
- <div class="ui attached segment">
+ <div class="ui{{if not $canAddRemove}} top{{end}} attached segment">
<div class="flex-list">
{{range .Team.Repos}}
<div class="flex-item tw-items-center">
{{end}}
{{template "repo/commit_load_branches_and_tags" .}}
</div>
- <div class="ui attached segment tw-flex tw-items-center tw-justify-between tw-py-1 commit-header-row tw-flex-wrap {{$class}}">
+ <div class="ui{{if not .Commit.Signature}} bottom{{end}} attached segment tw-flex tw-items-center tw-justify-between tw-py-1 commit-header-row tw-flex-wrap {{$class}}">
<div class="tw-flex tw-items-center author">
{{if .Author}}
{{ctx.AvatarUtils.Avatar .Author 28 "tw-mr-2"}}
+{{if .File}}
<div class="diff-file-box">
<div class="ui attached table segment">
<div class="file-body file-code code-diff code-diff-unified unicode-escaped">
</div>
</div>
</div>
+{{else}}
+<div class="tw-p-6 tw-text-center">
+ {{ctx.Locale.Tr "repo.editor.no_changes_to_show"}}
+</div>
+{{end}}
</div>
</div>
<div class="field">
- <div class="ui top attached tabular menu" data-write="write" data-preview="preview" data-diff="diff">
+ <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-url="{{.Repository.Link}}/markup" data-context="{{.RepoLink}}/src/{{.BranchNameSubURL}}" data-markup-mode="file">{{svg "octicon-eye"}} {{ctx.Locale.Tr "preview"}}</a>
{{if not .IsNewFile}}
<a class="item" data-tab="diff" hx-params="context,content" hx-vals='{"context":"{{.BranchLink}}"}' hx-include="#edit_area" hx-swap="innerHTML" hx-target=".tab[data-tab='diff']" hx-indicator=".tab[data-tab='diff']" hx-post="{{.RepoLink}}/_preview/{{.BranchName | PathEscapeSegments}}/{{.TreePath | PathEscapeSegments}}">{{svg "octicon-diff"}} {{ctx.Locale.Tr "repo.editor.preview_changes"}}</a>
{{end}}
</div>
- <div class="ui bottom attached active tab segment" data-tab="write">
+ <div class="ui active tab segment tw-rounded" data-tab="write">
<textarea id="edit_area" name="content" class="tw-hidden" data-id="repo-{{.Repository.Name}}-{{.TreePath}}"
data-url="{{.Repository.Link}}/markup"
data-context="{{.RepoLink}}"
data-line-wrap-extensions="{{.LineWrapExtensions}}">{{.FileContent}}</textarea>
<div class="editor-loading is-loading"></div>
</div>
- <div class="ui bottom attached tab segment markup" data-tab="preview">
+ <div class="ui tab segment markup tw-rounded" data-tab="preview">
{{ctx.Locale.Tr "loading"}}
</div>
- <div class="ui bottom attached tab segment diff edit-diff" data-tab="diff">
+ <div class="ui tab segment diff edit-diff" data-tab="diff">
<div class="tw-p-16"></div>
</div>
</div>
</div>
</div>
<div class="field">
- <div class="ui top attached tabular menu" data-write="write">
+ <div class="ui compact small menu small-menu-items repo-editor-menu">
<a class="active item" data-tab="write">{{svg "octicon-code" 16 "tw-mr-1"}}{{ctx.Locale.Tr "repo.editor.new_patch"}}</a>
</div>
- <div class="ui bottom attached active tab segment" data-tab="write">
+ <div class="ui active tab segment tw-rounded tw-p-0" data-tab="write">
<textarea id="edit_area" name="content" class="tw-hidden" data-id="repo-{{.Repository.Name}}-patch"
data-context="{{.RepoLink}}"
data-line-wrap-extensions="{{.LineWrapExtensions}}">
<div class="ui centered grid">
<div class="twelve wide computer column">
- <div class="ui attached left aligned segment">
- <p>{{ctx.Locale.Tr "repo.issues.label_templates.info"}}</p>
- <br>
- <form class="ui form center" action="{{.Link}}/initialize" method="post">
- {{.CsrfTokenHtml}}
- <div class="field">
- <div class="ui selection dropdown">
- <input type="hidden" name="template_name" value="Default">
- <div class="default text">{{ctx.Locale.Tr "repo.issues.label_templates.helper"}}</div>
- <div class="menu">
- {{range .LabelTemplateFiles}}
- <div class="item" data-value="{{.DisplayName}}">{{.DisplayName}}<br><i>({{.Description}})</i></div>
- {{end}}
- </div>
- {{svg "octicon-triangle-down" 18 "dropdown icon"}}
+ <p>{{ctx.Locale.Tr "repo.issues.label_templates.info"}}</p>
+ <form class="ui form center" action="{{.Link}}/initialize" method="post">
+ {{.CsrfTokenHtml}}
+ <div class="field">
+ <div class="ui selection dropdown">
+ <input type="hidden" name="template_name" value="Default">
+ <div class="default text">{{ctx.Locale.Tr "repo.issues.label_templates.helper"}}</div>
+ <div class="menu">
+ {{range .LabelTemplateFiles}}
+ <div class="item" data-value="{{.DisplayName}}">{{.DisplayName}}<br><i>({{.Description}})</i></div>
+ {{end}}
</div>
+ {{svg "octicon-triangle-down" 18 "dropdown icon"}}
</div>
- <button type="submit" class="ui primary button">{{ctx.Locale.Tr "repo.issues.label_templates.use"}}</button>
- </form>
- </div>
+ </div>
+ <button type="submit" class="ui primary button">{{ctx.Locale.Tr "repo.issues.label_templates.use"}}</button>
+ </form>
</div>
</div>
<div class="ui container">
{{template "base/alert" .}}
{{template "repo/release_tag_header" .}}
+ {{if .Releases}}
<h4 class="ui top attached header">
<div class="five wide column tw-flex tw-items-center">
{{svg "octicon-tag" 16 "tw-mr-1"}}{{ctx.Locale.Tr "repo.release.tags"}}
</tbody>
</table>
</div>
+ {{end}}
{{template "base/paginate" .}}
</div>
{{template "base/head" .}}
<div role="main" aria-label="{{.Title}}" class="page-content user notification">
<div class="ui container">
- <div class="ui top attached tabular menu">
+ <div class="ui compact small menu small-menu-items">
<a href="{{AppSubUrl}}/notifications/subscriptions" class="{{if eq .Status 1}}active {{end}}item">
{{ctx.Locale.Tr "notification.subscriptions"}}
</a>
{{ctx.Locale.Tr "notification.watching"}}
</a>
</div>
- <div class="ui bottom attached active tab segment">
+ <div class="ui top attached segment">
{{if eq .Status 1}}
<div class="tw-flex tw-justify-between">
<div class="tw-flex">
{{end}}
</div>
</div>
- <div class="ui attached bottom segment">
+ <div class="ui bottom attached segment">
<form class="ui form" action="{{AppSubUrl}}/user/settings/account/email" method="post">
{{.CsrfTokenHtml}}
<div class="required field {{if .Err_Email}}error{{end}}">
{{end}}
</div>
</div>
- <div class="ui attached bottom segment">
+ <div class="ui bottom attached segment">
<h5 class="ui top header">
{{ctx.Locale.Tr "settings.generate_new_token"}}
</h5>
</form>
</div>
</div>
-<div class="ui attached bottom segment">
+<div class="ui bottom attached segment">
<form class="ui form ignore-dirty" action="{{.FormActionPath}}" method="post">
{{.CsrfTokenHtml}}
<div class="field {{if .Err_AppName}}error{{end}}">
</div>
</div>
-<div class="ui attached bottom segment">
+<div class="ui bottom attached segment">
<h5 class="ui top header">
{{ctx.Locale.Tr "settings.create_oauth2_application"}}
</h5>
{{end}}
</div>
</div>
-<div class="ui attached bottom segment">
+<div class="ui bottom attached segment">
<form class="ui form" action="{{AppSubUrl}}/user/settings/security/openid" method="post">
{{.CsrfTokenHtml}}
<div class="required field {{if .Err_OpenID}}error{{end}}">
background-color: transparent !important;
}
+.monaco-editor,
+.monaco-editor .overflow-guard {
+ border-radius: var(--border-radius);
+}
+
/* these seem unthemeable */
.monaco-scrollable-element > .scrollbar > .slider {
background: var(--color-primary) !important;
border: 1px solid var(--color-secondary);
box-shadow: none;
word-wrap: break-word;
+ border-radius: var(--border-radius);
}
.ui.card {
.ui.segment .ui.tabular.menu .active.item:hover {
background: var(--color-box-body);
}
+
+.small-menu-items {
+ min-height: 35.4px !important; /* match .small.button in height */
+ background: none !important; /* fomantic sets a color here which does not play well with active transparent color on the item, so unset and set the colors on the item */
+ user-select: none;
+}
+
+.small-menu-items .item {
+ background: var(--color-menu) !important;
+ padding-top: 6px !important;
+ padding-bottom: 6px !important;
+}
+
+.small-menu-items .item:hover {
+ background: var(--color-hover) !important;
+}
+
+.small-menu-items .item.active {
+ background: var(--color-active) !important;
+}
.ui.modal form > .content {
padding: 1.5em;
background: var(--color-body);
+ border-radius: 0 0 var(--border-radius) var(--border-radius);
}
.ui.modal > .actions,
border-color: var(--color-secondary);
padding: 1rem;
text-align: right;
+ border-radius: 0 0 var(--border-radius) var(--border-radius);
}
.ui.modal .content > .actions {
}
.ui.attached.segment:has(+ .ui[class*="top attached"].header),
-.ui.attached.segment:last-child {
+.ui.attached.segment:last-child,
+.ui.segment:has(+ .ui.segment:not(.attached)),
+.ui.attached.segment:has(+ .ui.modal) {
border-radius: 0 0 0.28571429rem 0.28571429rem;
}
.ui.segment[class*="top attached"]:first-child {
margin-top: 0;
}
+.ui[class*="top attached"].segment:last-child {
+ border-top-left-radius: 0.28571429rem;
+ border-top-right-radius: 0.28571429rem;
+}
.ui.segment[class*="bottom attached"] {
bottom: 0;
.repository .diff-file-box .file-body.file-code {
background: var(--color-code-bg);
+ border-radius: var(--border-radius);
}
.repository .diff-file-box .file-body.file-code .lines-num {
vertical-align: middle;
}
+/* fix bottom border radius on diff files */
+.diff-file-body tr.tag-code:last-child {
+ background: none;
+}
+.diff-file-body tr.tag-code:last-child > td {
+ background: var(--color-box-body-highlight);
+}
+.diff-file-body tr.tag-code:last-child td:first-child,
+.diff-file-body tr.tag-code:last-child td:first-child * {
+ border-bottom-left-radius: 3px;
+}
+.diff-file-body tr.tag-code:last-child td:last-child,
+.diff-file-body tr.tag-code:last-child td:last-child * {
+ border-bottom-right-radius: 3px;
+}
+
.resolved-placeholder {
font-weight: var(--font-weight-normal) !important;
border: 1px solid var(--color-secondary) !important;
.diff-file-header {
padding: 5px 8px !important;
+ box-shadow: 0 -1px 0 1px var(--color-body); /* prevent borders being visible behind top corners when sticky and scrolled */
}
.diff-file-box[data-folded="true"] .diff-file-body {
flex: 1;
}
-.small-menu-items {
- min-height: 35.4px !important; /* match .small.button in height */
- background: none !important; /* fomantic sets a color here which does not play well with active transparent color on the item, so unset and set the colors on the item */
-}
-
-.small-menu-items .item {
- background: var(--color-menu) !important;
- padding-top: 6px !important;
- padding-bottom: 6px !important;
-}
-
-.small-menu-items .item:hover {
- background: var(--color-hover) !important;
-}
-
-.small-menu-items .item.active {
- background: var(--color-active) !important;
-}
-
@media (max-width: 767.98px) {
.list-header-search {
order: 0;
'input.foreground': getColor('--color-input-text'),
'scrollbar.shadow': getColor('--color-shadow'),
'progressBar.background': getColor('--color-primary'),
+ 'focusBorder': '#0000', // prevent blue border
},
});
import {POST} from '../modules/fetch.js';
function initEditPreviewTab($form) {
- const $tabMenu = $form.find('.tabular.menu');
+ const $tabMenu = $form.find('.repo-editor-menu');
$tabMenu.find('.item').tab();
- const $previewTab = $tabMenu.find(`.item[data-tab="${$tabMenu.data('preview')}"]`);
+ const $previewTab = $tabMenu.find('a[data-tab="preview"]');
if ($previewTab.length) {
$previewTab.on('click', async function () {
const $this = $(this);
const formData = new FormData();
formData.append('mode', mode);
formData.append('context', context);
- formData.append('text', $form.find(`.tab[data-tab="${$tabMenu.data('write')}"] textarea`).val());
+ formData.append('text', $form.find('.tab[data-tab="write"] textarea').val());
formData.append('file_path', $treePathEl.val());
try {
const response = await POST($this.data('url'), {data: formData});
const data = await response.text();
- const $previewPanel = $form.find(`.tab[data-tab="${$tabMenu.data('preview')}"]`);
- renderPreviewPanelContent($previewPanel, data);
+ const $previewPanel = $form.find('.tab[data-tab="preview"]');
+ if ($previewPanel.length) {
+ renderPreviewPanelContent($previewPanel, data);
+ }
} catch (error) {
console.error('Error:', error);
}
})();
}
-export function renderPreviewPanelContent($panelPreviewer, data) {
- $panelPreviewer.html(data);
+export function renderPreviewPanelContent($previewPanel, data) {
+ $previewPanel.html(data);
initMarkupContent();
- const $refIssues = $panelPreviewer.find('p .ref-issue');
+ const $refIssues = $previewPanel.find('p .ref-issue');
attachRefIssueContextPopup($refIssues);
}