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

Add file tree to file view page #32721

Open
wants to merge 74 commits into
base: main
Choose a base branch
from

Conversation

kerwin612
Copy link
Member

@kerwin612 kerwin612 commented Dec 5, 2024

This pull request introduces a file tree on the left side when reviewing files of a repository.

32721

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Dec 5, 2024
@pull-request-size pull-request-size bot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Dec 5, 2024
@kerwin612 kerwin612 marked this pull request as draft December 5, 2024 02:38
@github-actions github-actions bot added modifies/templates This PR modifies the template files modifies/frontend labels Dec 5, 2024
@yp05327 yp05327 added this to the 1.24.0 milestone Dec 5, 2024
@pull-request-size pull-request-size bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Dec 5, 2024
@kerwin612 kerwin612 marked this pull request as ready for review December 5, 2024 06:34
templates/repo/home.tmpl Outdated Show resolved Hide resolved
templates/repo/home.tmpl Outdated Show resolved Hide resolved
templates/repo/home.tmpl Outdated Show resolved Hide resolved
@pull-request-size pull-request-size bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Dec 5, 2024
@github-actions github-actions bot added the modifies/go Pull requests that update Go code label Dec 5, 2024
@kerwin612 kerwin612 requested a review from wxiaoguang December 5, 2024 14:22
@lunny
Copy link
Member

lunny commented Dec 5, 2024

1 Move the three buttons on top of the left tree when expanding and move to the right once folding.
图片

2 The expanding state should be stored to users' configuration or as a session value once changed.
3 It should be sorted so that folders should always be on top of files on the left tree.
图片

@wxiaoguang wxiaoguang marked this pull request as draft December 7, 2024 03:21
@kerwin612 kerwin612 force-pushed the add-file-tree-to-file-view-page branch from 7229b60 to 59e46d4 Compare December 13, 2024 06:30
@pull-request-size pull-request-size bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Dec 13, 2024
@kerwin612 kerwin612 force-pushed the add-file-tree-to-file-view-page branch from e45940d to c4e7f0c Compare December 13, 2024 12:20
@yp05327
Copy link
Contributor

yp05327 commented Jan 10, 2025

My mouse has a back button, if I click the file tree, and then back, the URL will be changed, but the web page won't. 👀
This can be done later. Not a request.

@yp05327
Copy link
Contributor

yp05327 commented Jan 10, 2025

http://host/owner/symlink-test/src/tag/0.0.1/file-symlink

file-symlink not work.

image


type TreeEntry struct {
Name string `json:"name"`
IsFile bool `json:"isFile"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Besides "file" / "dir", it could also be something like "submodule"

Copy link
Member

Choose a reason for hiding this comment

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

67a749f, need frontend changes. @kerwin612

@wxiaoguang
Copy link
Contributor

To make things clear, we need this first: Refactor context repository #33202

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Jan 10, 2025

And I would suggest you to split the PR into small ones, do refactorings and preparations first, otherwise neither current tmpl layout nor the framework works for your new feature.

You can see how many PRs I made in 1.23 to make the render system right:

image

@wxiaoguang
Copy link
Contributor

Next: we need to remove the RefName from code&template: Refactor context RefName #33226

@wxiaoguang
Copy link
Contributor

Next: Refactor RefName #33234 , fix #32721 (comment)

// There are many "cancel button" elements in modal dialogs, Fomantic UI expects they are button-like elements but never submit a form.
// However, Gitea misuses the modal dialog and put the cancel buttons inside forms, so we must prevent the form submission.
// There are a few cancel buttons in non-modal forms, and there are some dynamically created forms (eg: the "Edit Issue Content")
addDelegatedEventListener(document, 'click', 'form button.ui.cancel.button', (_ /* el */, e) => e.preventDefault());
queryElems(target, 'form button.ui.cancel.button', (el) => el.addEventListener('click', (e) => e.preventDefault()));
Copy link
Contributor

Choose a reason for hiding this comment

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

NOOOOOOOOOOOO, do not do that.

It is not right. addDelegatedEventListener has its own clear purpose.

@GiteaBot GiteaBot added lgtm/blocked A maintainer has reservations with the PR and thus it cannot be merged and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Jan 13, 2025
@wxiaoguang
Copy link
Contributor

wxiaoguang commented Jan 13, 2025

Please please please fully understand the code before making breaking changes. I can't remember how many regressions this PR would introduce, I do not want to be the poor man to keep saying: this is not right, that is wrong.


And do not request my review before you are pretty sure this PR is "almost" right.

@@ -84,6 +84,19 @@ func RefNameFromCommit(shortName string) RefName {
return RefName(shortName)
}

func RefNameFromTypeAndShortName(tp RefType, shortName string) RefName {

This comment was marked as outdated.

Copy link
Contributor

Choose a reason for hiding this comment

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

If you insist that it is right, you could open a new PR to refactor existing code (for example: /tree-list) to use the new mechanism first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm/blocked A maintainer has reservations with the PR and thus it cannot be merged modifies/frontend modifies/go Pull requests that update Go code modifies/templates This PR modifies the template files size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. type/changelog Adds the changelog for a new Gitea version type/feature Completely new functionality. Can only be merged if feature freeze is not active.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants