SpeciesFileGroup/taxonworks

View on GitHub
app/views/collecting_events/_form.html.erb

Summary

Maintainability
Test Coverage
<p class="feedback feedback-info"> An editor task is available, use <%= link_to('New collecting event', new_collecting_event_task_path(collecting_event_id: @collecting_event.id)) -%>.</p>

<% if @collecting_event.persisted? %>
  <ul class="context-menu">
    <li> <%= collecting_event_tag(@collecting_event) -%>
    <li class="actions">
      <%= button_to "Clone", { action: "clone", id: @collecting_event.id },
        data: { confirm: "Clone this record? Changes will not be saved!" },
        class: 'actions' %>
    </li>

    <%= content_tag(:li, link_to("Browse",
      { action: :index, controller: 'tasks/collecting_events/browse', collecting_event_id: @collecting_event.id },
      data: { confirm: "Browse this record? Changes will not be saved!" })) %>

  <%= content_tag(:li, link_to( "Show", collecting_event_path(@collecting_event),
      data: { confirm: "Leave this record? Changes will not be saved!"})) %>

  <%= content_tag(:li, link_to( "New collection object",
      { action: :index, controller: 'tasks/accessions/comprehensive', collecting_event_id: @collecting_event.id },
      data: { confirm: "Leave this record? Changes will not be saved!"})) %>

  <%= content_tag(:li, link_to( "New", new_collecting_event_path,
      data: { confirm: "Leave this record? Changes will not be saved!"})) %>
  
  <%= content_tag(:li, radial_annotator(@collecting_event)) -%>

  </ul>
  <br/> 
<% end %>

