]> source.dussan.org Git - gitea.git/commit
Clean up and fix clone button script (#20415)
authorsilverwind <me@silverwind.io>
Sun, 31 Jul 2022 18:29:55 +0000 (20:29 +0200)
committerGitHub <noreply@github.com>
Sun, 31 Jul 2022 18:29:55 +0000 (20:29 +0200)
commit335e918b1129ef6e0dd03a4713de90e68fbb23e3
tree82afb38535535754d3b307bddf04ff8dc5feed85
parent589677fafb4b77112b7220a1c6089cec71d6db94
Clean up and fix clone button script (#20415)

The button 'primary' class needs to be set in a synchronous script to prevent flicker of the button which was regressed recently, fixed that.

Additionally, reduced the two script tags to just one, the previous scripts were actually initializing the buttons thrice on the empty repo page, now it only initializes once. Finally, removed duplicate code and re-used the inline function in the update code as well.

I had to split out the script into a separate template as on the empty repo page, the script needs access to the clone URL span in the example text, which is rendered below the clone buttons, so buttons and script could not be combined.
templates/repo/clone_buttons.tmpl
templates/repo/clone_script.tmpl [new file with mode: 0644]
templates/repo/empty.tmpl
templates/repo/home.tmpl
templates/repo/wiki/revision.tmpl
templates/repo/wiki/view.tmpl
web_src/js/features/repo-common.js