PageSourceSearch

https://guidy.ai/_nuxt/Doa2GCHl.js

js guidy.ai collected 2026-10-05 12:01:59 UTC 5,591 bytes, 1 lines download raw bytes

1import{w as x,h as u,i as h,a6 as P,j as d,B as w,z as t,g,N as C,q as T,C as y,M as k,G as S,O as A,F as B,f as E,e as L,E as I,H as $,K as D,L as V}from"./5kN0Q-Sq.js";import{u as R,_ as U}from"./trXDJKtW.js";import{f as j,a as M,d as O}from"./B_VugDQE.js";import{u as F}from"./BQQHEPGY.js";import"./DR_nszJX.js";const G={class:"draft-banner-text"},z={key:0},Y={key:1},q={class:"draft-banner-actions"},H=x({__name:"AdminArticleDraftBanner",props:{draft:{},stale:{type:Boolean}},emits:["restore","discard"],setup(m,{emit:s}){const e=m,o=s,v=g(()=>{const l=new Date(e.draft.savedAt);if(Number.isNaN(l.getTime()))return"earlier";const a=Math.round((Date.now()-l.getTime())/6e4);if(a<1)return"just now";if(a<60)return`${a} minute${a===1?"":"s"} ago`;const n=Math.round(a/60);return n<24?`${n} hour${n===1?"":"s"} ago`:l.toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"})});return(l,a)=>(u(),h("div",{class:P(["draft-banner",{"is-stale":m.stale}])},[d("div",G,[d("strong",null,"Unpublished changes from "+w(t(v)),1),m.stale?(u(),h("span",z," The live article has changed since these edits were made, so restoring them would overwrite that newer version. ")):(u(),h("span",Y," Saved in this browser and never published. Restore them to keep editing, or discard them to go back to the live article. "))]),d("div",q,[d("button",{type:"button",class:"btn-primary btn-sm",onClick:a[0]||(a[0]=n=>o("restore"))},"Restore"),d("button",{type:"button",class:"btn-clear btn-sm",onClick:a[1]||(a[1]=n=>o("discard"))},"Discard")])],2))}}),K=Object.assign(C(H,[["__scopeId","data-v-5ce88201"]]),{__name:"AdminArticleDraftBanner"}),J=x({__name:"AdminArticleEditorPanel",props:{article:{}},setup(m){const s=m,e=R(s.article),{confirm:o}=T();async function v(){const c=j(e.form.value.publishedAt),r=c!==null&&new Date(c).getTime()>Date.now(),f=M(e.form.value.publishedAt);await o(r?{title:"Schedule this article?",text:`It stays hidden until ${f}, then appears at /blog/${e.form.value.slug}/.`,confirmText:"Schedule"}:{title:"Publish this article?",text:`It becomes visible to everyone at /blog/${e.form.value.slug}/.`,confirmText:"Publish"})&&await e.setStatus(A.Published)}async function l(){await o({title:"Unpublish this article?",text:"It stops being reachable at its public URL. Nothing is deleted, and you can publish it again later.",confirmText:"Unpublish",confirmColor:"primary red"})&&await e.setStatus(A.Draft)}async function a(){const c=e.changedFields.value;await o({title:"Publish your changes?",text:`This updates the live article readers see. Changing: ${c.join(", ")||"nothing"}.`,confirmText:"Publish changes"})&&await e.commit()}async function n(){await o({title:"Overwrite the newer version?",text:"Someone else changed this article after you started editing. Publishing yours replaces their version.",confirmText:"Publish mine",confirmColor:"primary red"})&&await e.commit({force:!0})}async function p(){await o({title:"Discard your changes?",text:"Your unpublished edits are thrown away. The live article is unaffected.",confirmText:"Discard",confirmColor:"primary red"})&&e.discardDraft()}async function _(){await e.saveNow()&&window.open(`/admin/blog/preview/${s.article.id}/`,"_blank")}function i(){window.location.reload()}return(c,r)=>{const f=K,b=U;return u(),h("div",null,[t(e).pendingDraft.value?(u(),y(f,{key:0,draft:t(e).pendingDraft.value,stale:t(e).draftIsStale.value,onRestore:t(e).restoreDraft,onDiscard:p},null,8,["draft","stale","onRestore"])):k("",!0),S(b,{modelValue:t(e).form.value,"onUpdate:modelValue":r[0]||(r[0]=N=>t(e).form.value=N),"save-state":t(e).saveState.value,"save-error":t(e).saveError.value,"field-errors":t(e).fieldErrors.value,"article-id":t(e).articleId.value,"is-live":t(e).isLive.value,"unpublished-changes":t(e).unpublishedChanges.value,committing:t(e).committing.value,"commit-error":t(e).commitError.value,conflict:t(e).conflict.value,onChange:t(e).onChange,onSave:t(e).saveNow,onCommit:a,onCommitAnyway:n,onPublish:v,onUnpublish:l,onDiscard:p,onPreview:_,onReload:i},null,8,["modelValue","save-state","save-error","field-errors","article-id","is-live","unpublished-changes","committing","commit-error","conflict","onChange","onSave"])])}}}),Q=Object.assign(J,{__name:"AdminArticleEditorPanel"}
1),W={class:"admin-page container"},X={class:"admin-header"},Z={class:"admin-title"},ee={key:0,class:"error-banner"},te=x({__name:"[id]",async setup(m){let s,e;B({title:"Edit article — Guidy admin",robots:"noindex, nofollow"});const o=E(),{$sdk:v}=L(),l=g(()=>Number(o.params.id)),{data:a,status:n,error:p}=([s,e]=I(()=>F(()=>`admin-blog-article-${l.value}`,()=>v.blog.getAdminById(l.value))),s=await s,e(),s),_=g(()=>n.value===403?"You don't have access to the blog admin.":n.value===404?"That article no longer exists.":n.value!==null?`Could not load the article (error ${n.value}).`:p.value?"Could not load the article. Please try again.":null),i=g(()=>a.value?.article??null);return(c,r)=>{const f=V,b=Q;return u(),h("div",W,[d("header",X,[d("div",null,[S(f,{to:"/admin/blog/",class:"btn-clear back-link"},{default:$(()=>[...r[0]||(r[0]=[D("← Back to articles",-1)])]),_:1}),d("h1",Z,w(t(i)?.title||"Edit article"),1)]),t(i)&&t(O)(t(i).status,t(i).publishedAt)==="published"?(u(),y(f,{key:0,to:`/blog/${t(i).slug}/`,target:"_blank",class:"btn-outline view-link"},{default:$(()=>[...r[1]||(r[1]=[D(" View live ↗ ",-1)])]),_:1},8,["to"])):k("",!0)]),t(_)?(u(),h("p",ee,w(t(_)),1)):t(i)?(u(),y(b,{key:t(i).id,article:t(i)},null,8,["article"])):k("",!0)])}}}),se=C(te,[["__scopeId","data-v-5a03aae5"]]);export{se as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.