%#-- copyright
OpenProject is a project management system.
Copyright (C) 2012-2013 the OpenProject Team
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License version 3.
See doc/COPYRIGHT.rdoc for more details.
++#%>
<%= header_tags %>
<% unless User.current.impaired? %>
<%# TODO: Require autocompleter inside select_boxes.js
For lack of a requiring policy (such as requirejs), just include the
autocompleter on its own.
%>
<%= javascript_include_tag "timelines_autocompleter.js" %>
<%= javascript_include_tag "timelines_select_boxes.js" %>
<% end %>
<%= form_for :project_association,
:url => project_project_associations_path(@project),
:html => {:method => 'post'} do |f| %>
<% title = l('timelines.project_association_new',
:project_a => h(@project.name),
:project_b => '?') %>
<%= title.tap { |t| html_title t } %>
<%= label_tag 'project_association_select_project_b_id', l('timelines.project_association_new_for_with',
:project_a => h(@project.name)) %>
<% if User.current.impaired? %>
<%= select("project_association_select", "project_b_id",
grouped_options_for_select(@associated_project_candidates_by_type.collect do |type, projects|
[type.try(:name) || l('timelines.without_project_type'), projects.collect do |candidate|
[candidate.name, candidate.id]
end]
end)) %>
<% else %>
<%= select("project_association_select", "project_b_id",
options_for_select([]),
{},
{ :'data-ajaxURL' => url_for({:controller => "/api/v2/project_associations",
:action => "available_projects",
:format => "json"})
})
%>
<% end %>
<%= render :partial => 'form', :locals => {:f => f, :project => @project} %>
<%= f.submit l("timelines.add_project_association"), :name => nil %>
<%= link_to l(:button_cancel), project_project_associations_path(@project) %>
<% end %>
<% content_for :header_tags do %>
<%= stylesheet_link_tag 'timelines.css', :plugin => 'chiliproject_timelines', :media => "all" %>
<% end %>