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

Rework repo buttons #20602

Merged
merged 9 commits into from
Aug 7, 2022
Merged

Rework repo buttons #20602

merged 9 commits into from
Aug 7, 2022

Conversation

silverwind
Copy link
Member

  • Replace "New PR" and "Go to File" button with Icon Button
  • Move all "Add File" actions into a dropdown button
  • Remove most custom styling of clone buttons

Buttons are now all equal height, mobile layout wraps gracefully.

Fixes: #13671
Replaces: #20375

Screen Shot 2022-08-01 at 21 37 53

Screen Shot 2022-08-01 at 21 37 36

Screen Shot 2022-08-01 at 21 29 22

@silverwind
Copy link
Member Author

silverwind commented Aug 1, 2022

Maybe should backport this into 1.17. I think all these "Add file" buttons there are a eyesore.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Aug 1, 2022
@zeripath
Copy link
Contributor

zeripath commented Aug 1, 2022

So unfortunately there's still a way to get this to totally break:

Screenshot from 2022-08-01 21-39-40

Copy link
Contributor

@zeripath zeripath left a comment

Choose a reason for hiding this comment

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

Looks cool but I think it would better to stick a named class on these things as the string of 2-letter codes as a classes - all of which use !important seems likely to cause trouble.

I do wonder about whether dropping the New Pull Request label from the new pull request button makes it a bit difficult to see - previously it was pretty clear how to create a PR from a branch

templates/repo/commits.tmpl Outdated Show resolved Hide resolved
templates/repo/commits.tmpl Outdated Show resolved Hide resolved
@silverwind
Copy link
Member Author

Did a few more fixes:

  • Added margin back below subfolder path
  • Made branch button render correctly without JS, eliminating the layout shift when JS loads
  • Remove "Add File" button in subtree view, it seems to provide no value there.

@silverwind
Copy link
Member Author

Looks cool but I think it would better to stick a named class on these things as the string of 2-letter codes as a classes - all of which use !important seems likely to cause trouble.

I like to keep the CSS small and these helper they target a single element with a single CSS rule, that can't cause issues, the indent is clear.

I do wonder about whether dropping the New Pull Request label from the new pull request button makes it a bit difficult to see - previously it was pretty clear how to create a PR from a branch

Guess it is fine. My initial idea was to remove this button completely. But like it is now, it takes up little space so I kept it.

@silverwind
Copy link
Member Author

So unfortunately there's still a way to get this to totally break:

Screenshot from 2022-08-01 21-39-40

Hmm, I guess long branch name can be ellipsed there to prevent it.

@silverwind
Copy link
Member Author

Added truncation for long branch name:

Screen Shot 2022-08-01 at 23 36 42

Screen Shot 2022-08-01 at 23 36 15

@Gusted Gusted added this to the 1.18.0 milestone Aug 1, 2022
@silverwind
Copy link
Member Author

silverwind commented Aug 1, 2022

Another slightly related fix included: When clicking the clone URL input, the whole URL is selected. Sometimes one only wants to select part of the URL. I changed the handler to focus so manual selection after first click is still possible and this matches GH behaviour as well.

Copy link
Contributor

@wxiaoguang wxiaoguang left a comment

Choose a reason for hiding this comment

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

LGTM (except there is a small conflict)

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Aug 2, 2022
- Replace "New PR" and "Go to File" button with Icon Button
- Move all "Add File" actions into a dropdown button
- Remove most custom styling of clone buttons

Buttons are now all equal height, mobile layout wraps gracefully.

Fixes: go-gitea#13671
Replaces: go-gitea#20375
@silverwind
Copy link
Member Author

Rebased, squashed and added one more commit which brings margins in-line and added a few css rules for wiki only.

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Aug 3, 2022
@lafriks lafriks added the topic/ui Change the appearance of the Gitea UI label Aug 3, 2022
@silverwind
Copy link
Member Author

silverwind commented Aug 3, 2022

For backport, we should wait a bit until we have a few translations.

@silverwind
Copy link
Member Author

Shoul be ready to merge, CI failure is unrelated.

@lafriks
Copy link
Member

lafriks commented Aug 6, 2022

🚀

@lafriks
Copy link
Member

lafriks commented Aug 7, 2022

🚀

@lafriks lafriks merged commit abdebd2 into go-gitea:main Aug 7, 2022
@lafriks
Copy link
Member

lafriks commented Aug 7, 2022

please backport

