Yarden Shoham
6a6dc97b0f
Respect user's locale when rendering the date range in the repo activity page ( #21410 )
...
# Description
Previously, to make the date range understood by all, we used the format
"2006-01-02" for the dates as it's locale-generic.
This commit changes the rendering logic. Instead of rendering the date
on the server, we send a formatted computer-readable timestamp. The
client's javascript then renders it according to the user's locale.
This approach is reusable across the codebase, any `<time></time>` tag
with the data-format="date" attribute would get rendered according to
the user's chosen locale.
## Previous View
![image](https://user-images.githubusercontent.com/20454870/195099143-e1c5df86-282a-42f1-898f-a36bb5fe7c2f.png )
## New View
### English
![image](https://user-images.githubusercontent.com/20454870/195099301-5cda4eab-4012-49d5-97e5-b1f9cada9c06.png )
### French
![image](https://user-images.githubusercontent.com/20454870/195099434-ce23e394-8d65-4c4c-8ac8-8b96bc9044f3.png )
### Portuguese
![image](https://user-images.githubusercontent.com/20454870/195099559-9a7aed28-944a-45ec-bedb-64403e3faede.png )
### Italian
![image](https://user-images.githubusercontent.com/20454870/195099661-17758d55-3fe0-4797-879b-d45de0ee8ba3.png )
# References
* #21380
* #21387
* #21396
Inspiration:
I think either differentiating by class, or probably better by a custom
attribute such as `data-format` or similar, is the best course of
action.
_Originally posted by @delvh in
https://github.com/go-gitea/gitea/issues/21396#issuecomment-1274424788_
Resolves #21380
Signed-off-by: Yarden Shoham <hrsi88@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
2 years ago
Yarden Shoham
2d4c6321c3
Use ISO date format instead of hard-coded English date format for date range in repo activity page ( #21396 )
...
January 2, 2006 -> 2006-01-02
Signed-off-by: Yarden Shoham <hrsi88@gmail.com>
2 years ago
Lunny Xiao
1d8543e7db
Move some files into models' sub packages ( #20262 )
...
* Move some files into models' sub packages
* Move functions
* merge main branch
* Fix check
* fix check
* Fix some tests
* Fix lint
* Fix lint
* Revert lint changes
* Fix error comments
* Fix lint
Co-authored-by: 6543 <6543@obermui.de>
2 years ago
zeripath
5cb0c9aa0d
Propagate context and ensure git commands run in request context ( #17868 )
...
This PR continues the work in #17125 by progressively ensuring that git
commands run within the request context.
This now means that the if there is a git repo already open in the context it will be used instead of reopening it.
Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years ago
Lunny Xiao
99b2858e62
Move unit into models/unit/ ( #17576 )
...
* Move unit into models/unit/
* Rename unit.UnitType as unit.Type
3 years ago
wxiaoguang
56362043d3
Frontend refactor: move Vue related code from `index.js` to `components` dir, and remove unused codes. ( #17301 )
...
* frontend refactor
* Apply suggestions from code review
Co-authored-by: delvh <dev.lh@web.de>
* Update templates/base/head.tmpl
Co-authored-by: delvh <dev.lh@web.de>
* Update docs/content/doc/developers/guidelines-frontend.md
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* fix typo
* fix typo
* refactor PageData to pageData
* Apply suggestions from code review
Co-authored-by: delvh <dev.lh@web.de>
* Simply for the visual difference.
Co-authored-by: delvh <dev.lh@web.de>
* Revert "Apply suggestions from code review"
This reverts commit 4d78ad9b0e96ca180e0823de17659a2e0814c099.
Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
3 years ago
Lunny Xiao
1bfb0a24d8
Refactor routers directory ( #15800 )
...
* refactor routers directory
* move func used for web and api to common
* make corsHandler a function to prohibit side efects
* rm unused func
Co-authored-by: 6543 <6543@obermui.de>
4 years ago
6543
16dea6cebd
[refactor] replace int with httpStatusCodes ( #15282 )
...
* replace "200" (int) with "http.StatusOK" (const)
* ctx.Error & ctx.HTML
* ctx.JSON Part1
* ctx.JSON Part2
* ctx.JSON Part3
4 years ago
Lauris BH
81cfe243f9
Add top author stats to activity page ( #9615 )
5 years ago
Lauris BH
a91679c9e3
Add additional periods to activity page ( #8829 )
5 years ago
Lauris BH
1fa9662946
Git statistics in Activity tab ( #4724 )
...
* Initial implementation for git statistics in Activity tab
* Create top user by commit count endpoint
* Add UI and update src-d/go-git dependency
* Add coloring
* Fix typo
* Move git activity stats data extraction to git module
* Fix message
* Add git code stats test
6 years ago
Lunny Xiao
eabbddcd98
Restrict permission check on repositories and fix some problems ( #5314 )
...
* fix units permission problems
* fix some bugs and merge LoadUnits to repoAssignment
* refactor permission struct and add some copyright heads
* remove unused codes
* fix routes units check
* improve permission check
* add unit tests for permission
* fix typo
* fix tests
* fix some routes
* fix api permission check
* improve permission check
* fix some permission check
* fix tests
* fix tests
* improve some permission check
* fix some permission check
* refactor AccessLevel
* fix bug
* fix tests
* fix tests
* fix tests
* fix AccessLevel
* rename CanAccess
* fix tests
* fix comment
* fix bug
* add missing unit for test repos
* fix bug
* rename some functions
* fix routes check
6 years ago
Morgan Bazalgette
65861900cd
Handle refactor ( #3339 )
...
* Replace all ctx.Handle with ctx.ServerError or ctx.NotFound
* Change Handle(403) to NotFound, avoid using macaron's NotFound
7 years ago
Lauris BH
c7f4f07765
Integration test for activity page ( #2704 )
...
* Integration test for activity page
* Small code refactoring for acitvity page
* Move activity stats calculation logic to model
7 years ago
Lauris BH
f42dbdbae5
Add Activity page to repository ( #2674 )
...
* Add Activity page to repository
* Add request data for activity
* Add issue data for activity
* Add user unit right checks
* Add releases to activity
* Log repository unit loading error
7 years ago