Skip to content

Commit

Permalink
Refactor image diff (go-gitea#31444)
Browse files Browse the repository at this point in the history
And remove some jQuery functions
  • Loading branch information
wxiaoguang committed Jun 22, 2024
1 parent b3ed1e0 commit 1a811c0
Show file tree
Hide file tree
Showing 6 changed files with 193 additions and 169 deletions.
2 changes: 1 addition & 1 deletion templates/repo/diff/image_diff.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
data-mime-before="{{.sniffedTypeBase.GetMimeType}}"
data-mime-after="{{.sniffedTypeHead.GetMimeType}}"
>
<overflow-menu class="ui secondary pointing tabular top attached borderless menu">
<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>
{{if and .blobBase .blobHead}}
Expand Down
2 changes: 2 additions & 0 deletions web_src/js/features/common-form.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import $ from 'jquery';
import {initAreYouSure} from '../vendor/jquery.are-you-sure.js';
import {handleGlobalEnterQuickSubmit} from './comp/QuickSubmit.js';

export function initGlobalFormDirtyLeaveConfirm() {
initAreYouSure(window.jQuery);
// Warn users that try to leave a page after entering data into a form.
// Except on sign-in pages, and for forms marked as 'ignore-dirty'.
if (!$('.user.signin').length) {
Expand Down
6 changes: 4 additions & 2 deletions web_src/js/features/common-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export function initFootLanguageMenu() {
$('.language-menu a[lang]').on('click', linkLanguageAction);
}

export function initGlobalComponents() {
export function initGlobalDropdown() {
// Semantic UI modules.
const $uiDropdowns = $('.ui.dropdown');

Expand Down Expand Up @@ -68,8 +68,10 @@ export function initGlobalComponents() {
// eg: the "Create New Repo" menu on the navbar.
$uiDropdowns.filter('.upward').dropdown('setting', 'direction', 'upward');
$uiDropdowns.filter('.downward').dropdown('setting', 'direction', 'downward');
}

$('.ui.menu.tabular .item').tab({autoTabActivation: false});
export function initGlobalTabularMenu() {
$('.ui.menu.tabular:not(.custom) .item').tab({autoTabActivation: false});
}

/**
Expand Down
Loading

0 comments on commit 1a811c0

Please sign in to comment.