[Feature proposal] Multiple repositories selectable @ issues/PR page #3062

Closed
opened 2025-11-02 04:59:18 -06:00 by GiteaMirror · 9 comments
Owner

Originally created by @oscarlofwenhamn on GitHub (Mar 18, 2019).

Description

As a user, I would like to be have the option to view issues and pull-requests from multiple repositories on their respective pages. Currently, selecting one repository removes the other repos from the list. This feels unnecessarily limiting, and not very intuitive. My suggestion is to use a similar style, but not remove the repos and also allow multiple selections.

Possible method

Currently, the page identifies what repo should be used by defining a number of variables including repo (e.g. ?type=all&repo=17&sort=&state=open). Passing multiple repo entries here could make multiple selection possible, something like
?type=all&repos[]=17&repos[]=21&repos[]=22&sort=&state=open.

I will test out a local fix, and post my findings here.

Illustration

multiple-repo-select

Originally created by @oscarlofwenhamn on GitHub (Mar 18, 2019). ## Description As a user, I would like to be have the option to view issues and pull-requests from multiple repositories on their respective pages. Currently, selecting one repository removes the other repos from the list. This feels unnecessarily limiting, and not very intuitive. My suggestion is to use a similar style, but not remove the repos and also allow multiple selections. ### Possible method Currently, the page identifies what repo should be used by defining a number of variables including repo (e.g. `?type=all&repo=17&sort=&state=open`). Passing multiple repo entries here could make multiple selection possible, something like `?type=all&repos[]=17&repos[]=21&repos[]=22&sort=&state=open`. I will test out a local fix, and post my findings here. ## Illustration ![multiple-repo-select](https://user-images.githubusercontent.com/44643697/54518445-8cd77b00-4964-11e9-8f6a-d7b21b356b2c.png)
GiteaMirror added the issue/confirmedtype/enhancement labels 2025-11-02 04:59:18 -06:00
Author
Owner

@oscarlofwenhamn commented on GitHub (Mar 18, 2019):

A local fix for persisting the repo list was achieved by simply moving the three lines

if repoID > 0 {
    opts.RepoIDs = []int64{repoID}
}

in routers/user/home.go:Issues down from before the call

counts, err := models.CountIssuesByRepo(opts)

to right before

issues, err := models.Issues(opts)

This keeps the list of repositories, whilst still making the selected one highlighted and only showing its issues/PR's.

The next step is to enable multiple selections.

I'm not really sure if there exists a function for querying a list of integers similar to how the repo id is currently queried using repoID := ctx.QueryInt64("repo"), any suggestions are very welcome.

@oscarlofwenhamn commented on GitHub (Mar 18, 2019): A local fix for persisting the repo list was achieved by simply moving the three lines ```go if repoID > 0 { opts.RepoIDs = []int64{repoID} } ``` in `routers/user/home.go:Issues` down from before the call ```go counts, err := models.CountIssuesByRepo(opts) ``` to right before ```go issues, err := models.Issues(opts) ``` This keeps the list of repositories, whilst still making the selected one highlighted and only showing its issues/PR's. The next step is to enable multiple selections. I'm not really sure if there exists a function for querying a list of integers similar to how the repo id is currently queried using ` repoID := ctx.QueryInt64("repo")`, any suggestions are very welcome.
Author
Owner

@oscarlofwenhamn commented on GitHub (Mar 18, 2019):

In gitea\routers\admin\notice.go something similar is achieved which is looking promising, using

strs := ctx.QueryStrings("ids[]")
ids := make([]int64, 0, len(strs))
@oscarlofwenhamn commented on GitHub (Mar 18, 2019): In `gitea\routers\admin\notice.go` something similar is achieved which is looking promising, using ```go strs := ctx.QueryStrings("ids[]") ids := make([]int64, 0, len(strs)) ```
Author
Owner

@lunny commented on GitHub (Mar 19, 2019):

@oscarlofwenhamn Could you send a PR for that?

@lunny commented on GitHub (Mar 19, 2019): @oscarlofwenhamn Could you send a PR for that?
Author
Owner

@oscarlofwenhamn commented on GitHub (Mar 19, 2019):

