% types = @challenge.class::PROMPT_TYPES.select {|t| @challenge.allowed(t) > @challenge.required(t)} %>
<% unless types.empty? %>
<%= form_tag({}, {:method => :get}) do %>
<%= ts("Add Prompts") %>
<%= ts("Add Prompts") %>
<%= ts("Since you don't have JavaScript turned on, please tell us how many #{types.to_sentence} you want to submit: ") %>
<% types.each do |type| %>
<%= label_tag "num_#{type}", ts("#{type.classify.pluralize} (Up to %{allowed}):", :allowed => @challenge.allowed(type)) %>
<%= text_field_tag "num_#{type}", params["num_#{type}"] || @challenge.required(type), :class => "number" %>
<% end %>
<%= ts("Submit") %>
<%= submit_tag ts('Update Form') %>
<% end %>
<% end %>
<%= form_for([@collection, @challenge_signup], :url => (@challenge_signup.new_record? ? collection_signups_path(@collection) : collection_signup_path(@collection))) do |signup_form| %>
<% if !@current_user&.preference&.allow_gifts? %>
<%= t(".notice.preference.#{@collection.challenge_type.underscore}",
preferences_link: link_to(
t(".notice.preference.preferences_link_text"),
user_preferences_path(@current_user)),
refuse_link: link_to(
t(".notice.preference.refuse_link_text"),
archive_faq_path("your-account", anchor: "refusegift"))
).html_safe %>
<% end %>
<% if @collection.challenge_type == "GiftExchange" %>
<%= ts("Challenge maintainers will have access to the email address associated with your AO3 account for the purpose of communicating with you about the challenge.") %>
<% end %>
<%= ts("* Required information") %>
<% unless @challenge_signup.errors.empty? %>
<%= ts("There were some problems with this submission. Please correct the mistakes below.") %>
<% end %>
<%= error_messages_for @challenge_signup %>
<%= render "signup_form_general_information", :form => signup_form %>
<% # requests and offers section %>
<% @challenge.class::PROMPT_TYPES.each do |prompt_type| %>
<%= prompt_type.capitalize %>
<%= prompt_type.capitalize %> (<%= @challenge.allowed_range_string(prompt_type) %>)
<% unless sanitize_field(@challenge, "signup_instructions_#{prompt_type}".to_sym).blank? %>
<%=raw sanitize_field(@challenge, "signup_instructions_#{prompt_type}".to_sym) %>
<% end %>
<% @challenge_signup.send("#{prompt_type}").each_with_index do |prompt, index| %>
<%= error_messages_for(prompt).html_safe unless !prompt.errors.present? %>
<%= signup_form.fields_for prompt_type.to_sym, prompt do |prompt_form| %>
<%= render "prompts/prompt_form", :form => prompt_form, :index => index, :required => (index < @challenge.required(prompt_type)) %>
<% end %>
<% end %>
<% if @challenge.allowed(prompt_type) > @challenge.required(prompt_type) %>
<% linktext = ts("Add another %{type}? (Up to %{allowed} allowed.)", :type => prompt_type.singularize, :allowed => @challenge.allowed(prompt_type)) %>
<%= link_to_add_section(linktext, signup_form, prompt_type.to_sym, "prompts/prompt_form", :required => false) %>
<% end %>
<% end # requests & offers section %>
<%= submit_fieldset signup_form %>
<% end %>