This commit is contained in:
hamdy
2020-11-18 16:15:40 +02:00
parent fa9b5b67e5
commit 5f8af344c8
8 changed files with 50 additions and 187 deletions

View File

@@ -69,7 +69,7 @@ module.exports = {
typeName: 'Membership', typeName: 'Membership',
create: true create: true
}, },
project_ids: 'Project'
}, },
} }
}, },

View File

@@ -41,6 +41,7 @@ module.exports = function (api) {
if (options.internal.typeName === 'Person') { if (options.internal.typeName === 'Person') {
options.project_ids = (typeof options.project_ids === 'string') ? options.project_ids.split(',').map(string => string.trim()) : options.project_ids;
options.memberships = (typeof options.memberships === 'string') ? options.memberships.split(',').map(string => string.trim()) : options.memberships; options.memberships = (typeof options.memberships === 'string') ? options.memberships.split(',').map(string => string.trim()) : options.memberships;
options.countries = (typeof options.countries === 'string') ? options.countries.split(',').map(string => string.trim()) : options.countries; options.countries = (typeof options.countries === 'string') ? options.countries.split(',').map(string => string.trim()) : options.countries;
options.cities = (typeof options.cities === 'string') ? options.cities.split(',').map(string => string.trim()) : options.cities; options.cities = (typeof options.cities === 'string') ? options.cities.split(',').map(string => string.trim()) : options.cities;

View File

@@ -28,7 +28,6 @@ query {
bio bio
linkedin linkedin
websites websites
project_ids
countries countries
cities cities
image(width:800) image(width:800)

View File

@@ -70,7 +70,6 @@ query {
bio bio
linkedin linkedin
websites websites
project_ids
countries countries
cities cities
image(width:800) image(width:800)

View File

@@ -1,139 +0,0 @@
<template>
<Layout :hideHeader="true" :disableScroll="true">
<div class="container sm:pxi-0 mx-auto overflow-x-hidden pt-24">
<div class="flex flex-row flex-wrap items-center mx-4 sm:mx-0">
<div class="w-full md:w-1/6 mx-auto sm:mx-0">
<g-image
:src="$page.author.image"
class="rounded-full bg-gray-200 w-32 h-32 border-4 border-gray-400 mx-auto md:mx-0"
></g-image>
</div>
<div class="w-full md:w-5/6 text-center md:text-left md:pl-8 lg:pl-0">
<h1 class="pb-0 mb-0 mt-0 text-4xl font-medium">{{ $page.author.name }}</h1>
<p class="text-gray-700 text-xl" v-if="$page.author.bio">{{ $page.author.bio }}</p>
<div class="author-social">
{{ $page.author.belongsTo.totalCount }} Projects
&nbsp;&middot;&nbsp;
<!-- <a
:href="$page.author.facebook"
target="_blank"
rel="noopener noreferrer"
class="text-gray-400 hover:text-black"
>
<font-awesome :icon="['fab', 'facebook']" />
</a>
&nbsp;
<a
:href="$page.author.twitter"
target="_blank"
rel="noopener noreferrer"
class="text-gray-400 hover:text-black"
>
<font-awesome :icon="['fab', 'twitter']" />
</a>
&nbsp; -->
<a
:href="$page.author.linkedin"
target="_blank"
rel="noopener noreferrer"
class="text-gray-400 hover:text-black"
>
<font-awesome :icon="['fab', 'linkedin']" />
</a>
</div>
</div>
</div>
<div class="pt-8 border-b mx-4 sm:-mx-4"></div>
<section class="post-content container mx-auto relative font-serif text-gray-700">
<div class="post-content-text text-xl" v-html="$page.author.content"></div>
</section>
<div class="pt-8 border-b mx-4 sm:-mx-4"></div>
<div class="flex flex-wrap pt-8 pb-8 mx-4 sm:-mx-4">
<PostListItem
v-for="edge in $page.author.belongsTo.edges"
:key="edge.node.id"
:record="edge.node"
/>
</div>
<div class="pagination flex justify-center mb-8">
<Pagination
:baseUrl="$page.author.path"
:currentPage="$page.author.belongsTo.pageInfo.currentPage"
:totalPages="$page.author.belongsTo.pageInfo.totalPages"
:maxVisibleButtons="5"
v-if="$page.author.belongsTo.pageInfo.totalPages > 1"
/>
</div>
</div>
</Layout>
</template>
<page-query>
query($id: ID!, $page:Int) {
author(id: $id) {
name
path
bio
image(width:150, height:150)
facebook
twitter
linkedin
content
belongsTo(perPage: 5, page: $page) @paginate {
totalCount
pageInfo {
totalPages
currentPage
}
edges {
node {
... on Blog {
title
excerpt
image(width:800)
path
timeToRead
humanTime : created(format:"DD MMM YYYY")
datetime : created
author {
id
name
image(width:64, height:64, fit:inside)
path
}
}
}
}
}
}
}
</page-query>
<script>
import PostListItem from "~/components/PostListItem.vue";
import Pagination from "~/components/Pagination.vue";
export default {
components: {
Pagination,
PostListItem
},
computed: {
postLabel: function() {
var pluralize = require("pluralize");
return pluralize("post", this.$page.author.belongsTo.totalCount);
}
},
metaInfo() {
return {
title: this.$page.author.name
};
}
};
</script>

View File

@@ -61,7 +61,6 @@
excerpt excerpt
linkedin linkedin
websites websites
project_ids
countries countries
cities cities
private private

View File

@@ -25,27 +25,32 @@
{{ $page.person.bio }} {{ $page.person.bio }}
</p> </p>
<div class="author-social"> <div class="author-social">
{{ $page.person.belongsTo.totalCount }} Projects
&nbsp;&middot;&nbsp;
<!-- <a
:href="$page.person.facebook"
target="_blank"
rel="noopener noreferrer"
class="text-gray-400 hover:text-black"
>
<font-awesome :icon="['fab', 'facebook']" />
</a>
&nbsp;
<a
:href="$page.person.twitter"
target="_blank"
rel="noopener noreferrer"
class="text-gray-400 hover:text-black"
>
<font-awesome :icon="['fab', 'twitter']" />
</a>
&nbsp; -->
</div> </div>
<section>
<div class="avatars">
<div class="flex items-center">
<div class="flex justify-between items-center">
<ul class="list-none flex author-list m-0">
<li
v-for="project in $page.person.project_ids"
:key="project.id"
class="author-list-item"
>
<g-link :to="project.path" v-tooltip="project.title">
<g-image
:src="project.logo"
:alt="project.title"
class="w-8 h-8 rounded-full bg-gray-200 border-2 border-white"
/>
</g-link>
</li>
</ul>
</div>
</div>
</div>
</section>
</div> </div>
</div> </div>
@@ -70,21 +75,13 @@
/> />
</div> </div>
<div class="pagination flex justify-center mb-8">
<Pagination
:baseUrl="$page.person.path"
:currentPage="$page.person.belongsTo.pageInfo.currentPage"
:totalPages="$page.person.belongsTo.pageInfo.totalPages"
:maxVisibleButtons="5"
v-if="$page.person.belongsTo.pageInfo.totalPages > 1"
/>
</div>
</div> </div>
</Layout> </Layout>
</template> </template>
<page-query> <page-query>
query($id: ID!, $page:Int) { query($id: ID!) {
person(id: $id) { person(id: $id) {
path path
content content
@@ -95,16 +92,21 @@
title title
path path
} }
project_ids{
id
title
path
logo
}
bio bio
excerpt excerpt
linkedin linkedin
websites websites
project_ids
countries countries
cities cities
private private
image(width:150, height:150) image(width:150, height:150)
belongsTo(perPage: 5, page: $page) @paginate { belongsTo {
totalCount totalCount
pageInfo { pageInfo {
totalPages totalPages
@@ -113,6 +115,7 @@
edges { edges {
node { node {
... on Blog { ... on Blog {
id
title title
excerpt excerpt
image(width:800) image(width:800)
@@ -128,9 +131,11 @@
} }
}, },
... on Project { ... on Project {
id
title title
excerpt excerpt
image(width:800) image(width:800)
logo
path path
humanTime : startdate(format:"DD MMM YYYY") humanTime : startdate(format:"DD MMM YYYY")
datetime : created datetime : created

View File

@@ -114,21 +114,13 @@
</div> </div>
</div> </div>
</section> </section>
<div class="pagination flex justify-center mb-8">
<Pagination
:baseUrl="$page.project.path"
:currentPage="$page.project.belongsTo.pageInfo.currentPage"
:totalPages="$page.project.belongsTo.pageInfo.totalPages"
:maxVisibleButtons="5"
v-if="$page.project.belongsTo.pageInfo.totalPages > 1"
/>
</div>
</div> </div>
</Layout> </Layout>
</template> </template>
<page-query> <page-query>
query($id: ID!, $page:Int) { query($id: ID!) {
project(id: $id) { project(id: $id) {
id id
title title
@@ -166,8 +158,8 @@
} }
rank rank
excerpt excerpt
content
belongsTo(perPage: 5, page: $page) @paginate { belongsTo {
totalCount totalCount
pageInfo { pageInfo {
totalPages totalPages
@@ -180,6 +172,13 @@
name name
image(width:64, height:64, fit:inside) image(width:64, height:64, fit:inside)
path path
project_ids{
id
title
path
logo
image
}
} }
} }
} }