{% extends "_layouts/cp" %} {% import "_includes/forms" as forms %} {% block pageTitle %} {{ parent() }} {% if entry.id %} {% include "entries/_revisions" %} {% endif %} {% endblock %} {% set sectionHandle = section.handle %} {% set isSingle = section.type == 'single' %} {% set isVersion = entry.getClassHandle() == 'EntryVersion' %} {% set isDraft = entry.id and entry.getClassHandle() == 'EntryDraft' %} {% set canPublish = currentUser.can('publishEntries'~permissionSuffix) %} {% set canSave = ( (entry.id or currentUser.can('createEntries'~permissionSuffix)) and (not entry.id or not entry.enabled or canPublish) and (isSingle or entry.authorId == currentUser.id or currentUser.can('publishPeerEntries'~permissionSuffix)) ) %} {% hook "cp.entries.edit" %} {% block saveButton %} {% if isDraft %}
{# Are they allowed to publish this draft? #} {% set canPublishDraft = ( canPublish and (isSingle or entry.authorId == currentUser.id or currentUser.can('publishPeerEntries'~permissionSuffix)) and (entry.creatorId == currentUser.id or currentUser.can('publishPeerEntryDrafts'~permissionSuffix)) ) %} {# Are they allowed to delete this draft? #} {% set canDeleteDraft = ( entry.creatorId == currentUser.id or currentUser.can('deletePeerEntryDrafts'~permissionSuffix) ) %} {% if canPublishDraft or canDeleteDraft %} {% endif %}
{% elseif isVersion %} {# Are they allowed to publish changes? #} {% if canPublish and (isSingle or entry.authorId == currentUser.id or currentUser.can('publishPeerEntries'~permissionSuffix)) %}
{% endif %} {% elseif canSave %}
{% else %} {% endif %} {% endblock %} {% block main %} {% if not isVersion %} {% if entry.id %}{% endif %} {% if craft.isLocalized() %}{% endif %} {% else %} {% endif %}
{% include "_includes/tabs" %} {% include "entries/_fields" with { static: isVersion } %}
{% if showPreviewBtn %} {% include "_includes/previewbtns" %} {% endif %} {% if craft.isLocalized() and section.getLocales() | length > 1 %} {% endif %} {% if not isSingle or canPublish %}
{% if not isSingle %} {% if showEntryTypes %} {{ forms.selectField({ label: "Entry Type"|t, id: 'entryType', name: 'typeId', value: entryType.id, options: entryTypeOptions }) }} {% endif %} {{ forms.textField({ label: "Slug"|t, locale: entry.locale, id: 'slug', name: 'slug', value: entry.slug, placeholder: "Enter slug"|t, errors: (not isVersion ? entry.getErrors('slug')|merge(entry.getErrors('uri'))), disabled: isVersion }) }} {% if parentOptionCriteria is defined %} {{ forms.elementSelectField({ label: "Parent"|t, id: 'parentId', name: 'parentId', elementType: elementType, selectionLabel: "Choose"|t, sources: ['section:'~section.id], criteria: parentOptionCriteria, limit: 1, elements: (parent is defined and parent ? [parent]), errors: entry.getErrors('parent') }) }} {% endif %} {% if CraftEdition == CraftPro and currentUser.can('editPeerEntries'~permissionSuffix) %} {{ forms.elementSelectField({ label: "Author"|t, id: 'author', name: 'author', elementType: userElementType, selectionLabel: "Choose"|t, criteria: authorOptionCriteria, limit: 1, elements: (author is defined and author ? [author]) }) }} {% endif %} {{ forms.dateTimeField({ label: "Post Date"|t, id: 'postDate', name: 'postDate', value: (entry.postDate ? entry.postDate : null), errors: entry.getErrors('postDate'), disabled: isVersion }) }} {{ forms.dateTimeField({ label: "Expiry Date"|t, id: 'expiryDate', name: 'expiryDate', value: (entry.expiryDate ? entry.expiryDate : null), errors: entry.getErrors('expiryDate'), disabled: isVersion }) }} {% endif %} {% if canPublish or (not isVersion and canDeleteEntry) %} {% set statusInput %} {% if canPublish %}
{{ forms.lightswitch({ id: 'enabled', name: 'enabled', on: entry.enabled, disabled: isVersion }) }}
{% endif %} {% if not isSingle and not isVersion and canDeleteEntry %}
{% endif %} {% endset %} {{ forms.field({ label: (canPublish ? "Enabled"|t), id: 'enabled' }, statusInput) }} {% endif %}
{% if entry.id %}
{{ "Date Created"|t }}
{{ entry.dateCreated.localeDate() }} {{ entry.dateCreated.localeTime() }}
{{ "Date Updated"|t }}
{{ entry.dateUpdated.localeDate() }} {{ entry.dateUpdated.localeTime() }}
{% if entry.revisionNotes %}
{{ "Version Notes"|t }}
{{ entry.revisionNotes }}
{% endif %}
{% endif %} {% endif %} {# Give plugins a chance to add other panes here #} {% hook "cp.entries.edit.right-pane" %} {% if ( not isDraft and not isVersion and canSave and section.enableVersioning ) %}
{% endif %}
{% endblock %} {% if not entry.slug %} {% includejs "window.slugGenerator = new Craft.SlugGenerator('#title', '#slug');" %} {% endif %}