I've started working on multiple selection, though if available I could use a tip on finding documentation regarding what functions are available in the tmpl, specifically for finding if a repo ID is in the list of selected repos. I'm thinking something like {{if in .RepoIDs .ID}}..., but I'm not aware of what functionality is available.

@oscarlofwenhamn commented on GitHub (Mar 19, 2019): I've started working on multiple selection, though if available I could use a tip on finding documentation regarding what functions are available in the tmpl, specifically for finding if a repo ID is in the list of selected repos. I'm thinking something like `{{if in .RepoIDs .ID}}...`, but I'm not aware of what functionality is available.
Author
Owner

@jolheiser commented on GitHub (Mar 19, 2019):

The helper functions that Gitea provides can be found in modules/templates/helper.go

Things like and, or, etc. should be in the Go template documentation
There is technically a template package specifically for HTML, but most of the actions, pipelines, etc. are defined in the text package.

@jolheiser commented on GitHub (Mar 19, 2019): The helper functions that Gitea provides can be found in [modules/templates/helper.go](https://github.com/go-gitea/gitea/blob/master/modules/templates/helper.go#L35) Things like `and`, `or`, etc. should be in the [Go template documentation](https://golang.org/pkg/text/template/#hdr-Actions) There is technically a template package specifically for HTML, but most of the actions, pipelines, etc. are defined in the text package.
Author
Owner

@oscarlofwenhamn commented on GitHub (Mar 19, 2019):

Thanks, @jolheiser. I managed to come across them, so it's good to know I'm not sniffing up the wrong tree.

I think I am quite close to a local fix, though it is pretty clunky to be honest. I will post it when I confirm it works, maybe we can find a way to slim it down.

@oscarlofwenhamn commented on GitHub (Mar 19, 2019): Thanks, @jolheiser. I managed to come across them, so it's good to know I'm not sniffing up the wrong tree. I think I am quite close to a local fix, though it is pretty clunky to be honest. I will post it when I confirm it works, maybe we can find a way to slim it down.
Author
Owner

@oscarlofwenhamn commented on GitHub (Mar 19, 2019):

There, it seems to be working.

In order to pass all other selected RepoIDs when selecting/deselecting a repo, I've constructed the following snippet, which is added to the href-attribute of the repo links instead of the old &repo part. I'm not sure if you think I should try to write a helper function, or if anyone has another idea of how to put it together, but either way I will look it over a few more times to make sure there's no slimmer way of doing it.

Basically, I want to include all elements of repos[], adding the selected repo to the list if it's not there and removing it from the list if it is there (selecting unselected repos, delesecting selected repos).

First draft:
$Repo corresponds to each element in {{range .Repos}}

{{with $include := true}}
	{{range $.RepoIDs}}
		{{if eq . $Repo.ID}}
			{{$include = false}}
		{{else}}
			&repos[]={{.}}
		{{end}}
	{{end}}
	{{if eq $include true}}
		&repos[]={{$Repo.ID}}
	{{end}}
{{end}}
@oscarlofwenhamn commented on GitHub (Mar 19, 2019): There, it seems to be working. In order to pass all other selected RepoIDs when selecting/deselecting a repo, I've constructed the following snippet, which is added to the href-attribute of the repo links instead of the old `&repo` part. I'm not sure if you think I should try to write a helper function, or if anyone has another idea of how to put it together, but either way I will look it over a few more times to make sure there's no slimmer way of doing it. Basically, I want to include all elements of `repos[]`, adding the selected repo to the list if it's not there and removing it from the list if it is there (selecting unselected repos, delesecting selected repos). First draft: _$Repo corresponds to each element in {{range .Repos}}_ ```go {{with $include := true}} {{range $.RepoIDs}} {{if eq . $Repo.ID}} {{$include = false}} {{else}} &repos[]={{.}} {{end}} {{end}} {{if eq $include true}} &repos[]={{$Repo.ID}} {{end}} {{end}} ```
Author
Owner

@stale[bot] commented on GitHub (May 18, 2019):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale[bot] commented on GitHub (May 18, 2019): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.
Author
Owner

@oscarlofwenhamn commented on GitHub (May 19, 2019):

Still working on this in #6369 though not completely finished yet.

@oscarlofwenhamn commented on GitHub (May 19, 2019): Still working on this in #6369 though not completely finished yet.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#3062