org: use the same logic as user

This commit is contained in:
Simone Gotti 2019-03-30 13:15:43 +01:00
parent 6e8cd885aa
commit 8c62e10c42
2 changed files with 28 additions and 10 deletions

View File

@ -139,9 +139,22 @@ export default new VueRouter({
}, },
{ {
path: "/org/:orgname", path: "/org/:orgname",
name: "org",
component: Org, component: Org,
props: (route) => ({ orgname: route.params.orgname }), props: (route) => ({ orgname: route.params.orgname }),
children: [
{
path: "",
name: "org",
component: projects,
props: (route) => ({ ownertype: "org", ownername: route.params.orgname })
},
{
path: "projects",
name: "org projects",
component: projects,
props: (route) => ({ ownertype: "org", ownername: route.params.orgname })
},
]
}, },
{ {

View File

@ -1,32 +1,36 @@
<template> <template>
<div> <div>
<div class="org-title"> <div class="org-title">
<span class="org-name">{{orgname}}</span> <router-link class="org-name" :to="ownerLink('org', orgname)">
<span>{{orgname}}</span>
</router-link>
</div> </div>
<div class="tabs"> <div class="tabs">
<ul> <ul>
<li :class="[{ 'is-active': currentTab === 'projects' }]"> <li :class="[{ 'is-active': $route.name === 'org projects' || $route.name === 'org' }]">
<a @click="currentTab = 'projects'">Projects</a> <router-link :to="ownerProjectsLink('org', orgname)">Projects</router-link>
</li> </li>
</ul> </ul>
</div> </div>
<projects v-if="currentTab == 'projects'" ownertype="org" :ownername="orgname"/> <router-view></router-view>
</div> </div>
</template> </template>
<script> <script>
import { ownerLink, ownerProjectsLink } from "@/util/link.js";
import projects from "@/components/projects.vue"; import projects from "@/components/projects.vue";
export default { export default {
name: "Org", name: "Org",
components: { projects }, components: { projects },
props: { props: {
orgname: String, orgname: String
currentTab: { },
type: String, methods: {
default: "projects" ownerLink: ownerLink,
} ownerProjectsLink: ownerProjectsLink
} }
}; };
</script> </script>
@ -40,6 +44,7 @@ export default {
padding-left: 5px; padding-left: 5px;
margin-bottom: 25px; margin-bottom: 25px;
.org-name { .org-name {
color: $grey-dark;
padding-left: 5px; padding-left: 5px;
font-size: 1.5rem; font-size: 1.5rem;
padding-right: 1rem; padding-right: 1rem;