<%= form_for(@collecting_event, html: {id: :collecting_event_form}) do |f| %>
    <%= render 'shared/errors', object: @collecting_event %>

    <div class="actions">
      <%= f.submit %>
    </div>

    <div class="flexbox">
      <div class="item item1">

        <h3> Verbatim values </h3>

        <div class="field">
          <%= f.label :verbatim_locality %>
          <br>
          <%= f.text_area :verbatim_locality, cols: 30 %>
        </div>

        <div class="field">
          <%= f.label :verbatim_date %>
          <br>
          <%= f.text_field :verbatim_date, size: 35 %>
        </div>

        <div class="field">
          <%= f.label :verbatim_collectors %>
          <br>
          <%= f.text_field :verbatim_collectors, size: 35 %>
        </div>

        <div class="field">
          <%= f.label :verbatim_method %>
          <br>
          <%= f.text_field :verbatim_method, size: 35 %>
        </div>

        <div class="field">
          <%= f.label :verbatim_habitat %>
          <br>
          <%= f.text_field :verbatim_habitat, size: 35 %>
        </div>

        <div class="field">
          <%= f.label :verbatim_latitude %>
          <br>
          <%= f.text_field :verbatim_latitude %>
        </div>

        <div class="field">
          <%= f.label :verbatim_longitude %>
          <br>
          <%= f.text_field :verbatim_longitude %>
        </div>

        <div class="field">
          <%= f.label :verbatim_datum %>
          <br>
          <%= f.text_field :verbatim_datum %>
        </div>

        <div class="field">
          <%= f.label :verbatim_geolocation_uncertainty %>
          <br>
          <%= f.text_field :verbatim_geolocation_uncertainty %>
        </div>
        <div class="field">
          <%= f.label :verbatim_trip_identifier %>
          <br>
          <%= f.text_field :verbatim_trip_identifier,  size: 35 %>
        </div>

        <div class="field">
          <%= f.label :verbatim_elevation %>
          <br>
          <%= f.text_field :verbatim_elevation, size: 6 %>
        </div>
      </div>

      <div class="item item2">
        <h3> Parsed data </h3>

        <%= render partial: '/people/role_picker', locals: {role: Collector.new(), object: @collecting_event, f: f} %>

        <div class="field">
          <%= f.label :geographic_area_id, 'Geographic area' %>
          <br>
          <%= render 'workbench/elements/forms/ajax_select',
            controller: 'geographic_areas',
            object:     'collecting_event',
            method:     'geographic_area_id',
            tag_id:     'geographic_area_id_for_collecting_event',
            display:    geographic_area_tag(@collecting_event.geographic_area),
            size:       40
          %>
      </div>

        <div>
          <div class="left_float">
            <h4> Start date </h4>
            <table>
              <tr>
                <td class="field">
                  <%= f.label :start_date_day, :Day %>
                </td>
                <td class="field">
                  <%= f.label :start_date_month, :Month %>
                </td>
                <td class="field">
                  <%= f.label :start_date_year, :Year %>
                </td>
              </tr>
              <tr>
                <td>
                  <%= f.text_field :start_date_day, size: 2 %>
                </td>
                <td>
                  <%= f.select :start_date_month, options_for_select(Utilities::Dates::MONTHS_FOR_SELECT, selected: @collecting_event.start_date_month), include_blank: true -%>
                </td>
                <td>
                  <%= f.text_field :start_date_year, size: 4 %>
                </td>
              </tr>
            </table>
          </div>

          <div class="left_float inline_div">
            <h4> End date </h4>
            <table>
              <tr>
                <td>
                  <%= f.label :end_date_day, :Day %>
                </td>
                <td>
                  <%= f.label :end_date_month, :Month %>
                </td>
                <td>
                  <%= f.label :end_date_year, :Year %>
                </td>
              </tr>
              <tr>
                <td>
                  <%= f.text_field :end_date_day, size: 2 %>
                </td>
                <td>
                  <%= f.select :end_date_month, options_for_select(Utilities::Dates::MONTHS_FOR_SELECT, selected: @collecting_event.end_date_month), include_blank: true -%>
                </td>
                <td>
                  <%= f.text_field :end_date_year, size: 4 %>
                </td>
              </tr>
            </table>
          </div>
          <br class="clear_both">
        </div>

        <div>
          <div class="left_float">

            <h4> Time start </h4>
            <table>
              <tr>
                <td><%= f.label :time_start_hour, :Hour %>  </td>
                <td><%= f.label :time_start_minute, :Minute %> </td>
                <td><%= f.label :time_start_second, :Second %> </td>
              </tr>
              <tr>
                <td> <%= f.select :time_start_hour, options_for_select((0..23), nil), include_blank: true %> </td>
                <td> <%= f.select :time_start_minute, options_for_select((0..59), nil), include_blank: true %>  </td>
                <td> <%= f.select :time_start_second, options_for_select((0..59), nil), include_blank: true %>  </td>
              </tr>
            </table>
          </div>

          <div class="left_float inline_div">
            <h4> Time end </h4>
            <table>
              <tr>
                <td><%= f.label :time_end_hour, :Hour %>  </td>
                <td><%= f.label :time_end_minute, :Minute %> </td>
                <td><%= f.label :time_end_second, :Second %> </td>
              </tr>
              <tr>
                <td> <%= f.select :time_end_hour, options_for_select((0..23), nil), include_blank: true %> </td>
                <td> <%= f.select :time_end_minute, options_for_select((0..59), nil), include_blank: true %>  </td>
                <td> <%= f.select :time_end_second, options_for_select((0..59), nil), include_blank: true %>  </td>
              </tr>
            </table>
          </div>

          <br class="clear_both">
        </div>

        <h4> Elevation </h4>
        <p><em> All values in meters</em></p>

        <table>
          <tr>
            <td class="field"><%= f.label :minimum_elevation, :Minimum %></td>
            <td class="field"><%= f.label :maximum_elevation, :Maximum %></td>
            <td class="field"><%= f.label :elevation_precision, :Precision %></td>
          </tr>
          <tr>
            <td class="field"><%= f.number_field :minimum_elevation, size: 6, step: :any %></td>
            <td class="field"><%= f.number_field :maximum_elevation, size: 6, step: :any %></td>
            <td class="field"><%= f.number_field :elevation_precision, size: 6, step: :any %></td>
          </tr>
        </table>

        <h4 data-help="Autocomplete boxes draw literal values from the Paleobiology database."> Stratigraphy </h4>

        <div class="flexbox">
          <div class="item item1">
            <div class="field">
              <%= f.label :group %>
              <br>
              <%= f.text_field :group, id: :group %>
            </div>

            <div class="field">
              <%= f.label :formation %>
              <br>
              <%= f.text_field :formation, id: :formation %>
            </div>

            <div class="field">
              <%= f.label :member %>
              <br>
              <%= f.text_field :member, id: :member %>
            </div>

            <div class="field">
              <%= f.label :lithology %>
              <br>
              <%= f.text_field :lithology, id: :lithology %>
            </div>
          </div>

          <div class="item item2">
            <div class="field">
              <%= f.label :min_ma %>
              <br>
              <%= f.number_field :min_ma, step: :any, min: 0 %>
            </div>

            <div class="field">
              <%= f.label :max_ma %>
              <br>
              <%= f.number_field :max_ma, step: :any, min: 0 %>
            </div>
          </div>
        </div>

        <br />
        <div class="field label_above">
          <%= f.label :field_notes %>
          <br>
          <%= f.text_area :field_notes, cols: 50, rows:5 %>
        </div>
      </div>


      <div class="item item3">
        <h3> Labels </h3>

        <div class="field label_above">
          <%= f.label :verbatim_label %>
          <br>
          <%= f.text_area :verbatim_label, cols: 30, rows: 8 %>
        </div>

        <div class="field label_above" >
          <%= f.label :print_label %>
          <br>
          <%= f.text_area :print_label, cols: 30, rows: 8 %>
        </div>

        <div class="field label_above">
          <%= f.label :document_label %>
          <br>
          <%= f.text_area :document_label, cols: 30, rows: 8 %>
        </div>
        <br>
     </div>
    </div>

    <div class="actions">
      <%= f.submit %>
    </div>
<% end %>