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