summaryrefslogtreecommitdiffstats
path: root/web_src/js
Commit message (Collapse)AuthorAgeFilesLines
* Add org visibility label to non-organization's dashboard (#24558)Hester Gong2023-05-071-0/+3
|
* Display warning when user try to rename default branch (#24512)sillyguodong2023-05-041-0/+5
| | | | | | | | | | | | | | | Follow #24380 It's better to warn users when they try to rename the default branch. ![image](https://user-images.githubusercontent.com/33891828/236107929-c8ac2854-dd0f-4500-a0a7-800c8fe48861.png) --------- Co-authored-by: techknowlogick <matti@mdranta.net> Co-authored-by: Jason Song <i@wolfogre.com> Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Giteabot <teabot@gitea.io>
* Improve template system and panic recovery (#24461)wxiaoguang2023-05-041-11/+0
| | | | | | | | | | | | | | | | | | | | | | | | | Partially for #24457 Major changes: 1. The old `signedUserNameStringPointerKey` is quite hacky, use `ctx.Data[SignedUser]` instead 2. Move duplicate code from `Contexter` to `CommonTemplateContextData` 3. Remove incorrect copying&pasting code `ctx.Data["Err_Password"] = true` in API handlers 4. Use one unique `RenderPanicErrorPage` for panic error page rendering 5. Move `stripSlashesMiddleware` to be the first middleware 6. Install global panic recovery handler, it works for both `install` and `web` 7. Make `500.tmpl` only depend minimal template functions/variables, avoid triggering new panics Screenshot: <details> ![image](https://user-images.githubusercontent.com/2114189/235444895-cecbabb8-e7dc-4360-a31c-b982d11946a7.png) </details>
* Make Issue/PR/projects more compact, misc CSS tweaks (#24459)silverwind2023-05-033-7/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Remove various horizontal dividers on repo pages that didn't provide visual benefit - Remove label/milestone pills on single issue/pr page - Remove issue-related pill buttons on projects page - Increase contrast of color-secondary on arc-green - Improve notifications icon, make circle bigger - Remove some inline styles - Fix focus in issue/pr title edit and select all text on button click ### Issue and PR before and after <img width="1249" alt="Screenshot 2023-05-01 at 11 44 22" src="https://user-images.githubusercontent.com/115237/235436662-a708288e-84fb-4b2e-a5a2-3a1c17d28f6c.png"> <img width="1248" alt="Screenshot 2023-05-01 at 11 58 51" src="https://user-images.githubusercontent.com/115237/235437992-f863e483-f3cc-4cc1-8204-fd223647a0c9.png"> ### Projects before and after <img width="1255" alt="Screenshot 2023-05-01 at 11 41 02" src="https://user-images.githubusercontent.com/115237/235436433-0deb85d6-4e7d-4e74-847f-254cc70a0cf9.png"> <img width="1267" alt="Screenshot 2023-05-01 at 11 40 03" src="https://user-images.githubusercontent.com/115237/235436431-715b13cb-f78c-4d86-b27a-9229f9738c5b.png"> ### Releases before and after <img width="1243" alt="Screenshot 2023-05-01 at 11 41 12" src="https://user-images.githubusercontent.com/115237/235436457-b655ee6f-03b8-4595-8d8c-b15ea469e988.png"> <img width="1240" alt="Screenshot 2023-05-01 at 11 40 10" src="https://user-images.githubusercontent.com/115237/235436456-05a2a0dd-7cbb-4f26-b0d3-4f667df4bb95.png"> ### Misc <img width="58" alt="Screenshot 2023-05-01 at 10 49 13" src="https://user-images.githubusercontent.com/115237/235432494-936ce995-6e22-47bc-ab2d-c9e93d31987d.png"> <img width="57" alt="Screenshot 2023-05-01 at 18 57 08" src="https://user-images.githubusercontent.com/115237/235492430-1d32cfe0-0f2c-467c-b2fa-925b27e30e0e.png"> Issue title edit and wrap: <img width="1238" alt="Screenshot 2023-05-01 at 12 34 40" src="https://user-images.githubusercontent.com/115237/235441407-d5067a57-e586-4865-a652-282e5944abb4.png"> <img width="1232" alt="Screenshot 2023-05-01 at 12 06 24" src="https://user-images.githubusercontent.com/115237/235438710-1a543dda-220f-4d87-8f93-f1710c0695f0.png"> --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix EasyMDE toolbar (#24489)silverwind2023-05-034-81/+217
| | | | | | | | | | | | | Fixes https://github.com/go-gitea/gitea/issues/24486 The "clean block" button is gone because I could not find a matching octicon. Order of buttons is roughly equal to textarea. <img width="824" alt="Screenshot 2023-05-02 at 21 10 00" src="https://user-images.githubusercontent.com/115237/235762593-ceccb260-e665-4932-ac8a-ef6fe8406a3c.png"> --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Enable whitespace rendering on selection in Monaco (#24444)silverwind2023-05-021-1/+0
| | | | | | | | | | | Remove the [renderWhitespace](https://microsoft.github.io/monaco-editor/docs.html#interfaces/editor.IEditorOptions.html#renderWhitespace) override, so the default value of `selection` takes over and makes whitespace visible on selection. <img width="128" alt="Screenshot 2023-04-30 at 19 09 41" src="https://user-images.githubusercontent.com/115237/235366707-d598268d-03cc-4839-a195-c460bddae99b.png"> Co-authored-by: Giteabot <teabot@gitea.io>
* Replace `N/A` with `-` everywhere (#24474)silverwind2023-05-021-1/+1
| | | | | | | | | | | | | | Followup to https://github.com/go-gitea/gitea/pull/24427. Reasoning is that `N/A` is specific to english while `-` is language-neutral and does not need translation. Before: <img width="891" alt="Screenshot 2023-05-01 at 20 58 20" src="https://user-images.githubusercontent.com/115237/235511592-8a36d0f2-34ff-4dbe-b642-67c0ade644fe.png"> After: <img width="901" alt="Screenshot 2023-05-01 at 20 59 59" src="https://user-images.githubusercontent.com/115237/235511594-d49f6d09-92e8-4e99-be7b-2a37f5d24129.png">
* Add rerun workflow button and refactor to use SVG octicons (#24350)yp053272023-05-012-17/+18
| | | | | | | | | | | | | | | | | Changes: - Add rerun workflow button. Then users can rerun the whole workflow by only one-click. - Refactor to use SVG octicons in RepoActionView.vue ![image](https://user-images.githubusercontent.com/18380374/234736083-dea9b333-ec11-4095-a113-763f3716fba7.png) ![image](https://user-images.githubusercontent.com/18380374/234736107-d657d19c-f70a-42f4-985f-156a8c7efb7a.png) ![image](https://user-images.githubusercontent.com/18380374/234736160-9ad372df-7089-4d18-9bab-48bca3f01878.png) --------- Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Remove all direct references to font-awesome (#24448)Yarden Shoham2023-05-012-17/+22
| | | | | | | | | | | | | | | | | - Related #10410 - I had to add an SVG for an empty checkbox https://github.com/primer/octicons/issues/942 # Before ![image](https://user-images.githubusercontent.com/20454870/235374683-13f355c3-1245-40db-adda-4c710fc80288.png) # After ![image](https://user-images.githubusercontent.com/20454870/235374655-cc637132-f314-424d-9243-13d45b8915d5.png) --------- Signed-off-by: Yarden Shoham <git@yardenshoham.com>
* Improve issue list filter (#24425)wxiaoguang2023-04-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | Partial regression of #24393, not only regression, but broken for long time, 24393 didn't really improve it but used wrong `overflow: scroll`. Actually, that "ui secondary filter menu labels" shouldn't be set as scrollable (I missed that at that time), the problem is: if a "ui menu" has "dropdown" items, then it should not be scrollable. Otherwise the dropdown menu can't be shown correctly. And there are more problems: * The "issue-filters" shouldn't be used anywhere else (copying&pasting problem again ....) * There is also an "issue-actions" container, it should also be fixed. * There are similar problems on the milestone page. * The old comment in code: "grid column" doesn't work well. The major changes of this PR are: use "flex: 1" instead of "ui grid column". After this PR, not 100% perfect but much better than before.
* Move `Rename branch` from repo settings page to the page of branches list ↵sillyguodong2023-04-301-0/+19
| | | | | | | | | | | | | | | | (#24380) Co-Author: @wxiaoguang It is more convenient that user just need to enter a new branch name after he selects the branch which he want to rename. So this PR move the function of renaming branch to the page of branches list. This PR also restyle the button of `new branch`, `download`, `delete`.... https://user-images.githubusercontent.com/33891828/235277997-413060bb-759f-430a-b5c4-df5e40ffcd28.mov --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Improve protected branch setting page (#24379)Hester Gong2023-04-291-17/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Main changes: 1. Change html structure of protected branch page, use [`grouped fields`](https://fomantic-ui.com/collections/form.html#grouped-fields) instead of `fields` for better margin, and wrap `grouped fields` around related `field`s, remove unnecessary `<div id="protection_box" class="fields">` outer div 2. Changed some order of field to make them more categorized, used `ui dividing header` for categorization and fine tune css. Before: <img width="1907" alt="Screen Shot 2023-04-27 at 14 56 19" src="https://user-images.githubusercontent.com/17645053/234783731-bce8a7ce-dfc9-4d47-a3a8-b962ebea9467.png"> <img width="1849" alt="Screen Shot 2023-04-27 at 14 56 30" src="https://user-images.githubusercontent.com/17645053/234783740-c47d314e-5e2d-4854-98fd-c88f85ef3584.png"> <img width="1872" alt="Screen Shot 2023-04-27 at 14 56 36" src="https://user-images.githubusercontent.com/17645053/234783745-18e35a75-07e8-451d-b001-f9bcf16fcab5.png"> After: https://user-images.githubusercontent.com/17645053/235114568-da010aad-7654-4410-ab8c-5d0fce7edadb.mov 3. Changed "Enable Merge Whitelist" to radio checkbox, and added "Enable Merge" radio checkbox, which are exclusive Before: <img width="926" alt="Screen Shot 2023-04-28 at 13 08 29" src="https://user-images.githubusercontent.com/17645053/235059233-75790f7a-e5ea-4e1c-82c6-509fef8b84b3.png"> After: <img width="942" alt="Screen Shot 2023-04-28 at 13 09 28" src="https://user-images.githubusercontent.com/17645053/235059367-852d1f61-8407-4126-8c79-315b9c1ffada.png"> 4. Add a link to set default branch on branch list page (with reference to github) https://user-images.githubusercontent.com/17645053/234787404-61c1c7b6-aabf-429f-a109-5b690e4e0b5a.mov 5. Removed dead codes. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Giteabot <teabot@gitea.io>
* Add eslint-plugin-regexp (#24361)silverwind2023-04-262-2/+2
| | | | | | Add [`eslint-plugin-regexp`](https://github.com/ota-meshi/eslint-plugin-regexp) and fix discovered issues. Config is mostly the recommended one, but I relaxed a few rules.
* Alert error message if open dependencies are included in the issues that try ↵sillyguodong2023-04-261-0/+2
| | | | | | | | | to batch close (#24329) fix #24185 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Improve RSS (#24335)wxiaoguang2023-04-251-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Follow #22719 ### Major changes 1. `ServerError` doesn't do format, so remove the `%s` 2. Simplify `RenderBranchFeed` (slightly) 3. Remove unused `BranchFeedRSS` 4. Make `feed.RenderBranchFeed` respect `EnableFeed` config 5. Make `RepoBranchTagSelector.vue` respect `EnableFeed` setting, otherwise there is always RSS icon 6. The `(branchURLPrefix + item.url).replace('src', 'rss')` doesn't seem right for all cases, for example, the string `src` could appear in `branchURLPrefix`, so we need a separate `rssURLPrefix` 7. The `<a>` in Vue menu needs `@click.stop`, otherwise the menu itself would be triggered at the same time 8. Change `<a><button></button></a>` to `<a role=button>` 9. Use `{{PathEscapeSegments .TreePath}}` instead of `{{range $i, $v := .TreeNames}}/{{$v}}{{end}}` Screenshot of changed parts: <details> ![image](https://user-images.githubusercontent.com/2114189/234315538-66603694-9093-48a8-af33-83575fd7a018.png) ![image](https://user-images.githubusercontent.com/2114189/234315786-f1efa60b-012e-490b-8ce2-d448dc6fe5c9.png) ![image](https://user-images.githubusercontent.com/2114189/234334941-446941bc-1baa-4256-8850-ccc439476cda.png) </details> ### Other thoughts Should we remove the RSS icon from the branch dropdown list? It seems too complex for a list UI, and users already have the chance to get the RSS feed URL from "branches" page. --------- Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: silverwind <me@silverwind.io>
* Automatically select the org when click create repo from org dashboard (#24325)yp053272023-04-251-1/+2
| | | | | | ![image](https://user-images.githubusercontent.com/18380374/234209941-d661b07f-e963-427b-a673-78c46043a792.png) In org dashboard, the create repo link will be `repo/create?org={orgId}`
* Restore bold on repolist (#24337)silverwind2023-04-251-1/+1
| | | | | | | | Looking at it again, it does look a bit "odd" without bold, so revert the repolist change done in https://github.com/go-gitea/gitea/pull/24307. <img width="141" alt="image" src="https://user-images.githubusercontent.com/115237/234331813-c6e2402f-e099-43b3-aed6-46a0e24e3899.png">
* Add RSS Feeds for branches and files (#22719)jladbrook2023-04-252-0/+5
| | | | | | | | | | | Fix #22228 adding RSS feeds for branches and files. RSS feeds are accessed through: * [gitea]/src/branch/{branch}.rss * [gitea]/src/branch/{branch}/{file_name}.rss No changes have been made to the UI to expose the feed urls for branches and files.
* Add --font-weight-bold and set previous bold to 601 (#24307)wxiaoguang2023-04-241-1/+1
| | | | | | | | | | | | | Fix #24305 According to MDN, "bold" starts from 700, some fonts do not provide "bolding" for weight 600 https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight --------- Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Giteabot <teabot@gitea.io>
* Refactor delete_modal_actions template and use it for project column related ↵Hester Gong2023-04-231-9/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | actions (#24097) Co-Author: @wxiaoguang This PR is to fix https://github.com/go-gitea/gitea/issues/23318#issuecomment-1506275446 . The way to fix this in this PR is to use `delete_modal_actions.tmpl` here both to fix this issue and keep ui consistency (as suggested by [TODO here](https://github.com/go-gitea/gitea/blob/4299c3b7db61f8741eca0ba3d663bb65745a4acc/templates/projects/view.tmpl#L161)) And this PR also refactors `delete_modal_actions.tmpl` and its related styles, and use the template for more modal actions: 1. Added template attributes: * locale * ModalButtonStyle: "yes" (default) or "confirm" * ModalButtonCancelText * ModalButtonOkText 2. Rename `delete_modal_actions.tmpl` template to `modal_actions_confirm.tmpl` because it is not only used for action modals deletion now. 3. Refactored css related to modals into `web_src/css/modules/modal.css` and improved the styles. 4. Also use the template for PR deletion modal and remove issue dependency modal. 5. Some modals should also use the template, but not sure how to open them, so mark these modal actions by `{{/* TODO: Convert to base/modal_actions_confirm */}}` After (Also tested on arc green): Hovering on the left buttons <img width="711" alt="Screen Shot 2023-04-23 at 15 17 12" src="https://user-images.githubusercontent.com/17645053/233825650-76307e65-9255-44bb-80e8-7062f58ead1b.png"> <img width="786" alt="Screen Shot 2023-04-23 at 15 17 21" src="https://user-images.githubusercontent.com/17645053/233825652-4dc6f7d1-a180-49fb-a468-d60950eaee0d.png"> Test for functionalities: https://user-images.githubusercontent.com/17645053/233826857-76376fda-022c-42d0-b0f3-339c17ca4e59.mov --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Improve emoji and mention matching (#24255)Yarden Shoham2023-04-224-18/+103
| | | | | | | | | | | | | | | | | | | | | | | | Prioritize matches that start with the given text, then matches that contain the given text. I wanted to add a heart emoji on a pull request comment so I started writing `:`, `h`, `e`, `a`, `r` (at this point I still couldn't find the heart), `t`... The heart was not on the list, that's weird - it feels like I made a typo or a mistake. This fixes that. This also feels more like GitHub's emoji auto-complete. # Before ![image](https://user-images.githubusercontent.com/20454870/233630750-bd0a1b76-33d0-41d4-9218-a37b670c42b0.png) # After ![image](https://user-images.githubusercontent.com/20454870/233775128-05e67fc1-e092-4025-b6f7-1fd8e5f71e87.png) --------- Signed-off-by: Yarden Shoham <git@yardenshoham.com> Co-authored-by: silverwind <me@silverwind.io>
* Introduce eslint-plugin-no-jquery/no-event-shorthand (#24198)yp053272023-04-209-15/+15
| | | | | | | https://github.com/go-gitea/gitea/pull/24098#issuecomment-1514010690 --------- Co-authored-by: silverwind <me@silverwind.io>
* Fix issue attachment handling (#24202)wxiaoguang2023-04-201-24/+30
| | | | | | | | | | | | | | | | | | | | | | Close #24195 Some of the changes are taken from my another fix https://github.com/go-gitea/gitea/pull/20147/commits/f07b0de997125c9b79cc5af27966a7cdd1803a4d in #20147 (although that PR was discarded ....) The bug is: 1. The old code doesn't handle `removedfile` event correctly 2. The old code doesn't provide attachments for type=CommentTypeReview This PR doesn't intend to refactor the "upload" code to a perfect state (to avoid making the review difficult), so some legacy styles are kept. --------- Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Giteabot <teabot@gitea.io>
* Make wiki title supports dashes and improve wiki name related features (#24143)wxiaoguang2023-04-191-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Close #7570 1. Clearly define the wiki path behaviors, see `services/wiki/wiki_path.go` and tests 2. Keep compatibility with old contents 3. Allow to use dashes in titles, eg: "2000-01-02 Meeting record" 4. Add a "Pages" link in the dropdown, otherwise users can't go to the Pages page easily. 5. Add a "View original git file" link in the Pages list, even if some file names are broken, users still have a chance to edit or remove it, without cloning the wiki repo to local. 6. Fix 500 error when the name contains prefix spaces. This PR also introduces the ability to support sub-directories, but it can't be done at the moment due to there are a lot of legacy wiki data, which use "%2F" in file names. ![image](https://user-images.githubusercontent.com/2114189/232239004-3359d7b9-7bf3-4ff3-8446-bfb0e79645dd.png) ![image](https://user-images.githubusercontent.com/2114189/232239020-74b92c72-bf73-4377-a319-1c85609f82b1.png) Co-authored-by: Giteabot <teabot@gitea.io>
* Fix Resolve Conversation not working in Conversation view (#24191)Brecht Van Lommel2023-04-191-1/+1
| | | | | It only worked in the Files Changed view. Caused by #23639.
* Add unset default project column (#23531)yp053272023-04-191-11/+22
| | | | Close: https://github.com/go-gitea/gitea/issues/23401
* Use same action status svg icons on actions list as on action page (#24178)Hester Gong2023-04-191-6/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Close #24020 After: These icons are the same now: <img width="1287" alt="截屏2023-04-18 13 52 11" src="https://user-images.githubusercontent.com/17645053/232684252-05ddc101-dc5b-41b5-b374-132c3d853a41.png"> <img width="1141" alt="截屏2023-04-18 13 54 48" src="https://user-images.githubusercontent.com/17645053/232684261-6ebd864a-a9aa-4982-af32-2cea91c35be8.png"> In this PR, didn't use `ActionRunStatus.vue` because the mounting of the component will cause flash of the icons like below: https://user-images.githubusercontent.com/17645053/232682646-713202dc-9023-4b9c-a849-c3a1ae6dd155.mov Instead, modified and used `status.tmpl` to make it the same as `ActionRunStatus.vue` to avoid the ui flash (Welcomed to show how to use `ActionRunStatus.vue` without flashing if there is a way). Added comments to both of them for reminding synchronization of these two files. --------- Co-authored-by: Jason Song <i@wolfogre.com>
* Make mention autocomplete case insensitive in new markdown editor (#24190)Brecht Van Lommel2023-04-181-2/+4
| | | | | | | | This matches EasyMDE, and makes it easier to find the right user without having to remember the exact name. --------- Co-authored-by: silverwind <me@silverwind.io>
* Fix duplicate modals when clicking on "remove all" repository button (#24129)Hester Gong2023-04-191-4/+4
| | | | | | | | | | | | | Under Team tab of an organization, click on "remove all" repositories button will trigger two modals. Because `data-modal-id` is not proerly added. Before: https://user-images.githubusercontent.com/17645053/231988545-ac690b86-e3fe-4bf5-81c6-5ef09302e849.mov After: https://user-images.githubusercontent.com/17645053/231989678-53be4f91-fdc9-4bc5-ba11-a08aa4548e37.mov
* Localize activity heatmap (except tooltip) (#24131)Yarden Shoham2023-04-172-11/+6
| | | | | | | | | | | | | | | The calculation of the total sum is moved to the backend so a full HTML string could be sent. ![image](https://user-images.githubusercontent.com/20454870/232112381-c11d896b-ba47-40f8-b2a3-71cf4b3208de.png) - Closes #10669 - 2nd attempt (the first was in #21570) --------- Signed-off-by: Yarden Shoham <git@yardenshoham.com> Co-authored-by: Giteabot <teabot@gitea.io>
* Fix Org edit page bugs: renaming detection, maxlength (#24161)wxiaoguang2023-04-171-14/+5
| | | | | | | | | | | | | | | | | | | | | ## Before * The renaming detection is wrong (eg: pasting a new name into the input doesn't trigger the detection) * The renaming prompt layout is not good * Some MaxSize/maxlength rules is missing ![image](https://user-images.githubusercontent.com/2114189/232379191-5d0f6d10-56ca-4cec-ac52-7f77b9cb4a8a.png) ![image](https://user-images.githubusercontent.com/2114189/232379234-3289373b-9ddb-4627-ae86-f4d74589fa0c.png) ## After * Fix these problems ![image](https://user-images.githubusercontent.com/2114189/232379098-31c6fa21-c210-4e7f-a337-b38b99670835.png)
* Fix math and mermaid rendering bugs (#24049)silverwind2023-04-175-40/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. Fix multiple error display for math and mermaid: ![err](https://user-images.githubusercontent.com/115237/231126411-8a21a777-cd53-4b7e-ac67-5332623106e8.gif) 2. Fix height calculation of certain mermaid diagrams by reading the iframe inner height from it's document instead of parsing it from SVG: Before: <img width="866" alt="Screenshot 2023-04-11 at 11 56 27" src="https://user-images.githubusercontent.com/115237/231126480-b194e02b-ea8c-4ddf-8c79-50c525815d92.png"> After: <img width="855" alt="Screenshot 2023-04-11 at 11 56 35" src="https://user-images.githubusercontent.com/115237/231126494-5fe86a48-8d21-455a-8b95-79b6ee27a16f.png"> 3. Refactor error handling to a common function 4. Rename to `renderAsciicast` for consistency 5. Improve mermaid loading sequence Note: I did try `securityLevel: 'sandbox'` to make mermaid output a iframe directly, but that showed a bug in mermaid where the iframe style height was set incorrectly. Opened https://github.com/mermaid-js/mermaid/issues/4289 for this. --------- Co-authored-by: Giteabot <teabot@gitea.io>
* Refactor locale number (#24134)wxiaoguang2023-04-172-21/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | Before, the `GiteaLocaleNumber.js` was just written as a a drop-in replacement for old `js-pretty-number`. Actually, we can use Golang's `text` package to format. This PR partially completes the TODOs in `GiteaLocaleNumber.js`: > if we have complete backend locale support (eg: Golang "x/text" package), we can drop this component. > tooltip: only 2 usages of this, we can replace it with Golang's "x/text/number" package in the future. This PR also helps #24131 Screenshots: <details> ![image](https://user-images.githubusercontent.com/2114189/232179420-b1b9974b-9d96-4408-b209-b80182c8b359.png) ![image](https://user-images.githubusercontent.com/2114189/232179416-14f36aa0-3f3e-4ac9-b366-7bd3a4464a11.png) </details>
* Use 1.18's aria role for dropdown menus (#24144)wxiaoguang2023-04-161-2/+2
| | | | | | | | | | | | According to erion's feedback, the 1.18 approach works with Safari (`role=menu` on the parent container), while the 1.19's approach doesn't work well with Safari+VoiceOver (although I tested it worked with Chrome a little better). I have tested this 1.18 approach could work for all Safari/Chrome+VoiceOver and Chrome+Talkback. Let's try to make it on try.gitea.io to see whether it helps Safari users.
* Sort repo topic labels by name (#24123)wxiaoguang2023-04-141-2/+3
| | | | Close #24077
* Add option to search for users is active join a team (#24093)Tyrone Yeh2023-04-141-1/+1
| | | | | | | | Adding a user in a team to enter a username gives a list of no active users --------- Co-authored-by: Jason Song <i@wolfogre.com>
* Show friendly 500 error page to users and developers (#24110)wxiaoguang2023-04-141-1/+11
| | | | | | | | | | | | | | | | | | | | | | Close #24104 This also introduces many tests to cover many complex error handling functions. ### Before The details are never shown in production. <details> ![image](https://user-images.githubusercontent.com/2114189/231805004-13214579-4fbe-465a-821c-be75c2749097.png) </details> ### After The details could be shown to site admin users. It is safe. ![image](https://user-images.githubusercontent.com/2114189/231803912-d5660994-416f-4b27-a4f1-a4cc962091d4.png)
* Add monospace toggle button to textarea (#24034)silverwind2023-04-131-2/+19
| | | | | | | | | | | | | | | | | - Add new button to textarea to switch font. State is persisted in localStorage. - Change markdown-switch-easymde button from `<span>` to `<button>` - Slightly increased monospace font globally by 5% as I think it fits better. For hover effect on these buttons I'm deferring to https://github.com/go-gitea/gitea/pull/23896. ![](https://user-images.githubusercontent.com/115237/230948526-ecf8d730-0c69-4a8e-a1a5-1e5e079c754d.gif) --------- Co-authored-by: delvh <dev.lh@web.de>
* Update the value of the `diffEnd` when click `Show More` btn in the ↵sillyguodong2023-04-121-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | DiffFileTree (#24069) In the component `DiffFileTree`,if don't update the value of the `diffEnd` in the callback of ajax request, click `Show More` btn will always return the same response, duplicate files are appended to the file list. Before: https://user-images.githubusercontent.com/33891828/231371188-82d169af-10bb-47e2-8aca-83ced2597f2d.mov After: https://user-images.githubusercontent.com/33891828/231369805-39a5a4d0-662c-4f08-bc5a-7d31e8782453.mov --------- Co-authored-by: Giteabot <teabot@gitea.io> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Expand selected file when clicking file tree (#24041)sillyguodong2023-04-121-0/+10
| | | | | | | Auto expand the selected file when clicking the file item of the file tree. This is consistent with Github's behavior. https://user-images.githubusercontent.com/33891828/231048124-61f180af-adba-42d7-9ffa-626e1de04aed.mov
* Add popup to hashed comments/pull requests/issues in file editing/adding ↵Hester Gong2023-04-112-10/+13
| | | | | | | | | | | | | | | | | | | | | | | preview tab (#24040) #23734 didn't add popups(tippy) to ref issues for the preview tab when adding/editing a file The location of the preview tab: <img width="1214" alt="截屏2023-04-10 13 55 38" src="https://user-images.githubusercontent.com/17645053/230836213-a73f0cee-378c-4a21-93db-583ba2c72f77.png"> This PR resues the logic in `ComboMarkdownEditor.js` to also add popup to hashed comments/pull requests/issues in file editing/adding preview tab. After - On hover: <img width="1222" alt="截屏2023-04-10 13 55 42" src="https://user-images.githubusercontent.com/17645053/230836250-527ca7d0-6ec4-4c68-89ab-4f1b57b09239.png"> --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: silverwind <me@silverwind.io>
* Use reactive store to share data between components (#23996)wxiaoguang2023-04-113-15/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | Follow #23947 * Use reactive store to share data between components * Remove no-op `this.hashListener = window.addEventListener()` because `addEventListener` returns void/undefined. Reference: https://vuejs.org/guide/scaling-up/state-management.html#simple-state-management-with-reactivity-api Screenshot (the same as before): <details> <img width="565" alt="image" src="https://user-images.githubusercontent.com/2114189/230701282-bd61bfa3-7786-433b-9ad8-a88591112a02.png"> </details> --------- Co-authored-by: silverwind <me@silverwind.io>
* Fine tune markdown editor toolbar (#24046)wxiaoguang2023-04-111-1/+4
| | | | | | | | | | | | | | | | | | | | | | | 1. Remove unnecessary `btn-link` `muted` classes * Link is link, button is button, I can't see a real requirement to make a button like a link. * If anyone insists, please help to show me real example from modern frameworks / websites, how and why they do so. * No need to duplicate a lot of class names on similar elements * Declare styles clearly, for example, `markdown-toolbar` itself should have `display: flex`, but not use `gt-df` to overwrite the `display: block`. 2. Remove unnecessary `role` attribute * https://github.com/github/markdown-toolbar-element/issues/70 * The `markdown-toolbar-element` does want to add `role=button`, but there is a bug. * So we do the similar thing as upstream does (add the role by JS), until they fix their bugs. 3. Indent `markdown-switch-easymde` (before it doesn't have a proper indent) Screenshot: ![image](https://user-images.githubusercontent.com/2114189/231090912-f6ba01cb-d0eb-40ad-bf8c-ffc597d9a778.png)
* Use auto-updating, natively hoverable, localized time elements (#23988)Yarden Shoham2023-04-116-69/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Added [GitHub's `relative-time` element](https://github.com/github/relative-time-element) - Converted all formatted timestamps to use this element - No more flashes of unstyled content around time elements - These elements are localized using the `lang` property of the HTML file - Relative (e.g. the activities in the dashboard) and duration (e.g. server uptime in the admin page) time elements are auto-updated to keep up with the current time without refreshing the page - Code that is not needed anymore such as `formatting.js` and parts of `since.go` have been deleted Replaces #21440 Follows #22861 ## Screenshots ### Localized ![image](https://user-images.githubusercontent.com/20454870/230775041-f0af4fda-8f6b-46d3-b8e3-d340c791a50c.png) ![image](https://user-images.githubusercontent.com/20454870/230673393-931415a9-5729-4ac3-9a89-c0fb5fbeeeb7.png) ### Tooltips #### Native for dates ![image](https://user-images.githubusercontent.com/20454870/230797525-1fa0a854-83e3-484c-9da5-9425ab6528a3.png) #### Interactive for relative ![image](https://user-images.githubusercontent.com/115237/230796860-51e1d640-c820-4a34-ba2e-39087020626a.png) ### Auto-update ![rec](https://user-images.githubusercontent.com/20454870/230672159-37480d8f-435a-43e9-a2b0-44073351c805.gif) --------- Signed-off-by: Yarden Shoham <git@yardenshoham.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: delvh <dev.lh@web.de>
* Replace tribute with text-expander-element for textarea (#23985)silverwind2023-04-091-4/+74
| | | | | | | | | | | | | | The completion popup now behaves now much more as expected than before for the raw textarea: - You can press <kbd>Tab</kbd> or <kbd>Enter</kbd> once the completion popup is open to accept the selected item - The menu does not close automatically when moving the cursor - When you delete text, previously correct suggestions are shown again - If you delete all text until the opening char (`@` or `:`) after applying a suggestion, the popup reappears again - Menu UI has been improved <img width="278" alt="Screenshot 2023-04-07 at 19 43 42" src="https://user-images.githubusercontent.com/115237/230653601-d6517b9f-0988-445e-aa57-5ebfaf5039f3.png">
* Expand/Collapse all changed files (#23639)sillyguodong2023-04-093-18/+40
| | | | | | | | | | close #23628 Now in `...` dropdown, you can expand or collapse all diff files that have loaded. https://user-images.githubusercontent.com/33891828/227749688-2d406916-3347-49f6-93a5-4092a00e8809.mov Co-authored-by: silverwind <me@silverwind.io>
* Add job.duration in web ui (#23963)yp053272023-04-071-2/+4
| | | | | | | ![image](https://user-images.githubusercontent.com/18380374/230532947-271ac389-8134-4c5e-8f2f-ced4a4fd0ebe.png) ![image](https://user-images.githubusercontent.com/18380374/230532963-e76532c5-7ca1-4b01-ae77-cc1223350fe7.png) Maybe we can change the location of it.
* Highlight selected file in the PR file tree (#23947)yusifeng2023-04-072-11/+29
| | | | | | | | | before ![before](https://user-images.githubusercontent.com/36984894/230327904-6e712ca2-f777-4cad-99f3-53bc20008180.gif) after ![after](https://user-images.githubusercontent.com/36984894/230327966-6e5dd971-f0df-427a-a80b-6a9b6db6065d.gif)
* Improve markdown editor: width, height, preferred (#23895)wxiaoguang2023-04-073-13/+175
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Follow #23876 1. Fine tune the heights of the editors (like before) * Auto expand the editor (increase/decrease the height) when editing 2. Remember user's last used editor (textarea/easymde) in LocalStorage, then next time the editor will be switched automatically * No need to introduce extra config option, it satisfies all users, including who prefer EasyMDE 3. Also fix the width problem of Review Panel Screenshot: <details> ![image](https://user-images.githubusercontent.com/2114189/229518585-2e05827e-8355-48f3-a20c-2c8b9e60ce74.png) ![image](https://user-images.githubusercontent.com/2114189/229518173-4caa6da7-6ad9-40e9-bf1a-ceddfcd4b37f.png) ![image](https://user-images.githubusercontent.com/2114189/229507886-148e9b84-9b58-46d1-ba3f-727e1396f476.png) ![image](https://user-images.githubusercontent.com/2114189/229518258-9f522294-1e64-4b06-91ab-ab43b0353aaa.png) ![image](https://user-images.githubusercontent.com/2114189/229507752-6d540ac7-7748-4bb6-bc09-28acab32d31b.png) ![image](https://user-images.githubusercontent.com/2114189/229510899-de322af5-57e8-4dc5-9a61-771a3b1bee79.png) </details> --------- Co-authored-by: silverwind <me@silverwind.io>
* Refactor authors dropdown (send get request from frontend to avoid long wait ↵Hester Gong2023-04-076-64/+174
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | time) (#23890) Right now the authors search dropdown might take a long time to load if amount of authors is huge. Example: (In the video below, there are about 10000 authors, and it takes about 10 seconds to open the author dropdown) https://user-images.githubusercontent.com/17645053/229422229-98aa9656-3439-4f8c-9f4e-83bd8e2a2557.mov Possible improvements can be made, which will take 2 steps (Thanks to @wolfogre for advice): Step 1: Backend: Add a new api, which returns a limit of 30 posters with matched prefix. Frontend: Change the search behavior from frontend search(fomantic search) to backend search(when input is changed, send a request to get authors matching the current search prefix) Step 2: Backend: Optimize the api in step 1 using indexer to support fuzzy search. This PR is implements the first step. The main changes: 1. Added api: `GET /{type:issues|pulls}/posters` , which return a limit of 30 users with matched prefix (prefix sent as query). If `DEFAULT_SHOW_FULL_NAME` in `custom/conf/app.ini` is set to true, will also include fullnames fuzzy search. 2. Added a tooltip saying "Shows a maximum of 30 users" to the author search dropdown 3. Change the search behavior from frontend search to backend search After: https://user-images.githubusercontent.com/17645053/229430960-f88fafd8-fd5d-4f84-9df2-2677539d5d08.mov Fixes: https://github.com/go-gitea/gitea/issues/22586 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: silverwind <me@silverwind.io>