<!-- Create a new project (3 dropdowns = 6 options) -->
<%= semantic_form_for @project, :url => {:controller => :projects, :action => :create }, :html=>{:method=>:post} do |f| %>
<%= f.inputs do %>
<%= hidden_field_tag :default_tag, "false" ,:id => "default_tag" %>
<div class="createa-project">
<h1> <%= _('Create a new plan')%> </h1>
<div class="info-new-project">
<p><%= raw _("<p>Please select from the following drop-downs so we can determine what questions and guidance should be displayed in your plan.</p> <p>If you aren't responding to specific requirements from a funder or an institution, <a id='create-default-plan-button' data-toggle='modal' href='#default-template-confirmation-dialog'>select here to write a generic DMP</a> based on the most common themes.</p>")%></p>
</div>
<div class="dropdowns">
<div class="control-group" id="funder-control-group">
<div class="controls">
<%= f.input :funder_id, :as => :select, :collection => @funders, :label => _('If applying for funding, select your research funder.'), :input_html => { :multiple => false, :class => ["select2", "select2-container"] }, :include_blank => _('Select Funder') %>
<div class="div_clear"></div>
<div id="other-funder-link" class="move_2_right">
<a href='#' id="no-funder"><%= _('Not applicable/not listed.')%></a>
</div>
<div class="create_project_question_descriptions">
<%= _('Otherwise leave blank.')%>
</div>
</div>
<div class="div_clear"></div>
<div id="other-funder-name" class="controls" style="display:none;">
<%= f.input :funder_name, :as => :string, :placeholder => _('Funder name'), :label => _('Name of funder, if applicable.') %>
</div>
</div>
<div class="control-group" id="institution-control-group">
<div class="controls">
<%= f.input :institution_id, :as => :select, :collection => @institutions, :label => _('To see institutional questions and/or guidance, select your organisation.'), :input_html => { :multiple => false, :class => ["select2", "select2-container", "typeahead"] }, :include_blank => _('Select Organisation') %>
<div class="div_clear"></div>
<div class="move_2_right">
<a href='#' id="no-institution"><%= _('Not applicable/not listed.')%></a>
</div>
<div class="create_project_question_descriptions">
<%= _('You may leave blank or select a different organisation to your own.')%>
</div>
</div>
</div>
<div class="control-group" id="template-control-group">
<div class="controls">
<li id="project_dmptemplate_id_input" class="select input optional">
<label for="project_dmptemplate_id" class="label">
<%= _('Choose a template') %>
</label>
<select id="project_dmptemplate_id" name="project[dmptemplate_id]" class="select2 select2-container typeahead"></select>
<div class="create_project_question_descriptions">
<%= _('There are a number of possible templates you could use. Please choose one.') %>
</div>
</li>
</div>
</div>
<div class="control-group" id="guidance-control-group">
<div class="controls">
<% other_guidance = GuidanceGroup.all %>
<%= f.input :guidance_groups, :as => :check_boxes, :collection => other_guidance, :label => _('Tick to select any other sources of guidance you wish to see.'), :member_label => :display_name %>
</div>
</div>
</div>
</div>
<% #
# The following JSON arrays are used to build/filter the contents of
# the select2 dropdown box for dmptemplates and the checkboxes for
# the guidance group selections
# (they are referenced in /app/assets/javascripts/projects.js)
# %>
<%= hash_to_js_json_variable('funders',
@funders.collect{ |inst|
{'id': inst.id,
'text': inst.name}
}) %>
<%= hash_to_js_json_variable('institutions',
@institutions.collect{ |inst|
{'id': inst.id,
'text': inst.name,
'default': (current_user.org.id == inst.id)}
}) %>
<%= hash_to_js_json_variable('templates',
@templates.collect{ |tmplt|
{'organisation': tmplt.organisation_id,
'id': tmplt.id,
'text': tmplt.title}
}) %>
<%= hash_to_js_json_variable('guidance_for_template_or_organisation',
@guidance_groups.collect{ |grp|
{'organisation': grp.organisation_id,
'templates': grp.dmptemplates.collect{ |t| t.id },
'id': grp.id,
'text': grp.name}
}) %>
<%= hash_to_js_json_variable('guidance_always_available',
@always_guidance.collect{ |grp|
{'id': grp.id,
'text': grp.name}
}) %>
<% end %>
<!-- submit buttons -->
<%= f.actions do %>
<a id="create-plan-button" style="display:none;" data-toggle="modal" href="#project-confirmation-dialog" class="btn btn-primary"><%= _('Create plan')%></a>
<% end %>
<% end %>