]> source.dussan.org Git - gitea.git/commitdiff
Automatically select the org when click create repo from org dashboard (#24325)
authoryp05327 <576951401@qq.com>
Wed, 26 Apr 2023 02:25:29 +0000 (11:25 +0900)
committerGitHub <noreply@github.com>
Wed, 26 Apr 2023 02:25:29 +0000 (22:25 -0400)
![image](https://user-images.githubusercontent.com/18380374/234209941-d661b07f-e963-427b-a673-78c46043a792.png)

In org dashboard, the create repo link will be `repo/create?org={orgId}`

templates/user/dashboard/repolist.tmpl
web_src/js/components/DashboardRepoList.vue

index 0a8f427f9da15a98ce811918e19077e60d761df2..20638aab411253844438e6dce2f3de50132c53d7 100644 (file)
@@ -44,8 +44,10 @@ data.teamId = {{.Team.ID}};
 {{if not .ContextUser.IsOrganization}}
 data.organizations = [{{range .Orgs}}{'name': {{.Name}}, 'num_repos': {{.NumRepos}}},{{end}}];
 data.isOrganization = false;
-data.organizationsTotalCount = {{.UserOrgsCount}}
-data.canCreateOrganization = {{.SignedUser.CanCreateOrganization}}
+data.organizationsTotalCount = {{.UserOrgsCount}};
+data.canCreateOrganization = {{.SignedUser.CanCreateOrganization}};
+{{else}}
+data.organizationId = {{.ContextUser.ID}};
 {{end}}
 
 window.config.pageData.dashboardRepoList = data;
index 1af53aac902b07439298c6328ed9105a5654f660..33b312aa6ee72ebca0b182cb0379ecd1593281f2 100644 (file)
@@ -10,7 +10,7 @@
           {{ textMyRepos }}
           <span class="ui grey label gt-ml-3">{{ reposTotalCount }}</span>
         </div>
-        <a :href="subUrl + '/repo/create'" :data-tooltip-content="textNewRepo">
+        <a :href="subUrl + '/repo/create' + (isOrganization ? '?org=' + organizationId : '')" :data-tooltip-content="textNewRepo">
           <svg-icon name="octicon-plus"/>
           <span class="sr-only">{{ textNewRepo }}</span>
         </a>
@@ -199,6 +199,7 @@ const sfc = {
       isOrganization: true,
       canCreateOrganization: false,
       organizationsTotalCount: 0,
+      organizationId: 0,
 
       subUrl: appSubUrl,
       ...pageData.dashboardRepoList,