leilukin-tumbleblog/admin/partials/page_fields.twig

89 lines
3.9 KiB
Twig

{{ trigger.call("before_page_fields") }}
{% set field_markdown = site.enable_markdown ? " data-markdown" : "" %}
<p class="main_options">
<label for="title">{{ "Title" | translate }}</label>
<input class="text" type="text" name="title" value="{{ page is defined ? page.title | fix(true, true) : '' }}" id="title" required>
</p>
<p class="main_options">
<label for="body">
{{ "Body" | translate }}
</label>
<span id="body_toolbar" class="options_toolbar" role="toolbar">{% if field_markdown %}
<a href="{{ url('help/id/markdown') }}" target="_blank" class="help emblem markdown">
{{- icon_img("markdown.svg", "Markdown" | translate) -}}
</a>
{% endif %}</span>
<textarea rows="12" name="body" id="body" data-preview{{ field_markdown }} required>{{ page is defined ? page.body | fix(false, true) : "" }}</textarea>
<span id="body_tray" class="options_tray" role="status"></span>
</p>
{{ trigger.call("after_page_fields") }}
<div id="more_options" class="more_options">
<p class="more_options_option">
<label for="slug">
{{ "Slug" | translate }}
<a href="{{ url('help/id/slugs') }}" rel="help" target="_blank" class="help emblem">
{{- icon_img("help.svg", "help" | translate) -}}
</a>
</label>
<input class="text" type="text" name="slug" value="{{ page is defined ? page.clean | fix(true) : '' }}" id="slug" maxlength="128"{{ slug_pattern() }}>
</p>
<p class="more_options_option">
<label for="status">{{ "Status" | translate }}</label>
<select name="status" id="status">
{% set option_selected = page is defined ? page.status | selected("listed") : " selected" %}
<option value="listed"{{ option_selected }}>{{ "Public and visible in pages list" | translate }}</option>
{% set option_selected = page is defined ? page.status | selected("public") : "" %}
<option value="public"{{ option_selected }}>{{ "Public" | translate }}</option>
{% set option_selected = page is defined ? page.status | selected("teased") : "" %}
<option value="teased"{{ option_selected }}>{{ "Private and visible in pages list" | translate }}</option>
{% set option_selected = page is defined ? page.status | selected("private") : "" %}
<option value="private"{{ option_selected }}>{{ "Private" | translate }}</option>
</select>
</p>
<p class="more_options_option">
<label for="list_priority">{{ "Priority in pages list" | translate }}</label>
<select name="list_priority" id="list_priority">
{% set option_selected = page is defined ? page.list_order | selected(0,1,2) : "" %}
<option value="0"{{ option_selected }}>{{ "High" | translate }}</option>
{% set option_selected = page is defined ? page.list_order | selected(3,4,5) : " selected" %}
<option value="4"{{ option_selected }}>{{ "Medium" | translate }}</option>
{% set option_selected = page is defined ? page.list_order | selected(6,7,8) : "" %}
<option value="8"{{ option_selected }}>{{ "Low" | translate }}</option>
</select>
</p>
<p class="more_options_option">
<label for="parent_id">{{ "Parent" | translate }}</label>
<select name="parent_id" id="parent_id">
<option value="0">{{ "[None]" | translate }}</option>
{% for item in theme.pages_list(0, page is defined ? page.id : null) %}
{% set option_selected = page is defined ? page.parent_id | selected(item.id) : "" %}
{% set option_contents = ("&nbsp;" | repeat((item.depth - 1) * 4)) ~ (item.title | striptags | fix) %}
<option value="{{ item.id }}"{{ option_selected }}>{{ option_contents }}</option>
{% endfor %}
</select>
</p>
{% if route.action == "write_page" %}
{{ trigger.call("new_page_options") }}
{% else %}
{{ trigger.call("edit_page_options", page) }}
{% endif %}
</div>
<div class="buttons confirmation">
{% if route.action == "write_page" %}
<button type="submit" class="yay">
{{ "Publish" | translate }}
</button>
<button type="submit" name="private" value="true">
{{ "Save" | translate }}
</button>
{% else %}
<button type="submit">
{{ "Save" | translate }}
</button>
<button type="submit" class="boo" name="cancel" value="true" data-confirm="">
{{ "Cancel" | translate }}
</button>
{% endif %}
</div>
</div>