aboutsummaryrefslogtreecommitdiffstats
path: root/web_src/js/features
Commit message (Collapse)AuthorAgeFilesLines
* Make Ctrl+Enter work for issue/comment edit (#30720)v1.22.0-rc1wxiaoguang2024-04-272-3/+8
| | | Fix #30710
* Refactor imagediff and fix regression bug (#30694)wxiaoguang2024-04-251-102/+102
| | | Fix #30683
* Fix issue comment form and quick-submit (#30623)wxiaoguang2024-04-222-7/+4
| | | | 1. Rewrite initGlobalEnterQuickSubmit (by the way, remove jQuery) 2. Fix issue comment form layout
* Refactor and fix archive link bug (#30535)wxiaoguang2024-04-191-32/+22
| | | | | | | | Regression of #29920 Fixes: #30569 Also this is a rewriting to eliminate the remaining jQuery usages from code. Co-authored-by: Giteabot <teabot@gitea.io>
* Disable enter key for accepting code completion in Monaco (#30548)silverwind2024-04-181-0/+4
| | | | | | Fixes https://github.com/go-gitea/gitea/issues/28114 and behaviour matches vscode on desktop as well. Co-authored-by: Giteabot <teabot@gitea.io>
* Rewrite and restyle reaction selector and enable no-sizzle eslint rule (#30453)silverwind2024-04-143-31/+28
| | | | | | | | | | | Enable `no-sizzle` lint rule, there was only one use in `initCompReactionSelector` and: - Remove all jQuery except the necessary fomantic dropdown init - Remove the recursion, instead bind event listeners to common parent container nodes --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Giteabot <teabot@gitea.io>
* Fix JS error when opening to expanded code comment (#30463)silverwind2024-04-141-5/+3
| | | | | | | | | | | | Fix regression from https://github.com/go-gitea/gitea/commit/e0b018706fa7703ef1759d9a75a1399383715808 where opening to a code comment via hash link would give this error: <img width="1247" alt="image" src="https://github.com/go-gitea/gitea/assets/115237/f9aaeded-8492-4416-9a73-afa0c56220a7"> --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix admin notice view-detail (#30450)silverwind2024-04-131-4/+4
| | | | | | | | | | | | | Fix https://github.com/go-gitea/gitea/issues/30434, regression from https://github.com/go-gitea/gitea/pull/30115. I also removed the date insertion into the modal which was also broken since that date was switched to `absolute-date` because I see no real purpose to putting that date into the modal. Result: <img width="1038" alt="image" src="https://github.com/go-gitea/gitea/assets/115237/aa2eb8b4-73dc-4d98-9b80-3f276f89d9e5">
* Remove jQuery from the commit graph (except Fomantic) (#30395)Yarden Shoham2024-04-121-61/+77
| | | | | | | | | | | | | | | - Switched to plain JavaScript - Tested the commit graph and it works as before # Demo using JavaScript without jQuery ![demo](https://github.com/go-gitea/gitea/assets/20454870/d0755ed6-bb5c-4601-a2b7-ebccaf4abce4) --------- Signed-off-by: Yarden Shoham <git@yardenshoham.com> Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: Giteabot <teabot@gitea.io>
* Split `issue edit` code from `repo-legacy.js` into its own file (#30419)wxiaoguang2024-04-122-204/+209
| | | | | Follow Split `index.js` to separate files (#17315) It's time to move some code away from the messy "legacy" file.
* Fix and rewrite contrast color calculation, fix project-related bugs (#30237)silverwind2024-04-071-40/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | 1. The previous color contrast calculation function was incorrect at least for the `#84b6eb` where it output low-contrast white instead of black. I've rewritten these functions now to accept hex colors and to match GitHub's calculation and to output pure white/black for maximum contrast. Before and after: <img width="94" alt="Screenshot 2024-04-02 at 01 53 46" src="https://github.com/go-gitea/gitea/assets/115237/00b39e15-a377-4458-95cf-ceec74b78228"><img width="90" alt="Screenshot 2024-04-02 at 01 51 30" src="https://github.com/go-gitea/gitea/assets/115237/1677067a-8d8f-47eb-82c0-76330deeb775"> 2. Fix project-related issues: - Expose the new `ContrastColor` function as template helper and use it for project cards, replacing the previous JS solution which eliminates a flash of wrong color on page load. - Fix a bug where if editing a project title, the counter would get lost. - Move `rgbToHex` function to color utils. @HesterG fyi --------- Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: Giteabot <teabot@gitea.io>
* Replace coloris with vanilla-colorful (#30201)silverwind2024-04-031-23/+58
| | | | | | | | | | | | | | Found [a better color picker](https://github.com/web-padawan/vanilla-colorful) that [does not rely](https://github.com/mdbassit/Coloris/issues/139) on `querySelectorAll` or a global shared instance, and is also around a third of the size of the previous one. The popover is handled by tippy.js for which I introduced a new "bare" theme and it uses a new sibling-based mechanism which should prove useful later to create tippy popovers via HTML only. <img width="846" alt="Screenshot 2024-03-31 at 04 03 38" src="https://github.com/go-gitea/gitea/assets/115237/7639b911-a2d7-4f5c-bffd-a9d84561e747">
* Refactor dropzone (#30232)wxiaoguang2024-04-021-29/+21
| | | Simplify code and use `.files` elements
* Remove fomantic input module (#30194)silverwind2024-03-312-4/+4
| | | | Another pure CSS module. Some styling is part of the `form` module which will likely follow next.
* Remove most jQuery function calls from the repository topic box (#30191)Yarden Shoham2024-03-311-61/+25
| | | | | | | | | Remove most jQuery function calls --------- Signed-off-by: Yarden Shoham <git@yardenshoham.com> Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Remove jQuery class from the `repo-issue.js` file (#30192)Yarden Shoham2024-03-311-70/+85
| | | | | | | | | | | | | | | | | | Switched from jQuery class functions to plain JavaScript `classList`. Tested the following functionalities and they work as before: - delete issue comment - cancel code comment - update (merge or rebase) pull request - re-request review - reply to code comment - show/hide outdated comments - add code comment - edit issue title --------- Signed-off-by: Yarden Shoham <git@yardenshoham.com> Co-authored-by: silverwind <me@silverwind.io>
* Make a distinction between `active` and `selected` in the issue author ↵Yarden Shoham2024-03-311-1/+3
| | | | | dropdown (#30207) Signed-off-by: Yarden Shoham <git@yardenshoham.com>
* Remove jQuery class from the issue author dropdown (#30188)Yarden Shoham2024-03-301-7/+13
| | | | | | | - Switched from jQuery class functions to plain JavaScript `classList` - Tested the issue author dropdown functionality and it works as before Signed-off-by: Yarden Shoham <git@yardenshoham.com> Co-authored-by: Giteabot <teabot@gitea.io>
* Remove jQuery class from the comment edit history (#30186)Yarden Shoham2024-03-301-2/+5
| | | | | | | - Switched from jQuery class functions to plain JavaScript `classList` - Tested the comment edit history functionality and it works as before Signed-off-by: Yarden Shoham <git@yardenshoham.com> Co-authored-by: Giteabot <teabot@gitea.io>
* Remove jQuery class from the repository branch settings (#30184)Yarden Shoham2024-03-301-13/+18
| | | | | | | - Switched from jQuery class functions to plain JavaScript `classList` - Tested the repository branch settings functionality and it works as before Signed-off-by: Yarden Shoham <git@yardenshoham.com>
* Remove jQuery class from the project page (#30183)Yarden Shoham2024-03-301-22/+23
| | | | | | - Switched from jQuery class functions to plain JavaScript `classList` - Tested the edit column modal functionality and it works as before Signed-off-by: Yarden Shoham <git@yardenshoham.com>
* Remove jQuery class from the commit button (#30178)Yarden Shoham2024-03-291-2/+2
| | | | | | | | | | | - Switched from jQuery class functions to plain JavaScript `classList` - Tested the commit button disabled toggling functionality and it works as before --------- Signed-off-by: Yarden Shoham <git@yardenshoham.com> Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Giteabot <teabot@gitea.io>
* Remove jQuery class from the diff view (#30176)Yarden Shoham2024-03-291-24/+31
| | | | | | | | | - Switched from jQuery class functions to plain JavaScript `classList` - Tested the diff view functionality and it works as before --------- Signed-off-by: Yarden Shoham <git@yardenshoham.com> Co-authored-by: silverwind <me@silverwind.io>
* Remove jQuery class from the notification count (#30172)Yarden Shoham2024-03-291-7/+5
| | | | | | | | | | - Switched from jQuery class functions to plain JavaScript `classList` - Tested the notification count and it works as before --------- Signed-off-by: Yarden Shoham <git@yardenshoham.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Giteabot <teabot@gitea.io>
* Remove jQuery class from the code range selection (#30173)Yarden Shoham2024-03-291-3/+5
| | | | | | - Switched from jQuery class functions to plain JavaScript `classList` - Tested the code range selection functionality and it works as before Signed-off-by: Yarden Shoham <git@yardenshoham.com>
* Remove jQuery class from the image diff (#30140)Yarden Shoham2024-03-291-9/+20
| | | | | | | | | | - Switched from jQuery class functions to plain JavaScript `classList` - Tested the image diff and it works as before --------- Signed-off-by: Yarden Shoham <git@yardenshoham.com> Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Remove fomantic checkbox module (#30162)silverwind2024-03-293-35/+34
| | | | | | | | | | | | | | | | | | | CSS is pretty slim already and the `.ui.toggle.checkbox` sliders on admin page also still work. The only necessary JS is the one that links `input` and `label` so that it can be toggled via label. All checkboxes except the markdown ones render at `--checkbox-size: 16px` now. <img width="174" alt="Screenshot 2024-03-28 at 22 15 10" src="https://github.com/go-gitea/gitea/assets/115237/3455c1bb-166b-47e4-9847-2d20dd1f04db"> <img width="499" alt="Screenshot 2024-03-28 at 21 00 07" src="https://github.com/go-gitea/gitea/assets/115237/412be2b3-d5a0-478a-b17b-43e6bc12e8ce"> <img width="83" alt="Screenshot 2024-03-28 at 22 14 34" src="https://github.com/go-gitea/gitea/assets/115237/d8c89838-a420-4723-8c49-89405bb39474"> --------- Co-authored-by: delvh <dev.lh@web.de>
* replace jquery-minicolors with coloris (#30055)silverwind2024-03-294-32/+42
| | | | | | | | | | | | | | | | | | Get rid of one more jQuery dependant and have a nicer color picker as well. Now there is only a single global color picker init because that is all that's necessary because the elements are present on the page when the init code runs. The init is slightly weird because the module only takes a selector instead of DOM elements directly. The label modals now also perform form validation because previously it was possible to trigger a 500 error `Color cannot be empty.` by clearing out the color value on labels. <img width="867" alt="Screenshot 2024-03-25 at 00 21 05" src="https://github.com/go-gitea/gitea/assets/115237/71215c39-abb1-4881-b5c1-9954b4a89adb"> <img width="860" alt="Screenshot 2024-03-25 at 00 20 48" src="https://github.com/go-gitea/gitea/assets/115237/a12cb68f-c38b-4433-ba05-53bbb4b1023e">
* Migrate font-family to tailwind (#30118)silverwind2024-03-281-1/+1
| | | | | | | | | | | Enable us to use tailwind's [`font-family`](https://tailwindcss.com/docs/font-family) classes as well as remove `gt-mono` in favor of `tw-font-mono`. I also merged the "compensation" to one selector, previously this was two different values 0.9em and 0.95em. I did not declare a `serif` font because I don't think there will ever be a use case for those. Command ran: ```sh perl -p -i -e 's#gt-mono#tw-font-mono#g' web_src/js/**/* templates/**/*
* Drag-and-drop improvements for projects and issue pins (#29875)silverwind2024-03-282-6/+1
| | | | | | | | | | | | | | | 1. Add "grabbing" cursor while dragging items: ![](https://github.com/go-gitea/gitea/assets/115237/c60845ff-7544-4215-aeaa-408e8c4ef03a) 2. Make project board only drag via their header, not via their whole body. ![](https://github.com/go-gitea/gitea/assets/115237/62c27f3d-993a-481d-9cc3-b6226b4c5d61) 3. Fix some cursor problems in projects 4. Move shared options into `createSortable`.
* Add default board to new projects, remove uncategorized pseudo-board (#29874)Denys Konovalov2024-03-271-1/+0
| | | | | | | | | | | | | | | | | | On creation of an empty project (no template) a default board will be created instead of falling back to the uneditable pseudo-board. Every project now has to have exactly one default boards. As a consequence, you cannot unset a board as default, instead you have to set another board as default. Existing projects will be modified using a cron job, additionally this check will run every midnight by default. Deleting the default board is not allowed, you have to set another board as default to do it. Fixes #29873 Fixes #14679 along the way Fixes #29853 Co-authored-by: delvh <dev.lh@web.de>
* Fix download buttons on branches page (#30147)silverwind2024-03-271-1/+1
| | | | | | | | Fixes https://github.com/go-gitea/gitea/issues/30143, regression from https://github.com/go-gitea/gitea/pull/29920. We have `.button` on the repo page, but on the branch page it's a `.btn`. Eventually we should find a solution to have a single button class but until then this solution should be acceptable.
* Remove jQuery class from the common admin functions (#30137)Yarden Shoham2024-03-271-7/+6
| | | | | | | | - Switched from jQuery class functions to plain JavaScript `classList` - Tested the new authentication source form and the deletion of system notices. They work as before Signed-off-by: Yarden Shoham <git@yardenshoham.com> Co-authored-by: Giteabot <teabot@gitea.io>
* Remove jQuery class from the reaction selector (#30138)Yarden Shoham2024-03-271-1/+1
| | | | | | | - Switched from jQuery class functions to plain JavaScript `classList` - Tested the reaction selector and it works as before Signed-off-by: Yarden Shoham <git@yardenshoham.com> Co-authored-by: Giteabot <teabot@gitea.io>
* Remove jQuery `.attr` from the common admin functions (#30115)Yarden Shoham2024-03-271-62/+91
| | | | | | | | | | - Switched from jQuery `attr` to plain javascript `getAttribute` and `setAttribute` - Tested most of the functions and they work as before --------- Signed-off-by: Yarden Shoham <git@yardenshoham.com> Co-authored-by: Giteabot <teabot@gitea.io>
* Remove jQuery from the create/rename branch modals (except Fomantic) (#30109)Yarden Shoham2024-03-271-25/+25
| | | | | | | | | | | | | | | | - Switched to plain JavaScript - Tested the create/rename branch modals' functionality and they work as before # Demo using JavaScript without jQuery ![demo](https://github.com/go-gitea/gitea/assets/20454870/ca53155e-856e-44ca-9852-12ff60065735) --------- Signed-off-by: Yarden Shoham <git@yardenshoham.com> Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: Giteabot <teabot@gitea.io>
* When the title in the issue has a value, set the text cursor at the end of ↵HEREYUA2024-03-271-0/+6
| | | | | | | | | | | | | | | the text. (#30090) Fix: [#25055](https://github.com/go-gitea/gitea/issues/25055) Before ![image](https://github.com/go-gitea/gitea/assets/37935145/1b89cd7b-4fa3-49aa-9b5e-a8413add436e) After ![image](https://github.com/go-gitea/gitea/assets/37935145/fa808f8d-d3ce-4245-a4fe-dd0282ba3fdf) ps: I've noticed that we are gradually replacing jQuery, so I didn't use jQuery here.
* Remove jQuery `.attr` from the code comments (#30112)Yarden Shoham2024-03-261-60/+71
| | | | | | | | | | - Switched from jQuery `attr` to plain javascript `getAttribute` - Tested the code comments and they work as before --------- Signed-off-by: Yarden Shoham <git@yardenshoham.com> Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Giteabot <teabot@gitea.io>
* Remove jQuery calls that have no effect on `showElem` and `hideElem` (#30110)Yarden Shoham2024-03-263-22/+22
| | | | | | There's no need to initialize a jQuery object with a CSS selector when we can pass the CSS selector directly. Signed-off-by: Yarden Shoham <git@yardenshoham.com>
* Remove jQuery `.attr` from the common issue page functions (#30083)Yarden Shoham2024-03-261-73/+83
| | | | | | | | | | | - Switched from jQuery `attr` to plain javascript `getAttribute` and `setAttribute` - Tested most of the functions and they work as before --------- Signed-off-by: Yarden Shoham <git@yardenshoham.com> Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: delvh <dev.lh@web.de>
* Remove jQuery `.attr` from the code line range selection (#30077)Yarden Shoham2024-03-251-22/+20
| | | | | | | | | | - Switched from jQuery `attr` to plain javascript `getAttribute` and `setAttribute` - Tested the code line range selection and it works as before --------- Signed-off-by: Yarden Shoham <git@yardenshoham.com> Co-authored-by: silverwind <me@silverwind.io>
* Refactor all `.length === 0` patterns in JS (#30045)silverwind2024-03-2511-34/+23
| | | | This pattern comes of often during review, so let's fix it once and for all. Did not test, but changes are trivial enough imho.
* Remove jQuery `.attr` from the reaction selector (#30052)Yarden Shoham2024-03-251-3/+3
| | | | | | - Switched from jQuery `attr` to plain javascript `getAttribute` - Tested the reaction selector and it works as before Signed-off-by: Yarden Shoham <git@yardenshoham.com>
* Remove jQuery `.attr` from the ComboMarkdownEditor (#30051)Yarden Shoham2024-03-251-16/+15
| | | | | | | - Switched from jQuery `attr` to plain javascript `getAttribute` and `setAttribute` - Tested the markdown editor and it works as before Signed-off-by: Yarden Shoham <git@yardenshoham.com>
* Remove jQuery `.attr` from the label edit exclusive checkbox (#30053)Yarden Shoham2024-03-241-13/+13
| | | | | | - Switched from jQuery `attr` to plain javascript `getAttribute` - Tested the label edit exclusive checkbox and it works as before Signed-off-by: Yarden Shoham <git@yardenshoham.com>
* Remove jQuery `.attr` from the repository topic bar (#30050)Yarden Shoham2024-03-251-27/+29
| | | | | | | | | - Switched from jQuery `.attr` to plain javascript `getAttribute` and `setAttribute` - Tested the repository topic bar. It works as before --------- Signed-off-by: Yarden Shoham <git@yardenshoham.com>
* Migrate `gt-hidden` to `tw-hidden` (#30046)silverwind2024-03-247-41/+41
| | | | | | | | | | | | We have to define this one in helpers.css because tailwind only generates a single class but certain things rely on this being double-class. Command ran: ```sh perl -p -i -e 's#gt-hidden#tw-hidden#g' web_src/js/**/* templates/**/* models/**/* web_src/css/**/* --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Forbid jQuery `is` and fix issues (#30016)silverwind2024-03-243-6/+6
| | | | | | | Tested all functionality. --------- Co-authored-by: Yarden Shoham <git@yardenshoham.com>
* Migrate margin and padding helpers to tailwind (#30043)silverwind2024-03-247-9/+9
| | | | | | | | | | | | | This will conclude the refactor of 1:1 class replacements to tailwind, except `gt-hidden`. Commands ran: ```bash perl -p -i -e 's#gt-(p|m)([lrtbxy])?-0#tw-$1$2-0#g' {web_src/js,templates,routers,services}/**/* perl -p -i -e 's#gt-(p|m)([lrtbxy])?-1#tw-$1$2-0.5#g' {web_src/js,templates,routers,services}/**/* perl -p -i -e 's#gt-(p|m)([lrtbxy])?-2#tw-$1$2-1#g' {web_src/js,templates,routers,services}/**/* perl -p -i -e 's#gt-(p|m)([lrtbxy])?-3#tw-$1$2-2#g' {web_src/js,templates,routers,services}/**/* perl -p -i -e 's#gt-(p|m)([lrtbxy])?-4#tw-$1$2-4#g' {web_src/js,templates,routers,services}/**/* perl -p -i -e 's#gt-(p|m)([lrtbxy])?-5#tw-$1$2-8#g' {web_src/js,templates,routers,services}/**/* ```
* Various code view improvements (#30014)silverwind2024-03-241-44/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. Restore missing styles for message close icon 2. Move `code-line-button` so that it does not go off-screen on small viewports 3. Make `code-line-button` look and behave like other buttons 4. Make `code-line-button` work in blame 5. Make the active selection span the whole line, not just the code part 6. Tweak colors, make dark theme code bg darker, make line numbers same color in diff and file view. 7. Move code background to parent, fixing border radius and other problems 8. Enable code wrap in blame 9. Improve blame responsiveness 10. Remove `--color-code-sidebar-bg` in blame, now it uses same background as code 11. Rename `--color-active-line` to `--color-highlight-bg` 12. Add `--color-highlight-bg` 13. Fix button group borders on hover and border-right on last button. <img width="1343" alt="Screenshot 2024-03-23 at 22 34 13" src="https://github.com/go-gitea/gitea/assets/115237/fcbb919f-5dc3-43f0-97f6-870d6f412554"> <img width="1334" alt="Screenshot 2024-03-23 at 22 34 26" src="https://github.com/go-gitea/gitea/assets/115237/ca44c3b7-4328-4645-ba49-b0dc6a5ac06d"> <img width="1338" alt="Screenshot 2024-03-23 at 22 34 57" src="https://github.com/go-gitea/gitea/assets/115237/00eb0b5a-1ec7-4669-a94a-4602b9d1c1ac"> <img width="1337" alt="Screenshot 2024-03-23 at 22 34 42" src="https://github.com/go-gitea/gitea/assets/115237/752edc4a-064f-413c-9dff-c086187fcd85"> Fixes: https://github.com/go-gitea/gitea/issues/18074