mirror of https://github.com/Requarks/wiki.git
Nick
5 years ago
13 changed files with 454 additions and 45 deletions
Split View
Diff Options
-
4client/components/admin.vue
-
8client/components/admin/admin-navigation.vue
-
236client/components/admin/admin-pages-edit.vue
-
50client/components/admin/admin-pages.vue
-
27client/graph/admin/pages/pages-query-single.gql
-
44client/static/svg/icon-view-details.svg
-
48server/controllers/common.js
-
12server/graph/resolvers/page.js
-
27server/graph/schemas/page.graphql
-
4server/helpers/error.js
-
4server/helpers/page.js
-
1server/master.js
-
34server/models/pages.js
@ -0,0 +1,236 @@ |
|||
<template lang='pug'> |
|||
v-container(fluid, grid-list-lg) |
|||
v-layout(row, wrap, v-if='page.id') |
|||
v-flex(xs12) |
|||
.admin-header |
|||
img.animated.fadeInUp(src='/svg/icon-view-details.svg', alt='Edit Page', style='width: 80px;') |
|||
.admin-header-title |
|||
.headline.blue--text.text--darken-2.animated.fadeInLeft Page Details |
|||
.subheading.grey--text.animated.fadeInLeft.wait-p2s |
|||
v-chip.ml-0.mr-2(label, small).caption ID {{page.id}} |
|||
span /{{page.locale}}/{{page.path}} |
|||
v-spacer |
|||
template(v-if='page.isPublished') |
|||
status-indicator.mr-3(positive, pulse) |
|||
.caption.green--text {{$t('common:page.published')}} |
|||
template(v-else) |
|||
status-indicator.mr-3(negative, pulse) |
|||
.caption.red--text {{$t('common:page.unpublished')}} |
|||
template(v-if='page.isPrivate') |
|||
status-indicator.mr-3.ml-4(intermediary, pulse) |
|||
.caption.deep-orange--text {{$t('common:page.private')}} |
|||
template(v-else) |
|||
status-indicator.mr-3.ml-4(active, pulse) |
|||
.caption.blue--text {{$t('common:page.global')}} |
|||
v-spacer |
|||
v-btn.animated.fadeInRight.wait-p4s(color='grey', large, outline, to='/pages') |
|||
v-icon arrow_back |
|||
v-divider.animated.fadeInRight.wait-p3s.mx-3(vertical) |
|||
v-dialog(v-model='deletePageDialog', max-width='500') |
|||
v-btn.animated.fadeInDown.wait-p1s(color='red', large, outline, slot='activator') |
|||
v-icon(color='red') delete |
|||
v-card.wiki-form |
|||
.dialog-header.is-short.is-red |
|||
v-icon.mr-2(color='white') highlight_off |
|||
span {{$t('common:page.delete')}} |
|||
v-card-text |
|||
i18next.body-2(path='common:page.deleteTitle', tag='div') |
|||
span.red--text.text--darken-2(place='title') {{page.title}} |
|||
.caption {{$t('common:page.deleteSubtitle')}} |
|||
v-chip.mt-3.ml-0.mr-1(label, color='red lighten-4', disabled, small) |
|||
.caption.red--text.text--darken-2 {{page.locale.toUpperCase()}} |
|||
v-chip.mt-3.mx-0(label, color='red lighten-5', disabled, small) |
|||
span.red--text.text--darken-2 /{{page.path}} |
|||
v-card-chin |
|||
v-spacer |
|||
v-btn(flat, @click='deletePageDialog = false', :disabled='loading') {{$t('common:actions.cancel')}} |
|||
v-btn(color='red darken-2', @click='deletePage', :loading='loading').white--text {{$t('common:actions.delete')}} |
|||
v-btn.animated.fadeInDown(color='teal', large, outline, @click='rerenderPage') |
|||
v-icon(left) system_update_alt |
|||
span Re-render |
|||
v-flex(xs12, lg6) |
|||
v-card.animated.fadeInUp |
|||
v-toolbar(color='primary', dense, dark, flat) |
|||
v-icon.mr-2 subject |
|||
span Properties |
|||
v-list.py-0(two-line, dense) |
|||
v-list-tile |
|||
v-list-tile-content |
|||
v-list-tile-title.caption.grey--text Title |
|||
v-list-tile-sub-title.body-2.grey--text.text--darken-3 {{ page.title }} |
|||
v-divider |
|||
v-list-tile |
|||
v-list-tile-content |
|||
v-list-tile-title.caption.grey--text Description |
|||
v-list-tile-sub-title.body-2.grey--text.text--darken-3 {{ page.description || '-' }} |
|||
v-divider |
|||
v-list-tile |
|||
v-list-tile-content |
|||
v-list-tile-title.caption.grey--text Locale |
|||
v-list-tile-sub-title.body-2.grey--text.text--darken-3 {{ page.locale }} |
|||
v-list-tile-action |
|||
v-btn(icon) |
|||
v-icon(color='grey') edit |
|||
v-divider |
|||
v-list-tile |
|||
v-list-tile-content |
|||
v-list-tile-title.caption.grey--text Path |
|||
v-list-tile-sub-title.body-2.grey--text.text--darken-3 {{ page.path }} |
|||
v-list-tile-action |
|||
v-btn(icon) |
|||
v-icon(color='grey') edit |
|||
v-divider |
|||
v-list-tile |
|||
v-list-tile-content |
|||
v-list-tile-title.caption.grey--text Editor |
|||
v-list-tile-sub-title.body-2.grey--text.text--darken-3 {{ page.editor || '?' }} |
|||
v-divider |
|||
v-list-tile |
|||
v-list-tile-content |
|||
v-list-tile-title.caption.grey--text Content Type |
|||
v-list-tile-sub-title.body-2.grey--text.text--darken-3 {{ page.contentType || '?' }} |
|||
|
|||
v-toolbar.elevation-2.mt-3.animated.fadeInUp.wait-p4s(color='white', dense) |
|||
v-spacer |
|||
v-btn(color='primary', flat, :href='`/` + page.locale + `/` + page.path') |
|||
v-icon(left) subject |
|||
span View |
|||
v-divider(vertical) |
|||
v-btn(color='primary', flat, :href='`/e/` + page.locale + `/` + page.path') |
|||
v-icon(left) edit |
|||
span Edit |
|||
v-divider(vertical) |
|||
v-btn(color='primary', flat, :href='`/s/` + page.locale + `/` + page.path') |
|||
v-icon(left) code |
|||
span Source |
|||
v-divider(vertical) |
|||
v-btn(color='primary', flat, :href='`/h/` + page.locale + `/` + page.path') |
|||
v-icon(left) history |
|||
span History |
|||
v-spacer |
|||
|
|||
.caption.mt-4.grey--text.animated.fadeInUp.wait-p6s Page Hash: {{ page.hash }} |
|||
|
|||
v-flex(xs12, lg6) |
|||
v-card.animated.fadeInUp.wait-p2s |
|||
v-toolbar(color='primary', dense, dark, flat) |
|||
v-icon.mr-2 people |
|||
span Users |
|||
v-list.py-0(two-line, dense) |
|||
v-list-tile |
|||
v-list-tile-avatar |
|||
v-btn(icon, :to='`/users/` + page.creatorId') |
|||
v-icon(color='grey') person |
|||
v-list-tile-content |
|||
v-list-tile-title.caption.grey--text Creator |
|||
v-list-tile-sub-title.body-2.grey--text.text--darken-3 {{ page.creatorName }} #[em.caption ({{ page.creatorEmail }})] |
|||
v-list-tile-action |
|||
v-list-tile-action-text {{ page.createdAt | moment('calendar') }} |
|||
v-divider |
|||
v-list-tile |
|||
v-list-tile-avatar |
|||
v-btn(icon, :to='`/users/` + page.authorId') |
|||
v-icon(color='grey') person |
|||
v-list-tile-content |
|||
v-list-tile-title.caption.grey--text Last Editor |
|||
v-list-tile-sub-title.body-2.grey--text.text--darken-3 {{ page.authorName }} #[em.caption ({{ page.authorEmail }})] |
|||
v-list-tile-action |
|||
v-list-tile-action-text {{ page.updatedAt | moment('calendar') }} |
|||
v-card.mt-3.animated.fadeInUp.wait-p4s |
|||
v-toolbar(color='primary', dense, dark, flat) |
|||
v-icon.mr-2 history |
|||
span Recent History |
|||
v-spacer |
|||
v-chip(label, color='white', small).primary--text coming soon |
|||
v-timeline.mx-3(dense, clipped) |
|||
v-timeline-item(color='teal', small, v-if='page.createdAt !== page.updatedAt') |
|||
v-layout(justify-space-between) |
|||
v-flex(xs7) Page Modified by #[strong {{ page.authorName }}] #[em.caption ({{ page.authorEmail }})] |
|||
v-flex.text-xs-right(xs5).caption.grey--text.text-darken-2 {{ page.updatedAt | moment('calendar') }} |
|||
v-timeline-item(hide-dot, small) |
|||
.body-1 ... |
|||
v-btn.mx-0(outline, color='grey') View Full History |
|||
.body-1 ... |
|||
v-timeline-item(color='pink', small) |
|||
v-layout(justify-space-between) |
|||
v-flex(xs7) Page created by #[strong {{ page.creatorName }}] #[em.caption ({{ page.creatorEmail }})] |
|||
v-flex.text-xs-right(xs5).caption.grey--text.text-darken-2 {{ page.createdAt | moment('calendar') }} |
|||
|
|||
v-layout(row, align-center, v-else) |
|||
v-progress-circular(indeterminate, width='2', color='grey') |
|||
.body-2.pl-3.grey--text {{ $t('common:page.loading') }} |
|||
|
|||
</template> |
|||
<script> |
|||
import _ from 'lodash' |
|||
import { StatusIndicator } from 'vue-status-indicator' |
|||
|
|||
import pageQuery from 'gql/admin/pages/pages-query-single.gql' |
|||
import deletePageMutation from 'gql/common/common-pages-mutation-delete.gql' |
|||
|
|||
export default { |
|||
components: { |
|||
StatusIndicator |
|||
}, |
|||
data() { |
|||
return { |
|||
deletePageDialog: false, |
|||
page: {}, |
|||
loading: false |
|||
} |
|||
}, |
|||
methods: { |
|||
async deletePage() { |
|||
this.loading = true |
|||
this.$store.commit(`loadingStart`, 'page-delete') |
|||
try { |
|||
const resp = await this.$apollo.mutate({ |
|||
mutation: deletePageMutation, |
|||
variables: { |
|||
id: this.page.id |
|||
} |
|||
}) |
|||
if (_.get(resp, 'data.pages.delete.responseResult.succeeded', false)) { |
|||
this.$store.commit('showNotification', { |
|||
style: 'green', |
|||
message: `Page deleted successfully.`, |
|||
icon: 'check' |
|||
}) |
|||
this.$router.replace('/pages') |
|||
} else { |
|||
throw new Error(_.get(resp, 'data.pages.delete.responseResult.message', this.$t('common:error.unexpected'))) |
|||
} |
|||
} catch (err) { |
|||
this.$store.commit('pushGraphError', err) |
|||
} |
|||
this.$store.commit(`loadingStop`, 'page-delete') |
|||
}, |
|||
async rerenderPage() { |
|||
this.$store.commit('showNotification', { |
|||
style: 'indigo', |
|||
message: `Coming soon...`, |
|||
icon: 'directions_boat' |
|||
}) |
|||
} |
|||
}, |
|||
apollo: { |
|||
page: { |
|||
query: pageQuery, |
|||
variables() { |
|||
return { |
|||
id: _.toSafeInteger(this.$route.params.id) |
|||
} |
|||
}, |
|||
fetchPolicy: 'network-only', |
|||
update: (data) => data.pages.single, |
|||
watchLoading (isLoading) { |
|||
this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-pages-refresh') |
|||
} |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style lang='scss'> |
|||
|
|||
</style> |
@ -0,0 +1,27 @@ |
|||
query($id: Int!) { |
|||
pages { |
|||
single(id:$id) { |
|||
id |
|||
path |
|||
hash |
|||
title |
|||
description |
|||
isPrivate |
|||
isPublished |
|||
privateNS |
|||
publishStartDate |
|||
publishEndDate |
|||
contentType |
|||
createdAt |
|||
updatedAt |
|||
editor |
|||
locale |
|||
authorId |
|||
authorName |
|||
authorEmail |
|||
creatorId |
|||
creatorName |
|||
creatorEmail |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,44 @@ |
|||
<?xml version="1.0" encoding="iso-8859-1"?> |
|||
<!-- Generator: Adobe Illustrator 20.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> |
|||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Слой_1" x="0px" y="0px" viewBox="0 0 64 64" style="enable-background:new 0 0 64 64;" xml:space="preserve" width="96px" height="96px"> |
|||
<linearGradient id="SVGID_1__44764" gradientUnits="userSpaceOnUse" x1="43" y1="28.8333" x2="43" y2="37.5036" spreadMethod="reflect"> |
|||
<stop offset="0" style="stop-color:#6DC7FF"/> |
|||
<stop offset="1" style="stop-color:#E6ABFF"/> |
|||
</linearGradient> |
|||
<path style="fill:url(#SVGID_1__44764);" d="M47,33c0,2.21-1.79,4-4,4s-4-1.79-4-4c0-2.21,1.79-4,4-4C43,31.21,44.79,33,47,33z"/> |
|||
<linearGradient id="SVGID_2__44764" gradientUnits="userSpaceOnUse" x1="16" y1="36.8333" x2="16" y2="43.3275" spreadMethod="reflect"> |
|||
<stop offset="0" style="stop-color:#6DC7FF"/> |
|||
<stop offset="1" style="stop-color:#E6ABFF"/> |
|||
</linearGradient> |
|||
<path style="fill:url(#SVGID_2__44764);" d="M20,42c0,0.552-0.448,1-1,1h-6c-0.552,0-1-0.448-1-1v-4c0-0.552,0.448-1,1-1h6 c0.552,0,1,0.448,1,1V42z"/> |
|||
<linearGradient id="SVGID_3__44764" gradientUnits="userSpaceOnUse" x1="32" y1="7.375" x2="32" y2="57.825" spreadMethod="reflect"> |
|||
<stop offset="0" style="stop-color:#1A6DFF"/> |
|||
<stop offset="1" style="stop-color:#C822FF"/> |
|||
</linearGradient> |
|||
<path style="fill:url(#SVGID_3__44764);" d="M58,33c0-4.335-7.062-10.397-14-10.946V11c0-1.654-1.346-3-3-3H9c-1.654,0-3,1.346-3,3v38v4 c0,1.654,1.346,3,3,3h32c1.654,0,3-1.346,3-3v-4v-5.054C50.938,43.397,58,37.335,58,33z M41,54H9c-0.552,0-1-0.448-1-1v-1.184 C8.314,51.928,8.648,52,9,52h32c0.352,0,0.686-0.072,1-0.184V53C42,53.552,41.552,54,41,54z M41,50H9c-0.552,0-1-0.448-1-1V11 c0-0.552,0.448-1,1-1h32c0.552,0,1,0.448,1,1v11.054C35.062,22.603,28,28.665,28,33s7.062,10.397,14,10.946V49 C42,49.552,41.552,50,41,50z M43,42c-6.317,0-13-5.853-13-9s6.683-9,13-9s13,5.853,13,9S49.317,42,43,42z"/> |
|||
<linearGradient id="SVGID_4__44764" gradientUnits="userSpaceOnUse" x1="20" y1="7.375" x2="20" y2="57.825" spreadMethod="reflect"> |
|||
<stop offset="0" style="stop-color:#1A6DFF"/> |
|||
<stop offset="1" style="stop-color:#C822FF"/> |
|||
</linearGradient> |
|||
<rect x="12" y="21" style="fill:url(#SVGID_4__44764);" width="16" height="2"/> |
|||
<linearGradient id="SVGID_5__44764" gradientUnits="userSpaceOnUse" x1="19" y1="7.375" x2="19" y2="57.825" spreadMethod="reflect"> |
|||
<stop offset="0" style="stop-color:#1A6DFF"/> |
|||
<stop offset="1" style="stop-color:#C822FF"/> |
|||
</linearGradient> |
|||
<rect x="12" y="25" style="fill:url(#SVGID_5__44764);" width="14" height="2"/> |
|||
<linearGradient id="SVGID_6__44764" gradientUnits="userSpaceOnUse" x1="17" y1="7.375" x2="17" y2="57.825" spreadMethod="reflect"> |
|||
<stop offset="0" style="stop-color:#1A6DFF"/> |
|||
<stop offset="1" style="stop-color:#C822FF"/> |
|||
</linearGradient> |
|||
<rect x="12" y="29" style="fill:url(#SVGID_6__44764);" width="10" height="2"/> |
|||
<linearGradient id="SVGID_7__44764" gradientUnits="userSpaceOnUse" x1="16" y1="7.375" x2="16" y2="57.825" spreadMethod="reflect"> |
|||
<stop offset="0" style="stop-color:#1A6DFF"/> |
|||
<stop offset="1" style="stop-color:#C822FF"/> |
|||
</linearGradient> |
|||
<rect x="12" y="33" style="fill:url(#SVGID_7__44764);" width="8" height="2"/> |
|||
<linearGradient id="SVGID_8__44764" gradientUnits="userSpaceOnUse" x1="25" y1="7.375" x2="25" y2="57.825" spreadMethod="reflect"> |
|||
<stop offset="0" style="stop-color:#1A6DFF"/> |
|||
<stop offset="1" style="stop-color:#C822FF"/> |
|||
</linearGradient> |
|||
<rect x="12" y="17" style="fill:url(#SVGID_8__44764);" width="26" height="2"/> |
|||
</svg> |
Write
Preview
Loading…
Cancel
Save