<% locked_by_other = @node.locked? && @node.lock_owner != current_user %>

<%= title_for_node(@node) %> (<%= I18n.default_locale.to_s.upcase %>)

Status
Head <%= @node.head ? "#{@node.head.title} (rev #{@node.head.revision}, #{@node.head.updated_at})" : "none — never published" %>
Draft <%= @node.draft ? "#{@node.draft.title} (rev #{@node.draft.revision}, saved #{@node.draft.updated_at})" : "none" %>
Autosave <%= @node.autosave ? "#{@node.autosave.title} (unsaved, #{@node.autosave.updated_at})" : "none" %>
<% edit_label = @node.autosave ? "Continue Editing" : (@node.draft ? "Edit Draft" : "Edit") %>
<% if locked_by_other %> <%= edit_label %> <% else %> <%= link_to edit_node_path(@node), class: "action_button" do %> <%= icon("edit", library: "tabler", "aria-hidden": true) %> <%= @node.autosave ? "Continue Editing" : (@node.draft ? "Edit Draft" : "Lock + Edit") %> <% end %> <% if !@node.draft && !@node.autosave %> Nothing pending — this will start a fresh draft. <% end %> <% end %>
<% @node.available_layer_pairs.each do |pair| %>
<%= button_to "Diff #{pair.first.to_s.capitalize} vs. #{pair.last.to_s.capitalize}", diff_node_revisions_path(@node), method: :get, params: { start_revision: pair.first, end_revision: pair.last }, form: { class: 'button_to computation' } %>
<% end %> <% unless locked_by_other %> <% if @node.draft && !@node.autosave %>
<%= button_to 'Publish', publish_node_path(@node), method: :put, form: { data: { confirm: "Publish this draft?" }, class: 'button_to state_changing' } %>
<% end %> <% if @node.autosave || (@node.draft && @node.head) %>
<%= button_to revert_node_path(@node), method: :put, params: { return_to: request.path }, form: { data: { confirm: "This cannot be undone. Continue?" }, class: 'button_to destructive' } do %> <%= icon("trash", library: "tabler", "aria-hidden": true) %> <%= @node.draft && !@node.autosave ? "Destroy Draft" : "Discard Autosave" %> <% end %>
<% end %> <% end %>
<% if locked_by_other %> Locked — see People below to unlock before editing, publishing, or discarding. <% end %>
Translations
<% @translations.each do |t| %>
<%= t[:locale].to_s.upcase %>
<% if t[:exists] %> <%= link_to t[:title], node_translation_path(@node, t[:locale]) %> — updated <%= t[:updated_at] %> <% if t[:outdated] %> may be outdated <% end %> <% else %> Not yet translated. <% end %> <% if locked_by_other %> <%= t[:exists] ? "Lock + Edit" : "Create translation + Lock" %> <% else %> <%= link_to edit_node_translation_path(@node, t[:locale]), class: "action_button" do %> <%= icon(t[:exists] ? "edit" : "language", library: "tabler", "aria-hidden": true) %> <%= t[:exists] ? "Lock + Edit" : "Create translation + Lock" %> <% end %> <% if t[:exists] %> <%= button_to node_translation_path(@node, t[:locale]), method: :delete, form: { data: { confirm: "This cannot be undone. Continue?" }, class: 'button_to destructive' } do %> <%= icon("trash", library: "tabler", "aria-hidden": true) %> Destroy Translation <% end %> <% end %> <% end %>
<% end %>
People
Author <%= @page.user.try(:login) %>
Editor <%= @page.editor.try(:login) %>
<% if @node.locked? %>
Locked by <%= @node.lock_owner.login %> <%= unlock_link %>
<% end %>
Dates
Last updated <%= @page.updated_at %>
<% if @page.published_at.present? %>
<%= @page.public? ? 'Published at' : 'Will publish at' %> <%= @page.published_at %>
<% end %>
Links
Public <%= link_to @page.public_link, content_url(@node.unique_path) %>
<% if @node.draft %>
Admin Preview <%= link_to preview_page_path(@node.draft), preview_page_path(@node.draft) %>
Public Preview <% if @node.draft.preview_token.present? %>
<%= link_to shared_preview_path(token: @node.draft.preview_token), shared_preview_url(token: @node.draft.preview_token), target: "_blank", rel: "noopener" %> <%= button_to 'Revoke', revoke_shared_preview_node_path(@node), method: :put, form: { data: { confirm: "Revoke this preview link? Anyone currently using it will immediately lose access." }, class: 'button_to state_changing' } %>
<% else %> <%= button_to 'Create public preview link', generate_shared_preview_node_path(@node), method: :put, form: { class: 'button_to state_changing' } %> <% end %>
<% end %>
Revisions
<%= pluralize(@node.pages.count, 'revision', 'revisions') %>
    <% @node.pages.order(:revision).each do |page| %>
  • <%= link_to "##{page.revision} — #{page.title} (#{page.editor.try(:login)}, #{page.updated_at})", node_revision_path(@node, page) %>
  • <% end %>
Tags
<% if @page.tag_list.any? %>
    <% @page.tag_list.sort.each do |tag| %>
  • <%= tag %>
  • <% end %>
<% else %> No tags. <% end %>
<% if @page.assets.images.any? %>
Images
    <% @page.assets.images.each do |asset| %>
  • <%= link_to image_tag(asset.upload.url(:thumb)), asset_path(asset) %>
  • <% end %>
<% end %>
Events
    <% @node.events.order(:start_time).each do |event| %>
  • <%= event_schedule_text(event) %> [<%= link_to 'show', event_path(event, return_to: request.path) %> | <%= link_to 'edit', edit_event_path(event, return_to: request.path) %>]
  • <% end %>
<% mapping = default_event_tag_mapping(@page) %> <%= link_to 'add event', new_event_path(node_id: @node.id, tag_list: mapping&.last, auto_tag_source: mapping&.first, return_to: request.path) %>
<% matches = matching_node_kinds(@node) %> <% if @node.children.any? || matches.any? %>
Children
<% if @node.children.any? %>
<%= pluralize(@node.children.count, 'child', 'children') %>
    <% @node.children.order(:slug).each do |child| %>
  • <%= link_to (child.head&.title || child.draft&.title || child.slug), node_path(child) %>
  • <% end %>
<% end %> <% if matches.any? %> <% end %>
<% end %>
Abstract (<%= I18n.default_locale.to_s.upcase %>)
<%= sanitize(@page.abstract) %>
Body (<%= I18n.default_locale.to_s.upcase %>)
<%= sanitize(@page.body) %>