<% item ||= @item %> <% @collection_item ||= CollectionItem.new %> <% in_page ||= false %>
<% if item.is_a?(Work) %>

<% if current_user.archivist %> <%= t(".add_work_header_html", title: item.title) %> <% else %> <%= t(".invite_header_html", title: item.title) %> <% end %>

<% else %>

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

<% end %> <% # when in the works controller, such as for a non-multi-chapter work, form_for does not set work_id # so the create action of the collection_items controller fails to find the targetted work # hence the klutzy workaround with setting the _id manually in the url, below %> <%= form_for([item, @collection_item], :url => { (item.class.name.foreign_key).to_sym => item.id, :controller => 'collection_items', :action => :create}) do |form| %>
<%= label_tag :collection_names, ts("Collection name(s): ") %>
<%= text_field_tag :collection_names, nil, autocomplete_options("open_collection_names", :size => 40) %>
<%= ts("Submit") %>
<% if item.is_a?(Work) && !current_user.archivist %> <%= form.submit(t(".invite")) %> <% else %> <%= form.submit(t(".add")) %> <% end %> <% if in_page %> <%= ts("Cancel") %> <% else %> <%= link_to ts("Back"), polymorphic_path(item) %> <% end %>
<% end %>