post_wizard.tx 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <script type="text/javascript" src="/scripts/post_wizard.js"></script>
  2. <div id="backoffice">
  3. <p class="title">
  4. Existing Post Types:
  5. </p>
  6. A "post type" is just a template living in <code>templates/html/components/forms/</code>.
  7. Every post picks exactly one of them &mdash; it's what the <em>Content Template</em> dropdown
  8. selects when you edit a Series.
  9. <hr />
  10. <ul id="existing-post-types">
  11. : for $forms -> $form {
  12. <li><: $form :></li>
  13. : }
  14. </ul>
  15. <hr />
  16. <p class="title">
  17. Create a new Post Type:
  18. </p>
  19. This writes a new template into the forms directory currently in use
  20. (<code><: $forms_dir :></code>) along with a matching <code>.json</code> sidecar describing
  21. any custom fields, so that the data model knows to keep them when a post is saved.
  22. <hr />
  23. <form class="Submissions" id="postTypeWizard" method="post" action="/admin/wyzzerdd/save">
  24. Type Name * &mdash; letters, numbers, dash and underscore only<br />
  25. <input required class="cooltext" type="text" name="name" pattern="[A-Za-z0-9_-]+" placeholder="recipe" value="<: $name :>" />
  26. <p class="title">Canned Fields</p>
  27. Most post types reuse the same handful of blocks. Tick whichever ones this type needs.
  28. <br />
  29. <label for="wiz-wrapper">Wrap output in the standard post &lt;div&gt;<input id="wiz-wrapper" class="coolcb" type="checkbox" name="wrapper" value="1" <: $checked.wrapper :> /></label><br />
  30. <label for="wiz-post_title">Post title &amp; 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 />
  31. <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 />
  32. <label for="wiz-title_input">Title input in the editor<input id="wiz-title_input" class="coolcb" type="checkbox" name="inc_title_input" value="1" <: $checked.inc_title_input :> /></label><br />
  33. <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 />
  34. <label for="wiz-visibility">Visibility selector (visibility.tx)<input id="wiz-visibility" class="coolcb" type="checkbox" name="inc_visibility" value="1" <: $checked.inc_visibility :> /></label><br />
  35. <label for="wiz-acls">ACL selector (acls.tx)<input id="wiz-acls" class="coolcb" type="checkbox" name="inc_acls" value="1" <: $checked.inc_acls :> /></label><br />
  36. <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 />
  37. <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 />
  38. <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 />
  39. <br />
  40. Title placeholder text<br />
  41. <input class="cooltext" type="text" name="title_placeholder" placeholder="Iowa Man Destroys Moon" value="<: $title_placeholder :>" />
  42. <br />
  43. Content Body &mdash; this is always the last thing in the editor, and is what carries the post body itself.<br />
  44. <select class="cooltext" name="body_form">
  45. <option value="form_common.tx" <: $body_form == 'form_multi.tx' ? '' : 'selected' :> >Single page (form_common.tx)</option>
  46. <option value="form_multi.tx" <: $body_form == 'form_multi.tx' ? 'selected' : '' :> >Multiple pages, like presentations (form_multi.tx)</option>
  47. </select>
  48. <p class="title">Custom Fields</p>
  49. These become extra inputs in the editor, and are available in your display template below
  50. as <code>&lt;: $post.your_field_name :&gt;</code>.
  51. Uploads aren't supported here &mdash; use the Attachment uploader above for those.
  52. <div id="wizard-params"></div>
  53. <button type="button" style="float:right;" class="coolbutton" onclick="addParam(); return false;">Add Field</button>
  54. <br style="clear:both;" />
  55. <p class="title">Display Template</p>
  56. <a href="https://metacpan.org/pod/Text::Xslate::Syntax::Kolon" title="GET UR MIND RITE">Kolon</a>
  57. markup for how this post type renders when someone looks at it.
  58. Use <code>&lt;: $post.yourfield :&gt;</code> for your custom fields, and
  59. <code>&lt;: render_it($post.data) | mark_raw :&gt;</code> for the post body.
  60. <br />
  61. <textarea class="cooltext" name="display" rows="12" placeholder="&lt;div class=&quot;postData responsive-text&quot;&gt;&#10; &lt;: render_it($post.data) | mark_raw :&gt;&#10;&lt;/div&gt;"><: $display :></textarea>
  62. <br />
  63. <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>
  64. <br />
  65. <input type="submit" class="coolbutton" value="Create Post Type" />
  66. </form>
  67. <template id="wizard-param-template">
  68. <div class="wizard-param-row">
  69. <hr />
  70. Name <input required class="cooltext" type="text" name="param_name" pattern="[A-Za-z][A-Za-z0-9_]*" placeholder="cook_time" />
  71. Type <select class="cooltext" name="param_type">
  72. <option value="text">Text</option>
  73. <option value="url">URL</option>
  74. <option value="number">Number</option>
  75. <option value="date">Date</option>
  76. <option value="textarea">Long Text</option>
  77. <option value="checkbox">Checkbox</option>
  78. </select>
  79. Label <input class="cooltext" type="text" name="param_label" placeholder="Cook Time" />
  80. Placeholder <input class="cooltext" type="text" name="param_placeholder" placeholder="45 minutes" />
  81. <select class="cooltext" name="param_required">
  82. <option value="0">Optional</option>
  83. <option value="1">Required</option>
  84. </select>
  85. <button type="button" class="coolbutton" onclick="delParam(this); return false;">Remove</button>
  86. </div>
  87. </template>
  88. </div>