PluginProbe
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses / trunk
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses vtrunk
2.10.0 2.10.01 2.9.1 2.9.0 2.8.1 2.8.0 2.7.7 2.7.5 2.7.0 2.6.01 2.6.0 2.5.0 2.4.01 trunk 1.0.90 1.0.91 1.0.92 1.0.93 1.0.94 1.0.95 1.0.96 1.0.97 1.0.98 1.0.99 1.1.0 All 77 releases
fluent-community / assets / ViewSpacePage.js

ViewSpacePage.js in FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses trunk, at assets/ViewSpacePage.js

2 lines 5.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import{q as b,d as k}from"./element-plus.js?ver=2.10.01";import"./dayjs.js?ver=2.10.01";import{N as B,F as v,d as L,u as S}from"./app.js?ver=2.10.01";import{F as n,S as r,E as l,K as _,Q as i,I as p,O as c,L as E,ae as u,D as a,P as d}from"./vue.js?ver=2.10.01";import{_ as I}from"./emoji-picker.js?ver=2.10.01";import"./fcom-utils.js?ver=2.10.01";import"./vendor.js?ver=2.10.01";import"./vue-router.js?ver=2.10.01";import"./pinia.js?ver=2.10.01";import"./milkdown.js?ver=2.10.01";const f="fcom_space_page_inline_css",F=["unified","standard","classic","full_width"],P="unified",A={narrow:"classic"},T="classic",M={name:"ViewSpacePage",components:{NotFoundResult:B,FeedMdContent:v,CommentBox:L},props:["space_profile","space_slug","page_slug"],setup(){return{spaceStore:S()}},data(){return{loading:!0,notFound:!1,page:null,appliedBodyClasses:[]}},computed:{canManage(){var e,s;return!!((s=(e=this.space_profile)==null?void 0:e.permissions)!=null&&s.can_manage_pages)},spaceSlug(){return this.space_slug||this.$route.params.space},pageMeta(){var e;return((e=this.page)==null?void 0:e.meta)||{}},pageLayout(){const e=A[this.pageMeta.layout]||this.pageMeta.layout;return F.includes(e)?e:P},showTitle(){return this.pageMeta.show_title!=="no"},showFeaturedImage(){var e,s;return!!((e=this.page)!=null&&e.featured_image)&&((s=this.page)==null?void 0:s.can_view)&&this.pageMeta.show_featured_image==="yes"},commentsEnabled(){var e,s;return this.pageMeta.enable_comments==="yes"&&!!((e=this.page)!=null&&e.can_view)&&((s=this.page)==null?void 0:s.status)==="published"},wrapperClasses(){return this.page?["fcom_page_layout_"+this.pageLayout]:this.loading?["fcom_space_page_loading"]:[]},editRoute(){var e;return{name:"space_settings_pages",params:{space:this.spaceSlug},query:{page_id:(e=this.page)==null?void 0:e.id}}},notFoundActions(){return[{text:this.$t("Back to Space"),class:"fcom_primary_button",action:()=>{this.$router.push({name:"space_feeds",params:{space:this.spaceSlug}})}}]}},watch:{page_slug(){this.fetchPage()},wrapperClasses(){this.applyBodyClasses()}},methods:{fetchPage(){const e=this.page_slug;this.loading=!0,this.notFound=!1,this.page=null,this.publishLayout(),this.removeInlineCss(),this.$get(`spaces/${this.spaceSlug}/pages/${e}`).then(s=>{e===this.page_slug&&(this.page=s.page,this.changeTitle(this.page.title),this.publishLayout(),this.$nextTick(()=>{this.applyInlineCss()}))}).catch(s=>{if(e===this.page_slug){if((s==null?void 0:s.xhr_status)===404||(s==null?void 0:s.status)===404){this.notFound=!0;return}this.$handleError(s)}}).finally(()=>{e===this.page_slug&&(this.loading=!1)})},applyBodyClasses(){this.removeBodyClasses(),this.wrapperClasses.length&&(this.appliedBodyClasses=[...this.wrapperClasses],document.body.classList.add(...this.appliedBodyClasses))},removeBodyClasses(){this.appliedBodyClasses.length&&(document.body.classList.remove(...this.appliedBodyClasses),this.appliedBodyClasses=[])},publishLayout(){this.spaceStore.setCurrentPageLayout(this.page&&this.pageLayout===T?this.pageLayout:null)},applyInlineCss(){var s;if(this.removeInlineCss(),!((s=this.page)!=null&&s.inline_css))return;const e=document.createElement("style");e.setAttribute("id",f),e.appendChild(document.createTextNode(this.page.inline_css)),document.head.appendChild(e)},removeInlineCss(){const e=document.getElementById(f);e&&e.remove()}},mounted(){this.fetchPage()},beforeUnmount(){this.removeInlineCss(),this.removeBodyClasses(),this.spaceStore.setCurrentPageLayout(null)}},N={key:0},x={key:2,class:"fcom_space_page"},D={key:0,class:"fcom_space_page_draft_notice"},O={class:"fcom_space_page_draft_badge"},V=["src","alt"],R={key:2,class:"fcom_space_page_header"},U=["textContent"],Y={key:5,class:"fcom_space_page_admin_bar"},q={key:3,class:"fcom_space_page_comments"},z={class:"fcom_space_page_comments_title"};function K(e,s,Q,j,t,o){const y=k,C=u("not-found-result"),m=u("router-link"),g=u("feed-md-content"),h=b,w=u("CommentBox");return a(),n("div",{class:E([o.wrapperClasses,"fcom_space_page_wrap"])},[t.loading?(a(),n("div",N,[r(y,{class:"white_loaded",rows:10,animated:!0})])):t.notFound?(a(),l(C,{key:1,title:e.$t("Page Not Found"),message:e.$t("The page you are looking for does not exist or has been removed."),actions:o.notFoundActions},null,8,["title","message","actions"])):t.page?(a(),n("article",x,[o.canManage&&t.page.status!=="published"?(a(),n("div",D,[_("span",O,i(e.$t("Draft Preview")),1),_("span",null,i(e.$t("Only space admins and moderators can see this page. Publish it from the editor to make it visible.")),1),r(m,{class:"fcom_space_page_draft_edit",to:o.editRoute},{default:p(()=>[d(i(e.$t("Edit Page")),1)]),_:1},8,["to"])])):c("",!0),o.showFeaturedImage?(a(),n("img",{key:1,class:"fcom_space_page_cover",src:t.page.featured_image,alt:t.page.title},null,8,V)):c("",!0),o.showTitle?(a(),n("header",R,[_("h1",{class:"fcom_space_page_title",textContent:i(t.page.title)},null,8,U)])):c("",!0),t.page.can_view?(a(),l(g,{key:4,content:t.page.content,class_name:"fcom_space_page_content"},null,8,["content"])):(a(),l(g,{key:3,content:t.page.access_message,class_name:"fcom_locked_container"},null,8,["content"])),o.canManage?(a(),n("footer",Y,[t.page.status!=="published"?(a(),l(h,{key:0,type:"warning",size:"small"},{default:p(()=>[d(i(e.$t("Draft")),1)]),_:1})):c("",!0),t.page.privacy==="members_only"?(a(),l(h,{key:1,type:"info",size:"small"},{default:p(()=>[d(i(e.$t("Members Only")),1)]),_:1})):c("",!0),r(m,{class:"el-button el-button--small fcom_space_page_edit",to:o.editRoute},{default:p(()=>[d(i(e.$t("Edit Page")),1)]),_:1},8,["to"])])):c("",!0)])):c("",!0),o.commentsEnabled?(a(),n("section",q,[r(w,{feed:t.page,showAll:!0,checkPermission:!0},{before_comment_box:p(()=>[_("h3",z,i(e.$t("Discussion")),1)]),_:1},8,["feed"])])):c("",!0)],2)}const ae=I(M,[["render",K]]);export{ae as default};
2