<%#-- copyright OpenProject is a project management system. Copyright (C) 2012-2017 the OpenProject Foundation (OPF) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 3. OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: Copyright (C) 2006-2017 Jean-Philippe Lang Copyright (C) 2010-2013 the ChiliProject Team This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. See doc/COPYRIGHT.rdoc for more details. ++#%> <%= error_messages_for 'custom_field' %>
<%= f.text_field :name, required: true, container_class: '-middle' %>
<%= f.select :field_format, custom_field_formats_for_select(@custom_field), { container_class: '-slim' }, disabled: !@custom_field.new_record? %>
<%= t(:label_min_max_length) %>
(<%= t(:text_min_max_length_info ) %>)
<%= f.number_field :min_length, container_class: '-xslim' %>
<%= f.number_field :max_length, container_class: '-xslim' %>
<%= f.text_field :regexp, size: 50 %> <%=t(:text_regexp_info)%>
<% if @custom_field.class.name == 'WorkPackageCustomField' %>
<% if EnterpriseToken.allows_to?(:multiselect_custom_fields) %> <%= f.check_box :multi_value %> <% else %> <%= render partial: 'enterprise/locked_note' %> <% end %>
<% end %> <% if @custom_field.new_record? || @custom_field.field_format == 'list' %>
<%= I18n.t("activerecord.attributes.custom_field.possible_values") %>
<%= render partial: "custom_fields/custom_options", locals: { custom_options: @custom_field.custom_options, f: f } %> <%= t(:button_add) %>
<% end %>
<% if @custom_field.new_record? || @custom_field.field_format != 'bool' %> <%= f.text_field(:default_value, container_class: '-wide') %> <% end %>
<%= call_hook(:view_custom_fields_form_upper_box, custom_field: @custom_field, form: f) %>
<% case @custom_field.class.name when "WorkPackageCustomField" %>
<%= f.check_box :is_required %>
<%= f.check_box :is_for_all %>
<%= f.check_box :is_filter %>
<%= f.check_box :searchable %>
<% when "UserCustomField" %>
<%= f.check_box :is_required %>
<%= f.check_box :visible %>
<%= f.check_box :editable %>
<% when "ProjectCustomField" %>
<%= f.check_box :is_required %>
<%= f.check_box :visible %>
<%= f.check_box :searchable %>
<% when "TimeEntryCustomField" %>
<%= f.check_box :is_required %>
<% else %>
<%= f.check_box :is_required %>
<% end %> <%= call_hook(:"view_custom_fields_form_#{@custom_field.type.to_s.underscore}", custom_field: @custom_field, form: f) %>