|
|
@@ -1,5 +1,5 @@
|
|
|
<template>
|
|
|
- <div class="AdminContentShow"
|
|
|
+ <div class="AdminPostShow"
|
|
|
:style="localOptions.style">
|
|
|
<div class="flex justify-end">
|
|
|
<q-btn flat
|
|
|
@@ -9,44 +9,21 @@
|
|
|
>
|
|
|
</q-btn>
|
|
|
</div>
|
|
|
- <q-card flat>
|
|
|
- <q-tabs v-model="tab"
|
|
|
- align="left">
|
|
|
- <q-tab name="content"
|
|
|
- label="جزییات محتوا" />
|
|
|
- <q-tab name="contentTag"
|
|
|
- label="فیش برداری" />
|
|
|
- </q-tabs>
|
|
|
- </q-card>
|
|
|
- <q-tab-panels v-if="mounted"
|
|
|
- v-model="tab">
|
|
|
- <q-tab-panel name="content"
|
|
|
- class="q-pa-none">
|
|
|
- <entity-edit ref="entityEdit"
|
|
|
- v-model:value="inputs"
|
|
|
- title="اطلاعات محتوا"
|
|
|
- :api="api"
|
|
|
- :entity-id-key="entityIdKey"
|
|
|
- :entity-param-key="entityParamKey"
|
|
|
- :show-route-name="showRouteName"
|
|
|
- :show-close-button="false"
|
|
|
- :show-edit-button="false"
|
|
|
- :show-expand-button="false"
|
|
|
- :show-save-button="false"
|
|
|
- :show-reload-button="false"
|
|
|
- :redirect-after-edit="false"
|
|
|
- :after-load-input-data="afterLoadInputData" />
|
|
|
- </q-tab-panel>
|
|
|
- <q-tab-panel name="contentTag"
|
|
|
- class="q-pa-none">
|
|
|
- <admin-content-topic-create :content="contentId"
|
|
|
- :redirect="false"
|
|
|
- @created="onTopicCreated" />
|
|
|
- <q-separator class="q-my-md" />
|
|
|
- <admin-content-topic-list :key="topicListKey"
|
|
|
- :content-id="contentId" />
|
|
|
- </q-tab-panel>
|
|
|
- </q-tab-panels>
|
|
|
+ <entity-edit v-if="mounted"
|
|
|
+ ref="entityEdit"
|
|
|
+ v-model:value="inputs"
|
|
|
+ title="اطلاعات محتوا"
|
|
|
+ :api="api"
|
|
|
+ :entity-id-key="entityIdKey"
|
|
|
+ :entity-param-key="entityParamKey"
|
|
|
+ :show-route-name="showRouteName"
|
|
|
+ :show-close-button="false"
|
|
|
+ :show-edit-button="false"
|
|
|
+ :show-expand-button="false"
|
|
|
+ :show-save-button="false"
|
|
|
+ :show-reload-button="false"
|
|
|
+ :redirect-after-edit="false"
|
|
|
+ :after-load-input-data="afterLoadInputData" />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
@@ -56,53 +33,103 @@ import { EntityEdit } from 'quasar-crud'
|
|
|
import { mixinWidget } from 'src/mixin/Mixins.js'
|
|
|
import { APIGateway } from 'src/api/APIGateway.js'
|
|
|
import BtnControl from 'src/components/Control/btn.vue'
|
|
|
-import ContentMedias from 'src/components/FormBuilderCustumComponents/ContentMedias/ContentMedias.vue'
|
|
|
-import ContentCategorySelector from 'src/components/FormBuilderCustumComponents/ContentCategorySelector.vue'
|
|
|
-import AdminContentTopicList from 'src/components/Widgets/Content/AdminContentTopicList/AdminContentTopicList.vue'
|
|
|
-import AdminContentTopicCreate from 'src/components/Widgets/Content/AdminContentTopicCreate/AdminContentTopicCreate.vue'
|
|
|
+import PostMixin from 'src/components/Widgets/Post/PostMixin.js'
|
|
|
+import PostCategorySelector from 'src/components/FormBuilderCustomControls/PostCategorySelector.vue'
|
|
|
+import FormBuilderTiptapEditor from 'src/components/FormBuilderCustomControls/FormBuilderTiptapEditor.vue'
|
|
|
|
|
|
const BtnControlComp = shallowRef(BtnControl)
|
|
|
-const ContentMediasComp = shallowRef(ContentMedias)
|
|
|
-const ContentCategorySelectorComp = shallowRef(ContentCategorySelector)
|
|
|
+const PostCategorySelectorComp = shallowRef(PostCategorySelector)
|
|
|
+const FormBuilderTiptapEditorComp = shallowRef(FormBuilderTiptapEditor)
|
|
|
|
|
|
export default {
|
|
|
- name: 'AdminContentShow',
|
|
|
+ name: 'AdminPostShow',
|
|
|
components: {
|
|
|
- EntityEdit,
|
|
|
- AdminContentTopicList,
|
|
|
- AdminContentTopicCreate
|
|
|
+ EntityEdit
|
|
|
},
|
|
|
- mixins: [mixinWidget],
|
|
|
+ mixins: [mixinWidget, PostMixin],
|
|
|
data () {
|
|
|
+ const postId = this.$route.params.id
|
|
|
+ const uploadVideo = this.uploadVideo
|
|
|
+ const uploadPhoto = this.uploadPhoto
|
|
|
+ const uploadAudio = this.uploadAudio
|
|
|
return {
|
|
|
mounted: false,
|
|
|
entityLoading: true,
|
|
|
- topicListKey: Date.now(),
|
|
|
- api: APIGateway.content.APIAdresses.byId(this.$route.params.id),
|
|
|
- tab: 'content',
|
|
|
+ api: APIGateway.post.APIAdresses.byId(postId),
|
|
|
entityIdKey: 'id',
|
|
|
entityParamKey: 'id',
|
|
|
- showRouteName: 'Admin.Content.Show',
|
|
|
- indexRouteName: 'Admin.Content.List',
|
|
|
+ showRouteName: 'AdminPanel.Post.Show',
|
|
|
+ indexRouteName: 'AdminPanel.Post.List',
|
|
|
inputs: [
|
|
|
- { type: 'input', name: 'title', responseKey: 'title', label: 'عنوان', placeholder: ' ', col: 'col-md-6 col-12' },
|
|
|
+ { type: 'input', name: 'title', responseKey: 'title', label: 'عنوان', placeholder: ' ', col: 'col-12' },
|
|
|
+ { type: 'input', name: 'order', responseKey: 'order', label: 'ترتیب', placeholder: ' ', col: 'col-md-6 col-12' },
|
|
|
{ type: 'file', name: 'thumbnail', responseKey: 'thumbnail', label: 'عکس', placeholder: ' ', col: 'col-md-6 col-12' },
|
|
|
- { type: ContentCategorySelectorComp, name: 'category', responseKey: 'category_info', col: 'col-md-12 col-12' },
|
|
|
- { type: 'inputEditor', name: 'description', responseKey: 'description', label: 'توضیحات', col: 'col-md-12 col-12' },
|
|
|
- { type: ContentMediasComp, name: 'medias', responseKey: 'medias_info', col: 'col-md-12 col-12' },
|
|
|
- { type: BtnControlComp, name: 'btn', responseKey: 'btn', label: 'ویرایش محتوا', placeholder: ' ', ignoreValue: true, atClick: this.edit, col: 'col-md-6' }
|
|
|
+ { type: PostCategorySelectorComp, name: 'category', responseKey: 'category_info', col: 'col-md-12 col-12' },
|
|
|
+ {
|
|
|
+ // type: 'tiptap-editor',
|
|
|
+ type: FormBuilderTiptapEditorComp,
|
|
|
+ name: 'summary',
|
|
|
+ responseKey: 'summary',
|
|
|
+ label: 'خلاصه',
|
|
|
+ options: {
|
|
|
+ loadBareHtml: true,
|
|
|
+ persianKeyboard: true,
|
|
|
+ uploadPhoto,
|
|
|
+ uploadVideo,
|
|
|
+ uploadAudio
|
|
|
+ },
|
|
|
+ col: 'col-md-12 col-12'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ // type: 'tiptap-editor',
|
|
|
+ type: FormBuilderTiptapEditorComp,
|
|
|
+ name: 'text',
|
|
|
+ responseKey: 'text',
|
|
|
+ label: 'متن',
|
|
|
+ options: {
|
|
|
+ loadBareHtml: true,
|
|
|
+ persianKeyboard: true,
|
|
|
+ uploadPhoto,
|
|
|
+ uploadVideo,
|
|
|
+ uploadAudio
|
|
|
+ },
|
|
|
+ col: 'col-md-12 col-12'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: BtnControlComp,
|
|
|
+ name: 'btn',
|
|
|
+ responseKey: 'btn',
|
|
|
+ label: 'ویرایش پست',
|
|
|
+ placeholder: ' ',
|
|
|
+ ignoreValue: true,
|
|
|
+ atClick: () => {
|
|
|
+ this.edit()
|
|
|
+ },
|
|
|
+ col: 'col-md-6'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: BtnControlComp,
|
|
|
+ name: 'btnShowPost',
|
|
|
+ responseKey: 'btn',
|
|
|
+ label: 'مشاهده پست',
|
|
|
+ placeholder: ' ',
|
|
|
+ ignoreValue: true,
|
|
|
+ atClick: () => {
|
|
|
+ this.showPost()
|
|
|
+ },
|
|
|
+ col: 'col-md-6'
|
|
|
+ }
|
|
|
]
|
|
|
}
|
|
|
},
|
|
|
- computed: {
|
|
|
- contentId () {
|
|
|
- return parseInt(this.$route.params.id)
|
|
|
- }
|
|
|
- },
|
|
|
mounted() {
|
|
|
this.mounted = true
|
|
|
},
|
|
|
methods: {
|
|
|
+ showPost () {
|
|
|
+ const routeData = this.$router.resolve({ name: 'Public.Post.Show', params: { id: this.$route.params.id } })
|
|
|
+ window.open(routeData.href, '_blank')
|
|
|
+ },
|
|
|
afterLoadInputData () {
|
|
|
this.entityLoading = false
|
|
|
},
|
|
|
@@ -117,22 +144,13 @@ export default {
|
|
|
this.$refs.entityEdit.getData()
|
|
|
this.entityLoading = false
|
|
|
})
|
|
|
- },
|
|
|
- onTopicCreated () {
|
|
|
- this.topicListKey = Date.now()
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
-.AdminContentShow {
|
|
|
- .more-action {
|
|
|
- display: flex;
|
|
|
- flex-flow: row;
|
|
|
- justify-content: flex-start;
|
|
|
- margin-bottom: 10px;
|
|
|
- }
|
|
|
+.AdminPostShow {
|
|
|
.title {
|
|
|
font-style: normal;
|
|
|
font-weight: 700;
|