]> source.dussan.org Git - gitea.git/commit
Clean up and fix clone button script (#20415 & #20600) (#20599)
authorsilverwind <me@silverwind.io>
Tue, 2 Aug 2022 04:31:38 +0000 (06:31 +0200)
committerGitHub <noreply@github.com>
Tue, 2 Aug 2022 04:31:38 +0000 (12:31 +0800)
commit56b99551ae95c18c41ca45cd58e739895af44ffc
treed84df5cbe670a90637d3dbec7989ab2cd54c6573
parent51c8c0f3feb6b71ff5bf45e9e1422f2428eb7f5f
Clean up and fix clone button script (#20415 & #20600) (#20599)

* 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.

* Add default value for clone URLs

Default clone URLs to HTTP(S) in DOM rendering. JS will immediately
replace this if the user preference is SSH.

Fixes: https://github.com/go-gitea/gitea/issues/20558
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