zjjhot added a commit to zjjhot/gitea that referenced this pull request Aug 8, 2022
* giteaofficial/main: (23 commits)
  [skip ci] Updated translations via Crowdin
  Fix v220 migration to be compatible for MSSQL 2008 r2 (go-gitea#20702)
  Rework repo buttons (go-gitea#20602)
  Switch to building with go1.19 (go-gitea#20695)
  Update maven deploy docs (go-gitea#20691)
  Add support for Pub packages (go-gitea#20560)
  Fix typo overrided -> overridden (go-gitea#20687)
  [skip ci] Updated licenses and gitignores
  Update JS dependencies, adjust eslint (go-gitea#20659)
  Background color of private list-items updated (go-gitea#20630)
  Use request timeout for git service rpc (go-gitea#20689)
  Increase default item listing size `ISSUE_PAGING_NUM` to 20 (go-gitea#20547)
  [skip ci] Updated translations via Crowdin
  Allow multiple metadata files for Maven packages (go-gitea#20674)
  docs: update comparison.zh-cn.md (go-gitea#20656)
  Add a notice for breaking check in upgrade document (go-gitea#20682)
  move handleGlobalEnterQuickSubmit into a separate file to avoid cycle-import (go-gitea#20679)
  Use correct field name. (go-gitea#20675)
  [skip ci] Updated translations via Crowdin
  Use correct context to get package content (go-gitea#20673)
  ...

# Conflicts:
#	templates/repo/wiki/view.tmpl
@silverwind silverwind deleted the consolidate branch August 8, 2022 10:07
@silverwind
Copy link
Member Author

Release branches don't receive translation updates, so I think it'd be best to wait a bit until add_file has some translations on main, then backport along with those.

silverwind added a commit to silverwind/gitea that referenced this pull request Aug 8, 2022
Fix two regressions from go-gitea#20602:

- Restore the 'History' button that was previously unable to render
  because it's show condition was never hit
- Hide the 'Add File' button when there would be no items in the
  dropdown.
silverwind added a commit to silverwind/gitea that referenced this pull request Aug 8, 2022
* Rework repo buttons

- Replace "New PR" and "Go to File" button with Icon Button
- Move all "Add File" actions into a dropdown button
- Remove most custom styling of clone buttons
- Margin and wiki tweaks

Buttons are now all equal height, mobile layout wraps gracefully.

Fixes: go-gitea#13671
Replaces: go-gitea#20375

Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
wxiaoguang added a commit that referenced this pull request Aug 9, 2022
Fix two regressions from #20602:

- Restore the 'History' button that was previously unable to render
  because it's show condition was never hit
- Hide the 'Add File' button when there would be no items in the
  dropdown.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
silverwind added a commit to silverwind/gitea that referenced this pull request Aug 9, 2022
…ea#20718)

Fix two regressions from go-gitea#20602:

- Restore the 'History' button that was previously unable to render
  because it's show condition was never hit
- Hide the 'Add File' button when there would be no items in the
  dropdown.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
vsysoev pushed a commit to IntegraSDL/gitea that referenced this pull request Aug 10, 2022
* Rework repo buttons

- Replace "New PR" and "Go to File" button with Icon Button
- Move all "Add File" actions into a dropdown button
- Remove most custom styling of clone buttons
- Margin and wiki tweaks

Buttons are now all equal height, mobile layout wraps gracefully.

Fixes: go-gitea#13671
Replaces: go-gitea#20375

Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
vsysoev pushed a commit to IntegraSDL/gitea that referenced this pull request Aug 10, 2022
…ea#20718)

Fix two regressions from go-gitea#20602:

- Restore the 'History' button that was previously unable to render
  because it's show condition was never hit
- Hide the 'Add File' button when there would be no items in the
  dropdown.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
zeripath pushed a commit that referenced this pull request Aug 20, 2022
* Rework repo buttons (#20602)

* Rework repo buttons

- Replace "New PR" and "Go to File" button with Icon Button
- Move all "Add File" actions into a dropdown button
- Remove most custom styling of clone buttons
- Margin and wiki tweaks

Buttons are now all equal height, mobile layout wraps gracefully.

Fixes: #13671
Replaces: #20375

* Restore history button and hide add button when unable to add (#20718)

Fix two regressions from #20602:

- Restore the 'History' button that was previously unable to render
  because it's show condition was never hit
- Hide the 'Add File' button when there would be no items in the
  dropdown.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
@zeripath zeripath added the backport/done All backports for this PR have been created label Aug 21, 2022
zeripath pushed a commit that referenced this pull request Sep 6, 2022
In repository sub folder missing add file dropdown menu, Probably broken since #20602
tyroneyeh added a commit to tyroneyeh/gitea that referenced this pull request Sep 6, 2022
In repository sub folder missing add file dropdown menu, Probably broken since go-gitea#20602
zeripath pushed a commit that referenced this pull request Sep 6, 2022
Backport #21069

In repository sub folder missing add file dropdown menu, Probably broken since #20602
tyroneyeh added a commit to tyroneyeh/gitea that referenced this pull request Sep 7, 2022
commit 32eef4a
Author: Lunny Xiao <xiaolunwen@gmail.com>
Date:   Wed Sep 7 05:32:20 2022 +0800

    Add changelog for v1.17.2 (go-gitea#21089)

    Co-authored-by: John Olheiser <john+github@jolheiser.com>
    Co-authored-by: 6543 <6543@obermui.de>
    Co-authored-by: delvh <dev.lh@web.de>
    Co-authored-by: techknowlogick <techknowlogick@gitea.io>

commit 449b39e
Author: Tyrone Yeh <tyrone_yeh@draytek.com>
Date:   Tue Sep 6 16:42:05 2022 +0800

    Fix sub folder in repository missing add file dropdown (go-gitea#21069) (go-gitea#21083)

    Backport go-gitea#21069

    In repository sub folder missing add file dropdown menu, Probably broken since go-gitea#20602

commit 06f968d
Author: zeripath <art27@cantab.net>
Date:   Tue Sep 6 07:54:47 2022 +0100

    Fix hard-coded timeout and error panic in API archive download endpoint (go-gitea#20925) (go-gitea#21051)

    Backport go-gitea#20925

    This commit updates the `GET /api/v1/repos/{owner}/{repo}/archive/{archive}`
    endpoint which prior to this PR had a couple of issues.

    1. The endpoint had a hard-coded 20s timeout for the archiver to complete after
       which a 500 (Internal Server Error) was returned to client. For a scripted
       API client there was no clear way of telling that the operation timed out and
       that it should retry.

    2. Whenever the timeout _did occur_, the code used to panic. This was caused by
       the API endpoint "delegating" to the same call path as the web, which uses a
       slightly different way of reporting errors (HTML rather than JSON for
       example).

       More specifically, `api/v1/repo/file.go#GetArchive` just called through to
       `web/repo/repo.go#Download`, which expects the `Context` to have a `Render`
       field set, but which is `nil` for API calls. Hence, a `nil` pointer error.

    The code addresses (1) by dropping the hard-coded timeout. Instead, any
    timeout/cancelation on the incoming `Context` is used.

    The code addresses (2) by updating the API endpoint to use a separate call path
    for the API-triggered archive download. This avoids producing HTML-errors on
    errors (it now produces JSON errors).

    Signed-off-by: Peter Gardfjäll <peter.gardfjall.work@gmail.com>

    Signed-off-by: Peter Gardfjäll <peter.gardfjall.work@gmail.com>
    Signed-off-by: Andrew Thornton <art27@cantab.net>
    Co-authored-by: Peter Gardfjäll <peter.gardfjall.work@gmail.com>
    Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>

commit 084797b
Author: Lunny Xiao <xiaolunwen@gmail.com>
Date:   Tue Sep 6 06:48:57 2022 +0800

    Fix delete user missed some comments (go-gitea#21067) (go-gitea#21068)

commit 7888a55
Author: zeripath <art27@cantab.net>
Date:   Sun Sep 4 17:17:48 2022 +0100

    Delete unreferenced packages when deleting a package version (go-gitea#20977) (go-gitea#21060)

    Backport go-gitea#20977

    Delete a package if its last version got deleted. Otherwise removing the owner works only after the clean up job ran.

    Fix go-gitea#20969

    Co-authored-by: KN4CK3R <admin@oldschoolhack.me>

commit ea416d7
Author: zeripath <art27@cantab.net>
Date:   Sun Sep 4 17:17:35 2022 +0100

    Redirect if user does not exist on admin pages (go-gitea#20981) (go-gitea#21059)

    Backport go-gitea#20981

    When on /admin/users/ endpoints if the user is no longer in the DB,
    redirect instead of causing a http 500.

    Co-authored-by: KN4CK3R <admin@oldschoolhack.me>

commit 0db6add
Author: zeripath <art27@cantab.net>
Date:   Sun Sep 4 17:17:27 2022 +0100

    Set uploadpack.allowFilter etc on gitea serv to enable partial clones with ssh (go-gitea#20902) (go-gitea#21058)

    Backport go-gitea#20902

    When setting.Git.DisablePartialClone is set to false then the web server will add filter support to web http. It does this by using`-c` command arguments but this will not work on gitea serv as the upload-pack and receive-pack commands do not support this.

    Instead we move these options into the .gitconfig instead.

    Fix go-gitea#20400

    Signed-off-by: Andrew Thornton <art27@cantab.net>

    Signed-off-by: Andrew Thornton <art27@cantab.net>

commit 0ecbb71
Author: qwerty287 <80460567+qwerty287@users.noreply.github.com>
Date:   Sun Sep 4 17:12:37 2022 +0200

    Fix 500 on time in timeline API (go-gitea#21052) (go-gitea#21057)

    Backport go-gitea#21052

    Before converting a TrackedTime for the API we need to load its attributes - otherwise we get an NPE.

    Fix go-gitea#21041

commit ea38455
Author: Jason Song <i@wolfogre.com>
Date:   Sun Sep 4 23:12:01 2022 +0800

    Fill the specified ref in webhook test payload (go-gitea#20961) (go-gitea#21055)

    Backport go-gitea#20961

    The webhook payload should use the right ref when it‘s specified in the testing request.

    The compare URL should not be empty, a URL like `compare/A...A` seems useless in most cases but is helpful when testing.

commit 8fc80b3
Author: zeripath <art27@cantab.net>
Date:   Sun Sep 4 16:11:02 2022 +0100

    Add another index for Action table on postgres (go-gitea#21033) (go-gitea#21054)

    Backport go-gitea#21033

    In go-gitea#21031 we have discovered that on very big tables postgres will use a
    search involving the sort term in preference to the restrictive index.

    Therefore we add another index for postgres and update the original migration.

    Fix go-gitea#21031

    Signed-off-by: Andrew Thornton <art27@cantab.net>

commit 71aa64a
Author: zeripath <art27@cantab.net>
Date:   Sun Sep 4 14:59:20 2022 +0100

    fix broken insecureskipverify handling in rediss connection uris (go-gitea#20967) (go-gitea#21053)

    Backport go-gitea#20967

    Currently, it's impossible to connect to self-signed TLS encrypted redis instances. The problem lies in inproper error handling, when building redis tls options - only invalid booleans are allowed to be used in `tlsConfig` builder. The problem is, when `strconv.ParseBool(...)` returns error, it always defaults to false - meaning it's impossible to set `tlsOptions.InsecureSkipVerify` to true.

    Fixes go-gitea#19213

    Co-authored-by: Igor Rzegocki <ajgon@users.noreply.github.com>

commit 3aba72c
Author: zeripath <art27@cantab.net>
Date:   Sun Sep 4 14:41:21 2022 +0100

    Add more checks in migration code (go-gitea#21011) (go-gitea#21050)

    Backport go-gitea#21011

    When migrating add several more important sanity checks:

    * SHAs must be SHAs
    * Refs must be valid Refs
    * URLs must be reasonable

    Signed-off-by: Andrew Thornton <art27@cantab.net>

commit bd1412c
Author: José Carlos <joecarlhr@gmail.com>
Date:   Sat Sep 3 21:11:03 2022 +0200

    Add Dev, Peer and Optional dependencies to npm PackageMetadataVersion (go-gitea#21017) (go-gitea#21044)

    Backport go-gitea#21017

    Set DevDependencies, PeerDependencies & OptionalDependencies in npm package metadatas

    Fix go-gitea#21013

commit 3973ce3
Author: silverwind <me@silverwind.io>
Date:   Sat Sep 3 19:51:09 2022 +0200

    Improve arc-green code theme (go-gitea#21039) (go-gitea#21042)

    Backport go-gitea#21039

    - Increase contrasts overall
    - Add various missing theme classes
    - Ensure strings and constants are colored the same across languages

commit fbde31f
Author: Tyrone Yeh <tyrone_yeh@draytek.com>
Date:   Sat Sep 3 21:36:27 2022 +0800

    Add down key check has tribute container (go-gitea#21016) (go-gitea#21038)

    Backport go-gitea#21016

    Fixes an issue where users would not be able to select by pressing the down arrow when using @tag above a message

    Bug videos:

    https://user-images.githubusercontent.com/1255041/188095999-c4ccde18-e53b-4251-8a14-d90c4042d768.mp4
@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport/done All backports for this PR have been created lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. topic/ui Change the appearance of the Gitea UI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Buggy CSS when browsers are not maximised, needs more wrap-around
7 participants