Compare commits

...

7 Commits

Author SHA1 Message Date
silverwind 6247864aaf
revert var rename 2024-04-27 18:35:18 +02:00
silverwind f4a743dff0
revert function change 2024-04-27 18:34:00 +02:00
silverwind 7c31f74849
editor improvements and simplifications 2024-04-27 18:28:36 +02:00
silverwind 3de13aa93f
remove 'active tab' from subscriptions 2024-04-27 17:38:06 +02:00
silverwind 2bd28a7f73
move border-radius to .ui.card 2024-04-27 17:34:25 +02:00
silverwind f18ad0efa9
move tw-text-center 2024-04-27 17:31:36 +02:00
wxiaoguang 7a832ef248 fix modal border 2024-04-27 18:08:17 +08:00
12 changed files with 40 additions and 38 deletions

View File

@ -11,7 +11,7 @@
</div>
</div>
{{else}}
<div class="tw-p-6">
<div class="tw-p-6 tw-text-center">
{{ctx.Locale.Tr "repo.editor.no_changes_to_show"}}
</div>
{{end}}

View File

@ -26,7 +26,7 @@
</div>
</div>
<div class="field">
<div class="ui compact small menu small-menu-items repo-editor-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}}
@ -44,7 +44,7 @@
<div class="ui tab segment markup tw-rounded" data-tab="preview">
{{ctx.Locale.Tr "loading"}}
</div>
<div class="ui tab segment diff edit-diff tw-text-center" data-tab="diff">
<div class="ui tab segment diff edit-diff" data-tab="diff">
<div class="tw-p-16"></div>
</div>
</div>

View File

@ -19,10 +19,10 @@
</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}}">

View File

@ -5,7 +5,7 @@
{{template "repo/migrate/helper" .}}
<div class="ui cards migrate-entries">
{{range .Services}}
<a class="ui card migrate-entry tw-flex tw-items-center tw-rounded" href="{{AppSubUrl}}/repo/migrate?service_type={{.}}&org={{$.Org}}&mirror={{$.Mirror}}">
<a class="ui card migrate-entry tw-flex tw-items-center" href="{{AppSubUrl}}/repo/migrate?service_type={{.}}&org={{$.Org}}&mirror={{$.Mirror}}">
{{if eq .Name "github"}}
{{svg "octicon-mark-github" 184 "tw-p-4"}}
{{else if eq .Name "gitlab"}}

View File

@ -1,4 +1,4 @@
<div id="profile-avatar-card" class="ui card tw-rounded">
<div id="profile-avatar-card" class="ui card">
<div id="profile-avatar" class="content tw-flex">
{{if eq .SignedUserID .ContextUser.ID}}
<a class="image" href="{{AppSubUrl}}/user/settings" data-tooltip-content="{{ctx.Locale.Tr "user.change_avatar"}}">

View File

@ -9,7 +9,7 @@
{{ctx.Locale.Tr "notification.watching"}}
</a>
</div>
<div class="ui top 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">

View File

@ -435,10 +435,6 @@ a.label,
box-shadow: 1px 1px 0 0 var(--color-secondary);
}
.ui.modal .actions {
border-radius: 0 0 var(--border-radius) var(--border-radius);
}
.ui.comments .comment .text {
margin: 0;
}

View File

@ -21,6 +21,7 @@
border: 1px solid var(--color-secondary);
box-shadow: none;
word-wrap: break-word;
border-radius: var(--border-radius);
}
.ui.card {

View File

@ -799,3 +799,23 @@
.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;
}

View File

@ -54,6 +54,7 @@ These inconsistent layouts should be refactored to simple ones.
.ui.modal form > .content {
padding: 1.5em;
background: var(--color-body);
border-radius: 0 0 var(--border-radius) var(--border-radius);
}
.ui.modal > .actions,
@ -63,6 +64,7 @@ These inconsistent layouts should be refactored to simple ones.
border-color: var(--color-secondary);
padding: 1rem;
text-align: right;
border-radius: 0 0 var(--border-radius) var(--border-radius);
}
.ui.modal .content > .actions {

View File

@ -25,25 +25,6 @@
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;

View File

@ -9,7 +9,7 @@ import {POST} from '../modules/fetch.js';
function initEditPreviewTab($form) {
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);
@ -24,13 +24,15 @@ function initEditPreviewTab($form) {
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);
}
@ -175,10 +177,10 @@ export function initRepoEditor() {
})();
}
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);
}