app/views/concepts/_form.html.erb

Summary

Maintainability
Test Coverage
<%= bootstrap_form_for concept,
    :as => :concept,
    :url => concept.new_record? ? concepts_path : concept_path(:published => 0, :id => concept),
    :layout => :horizontal do |f| %>

  <!-- Base data -->
  <fieldset>
    <legend><%= t('txt.common.attributes') %></legend>
    <%= f.text_field :follow_up, :class => 'datepicker' %>
    <%= f.text_field :expired_at, :class => 'datepicker' %>

    <%- Iqvoc::Concept.additional_association_classes.keys.each do |assoc_class| -%>
      <%= render assoc_class.edit_partial_name(concept),
        :concept => concept, :klass => assoc_class, :f => f %>
    <%- end -%>
  </fieldset>
  <!-- / Base data -->

  <!-- Labelings -->
  <fieldset>
    <legend><%= Labeling::Base.model_name.human(:count => 2) %></legend>
    <% unless Iqvoc.const_defined?(:SKOSXL) %>
      <p><%= t 'txt.common.hint_csv_input' %></p>
    <% end %>
    <%- Iqvoc::Concept.labeling_classes.each do |labeling_class, languages| -%>
      <%- languages.each do |language| -%>
        <%= render labeling_class.edit_partial_name(concept), :f => f,
          :concept => concept, :klass => labeling_class, :language => language %>
      <%- end -%>
    <%- end -%>
  </fieldset>
  <!-- / Labelings -->

  <!-- Concept relations -->
  <fieldset>
    <legend><%= Concept::Relation::Base.model_name.human(:count => 2) %></legend>
    <% unless Iqvoc::Concept.broader_relation_class.edit_partial_name(concept).nil? %>
      <%- if Iqvoc::Concept.broader_relation_class.narrower_editable -%>
        <%= render Iqvoc::Concept.broader_relation_class.narrower_class.edit_partial_name(concept),
          :concept => concept, :klass => Iqvoc::Concept.broader_relation_class.narrower_class, :f => f %>
      <%- end -%>

      <%= f.form_group :top_term do %>
        <%= f.check_box :top_term,
          :class => ("exclusive" if Iqvoc::Concept.broader_relation_class.singular?) %>
      <% end %>

      <%= render Iqvoc::Concept.broader_relation_class.edit_partial_name(concept),
        :concept => concept, :klass => Iqvoc::Concept.broader_relation_class, :f => f %>
    <% end %>

    <%- Iqvoc::Concept.further_relation_classes.each do |relation_class| -%>
      <%= render relation_class.edit_partial_name(concept),
        :concept => concept, :klass => relation_class, :f => f %>
    <%- end -%>
  </fieldset>
  <!-- / Concept relations -->

  <!-- Collections -->
  <fieldset>
    <legend><%= Iqvoc::Collection.base_class.model_name.human(:count => 2) %></legend>
    <%= f.form_group :assigned_collection_origins, :label => {:text => t('txt.common.type_to_search')} do %>
      <%= text_field_tag "concept[assigned_collection_origins]",
        concept.assigned_collection_origins.join(InlineDataHelper::JOINER),
        :class => "entity_select",
        :"data-query-url" => collections_path(:format => :json),
        :"data-entity-uri" => collection_path(:id => "{id}"),
        :"data-entities" => concept.collections.map { |c| collection_widget_data(c) }.to_json %>
    <% end %>
  </fieldset>
  <!-- /Collection -->

  <!-- Notes ohne Change Note class -->
  <% Iqvoc::Concept.note_classes.reject { |n| n == Iqvoc.change_note_class  }.each do |note_class| %>
    <% unless note_class.edit_partial_name(concept).nil? %>
      <%= render note_class.edit_partial_name(concept), :owner_klass => concept, :assoc_klass => note_class, :f => f %>
    <% end %>
  <% end %>
  <!-- / Notes -->

  <!-- Matches -->
  <fieldset class="matches" data-datasets="<%= @datasets %>" data-remote-proxy-url="<%= alphabetical_concepts_path %>" data-translation-other="<%= t('txt.common.other') %>" data-no-results-msg="<%= t('txt.views.search_results.no_results') %>">
    <legend><%= Match::Base.model_name.human(:count => 2) %></legend>
    <% Iqvoc::Concept.match_classes.each do |match_class| %>
      <%= render match_class.edit_partial_name(concept), :owner_klass => concept, :assoc_klass => match_class, :f => f %>
    <% end %>
  </fieldset>
  <!-- / Matches -->

  <!-- Notations -->
  <% Iqvoc::Concept.notation_classes.each do |notation_class| %>
    <%= render notation_class.edit_partial_name(concept), :owner_klass => concept, :assoc_klass => notation_class, :f => f %>
  <% end %>
  <!-- / Notations -->

  <!-- Change Note class -->
  <% note_class = Iqvoc.change_note_class %>
  <% unless note_class.edit_partial_name(concept).nil? %>
    <%= render note_class.edit_partial_name(concept), :owner_klass => concept, :assoc_klass => note_class, :f => f %>
  <% end %>
  <!-- / Change Note class -->

  <hr />

  <div class="mb-5">
    <%= f.submit t("txt.common.save"), :class => "btn btn-primary" %>
    <%= link_to t("txt.common.cancel"), concept.new_record? ? dashboard_path : concept_path(:published => 0, :id => concept), :class => "btn btn-outline-secondary" %>
  </div>

<% end %>