PluginProbe
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses / 2.11.0
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses v2.11.0
2.11.0 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 All 78 releases
fluent-community / assets / ManageSpaceMenu.js

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

2 lines 6.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import{N as P,d as k,r as w}from"./element-plus.js?ver=2.11.0";import"./dayjs.js?ver=2.11.0";import{u as M}from"./app.js?ver=2.11.0";import{M as I}from"./_MenuGroupSettings.js?ver=2.11.0";import{E as v,I as m,ae as L,D as n,S as p,K as s,F as o,Q as a,R as h,ab as g,O as _}from"./vue.js?ver=2.11.0";import{_ as O}from"./emoji-picker.js?ver=2.11.0";import"./fcom-utils.js?ver=2.11.0";import"./vendor.js?ver=2.11.0";import"./vue-router.js?ver=2.11.0";import"./pinia.js?ver=2.11.0";import"./milkdown.js?ver=2.11.0";const j={name:"ManageSpaceMenu",components:{MenuGroupSettings:I},props:["spaceProfile"],setup(){return{spaceStore:M()}},data(){return{loading:!0,savingPrimary:!1,savingSecondary:!1,menuItems:[],pageOptions:[],saveQueue:Promise.resolve()}},computed:{secondaryLinks(){return this.spaceProfile.settings.links},sourceLabels(){return{custom:this.$t("Custom"),space_page:this.$t("Page"),pro_module:this.$t("Module"),system:this.$t("Built-in")}},sectionTitles(){return{primary:this.$t("Primary Menu"),secondary:this.$t("Secondary Links")}},placementOptions(){return[{label:this.sectionTitles.primary,value:"primary"},{label:this.sectionTitles.secondary,value:"secondary"}]},enabledPrimary(){return this.menuItems.filter(e=>e.enabled!=="no")},previewSecondary(){return this.secondaryLinks.filter(e=>e.enabled!=="no")}},methods:{getMenuItems(){this.loading=!0,this.$get("spaces/"+this.spaceProfile.slug+"/primary-menu").then(e=>{this.menuItems=e.menu_items}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})},getPageOptions(){var e;!this.has_pro||!((e=this.spaceProfile.permissions)!=null&&e.can_manage_pages)||this.$get("spaces/"+this.spaceProfile.slug+"/pages").then(r=>{this.pageOptions=(r.pages||[]).map(c=>({label:c.title,value:c.slug}))}).catch(()=>{})},queueSave(e){const r=this.saveQueue.then(()=>e());return this.saveQueue=r,r},savePrimaryMenu(){return this.savingPrimary=!0,this.$post("spaces/"+this.spaceProfile.slug+"/primary-menu",{menu_items:this.menuItems}).then(e=>(this.menuItems=e.menu_items,this.$notify.success(e.message),this.refreshSpace(),!0)).catch(e=>(this.$handleError(e),!1)).finally(()=>{this.savingPrimary=!1})},saveSecondaryLinks(){return this.savingSecondary=!0,this.$post("spaces/"+this.spaceProfile.slug+"/links",{links:this.secondaryLinks,space_id:this.spaceProfile.id}).then(e=>(this.spaceProfile.settings.links=e.links,this.$notify.success(e.message),this.refreshSpace(),!0)).catch(e=>(this.$handleError(e),!1)).finally(()=>{this.savingSecondary=!1})},saveAll(){return this.queueSave(this.savePrimaryMenu).then(e=>e&&this.queueSave(this.saveSecondaryLinks))},moveItem({item:e,to:r}){const c=r==="primary"?this.menuItems:this.secondaryLinks,u={...e,placement:r};r==="primary"&&(u.is_custom="yes"),c.push(u),this.saveAll().then(l=>{l||(this.getMenuItems(),this.refreshSpace())})},refreshSpace(){const e=this.spaceProfile.slug;this.spaceStore.invalidateSpace(e),this.spaceStore.fetchSpace(e,!0).catch(()=>{})}},mounted(){this.spaceProfile.settings.links||(this.spaceProfile.settings.links=[]),this.getMenuItems(),this.getPageOptions()}},E={class:"fcom_space_menu_manager"},T={class:"fcom_menu_preview"},B={class:"fcom_menu_preview_head"},q={class:"fcom_menu_preview_label"},N={class:"fcom_menu_preview_hint"},C={class:"fcom_menu_preview_body"},Q={class:"fcom_menu_preview_row fcom_menu_preview_primary"},V={class:"fcom_menu_preview_brand"},A=["src"],D={key:1,class:"fcom_emoji"},F={key:2,class:"fcom_no_avatar"},G={class:"fcom_menu_preview_brand_title"},K={class:"fcom_menu_preview_items"},R=["src"],z={key:1,class:"fcom_emoji"},H={key:0,class:"fcom_menu_preview_empty"},J={class:"fcom_menu_preview_row fcom_menu_preview_secondary"},U={class:"fcom_menu_preview_items"},W=["src"],X={key:1,class:"fcom_emoji"},Y={key:0,class:"fcom_menu_preview_empty"},Z={class:"fcom_menu_columns"},$={class:"fcom_card_sections"},x={class:"fcom_menu_section_hint"},ee={class:"fcom_section_footer_note"},se={class:"fcom_card_sections"},te={class:"fcom_menu_section_hint"},ne={class:"fcom_section_footer_note"};function ae(e,r,c,u,l,t){const y=k,d=L("menu-group-settings"),b=w,S=P;return n(),v(S,{class:"fcom_full_editor_main lockscreen_editor"},{default:m(()=>[p(b,null,{default:m(()=>{var f;return[s("div",E,[l.loading?(n(),v(y,{key:0,rows:8,animated:""})):(n(),o(h,{key:1},[s("div",T,[s("div",B,[s("span",q,a(e.$t("Preview")),1),s("span",N,a(e.$t("Both rows, as members will see them")),1)]),s("div",C,[s("div",Q,[s("span",V,[c.spaceProfile.logo?(n(),o("img",{key:0,src:c.spaceProfile.logo,alt:""},null,8,A)):(f=c.spaceProfile.settings)!=null&&f.emoji?(n(),o("span",D,a(c.spaceProfile.settings.emoji),1)):(n(),o("span",F)),s("span",G,a(c.spaceProfile.title),1)]),s("div",K,[(n(!0),o(h,null,g(t.enabledPrimary,i=>(n(),o("span",{key:i.slug,class:"fcom_menu_preview_tab"},[i.icon_image?(n(),o("img",{key:0,src:i.icon_image,alt:""},null,8,R)):i.emoji?(n(),o("span",z,a(i.emoji),1)):_("",!0),s("span",null,a(i.title),1)]))),128)),t.enabledPrimary.length?_("",!0):(n(),o("span",H,a(e.$t("No menu item is visible")),1))])]),s("div",J,[s("div",U,[(n(!0),o(h,null,g(t.previewSecondary,i=>(n(),o("span",{key:i.slug,class:"fcom_menu_preview_tab"},[i.icon_image?(n(),o("img",{key:0,src:i.icon_image,alt:""},null,8,W)):i.emoji?(n(),o("span",X,a(i.emoji),1)):_("",!0),s("span",null,a(i.title),1)]))),128)),t.previewSecondary.length?_("",!0):(n(),o("span",Y,a(e.$t("Sub bar hidden — every secondary link is off")),1))])])])]),s("div",Z,[s("div",$,[p(d,{custom_svg:!0,use_icon_selector:!0,has_svg:!1,menu_rows:!0,min_enabled:1,saving:l.savingPrimary,title:t.sectionTitles.primary,menuItems:l.menuItems,page_options:l.pageOptions,source_labels:t.sourceLabels,placement:"primary",placement_options:t.placementOptions,onMove:t.moveItem,onSave:r[0]||(r[0]=i=>t.queueSave(t.savePrimaryMenu))},{title:m(()=>[s("h4",null,a(t.sectionTitles.primary),1),s("p",x,a(e.$t("The tab bar at the top of the space.")),1)]),_:1},8,["saving","title","menuItems","page_options","source_labels","placement_options","onMove"]),s("div",ee,[s("p",null,a(e.$t("Pages appear here once published. Order and label are set here, not by the page order.")),1)])]),s("div",se,[p(d,{custom_svg:!0,use_icon_selector:!0,has_svg:!1,menu_rows:!0,saving:l.savingSecondary,title:t.sectionTitles.secondary,menuItems:t.secondaryLinks,source_labels:t.sourceLabels,placement:"secondary",placement_options:t.placementOptions,onMove:t.moveItem,onSave:r[1]||(r[1]=i=>t.queueSave(t.saveSecondaryLinks))},{title:m(()=>[s("h4",null,a(t.sectionTitles.secondary),1),s("p",te,a(e.$t("The sub bar beneath the space header.")),1)]),_:1},8,["saving","title","menuItems","source_labels","placement_options","onMove"]),s("div",ne,[s("p",null,a(e.$t("Edit a link's Placement to move it to the space sub header.")),1)])])])],64))])]}),_:1})]),_:1})}const fe=O(j,[["render",ae]]);export{fe as default};
2