<% # TODO: the "if @page.persisted?" business below could possibly be done w/ some clever polymorphic routing. # Leaving as-is for now since technically you can't get to the new page form anyway. %> <%= bootstrap_form_for([spotlight, @page.exhibit, @page], role: 'form', html: { data: { :'form-observer' => true, :'blacklight-configuration-index-fields' => available_index_fields, :'blacklight-configuration-search-views' => available_view_fields.map { |k,v| { key: k, label: view_label(k) }}, :'attachment-endpoint' => spotlight.exhibit_attachments_path(@page.exhibit), :'autocomplete-exhibit-catalog-path'=> spotlight.autocomplete_exhibit_catalog_path(@page.exhibit, q: "%QUERY", format: "json"), :'autocomplete-exhibit-pages-path' => spotlight.exhibit_pages_path(@page.exhibit, format: "json"), :'autocomplete-exhibit-searches-path' => spotlight.exhibit_searches_path(@page.exhibit, format: "json"), :'preview-url' => (spotlight.exhibit_preview_block_url(@page.exhibit, @page) if @page.persisted?) } }) do |f| %> <%= render @page.lock if @page.lock and not @page.lock.stale? and not @page.lock.current_session? %> <% if @page.errors.any? %>

<%= pluralize(@page.errors.count, "error") %> prohibited this page from being saved:

<% end %>
<%= f.label :title, class: 'sr-only' %> <%= f.text_field_without_bootstrap :title, class: 'form-control input-lg', placeholder: t(:'.title_placeholder') %>
<%= f.label :content, class: 'sr-only' %> <%= f.text_area_without_bootstrap :content, value: { data: f.object.content.as_json }.to_json, class: 'js-st-instance', data: { 'block-types': Spotlight::Engine.config.sir_trevor_widgets } %>
<%= render "page_options", f: f %>
<% if @page.respond_to? :thumbnail %>
<%= f.fields_for :thumbnail, (@page.thumbnail || @page.build_thumbnail) do |m| %>

<%= t(:'.thumbnail.help') %>

<%= render '/spotlight/featured_images/form', f: m, initial_crop_selection: Spotlight::Engine.config.featured_image_thumb_size, crop_type: :thumbnail %> <% end %>
<% end %>
<%= link_to(t('cancel'), :back, class: "btn btn-link", data: (@page.lock && @page.lock.current_session? ? { lock: url_for([spotlight, @page.exhibit, @page.lock]) } : {})) %> <%= f.submit class: 'btn btn-primary' %>
<% end %>