<%= form_for([@work, chapter]) do |f| %>

<%= ts("* Required information") %>

<%= ts("Name, Order and Date") %>

<%= ts("Name, Order and Date") %>

<%= f.label :title, ts("Chapter Title") %> <%= link_to_help "chapter-title" %>
<%= f.text_field :title, class: "observe_textlength" %> <%= live_validation_for_field("chapter_title", presence: false, maximum_length: ArchiveConfig.TITLE_MAX) %> <%= generate_countdown_html("chapter_title", ArchiveConfig.TITLE_MAX) %>
<%= f.label :position, ts("Chapter Number") %>

<%= f.text_field :position, class: "number" %> <%= f.label :wip_length, ts("of"), title: ts("of total chapters") %> <%= f.text_field :wip_length, class: "number" %>

<%= f.label :published_at, ts("Chapter Publication Date") %> <%= link_to_help "backdating-help" %>
<%= f.date_select "published_at", start_year: Date.current.year, end_year: 1950, default: @work.default_date, order: [:day, :month, :year] %>
<%= ts("Chapter Preface") %>

<%= ts("Chapter Preface") %>

<%= render "pseuds/byline", form: f, object: @chapter %>
<%= f.label :summary, ts("Chapter Summary") %>
<%= f.text_area :summary, rows: 4, cols: 60, class: "observe_textlength" %> <%= live_validation_for_field("chapter_summary", presence: false, maximum_length: ArchiveConfig.SUMMARY_MAX) %> <%= generate_countdown_html("chapter_summary", ArchiveConfig.SUMMARY_MAX) %>
<%= render "works/notes_form", f: f, type: "chapter" %>
<%= ts("Chapter Text") + "*" %>

<%= ts("Chapter Text") %>

<%= allowed_html_instructions %>

<%= f.text_area :content, id: "content", class: "mce-editor observe_textlength large" %> <%= live_validation_for_field("content", maximum_length: ArchiveConfig.CONTENT_MAX_DISPLAYED, minimum_length: ArchiveConfig.CONTENT_MIN, tooLongMessage: ts("We salute your ambition! But sadly each chapter of a work must be less than %{max} characters long.", max: ArchiveConfig.CONTENT_MAX_DISPLAYED.to_s), tooShortMessage: ts("Brevity is the soul of wit, but your content does have to be at least %{min} characters long.", min: ArchiveConfig.CONTENT_MIN.to_s), failureMessage: ts("Brevity is the soul of wit, but your content does have to be at least %{min} characters long.", min: ArchiveConfig.CONTENT_MIN.to_s)) %> <%= generate_countdown_html("content", ArchiveConfig.CONTENT_MAX_DISPLAYED) %>
<%= ts("Post Chapter") %>

<%= t(".post_notice_html", content_policy_link: link_to(t(".content_policy"), content_path), tos_faq_link: link_to(t(".tos_faq"), tos_faq_path(anchor: "content_faq"))) %>

<% end # form_for %>
<%= content_for :footer_js do %> <%= javascript_tag do %> $j(document).ready(function(){ $j(".toggle_formfield").click(function() { var targetId = $j(this).attr("id").replace("-show", ""); toggleFormField(targetId); }); }) <% end %> <% use_tinymce %> <% end %>