mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-02-15 02:28:27 -05:00
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>
This commit is contained in:
parent
6bd9867c3e
commit
f66a6b12cd
3 changed files with 7 additions and 2 deletions
|
@ -46,7 +46,7 @@
|
|||
</div>
|
||||
<div class="eleven wide tw-pt-0">
|
||||
<div class="field {{if .Err_Title}}error{{end}}">
|
||||
<input name="title" aria-label="{{ctx.Locale.Tr "repo.release.title"}}" placeholder="{{ctx.Locale.Tr "repo.release.title"}}" value="{{.title}}" autofocus maxlength="255">
|
||||
<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">
|
||||
</div>
|
||||
<div class="field">
|
||||
{{template "shared/combomarkdowneditor" (dict
|
||||
|
|
|
@ -28,7 +28,9 @@ test('External Release Attachments', async ({page, isMobile}) => {
|
|||
// Fill out form and create new release
|
||||
await expect(page).toHaveURL('/user2/repo2/releases/new');
|
||||
await validate_form({page}, 'fieldset');
|
||||
await page.fill('input[name=tag_name]', '2.0');
|
||||
const textarea = page.locator('input[name=tag_name]');
|
||||
await textarea.pressSequentially('2.0');
|
||||
await expect(page.locator('input[name=title]')).toHaveAttribute('placeholder', '2.0');
|
||||
await page.fill('input[name=title]', '2.0');
|
||||
await page.click('#add-external-link');
|
||||
await page.click('#add-external-link');
|
||||
|
|
|
@ -43,6 +43,9 @@ function initTagNameEditor() {
|
|||
showElem('#tag-target-selector');
|
||||
tagHelper.textContent = value ? newTagHelperText : defaultTagHelperText;
|
||||
}
|
||||
|
||||
const title_input = document.getElementById('release-title');
|
||||
title_input.placeholder = value;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue