Skip to content

Conversation

@6543
Copy link
Member

@6543 6543 commented Aug 26, 2019

Arrow Preview:

how it works ... some notes

  • if table head colum class has attribute sort="xy" -> colum header klickable
  • Klich at colum header for example <ID>
    -> script check if url has already a sort= with <ID>
    NO: if data-sortt indikates default set URLsort=
    YES: set URLsort variable
    -> script check if URLsort and sort attribute is same
    YES: -> check if reverse attribute exist
    YES: generate URL with reverse sort param and open
    NO: generate URL with sort param and open

Roadmap:

@davydov-vyacheslav
Copy link

am I correct that this library is for client-side sorting? If so, we may have issues with pagination as library know nothing about pagination, haven't we?

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Aug 26, 2019
@6543 6543 changed the title Sortable Tables [UI] Sortable Tables [UI] [WIP] Aug 26, 2019
@6543
Copy link
Member Author

6543 commented Aug 26, 2019

@davydov-vyacheslav

am I correct that this library is for client-side sorting? If so, we may have issues with pagination as library know nothing about pagination, haven't we?

it is client-side sorting. I just searchend how to add this feature without many dependencys and so on ...
ill test things with paginaton but havent woked with jet so I'll see.

@6543
Copy link
Member Author

6543 commented Aug 26, 2019

am I correct that this library is for client-side sorting? If so, we may have issues with pagination as library know nothing about pagination, haven't we?

yes paginaton and this won't work ... I'll look at the sort function of http://localhost:3000/admin/orgs?sort=alphabetically ...

@codecov-io
Copy link

codecov-io commented Aug 26, 2019

Codecov Report

Merging #7980 into master will decrease coverage by 0.07%.
The diff coverage is 40.99%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #7980      +/-   ##
==========================================
- Coverage   43.43%   43.36%   -0.08%     
==========================================
  Files         593      594       +1     
  Lines       83286    83453     +167     
==========================================
+ Hits        36178    36186       +8     
- Misses      42620    42781     +161     
+ Partials     4488     4486       -2     
Impacted Files Coverage Δ
models/error.go 30.50% <0.00%> (ø)
models/issue.go 51.17% <0.00%> (-0.25%) ⬇️
models/issue_label.go 61.60% <0.00%> (-1.45%) ⬇️
models/migrations/migrations.go 4.16% <ø> (ø)
models/migrations/v128.go 0.00% <0.00%> (ø)
models/migrations/v134.go 0.00% <0.00%> (ø)
modules/private/manager.go 0.00% <0.00%> (ø)
routers/repo/compare.go 40.80% <ø> (-0.14%) ⬇️
routers/repo/pull.go 28.21% <0.00%> (-0.83%) ⬇️
routers/repo/pull_review.go 0.00% <0.00%> (ø)
... and 20 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 36d9237...9c27520. Read the comment docs.

@6543
Copy link
Member Author

6543 commented Aug 26, 2019

Current idear ...

  • if class has atribute sorttable -> colum header klickable
  • Klich at colum header for example <ID>
    -> script check if url has already a sort= with <ID>
    YES: open current URL wich sort=<ID> is replaced with <Rev_ID>
    NO: open current URL and add/change sort= to sort=<ID>

@davydov-vyacheslav
Copy link

Current idear ...

  • if class has atribute sorttable -> colum header klickable
  • Klich at colum header for example <ID>
    -> script check if url has already a sort= with <ID>
    YES: open current URL wich sort=<ID> is replaced with <Rev_ID>
    NO: open current URL and add/change sort= to sort=<ID>

I like this idea, but I don't think that all the table's controller has sort order for all the columns of these tables, at least at UI you are not able to perform sort by each column. Does controller support sort order for each column of the table?

@6543
Copy link
Member Author

6543 commented Aug 27, 2019

@davydov-vyacheslav my currend idear to solf this is to tag table header colums
with an sort parameter. sort="alphabetically" and if there exist a reverse then sort="alphabetically,reversealphabetically"
-> https://gitea.com/6543/gitea_sortt

@6543 6543 force-pushed the sortable-tables branch 2 times, most recently from 292ca6e to f9e663b Compare August 27, 2019 16:51
@6543 6543 changed the title Sortable Tables [UI] [WIP] Sortable Tables Header By Click [UI] Aug 27, 2019
@6543
Copy link
Member Author

6543 commented Aug 27, 2019

I'll have a look at the searchParams doku +1

@6543 6543 force-pushed the sortable-tables branch from d57ee63 to 99913ff Compare August 28, 2019 00:40
@6543
Copy link
Member Author

6543 commented Aug 28, 2019

@davydov-vyacheslav
ready for merge 🚀 ?

Copy link
Member

@techknowlogick techknowlogick left a comment

Choose a reason for hiding this comment

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

Thanks for contribution :)

