mirror of https://github.com/go-gitea/gitea.git
Refactor initRepoBranchTagSelector to use new init framework (#33776)
Make "initRepoBranchTagSelector" to use new init framework and fix the abused "js-branch-tag-selector" styles --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>pull/33778/head^2
parent
ad204f9c5a
commit
14be462646
|
@ -14,7 +14,8 @@
|
||||||
|
|
||||||
Search "repo/branch_dropdown" in the template directory to find all occurrences.
|
Search "repo/branch_dropdown" in the template directory to find all occurrences.
|
||||||
*/}}
|
*/}}
|
||||||
<div class="js-branch-tag-selector {{if .ContainerClasses}}{{.ContainerClasses}}{{end}}"
|
<div class="{{if .ContainerClasses}}{{.ContainerClasses}}{{end}}"
|
||||||
|
data-global-init="initRepoBranchTagSelector"
|
||||||
data-text-release-compare="{{ctx.Locale.Tr "repo.release.compare"}}"
|
data-text-release-compare="{{ctx.Locale.Tr "repo.release.compare"}}"
|
||||||
data-text-branches="{{ctx.Locale.Tr "repo.branches"}}"
|
data-text-branches="{{ctx.Locale.Tr "repo.branches"}}"
|
||||||
data-text-tags="{{ctx.Locale.Tr "repo.tags"}}"
|
data-text-tags="{{ctx.Locale.Tr "repo.tags"}}"
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
{{$compareTarget = $release.Sha1}}
|
{{$compareTarget = $release.Sha1}}
|
||||||
{{end}}
|
{{end}}
|
||||||
{{template "repo/branch_dropdown" dict
|
{{template "repo/branch_dropdown" dict
|
||||||
|
"ContainerClasses" "release-branch-tag-selector"
|
||||||
"Repository" $.Repository
|
"Repository" $.Repository
|
||||||
"ShowTabTags" true
|
"ShowTabTags" true
|
||||||
"DropdownFixedText" (ctx.Locale.Tr "repo.release.compare")
|
"DropdownFixedText" (ctx.Locale.Tr "repo.release.compare")
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
#release-list .js-branch-tag-selector {
|
#release-list .release-branch-tag-selector {
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
}
|
}
|
||||||
#release-list .branch-selector-dropdown .menu { /* open menu to left */
|
#release-list .branch-selector-dropdown .menu { /* open menu to left */
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import {registerGlobalInitFunc} from '../modules/observer.ts';
|
||||||
import {
|
import {
|
||||||
initRepoCommentFormAndSidebar,
|
initRepoCommentFormAndSidebar,
|
||||||
initRepoIssueBranchSelect, initRepoIssueCodeCommentCancel, initRepoIssueCommentDelete,
|
initRepoIssueBranchSelect, initRepoIssueCodeCommentCancel, initRepoIssueCommentDelete,
|
||||||
|
@ -20,10 +21,10 @@ import {initRepoNew} from './repo-new.ts';
|
||||||
import {createApp} from 'vue';
|
import {createApp} from 'vue';
|
||||||
import RepoBranchTagSelector from '../components/RepoBranchTagSelector.vue';
|
import RepoBranchTagSelector from '../components/RepoBranchTagSelector.vue';
|
||||||
|
|
||||||
function initRepoBranchTagSelector(selector: string) {
|
function initRepoBranchTagSelector() {
|
||||||
for (const elRoot of document.querySelectorAll(selector)) {
|
registerGlobalInitFunc('initRepoBranchTagSelector', async (elRoot: HTMLInputElement) => {
|
||||||
createApp(RepoBranchTagSelector, {elRoot}).mount(elRoot);
|
createApp(RepoBranchTagSelector, {elRoot}).mount(elRoot);
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function initBranchSelectorTabs() {
|
export function initBranchSelectorTabs() {
|
||||||
|
@ -42,7 +43,7 @@ export function initRepository() {
|
||||||
const pageContent = document.querySelector('.page-content.repository');
|
const pageContent = document.querySelector('.page-content.repository');
|
||||||
if (!pageContent) return;
|
if (!pageContent) return;
|
||||||
|
|
||||||
initRepoBranchTagSelector('.js-branch-tag-selector');
|
initRepoBranchTagSelector();
|
||||||
initRepoCommentFormAndSidebar();
|
initRepoCommentFormAndSidebar();
|
||||||
|
|
||||||
// Labels
|
// Labels
|
||||||
|
|
Loading…
Reference in New Issue