| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- <script type="text/javascript" src="/scripts/post_wizard.js"></script>
- <div id="backoffice">
- <p class="title">
- Existing Post Types:
- </p>
- A "post type" is just a template living in <code>templates/html/components/forms/</code>.
- Every post picks exactly one of them — it's what the <em>Content Template</em> dropdown
- selects when you edit a Series.
- <hr />
- <ul id="existing-post-types">
- : for $forms -> $form {
- <li><: $form :></li>
- : }
- </ul>
- <hr />
- <p class="title">
- Create a new Post Type:
- </p>
- This writes a new template into the forms directory currently in use
- (<code><: $forms_dir :></code>) along with a matching <code>.json</code> sidecar describing
- any custom fields, so that the data model knows to keep them when a post is saved.
- <hr />
- <form class="Submissions" id="postTypeWizard" method="post" action="/admin/wyzzerdd/save">
- Type Name * — letters, numbers, dash and underscore only<br />
- <input required class="cooltext" type="text" name="name" pattern="[A-Za-z0-9_-]+" placeholder="recipe" value="<: $name :>" />
- <p class="title">Canned Fields</p>
- Most post types reuse the same handful of blocks. Tick whichever ones this type needs.
- The title input, the visibility selector (visibility.tx) and the ACL selector (acls.tx)
- are always included — every post has all three, and a type whose editor cannot set
- them produces posts nobody can title, find or restrict.
- <br />
- <label for="wiz-wrapper">Wrap output in the standard post <div><input id="wiz-wrapper" class="coolcb" type="checkbox" name="wrapper" value="1" <: $checked.wrapper :> /></label><br />
- <label for="wiz-post_title">Post title & permalink (post_title.tx)<input id="wiz-post_title" class="coolcb" type="checkbox" name="inc_post_title" value="1" <: $checked.inc_post_title :> /></label><br />
- <label for="wiz-post_tags">Post tag list (post_tags.tx)<input id="wiz-post_tags" class="coolcb" type="checkbox" name="inc_post_tags" value="1" <: $checked.inc_post_tags :> /></label><br />
- <label for="wiz-preview">Preview image upload (preview.tx)<input id="wiz-preview" class="coolcb" type="checkbox" name="inc_preview" value="1" <: $checked.inc_preview :> /></label><br />
- <label for="wiz-tags">Tag editor (tags.tx)<input id="wiz-tags" class="coolcb" type="checkbox" name="inc_tags" value="1" <: $checked.inc_tags :> /></label><br />
- <label for="wiz-aliases">Alias URL editor (aliases.tx)<input id="wiz-aliases" class="coolcb" type="checkbox" name="inc_aliases" value="1" <: $checked.inc_aliases :> /></label><br />
- <label for="wiz-attachments">Attachment uploader (attachments.tx)<input id="wiz-attachments" class="coolcb" type="checkbox" name="inc_attachments" value="1" <: $checked.inc_attachments :> /></label><br />
- <br />
- Title placeholder text<br />
- <input class="cooltext" type="text" name="title_placeholder" placeholder="Iowa Man Destroys Moon" value="<: $title_placeholder :>" />
- <br />
- Content Body — this is always the last thing in the editor, and is what carries the post body itself.<br />
- <select class="cooltext" name="body_form">
- <option value="form_common.tx" <: $body_form == 'form_multi.tx' ? '' : 'selected' :> >Single page (form_common.tx)</option>
- <option value="form_multi.tx" <: $body_form == 'form_multi.tx' ? 'selected' : '' :> >Multiple pages, like presentations (form_multi.tx)</option>
- </select>
- <p class="title">Custom Fields</p>
- These become extra inputs in the editor, and are available in your display template below
- as <code><: $post.your_field_name :></code>.
- Uploads aren't supported here — use the Attachment uploader above for those.
- <br />
- A field set to <em>editors only</em> is dropped before the page is rendered for anyone who
- cannot edit it, so it is safe to refer to in the display template below without guarding it
- yourself — useful for a connection string or anything else that shouldn't be public.
- <br />
- An <em>Another Post</em> field depends on a different post type.
- <em>Pick one</em> stores a single post's ID, chosen from a dropdown in the editor, and hands you
- the whole post as <code><: $post.your_field_name_post :></code>.
- <em>All of them</em> stores nothing and simply hands you every post of that type as
- <code><: $post.your_field_name :></code> to loop over.
- <div id="wizard-params"></div>
- <button type="button" style="float:right;" class="coolbutton" onclick="addParam(); return false;">Add Field</button>
- <br style="clear:both;" />
- <p class="title">Display Template</p>
- <a href="https://metacpan.org/pod/Text::Xslate::Syntax::Kolon" title="GET UR MIND RITE">Kolon</a>
- markup for how this post type renders when someone looks at it.
- <br />
- <code><: $tiled :></code> is true when the series asked for its posts to be tiled, so branch on it
- if this type wants a compact view — see <code>forms/file.tx</code> for the shape.
- The wrapper gets the <code>tile</code> class either way.
- Note that it is only ever true for logged-out visitors: an editor needs the full view.
- Use <code><: $post.yourfield :></code> for your custom fields, and
- <code><: render_it($post.data) | mark_raw :></code> for the post body.
- <br />
- <textarea class="cooltext" name="display" rows="12" placeholder="<div class="postData responsive-text"> <: render_it($post.data) | mark_raw :> </div>"><: $display :></textarea>
- <br />
- <label for="wiz-overwrite">Overwrite it if this type already exists?<input id="wiz-overwrite" class="coolcb" type="checkbox" name="overwrite" value="1" <: $checked.overwrite :> /></label>
- <br />
- <input type="submit" class="coolbutton" value="Create Post Type" />
- </form>
- <template id="wizard-param-template">
- <div class="wizard-param-row">
- <hr />
- Name <input required class="cooltext" type="text" name="param_name" pattern="[A-Za-z][A-Za-z0-9_]*" placeholder="cook_time" />
- Type <select class="cooltext param-type" name="param_type" onchange="syncRelationRow(this);">
- <option value="text">Text</option>
- <option value="url">URL</option>
- <option value="number">Number</option>
- <option value="date">Date</option>
- <option value="textarea">Long Text</option>
- <option value="checkbox">Checkbox</option>
- <option value="relation">Another Post</option>
- </select>
- <span class="wizard-relation" style="display:none;">
- of type <select class="cooltext" name="param_relation_form">
- : for $forms -> $form {
- <option value="<: $form :>"><: $form :></option>
- : }
- </select>
- <select class="cooltext" name="param_relation_mode">
- <option value="one">pick one</option>
- <option value="all">all of them</option>
- </select>
- </span>
- Label <input class="cooltext" type="text" name="param_label" placeholder="Cook Time" />
- Placeholder <input class="cooltext" type="text" name="param_placeholder" placeholder="45 minutes" />
- <select class="cooltext" name="param_required">
- <option value="0">Optional</option>
- <option value="1">Required</option>
- </select>
- <select class="cooltext" name="param_private">
- <option value="0">Shown to everyone</option>
- <option value="1">Shown to editors only</option>
- </select>
- <button type="button" class="coolbutton" onclick="delParam(this); return false;">Remove</button>
- </div>
- </template>
- </div>
|