A few pieces of feedback:

  • If JS is getting injected into pages it should be in the footer with all other JS (and done in a DRY way)
  • Instead of doing onclick events, you can bind to elements in JS itself (this lets all related code be related to each other), and if you need to use arguments you can use something such as data-* attributes
  • librejs files need to be updated for each new JS dependency
  • This dependency is so small it could be included in the application itself

That being said, this can be done without JS, and have plain HTML links be generated, which is the way that I would recommend.

@6543
Copy link
Member Author

6543 commented Aug 28, 2019

@techknowlogick
thanks for the feedback!

the plain HTML way would be the interesting one, but how should links togle betwen normal and revert sort?

@davydov-vyacheslav
Copy link

@6543 I'm not maintainer, so, globally, my opinion cost nothing :) But the code looks much better than original one and I don't have more concerns about it

@6543
Copy link
Member Author

6543 commented Aug 28, 2019

@davydov-vyacheslav I know but it seems you already know a lot about javascript :)

Copy link
Member

@gary-kim gary-kim left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution.

I think we should also think about if we could just do this with html though.

@6543 6543 changed the title Sortable Tables Header By Click [UI] [WIP] [UI] Sortable Tables Header By Click Sep 3, 2019
@6543 6543 mentioned this pull request Sep 4, 2019
@6543 6543 changed the title [WIP] [UI] Sortable Tables Header By Click [UI] Sortable Tables Header By Click Sep 18, 2019
@6543
Copy link
Member Author

6543 commented Sep 18, 2019

@lafriks now it uses jQuery for events

@lunny @gary-kim

i think it is ready ... 🚀 - any thoughts?

@davydov-vyacheslav
Copy link

I have one more comment for this feature. Not all the columns' headers are able to sort. It would be nice to get images of current sorted column and the direction of sort (something like this one )

@silverwind
Copy link
Member

Yeah I guess that's material for another PR 😉

@6543
Copy link
Member Author

6543 commented Jun 23, 2020

@techknowlogick what is your opinion on this?

@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 Jun 23, 2020
@6543
Copy link
Member Author

6543 commented Jun 23, 2020

@gary-kim you had some opinions on this too - can you dismis or review :)

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: silverwind <me@silverwind.io>
@6543
Copy link
Member Author

6543 commented Jun 23, 2020

@silverwind your solution is not working - :/

@6543
Copy link
Member Author

6543 commented Jun 23, 2020

should I rolle it back or do you have a look at it?

Co-authored-by: silverwind <me@silverwind.io>
@6543
Copy link
Member Author

6543 commented Jun 23, 2020

@silverwind worked :)

and no problem, you have a lot more knowlage about JS than i do - so your suggestions are always welcome 👍

@6543
Copy link
Member Author

6543 commented Jun 23, 2020

I would say let the old pull 🚀

@6543
Copy link
Member Author

6543 commented Jun 24, 2020

ping

@6543
Copy link
Member Author

6543 commented Jun 24, 2020

Ping

@zeripath zeripath merged commit c86478e into go-gitea:master Jun 24, 2020
@6543 6543 deleted the sortable-tables branch June 25, 2020 00:48
ydelafollye pushed a commit to ydelafollye/gitea that referenced this pull request Jul 31, 2020
* [UI] Sortable Tables Header By Click

* get rid of padding above header

* restart CI

* fix lint

* convert getArrow JS to SortArrow go func

* addopt SortArrow funct

* suggestions from @silverwind - tablesort.js

Co-authored-by: silverwind <me@silverwind.io>

* Update web_src/js/features/tablesort.js

Co-authored-by: silverwind <me@silverwind.io>

* Update web_src/js/features/tablesort.js

Co-authored-by: silverwind <me@silverwind.io>

