{% set can_publish = can('publish') %}
{% set cabin_config = cabin_custom_config() %}
<h3>{{ __("New Blog Post") }}</h3>
<form method="post">{{ form_token() }}
<div class="table">
<div class="table-row">
<label class="table-cell" for="blog_post_title">{{ __("Post Title") }}:</label>
<div class="table-cell bottom-pad">
<input
class="full-width"
id="blog_post_title"
name="title"
type="text"
value="{{ _POST.title|e('html_attr') }}"
/>
</div>
</div>
<div class="table-row">
<label class="table-cell" for="blog_post_slug">{{ __("Slug") }}:</label>
<div class="table-cell bottom-pad">
<input
class="full-width"
data-original="{{ blogpost.slug|e('html_attr') }}"
id="blog_post_slug"
name="slug"
pattern="^[a-z0-9][a-z0-9\-]+$"
value="{{ _POST.slug|e('html_attr') }}"
type="text"
/>
</div>
</div>
{% if can_publish %}
<div class="table-row">
<label class="table-cell table-min-width" for="blog_post_publish_date">{{ __("Date/Time Published") }}:</label>
<div class="table-cell bottom-pad">
<input
class="full-width"
id="blog_post_publish_date"
name="published"
pattern="^2[0-9]{3}\-(0[0-9]|1[0-2])\-([012][0-9]|3[0-1])(T| )([0-1][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([\.:\+0-9]+)?$"
type="text"
value="{{ _POST.published|default(current_time)|e('html_attr') }}"
/>
</div>
</div>
{% endif %}
<div class="table-row">
<label class="table-cell" for="blog_post_category">{{ __("Category") }}:</label>
<div class="table-cell bottom-pad">
<select name="category" id="blog_post_category" class="treeselect">
<option value="0"> -- {{ __("None") }} -- </option>
{% for category in categories %}
{{
bcatmac.selectBox(
category,
_POST.category|default(0)
)
}}
{% endfor %}
</select>
</div>
</div>
<div class="table-row">
<label class="table-cell" for="blog_post_author">{{ __("Author") }}:</label>
<div class="table-cell bottom-pad">
<select name="author" id="blog_post_author" required="required">
<option value="">{% if authors %} -- {{ __("Please Select an Author") }} -- {% endif %}</option>
{% for auth in authors %}
<option
value="{{ auth.authorid|e('html_attr') }}"
{% if _POST.author %}
{% if auth.authorid == _POST.author %}
selected="selected"
{% endif %}
{% elseif auth.userid == userid() and auth.default_author_for_user %}
selected="selected"
{% endif %}>{{ auth.name }}</option>
{% endfor %}
</select>
<a
href="{{ cabin_url() }}author/new"
rel="noopener noreferrer"
target="_blank"
title="{{ __("Create an Author Profile")|e('html_attr') }}"
>
<i class="fa fa-user-plus"></i>
{% if not authors %}
{{ __("Create an Author Profile Now") }}
{% endif %}
</a>
</div>
</div>
<div class="table-row">
<label class="table-cell table-min-width" for="format">{{ __("Post Format") }}:</label>
<div class="table-cell">
{% include cargo("bridge_pages_select_format") with {
"format": _POST.format|default(
cabin_config['editor']['default-format']|default('Rich Text')
)
} %}
</div>
</div>
<div class="table-row">
<label class="table-cell" for="blog_post_cache">{{ __("Cache") }}:</label>
<div class="table-cell bottom-pad">
<input type="checkbox" class="large_checkbox" name="cache" id="cache" value="1" />
<label for="cache">{{ __("Cache this blog post?") }}</label>
</div>
</div>
<div class="table-row">
<label class="table-cell" for="format">{{ __("Tags") }}:</label>
<div class="table-cell bridge_blog_post_tags bottom-pad">
{% include cargo("bridge_blog_post_tags") with {
"tags": tags,
"checked": _POST.tags|default(
[]
)
} %}
</div>
</div>
<div class="table-row">
<label class="table-cell" for="blog_post_description">{{ __("Description") }}:</label>
<div class="table-cell full-width bottom-pad">
<input
type="text"
class="full-width"
name="description"
placeholder="{{ __("RSS Feed Description (Summary)")|e('html_attr') }}"
value="{{ _POST.description|e('html_attr') }}"
/>
</div>
</div>
{% include cargo("bridge_blog_post_extra_fields") ignore missing %}
</div>
<div class="bridge_blog_rich_text_wrapper">
{% include cargo("rich_text_editor") with {
"contents": _POST.blog_post_body|default(""),
"name": "blog_post_body",
"placeholder": ""
} %}
</div>
<fieldset class="form-metadata-wrapper">
<legend>
<input type="checkbox" id="show_metadata" />
<label for="show_metadata">{{ __("Show Metadata Fields?") }}</label>
</legend>
<div class="form-table" id="blog_posts_metadata">
{% include cargo("bridge_blog_posts_metadata") with {
"metadata": []
} %}
</div>
</fieldset>
<fieldset class="form-button-group">
{% if can_publish %}
<button type="submit" name="save_btn" value="publish" class="pure-button pure-button-secondary">
<i class="fa fa-check"></i>
{{ __("Publish") }}
</button>
<button type="submit" name="save_btn" value="draft" class="pure-button pure-button-tertiary">
<i class="fa fa-save"></i>
{{ __("Save Draft") }}
</button>
{% else %}
<button type="submit" name="save_btn" value="draft" class="pure-button pure-button-tertiary">
<i class="fa fa-save"></i>
{{ __("Save Draft") }}
</button>
{% endif %}
</fieldset>
</form>
|