loading up the forgejo repo on tangled to test page performance
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

templates: release: Add JS to set default release title to tag name (#6645)

Closes #6485

Adds a bit of javascript in the template responsible for the "create release" page

When typing a name in the "tag name" field, the content will be automatically set in the "Title" field as a placeholder.

This way, you can type a version number (ex: `v5.0.2`), and the title will default to it (`v5.0.2` in this case)

## 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...
- [ ] in their respective `*_test.go` for unit tests.
- [ ] 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.
- [x] 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

- [x] I do not want this change to show in the release notes.
- [ ] 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.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6645
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: Litchi Pi <litchi.pi@proton.me>
Co-committed-by: Litchi Pi <litchi.pi@proton.me>

authored by

Litchi Pi
Litchi Pi
and committed by
Earl Warren
f66a6b12 6bd9867c

+7 -2
+1 -1
templates/repo/release/new.tmpl
··· 46 46 </div> 47 47 <div class="eleven wide tw-pt-0"> 48 48 <div class="field {{if .Err_Title}}error{{end}}"> 49 - <input name="title" aria-label="{{ctx.Locale.Tr "repo.release.title"}}" placeholder="{{ctx.Locale.Tr "repo.release.title"}}" value="{{.title}}" autofocus maxlength="255"> 49 + <input id="release-title" name="title" aria-label="{{ctx.Locale.Tr "repo.release.title"}}" placeholder="{{ctx.Locale.Tr "repo.release.title"}}" value="{{.tag_name}}" autofocus maxlength="255"> 50 50 </div> 51 51 <div class="field"> 52 52 {{template "shared/combomarkdowneditor" (dict
+3 -1
tests/e2e/release.test.e2e.ts
··· 28 28 // Fill out form and create new release 29 29 await expect(page).toHaveURL('/user2/repo2/releases/new'); 30 30 await validate_form({page}, 'fieldset'); 31 - await page.fill('input[name=tag_name]', '2.0'); 31 + const textarea = page.locator('input[name=tag_name]'); 32 + await textarea.pressSequentially('2.0'); 33 + await expect(page.locator('input[name=title]')).toHaveAttribute('placeholder', '2.0'); 32 34 await page.fill('input[name=title]', '2.0'); 33 35 await page.click('#add-external-link'); 34 36 await page.click('#add-external-link');
+3
web_src/js/features/repo-release.js
··· 43 43 showElem('#tag-target-selector'); 44 44 tagHelper.textContent = value ? newTagHelperText : defaultTagHelperText; 45 45 } 46 + 47 + const title_input = document.getElementById('release-title'); 48 + title_input.placeholder = value; 46 49 }); 47 50 } 48 51