Co-authored-by: silverwind <me@silverwind.io>
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
project-mirrors-bot-tu bot pushed a commit to project-mirrors/forgejo-as-gitea-fork that referenced this pull request Oct 11, 2025
…os and diffs (go-gitea#9146)

- fix links to PR commits, e.g. `!7979 (commit 4d968c08e0)`
- show the repo slug for links other than the current repository, e.g. `forgejo/docs@498bd80133`
- truncate long `diff-...` fragments, e.g. `600be26638 (diff-953bb4f01)`
- show `files` query values for compare links, e.g. `8bbac4c679...e2278e5 (options/locale/locale_fi-FI.ini)`

Closes: go-gitea#7980
Closes: go-gitea#9130
Closes: go-gitea#8023
Ref: go-gitea#5901

## Checklist

The [contributor guide](https://forgejo.org/docs/next/contributor/) contains information that will be helpful to first time contributors. There also are a few [conditions for merging Pull Requests in Forgejo repositories](https://codeberg.org/forgejo/governance/src/branch/main/PullRequestsAgreement.md). You are also welcome to join the [Forgejo development chatroom](https://matrix.to/#/#forgejo-development:matrix.org).

### Tests

- I added test coverage for Go changes...
  - [x] in their respective `*_test.go` for unit tests.
  - [x] in the `tests/integration` directory if it involves interactions with a live Forgejo server.
- I added test coverage for JavaScript changes...
  - [ ] in `web_src/js/*.test.js` if it can be unit tested.
  - [ ] in `tests/e2e/*.test.e2e.js` if it requires interactions with a live Forgejo server (see also the [developer guide for JavaScript testing](https://codeberg.org/forgejo/forgejo/src/branch/forgejo/tests/e2e/README.md#end-to-end-tests)).

### Documentation

- [ ] I created a pull request [to the documentation](https://codeberg.org/forgejo/docs) to explain to Forgejo users how to use this change.
- [x] I did not document these changes and I do not expect someone else to do it.

### Release notes

- [ ] I do not want this change to show in the release notes.
- [x] I want the title to show in the release notes with a link to this pull request.
- [ ] I want the content of the `release-notes/<pull request number>.md` to be be used for the release notes instead of the title.

<!--start release-notes-assistant-->

## Release notes
<!--URL:https://codeberg.org/forgejo/forgejo-->
- User Interface features
  - [PR](https://codeberg.org/forgejo/forgejo/pulls/9146): <!--number 9146 --><!--line 0 --><!--description ZmVhdCh1aSk6IGltcHJvdmUgcmVuZGVyaW5nIGNvbW1pdCBsaW5rcyBmb3IgUFIgY29tbWl0cywgZXh0ZXJuYWwgcmVwb3MgYW5kIGRpZmZz-->feat(ui): improve rendering commit links for PR commits, external repos and diffs<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/9146
Reviewed-by: Robert Wolff <mahlzahn@posteo.de>
Co-authored-by: Lucas Schwiderski <lucas@lschwiderski.de>
Co-committed-by: Lucas Schwiderski <lucas@lschwiderski.de>
project-mirrors-bot-tu bot pushed a commit to project-mirrors/forgejo-as-gitea-fork that referenced this pull request Oct 11, 2025
…ts, external repos and diffs (go-gitea#9493)

**Backport:** https://codeberg.org/forgejo/forgejo/pulls/9146

- fix links to PR commits, e.g. `!7979 (commit 4d968c08e0)`
- show the repo slug for links other than the current repository, e.g. `forgejo/docs@498bd80133`
- truncate long `diff-...` fragments, e.g. `600be26638 (diff-953bb4f01)`
- show `files` query values for compare links, e.g. `8bbac4c679...e2278e5 (options/locale/locale_fi-FI.ini)`

Closes: go-gitea#7980
Closes: go-gitea#9130
Closes: go-gitea#8023
Ref: go-gitea#5901

## Checklist

The [contributor guide](https://forgejo.org/docs/next/contributor/) contains information that will be helpful to first time contributors. There also are a few [conditions for merging Pull Requests in Forgejo repositories](https://codeberg.org/forgejo/governance/src/branch/main/PullRequestsAgreement.md). You are also welcome to join the [Forgejo development chatroom](https://matrix.to/#/#forgejo-development:matrix.org).

### Tests

- I added test coverage for Go changes...
  - [x] in their respective `*_test.go` for unit tests.
  - [x] in the `tests/integration` directory if it involves interactions with a live Forgejo server.
- I added test coverage for JavaScript changes...
  - [ ] in `web_src/js/*.test.js` if it can be unit tested.
  - [ ] in `tests/e2e/*.test.e2e.js` if it requires interactions with a live Forgejo server (see also the [developer guide for JavaScript testing](https://codeberg.org/forgejo/forgejo/src/branch/forgejo/tests/e2e/README.md#end-to-end-tests)).

### Documentation

- [ ] I created a pull request [to the documentation](https://codeberg.org/forgejo/docs) to explain to Forgejo users how to use this change.
- [x] I did not document these changes and I do not expect someone else to do it.

### Release notes

- [ ] I do not want this change to show in the release notes.
- [x] I want the title to show in the release notes with a link to this pull request.
- [ ] I want the content of the `release-notes/<pull request number>.md` to be be used for the release notes instead of the title.

<!--start release-notes-assistant-->

## Release notes
<!--URL:https://codeberg.org/forgejo/forgejo-->
- User Interface features
  - [PR](https://codeberg.org/forgejo/forgejo/pulls/9146): <!--number 9146 --><!--line 0 --><!--description ZmVhdCh1aSk6IGltcHJvdmUgcmVuZGVyaW5nIGNvbW1pdCBsaW5rcyBmb3IgUFIgY29tbWl0cywgZXh0ZXJuYWwgcmVwb3MgYW5kIGRpZmZz-->feat(ui): improve rendering commit links for PR commits, external repos and diffs<!--description-->
<!--end release-notes-assistant-->

Co-authored-by: Lucas Schwiderski <lucas@lschwiderski.de>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/9493
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
Co-committed-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

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 type/enhancement An improvement of existing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.