| 1 |
"use strict";(self.webpackChunkfl_assistant=self.webpackChunkfl_assistant||[]).push([[870],{4046:(e,t,a)=>{a.r(t),a.d(t,{default:()=>p});var l=a(3804),n=a.n(l),o=a(8194),s=a(847),r=a(6911),i=a(3031),u=a(6404),d=a(4352);const c=({type:e="post"})=>{const t="fl-content",{query:a,listStyle:l}=(0,r.useAppState)(t),{setQuery:s,setListStyle:u}=(0,r.getAppActions)(t),c=d.W.query,m=()=>{const t={title:(0,o.__)("Title"),author:(0,o.__)("Author"),ID:(0,o.__)("Post ID"),date:(0,o.__)("Date Created"),modified:(0,o.__)("Date Modified")},r={any:(0,o.__)("Any"),publish:(0,o.__)("Published"),draft:(0,o.__)("Drafted"),pending:(0,o.__)("Pending"),future:(0,o.__)("Scheduled"),private:(0,o.__)("Private"),trash:(0,o.__)("Trashed")},m={ASC:(0,o.__)("Ascending"),DESC:(0,o.__)("Descending")},p={"":(0,o.__)("List"),thumb:(0,o.__)("Post Thumbnails")};return n().createElement(n().Fragment,null,n().createElement(i.Filter,null,n().createElement(i.Filter.RadioGroupItem,{title:(0,o.__)("Status"),items:r,value:a.post_status,defaultValue:c.post_status,onChange:e=>s({...a,post_status:e})}),n().createElement(i.Filter.LabelsItem,{value:a.label,defaultValue:c.label,onChange:e=>s({...a,label:e})}),n().createElement(i.Filter.RadioGroupItem,{title:(0,o.__)("Display As"),items:p,value:l,defaultValue:d.W.listStyle,onChange:e=>u(e)}),n().createElement(i.Filter.RadioGroupItem,{title:(0,o.__)("Sort By"),items:t,value:a.orderby,defaultValue:c.orderby,onChange:e=>s({...a,orderby:e})}),n().createElement(i.Filter.RadioGroupItem,{title:(0,o.__)("Order"),items:m,value:a.order,defaultValue:d.W.query.order,onChange:e=>s({...a,order:e})}),n().createElement(i.Filter.Button,{onClick:()=>s(c)},(0,o.__)("Reset Filter"))),n().createElement(i.List.InlineCreate,{postType:e,onPostCreated:()=>s({...d.W.query,order:"DESC",orderby:"ID",key:(new Date).getTime()})}))};return n().createElement(i.Layout.Box,{outset:!0,padY:!1,style:{maxHeight:"100%",minHeight:0,flex:"1 1 auto"}},n().createElement(i.List.Posts,{query:{...a,post_type:e},listStyle:l,getItemProps:(e,a)=>e.id?{...a,to:{pathname:`/${t}/post/${e.id}`,state:{item:e}}}:a,before:n().createElement(m,null)}))};(0,u.addFilter)("fl-asst.list-item-actions","fl-assistant",((e,{item:t,listType:a})=>{if("post"===a){const a=e.findIndex((e=>"edit-post"===e.handle));if(a){const l=e[a];delete l.href,l.isShowing=!0,l.title=(0,o.__)("Edit Details"),l.to={pathname:`/fl-content/post/${t.id}`,state:{item:t}}}}return e}));var m=a(7309);const p=({baseURL:e})=>n().createElement(s.Switch,null,n().createElement(s.Route,{exact:!0,path:e},n().createElement(s.Redirect,{to:{pathname:`${e}/tab/post`}})),n().createElement(s.Route,{path:`${e}/tab/:tab`,component:_}),n().createElement(s.Route,{path:`${e}/post/new`,component:i.Page.CreatePost}),n().createElement(s.Route,{path:`${e}/post/:id`,component:i.Page.Post})),_=()=>{const{contentTypes:e}=(0,r.getSystemConfig)(),t=()=>n().createElement(i.Layout.Tabs,{tabs:a,shouldHandleOverflow:!0}),a=(()=>{let t=[];return Object.keys(e).map((a=>{const l=e[a];t.push({handle:a,path:"/fl-content/tab/"+a,label:l.labels.plural,component:()=>n().createElement(c,{type:a})})})),t})();return n().createElement(i.Page,{id:"fl-asst-content-list-page",title:(0,o.__)("Content"),icon:n().createElement(m.Z,{context:"sidebar"}),padY:!1,header:n().createElement(t,null),topContentStyle:{border:"none"},shouldScroll:!1,shouldShowBackButton:!1,showAsRoot:!0,onLoad:()=>{const e=document.querySelector(".fl-asst-filter .fluid-button");e&&e.focus()}},n().createElement(i.Layout.CurrentTab,{tabs:a}))}}}]); |