<%= render partial: 'storytime/dashboard/versions/version.html.erb', collection: @post.versions.order(created_at: :desc), locals: { versionable: @post } %>
<%= link_to "Done", '#', class: "btn btn-primary btn-outline pull-right", style: "margin-top: 10px; margin-right: 15px;", data: { toggle: 'collapse', target: '#versions-panel' } %>
<%= simple_form_for [:dashboard, @post], html: { class: "post-form #{@post.new_record? ? 'new-post-form' : 'edit-post-form'}", data: { :"autosave-url" => (url_for([:dashboard, @post, :autosaves]) unless @post.new_record?), :"post-type" => current_post_type.type_name.tableize.singularize } } do |f| %> <%= hidden_field_tag :type, @post.type_name %> <% if Pundit.policy(current_user, @post).publish? %> <%= f.input :published, as: :hidden, input_html: { id: "post_published" } %> <% end %>
<% if lookup_context.template_exists?("storytime/dashboard/posts/_#{@post.type_name}_fields") %> <%= render("storytime/dashboard/posts/#{@post.type_name}_fields", f: f) %> <% end %> <% unless @post.is_a?(Storytime::Page) || @post.is_a?(Storytime::Blog) %>
<%= f.input :excerpt, required: false, input_html: { class: "character-limit-input" } %>
<% end %>
<%= f.input :slug, input_html: { value: (@post.persisted? ? @post.slug : nil) } %>
<%= f.input :published_at, as: :date_time_picker, label: "Publish Date/Time", input_html: { style: "display: inline;" } %>

<%= link_to "Cancel", '#', class: "btn btn-default", data: { toggle: 'collapse', target: '#post-advanced-settings' } %>
<%= f.submit "Save Draft", id: "save-draft-submit", class: "btn btn-default save" unless @post.published? %> <%= f.submit "Publish", class: "btn btn-primary btn-outline publish", publish: true unless @post.published? %> <%= f.submit "Update", class: "btn btn-primary btn-outline save" if @post.published? %>
<% unless @post.is_a?(Storytime::Page) || @post.is_a?(Storytime::Blog) %>
<%= f.input :notifications_enabled, as: :boolean, label: "Notify subscribers of new post" unless @post.published? %>
<% end %>
<% if Storytime.enable_file_upload && !@post.is_a?(Storytime::Page) && !@post.is_a?(Storytime::Blog) %>
<%= link_to "Done", '#', class: "btn btn-primary btn-outline pull-right", style: "margin-top: 10px;", data: { toggle: 'collapse', target: '#featured-images-panel' } %>
<% end %>
<%= autosave_info @post if @post.persisted? %> <%= f.error_notification if false %>

<%= @post.title %>

<%= f.input :title, as: :hidden, input_html: { class: "character-limit-input" } %>
<% if @post.errors[:title].present? %> <%= @post.errors[:title][0] %> <% end %>
<%= raw @post.draft_content %>
<%= f.input :draft_content, as: :text, label: false, input_html: { class: "codemirror draft-content-input" } %> <% end %>
<%= render "storytime/dashboard/media/modal" if Storytime.enable_file_upload %>