<%= simple_form_for @test_setting, html: { class: "smart-form" } do |f| %> <% if f.object.errors[:base].present? %>
<%= f.object.errors[:base].first %>
<% end %>
<% content_for :js do %> <%= javascript_include_tag 'views/test_settings/form' %> <% end %>
<%= f.input :exam_setting_type, as: :select2, elements: ExamSettingTypes.to_select.to_json %>
<%= f.input :year, input_html: { max_length: 4 } %>
<%= f.association :school_term_type_step, as: :select2, elements: SchoolTermTypeStep.to_select2( current_user.current_school_year ).to_json, required: true %>
Selecionar todos
<%= f.input :unities, as: :select2, multiple: true, elements: @unities, required: true, input_html: { value: f.object.unities.join(','), data: { without_json_parser: true } } %>
Selecionar todos
<%= hidden_field_tag :grades_list %> <%= f.input :grades, as: :select2, multiple: true, elements: grades, input_html: { value: f.object.grades.join(','), data: { without_json_parser: true } } %>
<%= f.input :maximum_score %>
<%= f.input :minimum_score, input_html: { rel: 'popover-hover', data: { placement: 'top', content: t('test_settings.form.minimum_score_warn.'), toggle: 'popover' } } %>
<%= f.input :number_of_decimal_places %>
<%= f.input :average_calculation_type, as: :select2, elements: AverageCalculationTypes.to_select.to_json %>
<%= f.input :default_division_weight, input_html: { min: 1 }, required: true %>
<%= t('.tests') %>

<%= t('.allow_break_up_info_html') %>

<% if f.object.errors[:tests].any? %>
<% f.object.errors[:tests].each do |error| %> <%= error %>
<% end %>
<% end %>
<%= f.association :tests do |p| %> <%= render 'test_fields', f: p %> <% end %>
<%= TestSettingTest.human_attribute_name :description %> <%= TestSettingTest.human_attribute_name :weight %> <%= TestSettingTest.human_attribute_name :allow_break_up %>
<%= t('.no_item_found') %>
<%= link_to_add_association t('.add_test'), f, :tests, 'data-association-insertion-method': 'append', 'data-association-insertion-node': '#test-settings-tests', class: 'btn btn-success btn-sm' %>
<% end %>