Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor image diff #31444

Merged
merged 3 commits into from
Jun 22, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
1 change: 1 addition & 0 deletions web_src/js/features/common-form.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import $ from 'jquery';
import '../vendor/jquery.are-you-sure.js';
Copy link
Member

@silverwind silverwind Jun 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already imported in web_src/js/features/common-global.js, so this would load it twice needlessly.

Move import to index.js?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no common-global.js

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is it currently loaded? Not at all?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move import to index.js?

I would say no. Only use it where it is really used. Here is initGlobalFormDirtyLeaveConfirm

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0678287 regressed it. I recommend moving the import to top of index.js, it's needed on so many pages, we may as well load it everywhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will rewrite the are-you-sure in next PR, but not in this one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-> Fix are-you-sure #31446

Copy link
Contributor Author

@wxiaoguang wxiaoguang Jun 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we do not need that many PRs, merged #31446 into this since it is simple enough

import {handleGlobalEnterQuickSubmit} from './comp/QuickSubmit.js';

export function initGlobalFormDirtyLeaveConfirm() {
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