]> source.dussan.org Git - gitea.git/commit
Add form field id generation, remove duplicated ids (#30546) (#30561)
authorGiteabot <teabot@gitea.io>
Thu, 18 Apr 2024 10:33:32 +0000 (18:33 +0800)
committerGitHub <noreply@github.com>
Thu, 18 Apr 2024 10:33:32 +0000 (10:33 +0000)
commit4fec3a3d440c5d614197f7419c4a2ec33d442dac
tree79a9a7331c96f3dc2aa1b7aa3b9c1adb23bb3325
parentb4a38318c333519b1008d03fd01e14a803363498
Add form field id generation, remove duplicated ids (#30546) (#30561)

Backport #30546 by @silverwind

Fixes: https://github.com/go-gitea/gitea/issues/30384
On repo settings page, there id `repo_name` was used 5 times on the same
page, some in modal and such. I think we are better off just
auto-generating these IDs in the future so that labels link up with
their form element.

Ideally this id generation would be done in backend in a subtemplate,
but seeing that we already have similar JS patches for checkboxes, I
took the easy path for now.

I also checked that these `#repo_name` were not in use in JS and the
only case where this id appears in JS is on the migration page where
it's still there.

Co-authored-by: silverwind <me@silverwind.io>
templates/repo/settings/options.tmpl
web_src/js/modules/fomantic.js
web_src/js/modules/fomantic/base.js
web_src/js/modules/fomantic/checkbox.js
web_src/js/modules/fomantic/form.js [new file with mode: 0644]