<%#-- copyright OpenProject is an open source project management software. Copyright (C) the OpenProject GmbH 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-2013 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 COPYRIGHT and LICENSE files for more details. ++#%> <% format_dependent = OpenProject::CustomFieldFormatDependent.new(@custom_field.field_format) %>
<%= f.text_field :name, required: true, container_class: '-middle' %>
<% if @custom_field.type == 'ProjectCustomField' %>
<%= f.select :custom_field_section_id, ProjectCustomFieldSection.all.collect { |s| [s.name, s.id] }, { container_class: '-slim' }, required: true %>
<% end %>
<%= f.select :field_format, custom_field_formats_for_select(@custom_field), { container_class: '-slim' }, disabled: !@custom_field.new_record?, data: { action: 'admin--custom-fields#formatChanged', 'admin--custom-fields-target': 'format' } %>
>
<%= 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, container_class: '-wide' %> <%= t(:text_regexp_info) %>
<% if @custom_field.new_record? || @custom_field.multi_value_possible? %>
> <%= f.check_box :multi_value, data: { action: 'admin--custom-fields#checkOnlyOne' } %>
> <%= I18n.t("activerecord.attributes.custom_field.possible_values") %> <% if @custom_field.persisted? %>
<%= link_to t('custom_fields.reorder_alphabetical'), { action: :reorder_alphabetical }, method: :post, data: { confirm: t('custom_fields.reorder_confirmation') } %>
<% end %>
<%= render partial: "custom_fields/custom_options", locals: { custom_field: @custom_field, f: f } %>
<% end %> <% if @custom_field.new_record? || @custom_field.allow_non_open_versions_possible? %>
> <%= f.check_box :allow_non_open_versions %>
<% end %> <% if @custom_field.new_record? || !%w[text bool].include?(@custom_field.field_format) %>
> <%= f.text_field :default_value, id: 'custom_fields_default_value_text', for: 'custom_fields_default_value_text', container_class: '-wide' %>
<% end %> <% if @custom_field.new_record? || @custom_field.field_format == 'bool' %>
> <%= f.check_box :default_value, id: 'custom_fields_default_value_bool', for: 'custom_fields_default_value_bool' %>
<% end %> <% if @custom_field.new_record? || @custom_field.field_format == 'text' %>
> <%= f.text_area :default_value, id: 'custom_fields_default_value_longtext', for: 'custom_fields_default_value_longtext', cols: 100, rows: 20, class: 'wiki-edit', macros: "none", with_text_formatting: true %>
<% 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 %>

<%= t('custom_fields.instructions.is_required') %>

<%= f.check_box :is_for_all %>

<%= t('custom_fields.instructions.is_for_all') %>

<%= f.check_box :is_filter %>

<%= t('custom_fields.instructions.is_filter') %>

> <%= f.check_box :searchable %>

<%= t('custom_fields.instructions.searchable') %>

> <%= f.check_box :content_right_to_left %>
<% when "UserCustomField" %>
<%= f.check_box :is_required %>

<%= t('custom_fields.instructions.is_required') %>

<%= f.check_box :admin_only %>

<%= t('custom_fields.instructions.admin_only') %>

<%= f.check_box :editable %>

<%= t('custom_fields.instructions.editable') %>

<% when "ProjectCustomField" %>
<%= f.check_box :is_required %>

<%= t('custom_fields.instructions.is_required_for_project') %>

<%= f.check_box :admin_only %>

<%= t('custom_fields.instructions.admin_only') %>

> <%= f.check_box :searchable %>

<%= t('custom_fields.instructions.searchable_for_project') %>

<% when "TimeEntryCustomField" %>
<%= f.check_box :is_required %>

<%= t('custom_fields.instructions.is_required') %>

<% else %>
<%= f.check_box :is_required %>

<%= t('custom_fields.instructions.is_required') %>

<% end %> <%= call_hook(:"view_custom_fields_form_#{@custom_field.type.to_s.underscore}", custom_field: @custom_field, form: f) %>