gitea
gitea copied to clipboard
Pin Repositories (Fixes #10375)
#10375
This PR adds the ability for repository administrators to pin up to 3 repositories to the home page of the repository owner.
This applies to both users and orgs.
Pinned repositories are stored in the user setting pinned_repos
.
Not included in this PR:
- Any API access to pinning/unpinning
- Configurable maximum pinned repos per org/user
@delvh All the bits of logging here are debugging hangovers, they won't be present in the finished PR :)
Thank you for the notes! I'll go through it all today.
Could you give some screenshots about the UI design? I think we need some discuss there.
Could you give some screenshots about the UI design? I think we need some discuss there.
I tried cards above the search bar, but couldn't get it to look coherent.
Part of it is that the repository names can be very long, right? So I found it hard to think of a better presentation than in a list with the rest.
However I take @delvh 's point that these are a user thing and should appear separately to the searched repositories. So I will try again with some cards.
I'd say if the name is too long for a card, we can simply overflow,
i.e. really-long-repository-name
could be shortened to really-lo...
, depending on the width of the card.
That should be easy to achieve with CSS.
EDIT: I just found out that GitHub handles long repository names as follows:
I don't know, do we want to keep that approach, or do we want to use overflow instead?
Moved to a card approach. I know it's not elegant yet but just as a centre for discussion.
Latest UI grab
User implementation always uses single column - Fits better with the narrower styling on the user profile.
If you use three wide it looks fine on a full size screen - But when you go to a narrower screen (but bigger than mobile) it gets cramped. This layout doesn't have that issue.
Feature complete. Unpin icon was made custom since octicons doesn't have one.
User profile:
Org home:
Why only 3 repos and not 6 like GitHub?
Why only 3 repos and not 6 like GitHub?
In the original issue, 3 was just the number used in the mockups so it's what I implemented.
As stated in the OP it's a known limitation of this PR. It wouldn't be hard to change to a different fixed number, like 6.
What does 6 look like on a mobile ? If 6 causes too much clutter then 3 is a reasonable number
What does 6 look like on a mobile ? If 6 causes too much clutter then 3 is a reasonable number
I've never tried anything other than 6. It would have to be prototyped
you mean 3? 3 is better than none and equally there is never enough :) 3 seems fine to me as the use-case I was considering was pinning a STEERING repository for each organisation, leaving 2 more for any heavily used ones
I'm curious since none of the test screenshots are anything close to a phone in portrait mode, but what happens with the pinned repos with a small page width? It would be cool if they then became vertically stacked or something else smart that doesn't involve just a giant horizontal scrollbar (and doesn't involve the pin cards becoming so tiny they can't be read anymore).
In overall this is really cool. Especially on instances with a lot of developers, this can help a lot with finding out what cool stuff the others made.
I'm curious since none of the test screenshots are anything close to a phone in portrait mode, but what happens with the pinned repos with a small page width? It would be cool if they then became vertically stacked or something else smart that doesn't involve just a giant horizontal scrollbar (and doesn't involve the pin cards becoming so tiny they can't be read anymore).
In overall this is really cool. Especially on instances with a lot of developers, this can help a lot with finding out what cool stuff the others made.
I believe stacking vertically is exactly what they do. They use the Fomantic stackable
class.
Moved to v1.19 because one should pin his organization repositories
I may not have the time to implement this new version any time soon. If someone else is interested I'm happy to hand it over.
So to be clear the spec here is:
- Users and orgs should be able to have up to 3 repositories pinned on their profiles
- For organisations, this must be repositories within that organisation
- For users, it can be any public repository (no restrictions?)
It is not super clear to me what the UI for this will be. For example if I'm on a repository owned by an org for which I'm the administrator, I need the option to pin it to my profile or the org's profile. I don't know how best to do that.
For users, it can be any public repository (no restrictions?)
For what it's worth, I think GitHub restricts it to having either some sort of repo ownership or past contributions.
I'm really just a random user (who happens to like pins), but I personally think no restriction may actually be cooler. It changes pins from only "look at my work" to "hey, look at this cool thing", and that feels more social and dynamic to me. But I wonder what others think?
Both have their advantages and disadvantages. The owner-based approach prevents errors, the freely-pinnable approach is less restrictive.
I'm also fine with both approaches, as long as we can agree on one and keep it at that.
Both have their advantages and disadvantages. The owner-based approach prevents errors, the freely-pinnable approach is less restrictive.
I'm also fine with both approaches, as long as we can agree on one and keep it at that.
I think free pinning gives users the opportunity to use the feature how they wish, which maybe feels more expressive?
Plus it's simpler to implement!
Both have their advantages and disadvantages. The owner-based approach prevents errors, the freely-pinnable approach is less restrictive. I'm also fine with both approaches, as long as we can agree on one and keep it at that.
I think free pinning gives users the opportunity to use the feature how they wish, which maybe feels more expressive?
Plus it's simpler to implement!
While that is true think about an organisation that wants to bring focus to a key repository. Users pinning for their convenience is important but an organisation pinning for visibility is equally important
eg https://github.com/go-gitea
Both have their advantages and disadvantages. The owner-based approach prevents errors, the freely-pinnable approach is less restrictive. I'm also fine with both approaches, as long as we can agree on one and keep it at that.
I think free pinning gives users the opportunity to use the feature how they wish, which maybe feels more expressive? Plus it's simpler to implement!
While that is true think about an organisation that wants to bring focus to a key repository. Users pinning for their convenience is important but an organisation pinning for visibility is equally important
eg https://github.com/go-gitea
I don't understand why users being able to free pin would impact orgs?
Orgs will be able to pin their own repos to their profiles for sure.
I am equally confused. The only thing I can somewhat guess would be that you need a dropdown when pinning to decide where to pin it to, with the options being you, or the orgs you have admin rights in. If you don't have admin rights in any org, we should probably shortcut to directly pinning to your own page.
I am equally confused. The only thing I can somewhat guess would be that you need a dropdown when pinning to decide where to pin it to, with the options being you, or the orgs you have admin rights in. If you don't have admin rights in any org, we should probably shortcut to directly pinning to your own page.
Hold on a mo.
It seems like you're suggesting that orgs should also be able to pin any repository to their profiles - not just ones tha they own?
I thought we were suggesting users could pin anything, but orgs could only pin their own repos.
but orgs could only pin their own repos.
Would that be important to limit though? Maybe it should also be unrestricted.
but orgs could only pin their own repos.
Would that be important to limit though? Maybe it should also be unrestricted.
Yeah that's a fair question. I suppose I'm worried about the UI explosion.
If the dropdown is just:
- Pin to my profile
- Pin to [orgname]
Then that's pretty digestable. If it's...
- Pin to my profile
- Pin to [org1]
- Pin to [org2]
- Pin to [org3]
- ...
It's a lot more irritating, especially given that 99% of the time you're going to want to pin the repo just to its owning org.
Please move the discussion to #10375, I think that's more appropriate as we have a lot to discuss as it seems.
Now that https://github.com/go-gitea/gitea/pull/24406 is in, I assume at least the HTML templates and CSS from it could be re-used here.
Are you still doing this PR?
Closing as stale and the author having said that this feature needs a completely new implementation (https://github.com/go-gitea/gitea/issues/10375#issuecomment-1293271930)