<%= title_for_node(@node) %>

<%= button_to t(".unlock_back"), unlock_node_path(@node), method: :put, form: { class: 'button_to state_changing' }, disabled: @node.autosave.present? %> <% if @node.autosave || (@node.draft && @node.head) %> <%= button_to revert_node_path(@node), method: :put, form: { data: { confirm: t(".confirm_discard") }, class: 'button_to destructive' } do %> <%= icon("trash", library: "tabler", "aria-hidden": true) %> <%= @node.draft && !@node.autosave ? t(".destroy_draft") : t(".discard_autosave") %> <% end %> <% if pair = @node.available_layer_pairs.find { |p| p.include?(:autosave) } %> <%= button_to t(".what_changed"), diff_node_revisions_path(@node), method: :get, params: { start_revision: pair.first, end_revision: pair.last }, form: { class: 'button_to computation' } %> <% end %> <% end %> <%= submit_tag t(".save_draft"), form: dom_id(@node, :edit) %> <%= submit_tag t(".save_unlock_exit"), name: "unlock_exit", form: dom_id(@node, :edit) %> <%= link_to t(".preview"), preview_page_path(@page), target: "_blank", rel: "noopener", class: "preview_link" %>
<%= form_for(@node, html: { data: { autosave_url: autosave_node_path(@node), show_url: node_path(@node) } }) do |f| %> <% if @node.errors.any? %>
<% end %> <%= fields_for @page do |d| %>
<%= t("admin.columns.title") %>
<%= d.text_field :title %>
<%= t(".abstract") %>
<%= d.text_area :abstract %>
<%= t(".attachments") %>
<%= t(".metadata_summary") %>
<%= t(".slug") %>
<%= f.text_field( :staged_slug, :value => @node.staged_slug || @node.slug ) %>
<%= t(".parent") %>
<%= text_field_tag :move_to_search_term, @node.parent.title rescue "" %>

<%= t(".parent_hint") %>

<%= f.hidden_field( :staged_parent_id, :value => @node.staged_parent_id || @node.parent_id ) %>
<%= t(".tags") %>
<%= text_field_tag :tag_list, @page.tag_list.join(', ') %> <%= t(".tags_hint") %>
<%= t(".publish_at") %>
<%= d.datetime_select :published_at, :value => @page.published_at %>
<%= t(".template") %>
<%= d.select :template_name, custom_page_templates, {:prompt => 'Select Template'} %> <%= t(".template_hint") %>
<%= t(".author") %>
<%= d.select :user_id, user_list, :selected => @page.user_id || @node.draft&.user_id || @node.head&.user_id %>
<%= t(".body") %>
<%= d.text_area :body, :class => 'with_editor' %>
<% end %>
<%= f.submit t(".save_draft") %> <%= f.submit t(".save_unlock_exit"), name: "unlock_exit"%>
<% end %>