Newer
Older
dmpopidor / app / views / branded / plans / _research_output_fields.html.erb
<%# locals: { plan, research_output, research_output_types } %>
<% other_type_displayed = research_output.type && research_output.type.is_other ? '' : 'display:none;' %>
<% edit_mode = research_output.is_default ? '' : "display:none;" %>
<% display_mode = research_output.is_default ? "display:none;" : '' %>
<div class='research-output-element <%= research_output_index != 0 ? '' : 'inactive' %>'>
  <div class='research-output-fields'>
    <div class='research-output-field form-group research-output-abbreviation'>
      <%= f.label :abbreviation, d_('dmpopidor', 'Abbreviated Name (20 chars max.)'),  class: 'control-label' %>
      <%= f.text_field :abbreviation, maxlength: 20, class: 'form-control input', "aria-required": true, style: edit_mode,
                   'data-toggle': 'tooltip', title: d_('dmpopidor', 'Research output name (20 chars max.)') %>
      <span class="readonly-value" style="<%= display_mode %>"><%= research_output.abbreviation ? research_output.abbreviation : _('None') %></span>
    </div>
    <div class='research-output-field form-group research-output-fullname'>
      <%= f.label :fullname, d_('dmpopidor', 'Fullname'), class: 'control-label' %>
      <%= f.text_field :fullname, class: 'form-control input', "aria-required": true, style: edit_mode,
                   'data-toggle': 'tooltip', title: d_('dmpopidor', 'Research output fullname')   %>
      <span class="readonly-value" style="<%= display_mode %>"><%= research_output.fullname ? research_output.fullname : _('None')  %></span>
    </div>
    <div class='research-output-field form-group research-output-type'>
      <%= f.label :research_output_type_id, d_('dmpopidor', 'Type'), class: 'control-label' %>
      <a href="<%= research_output_types_path %>" target="_blank" 
         title="<%= d_('dmpopidor', 'Click here to find out more about research output types.') %>">
        <i class="fa fa-info-circle"></i>
      </a>
      <%= f.select(:research_output_type_id, 
                    options_for_select(
                      research_output_types.map{ |r| [r.label, r.id, { 'data-other' => r.is_other }] }, 
                      selected: research_output.research_output_type_id, disabled: ""
                    ),
                    { prompt: d_('dmpopidor', 'Please select the type of your research output.') },
                    { multiple: false, class: 'form-control research-output-type-select input', "aria-required": true, style: edit_mode,
                   'data-toggle': 'tooltip', title: d_('dmpopidor', 'Please select a resource type from the list.') }) 
      %>
      <span class="readonly-value"  style="<%= display_mode %>"><%= research_output.type ? research_output.type.label : _('None')  %></span>
    </div>
    <div class='research-output-field form-group research-output-other-type-label' style='<%= other_type_displayed %>'>
      <%= f.label :other_type_label, d_('dmpopidor', 'Other Type'), class: 'control-label' %>
      <%= f.text_field :other_type_label, class: 'form-control input', "aria-required": true, required: other_type_displayed == '' ? true : false, style: edit_mode %>
        <span class="readonly-value" style="<%= display_mode %>"><%= research_output.other_type_label %></span>
    </div>
    <div class='research-output-field form-group research-output-pid'>
      <%= f.label :pid, d_('dmpopidor', 'Persistent Identifier'), class: 'control-label' %>
      <%= f.text_field :pid, class: 'form-control input', style: edit_mode,
                   'data-toggle': 'tooltip', title: d_('dmpopidor', 'If exists, please fill in the research output persistant identifier.')  %>
        <span class="readonly-value" style="<%= display_mode %>"><%= research_output.pid ? research_output.pid : _('None') %></span>
    </div>
    <%= f.hidden_field :order, class: 'research-output-order' %>
  </div>
  <div class='research-output-actions'>
    <i class="fa fa-edit pull-left edit" aria-hidden="true" style="<%= display_mode %>"
             title="<%= d_('dmpopidor', 'Edit research output') %>"></i>
    <% if plan.research_outputs.length > 1 && research_output_index != 0 %>
      <i class="fa fa-arrows handle" aria-hidden="true" style="<%= display_mode %>"
              title="<%= d_('dmpopidor', 'Move research output') %>"></i>
      <%= link_to plan_research_output_url(plan, research_output), 
                  data: {:confirm => d_('dmpopidor', 'Deleting this research output will remove the associated answers. Do you confirm ?')}, 
                  :method => :delete  do %>
        <i class="fa fa-close pull-right delete" aria-hidden="true" style="<%= display_mode %>"
              title="<%= d_('dmpopidor', 'Delete research output') %>" %></i>
      <% end %>
    <% end %>
  </div>
  <hr/>
</div>