PluginProbe
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses / 2.10.01
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses v2.10.01
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 / _MenuGroupSettings.js

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

2 lines 10.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import{a as U,E as j,q as A,g as F,v as O,h as T,I as R,n as x,b as G,x as P}from"./element-plus.js?ver=2.10.01";import"./dayjs.js?ver=2.10.01";import{S as z,c as H,D as J,A as q}from"./app.js?ver=2.10.01";import{F as W}from"./FluentDnD.js?ver=2.10.01";import{ae as h,D as a,F as d,K as m,B as Y,Q as r,S as n,I as o,P as g,O as u,R as k,E as c,a7 as K,ak as Q,ab as X}from"./vue.js?ver=2.10.01";import{_ as Z}from"./emoji-picker.js?ver=2.10.01";const $={name:"MenuGroupSettings",components:{SpaceCourseSelector:z,FluentDnD:W,LogoEmojiSelector:H,Drawer:J,ActionPopover:q},data(){return{editingItem:null,originalItem:null,openEditLinkDrawer:!1,isDragging:!1,isSpaceDragging:!1,draggingIndex:null,draggedSpaceIndex:null,mode:null,urlErrors:[],validationAttempt:0}},computed:{isDirty(){return!this.editingItem||!this.originalItem?!1:JSON.stringify(this.editingItem)!==JSON.stringify(this.originalItem)}},emits:["save"],props:{menuItems:{type:Array,required:!0},saving:{type:Boolean,default:!1},title:{type:String,required:!0},has_svg:{type:Boolean,default:!0},use_icon_selector:{type:Boolean,default:!1},has_enable_disable:{type:Boolean,default:!0},custom_svg:{type:Boolean,default:!1}},methods:{linkRowActions(e,i){const l=[{label:this.$t("Edit"),action:()=>this.initEditLink(e,"edit")}];return e.is_system!="yes"&&l.push({label:this.$t("Delete"),type:"danger",action:()=>this.removeLink(i)}),l},validateLinkForm(){return this.urlErrors=[],this.validationAttempt++,(!this.editingItem.title||!this.editingItem.title.trim())&&this.urlErrors.push(this.$t("Link title cannot be empty.")),this.editingItem.is_system!=="yes"&&(!this.editingItem.permalink||!this.editingItem.permalink.trim())&&this.urlErrors.push(this.$t("URL or path cannot be empty.")),this.urlErrors.length===0},initEditLink(e,i="create"){e.privacy||(e.privacy="public",e.membership_ids=e.membership_ids||[]),this.mode=i,this.urlErrors=[],this.originalItem=e,this.editingItem=JSON.parse(JSON.stringify(e||{})),this.$nextTick(()=>{this.openEditLinkDrawer=!0})},removeLink(e){this.$confirm(this.$t("Are you sure you want to remove this link?"),this.$t("Warning"),{confirmButtonText:this.$t("Yes"),cancelButtonText:this.$t("Cancel"),confirmButtonClass:"fcom_primary_button",cancelButtonClass:"fcom_secondary_button",type:"warning"}).then(()=>{this.menuItems.splice(e,1),this.saveMenuItems({customSuccessMessage:this.$t("Link deleted successfully.")})})},createOrUpdateLink(){if(!this.saving&&this.validateLinkForm()){if(!this.editingItem.slug)this.editingItem.slug="fcom_custom_"+this.editingItem.title.toLowerCase().replace(/[^a-z0-9]/g,"_"),this.menuItems.push(this.editingItem);else{const e=this.menuItems.findIndex(i=>i.slug===this.editingItem.slug);e!==-1?Object.assign(this.menuItems[e],this.editingItem):this.menuItems.push(this.editingItem)}this.openEditLinkDrawer=!1,this.editingItem=null,this.saveMenuItems()}},saveMenuItems({customSuccessMessage:e=null}={}){this.$emit("save",{customSuccessMessage:e})},drop({index:e}){this.draggingIndex=null,this.saveMenuItems()},beforeCloseDrawer(e){if(this.saving){this.$notify.info(this.$t("Please wait to complete."));return}this.editingItem=null,this.originalItem=null,this.mode=null,e()}}},ee={key:0,class:"fcom_section_primary fcom_menu_group_settings"},te={class:"fcom_section_primary_item"},ie={class:"fcom_section_primary_item_title"},se={class:"fcom_heading_item"},le={class:"fcom_section_item_actions"},ne={class:"fcom_section_items menu-items-container"},oe={key:0,style:{padding:"1rem"}},ae={class:"fcom_section_item_title"},me={class:"fcom_heading_item"},re={key:0,class:"community_avatar"},de=["src"],ue={key:1,class:"fcom_emoji"},ce={key:2,class:"fcom_shape"},_e=["innerHTML"],ge={class:"fcom_section_item_actions"},pe={key:0},he={key:1},fe={key:0},be={class:"fcom_help_text"},ye={class:"fcom_help_text"};function ve(e,i,l,Ie,s,p){const E=U,b=j,y=A,w=h("action-popover"),V=h("FluentDnD"),L=h("logo-emoji-selector"),v=F,_=O,S=T,f=R,D=x,C=h("SpaceCourseSelector"),M=G,B=P,N=h("drawer");return a(),d(k,null,[l.menuItems?(a(),d("div",ee,[m("div",te,[m("div",ie,[m("div",se,[Y(e.$slots,"title",{},()=>[m("h4",null,r(l.title),1)])])]),m("div",le,[n(E,{class:"fcom_primary_button",onClick:i[0]||(i[0]=t=>p.initEditLink({enabled:"yes",privacy:"public",membership_ids:[],new_tab:"yes"}))},{default:o(()=>[g(r(e.$t("Add New Link")),1)]),_:1})])]),m("div",ne,[l.menuItems.length?u("",!0):(a(),d("div",oe,[m("p",null,r(e.$t("No link has been added for this section")),1)])),n(V,{items:l.menuItems,"row-key":"slug",onDrop:p.drop,"item-class":"fcom_section_item"+(l.saving?"":" fcom_cursor_move"),"item-style":e.isMobile?"padding: 12px":"padding: 15px 15px 15px 35px"},{item:o(({data:t,index:I})=>[m("div",ae,[m("p",me,[l.use_icon_selector?(a(),d(k,{key:0},[i[12]||(i[12]=m("div",{class:"fcom_drag_handle"}," ⋮⋮ ",-1)),t.icon_image?(a(),d("div",re,[n(b,null,{default:o(()=>[m("img",{alt:"",style:{"max-width":"16px","max-height":"16px"},src:t.icon_image},null,8,de)]),_:2},1024)])):t.emoji?(a(),d("span",ue,r(t.emoji),1)):t.shape_svg?(a(),d("span",ce,[n(b,{innerHTML:t.shape_svg},null,8,["innerHTML"])])):u("",!0)],64)):t.icon_svg?(a(),c(b,{key:1},{default:o(()=>[m("span",{innerHTML:t.icon_svg},null,8,_e)]),_:2},1024)):u("",!0),m("span",null,r(t.title),1),t.is_unavailable=="yes"?(a(),c(y,{key:2,type:"danger"},{default:o(()=>[g(r(e.$t("unavailable")),1)]),_:1})):t.enabled=="yes"?(a(),c(y,{key:3,type:"success"},{default:o(()=>[g(r(e.$t("enabled")),1)]),_:1})):(a(),c(y,{key:4,type:"info"},{default:o(()=>[g(r(e.$t("disabled")),1)]),_:1}))])]),m("div",ge,[n(w,{items:p.linkRowActions(t,I),placement:"bottom-end"},null,8,["items"])])]),_:1},8,["items","onDrop","item-class","item-style"])])])):u("",!0),n(N,{modelValue:s.openEditLinkDrawer,"onUpdate:modelValue":i[11]||(i[11]=t=>s.openEditLinkDrawer=t),size:e.drawerWidth,"before-close":p.beforeCloseDrawer,id:"fluent_comminity_body","close-on-click-modal":!0,"has-close-confirmation":p.isDirty&&!l.saving,"close-confirmation-message":e.$t("Closing will discard your changes. Are you sure?")},{header:o(()=>[s.mode==="edit"?(a(),d("h4",pe,r(e.$t("Edit Link")),1)):(a(),d("h4",he,r(e.$t("Add Custom Link")),1))]),default:o(()=>[s.editingItem?(a(),d("div",fe,[n(B,{onSubmit:i[10]||(i[10]=K(t=>e.doNothing(),["prevent"])),"label-position":"top",disabled:l.saving},{default:o(()=>[n(_,{label:e.$t("Name of the Link")},{default:o(()=>[n(v,{disabled:l.saving,placeholder:e.$t("Public Name of the item"),modelValue:s.editingItem.title,"onUpdate:modelValue":i[2]||(i[2]=t=>s.editingItem.title=t)},Q({_:2},[l.use_icon_selector?{name:"prepend",fn:o(()=>[n(L,{custom_svg:l.custom_svg,fallback_mark:"<span style='font-size: 20px;'>☺</span>",onUpdate:i[1]||(i[1]=t=>{l.saving||(s.editingItem.emoji=t.emoji,s.editingItem.icon_image=t.logo,s.editingItem.shape_svg=t.shape_svg)}),config:{logo:s.editingItem.icon_image,emoji:s.editingItem.emoji||"",shape_svg:s.editingItem.shape_svg||""}},null,8,["custom_svg","config"])]),key:"0"}:void 0]),1032,["disabled","placeholder","modelValue"])]),_:1},8,["label"]),n(_,{label:e.$t("URL")},{default:o(()=>[n(v,{disabled:l.saving||s.editingItem.is_system=="yes",type:"text",placeholder:e.$t("URL or path (e.g. https://example.com or /members)"),modelValue:s.editingItem.permalink,"onUpdate:modelValue":i[3]||(i[3]=t=>s.editingItem.permalink=t)},null,8,["disabled","placeholder","modelValue"]),m("div",be,[m("p",null,r(e.$t("For internal links, start with / (e.g. /members).")),1)])]),_:1},8,["label"]),l.has_svg?(a(),c(_,{key:0,label:e.$t("SVG Code for Icon (Simplified SVG Code) / Emoji")},{default:o(()=>[n(v,{disabled:l.saving,placeholder:e.$t("SVG Code. No url please / You can use emoji"),type:"textarea",rows:3,modelValue:s.editingItem.icon_svg,"onUpdate:modelValue":i[4]||(i[4]=t=>s.editingItem.icon_svg=t)},null,8,["disabled","placeholder","modelValue"])]),_:1},8,["label"])):u("",!0),l.has_enable_disable?(a(),c(_,{key:1,style:{"margin-bottom":"5px"}},{default:o(()=>[n(S,{disabled:l.saving,"true-value":"yes","false-value":"no",modelValue:s.editingItem.enabled,"onUpdate:modelValue":i[5]||(i[5]=t=>s.editingItem.enabled=t),class:"fcom_checkbox"},{default:o(()=>[g(r(e.$t("Enable this link")),1)]),_:1},8,["disabled","modelValue"])]),_:1})):u("",!0),s.editingItem.is_system!="yes"?(a(),c(_,{key:2},{default:o(()=>[n(S,{disabled:l.saving,"true-value":"yes","false-value":"no",modelValue:s.editingItem.new_tab,"onUpdate:modelValue":i[6]||(i[6]=t=>s.editingItem.new_tab=t),class:"fcom_checkbox"},{default:o(()=>[g(r(e.$t("Open this link in a new tab.")),1)]),_:1},8,["disabled","modelValue"])]),_:1})):u("",!0),n(_,{label:e.$t("Visibility")},{default:o(()=>[n(D,{disabled:l.saving,modelValue:s.editingItem.privacy,"onUpdate:modelValue":i[7]||(i[7]=t=>s.editingItem.privacy=t)},{default:o(()=>[n(f,{label:e.$t("Everyone"),value:"public"},null,8,["label"]),n(f,{label:e.$t("Logged-in only"),value:"logged_in"},null,8,["label"]),n(f,{label:e.$t("Public only"),value:"logged_out_only"},null,8,["label"]),n(f,{label:e.$t("By Space/Course Memberships"),value:"members_only"},null,8,["label"])]),_:1},8,["disabled","modelValue"]),m("div",ye,r(e.$t("Select who can see this link.")),1)]),_:1},8,["label"]),s.editingItem.privacy=="members_only"?(a(),c(_,{key:3,label:e.$t("Select Space/Course Memberships")},{default:o(()=>[n(C,{disabled:l.saving,modelValue:s.editingItem.membership_ids,"onUpdate:modelValue":i[8]||(i[8]=t=>s.editingItem.membership_ids=t),placeholder_text:e.$t("Select Memberships"),is_multiple:!0},null,8,["disabled","modelValue","placeholder_text"])]),_:1},8,["label"])):u("",!0),s.urlErrors.length?(a(),c(M,{key:s.validationAttempt,type:"warning",closable:!0,"show-icon":"",style:{margin:"8px 0"}},{title:o(()=>[m("div",null,[m("ul",null,[(a(!0),d(k,null,X(s.urlErrors,(t,I)=>(a(),d("li",{style:{"margin-bottom":"0"},key:I},r(t),1))),128))])])]),_:1})):u("",!0),n(_,null,{default:o(()=>[n(E,{disabled:l.saving,class:"fcom_primary_button",onClick:i[9]||(i[9]=t=>p.createOrUpdateLink())},{default:o(()=>[g(r(l.saving?e.$t("Saving..."):e.$t("Save")),1)]),_:1},8,["disabled"])]),_:1})]),_:1},8,["disabled"])])):u("",!0)]),_:1},8,["modelValue","size","before-close","has-close-confirmation","close-confirmation-message"])],64)}const De=Z($,[["render",ve]]);export{De as M};
2