2006-06-28 22:11:03 +04:00
|
|
|
<%= error_messages_for 'custom_field' %>
|
|
|
|
|
2007-02-03 15:57:33 +03:00
|
|
|
<script type="text/javascript">
|
|
|
|
//<![CDATA[
|
2006-12-17 17:22:09 +03:00
|
|
|
function toggle_custom_field_format() {
|
2012-07-22 17:29:26 +04:00
|
|
|
var format = $("#custom_field_field_format").val();
|
|
|
|
var p_length = $("#custom_field_min_length");
|
|
|
|
var p_regexp = $("#custom_field_regexp");
|
|
|
|
var p_values = $("#custom_field_possible_values");
|
|
|
|
var p_searchable = $("#custom_field_searchable");
|
|
|
|
var p_default = $("#custom_field_default_value");
|
|
|
|
var p_multiple = $("#custom_field_multiple");
|
|
|
|
// can't change type on JQuery objects
|
|
|
|
var p_default2 = document.getElementById("custom_field_default_value");
|
2011-08-02 16:42:08 +04:00
|
|
|
|
2012-07-22 17:29:26 +04:00
|
|
|
p_default2.type = 'text';
|
|
|
|
p_default.parent().show();
|
2011-08-02 16:42:08 +04:00
|
|
|
|
2012-07-22 17:29:26 +04:00
|
|
|
switch (format) {
|
2006-12-17 17:22:09 +03:00
|
|
|
case "list":
|
2012-07-22 17:29:26 +04:00
|
|
|
p_length.parent().hide();
|
|
|
|
p_regexp.parent().hide();
|
|
|
|
p_searchable.parent().show();
|
|
|
|
p_values.parent().show();
|
|
|
|
p_multiple.parent().show();
|
2006-12-17 17:22:09 +03:00
|
|
|
break;
|
|
|
|
case "bool":
|
2012-07-22 17:29:26 +04:00
|
|
|
p_default2.type = 'checkbox';
|
|
|
|
p_length.parent().hide();
|
|
|
|
p_regexp.parent().hide();
|
|
|
|
p_searchable.parent().hide();
|
|
|
|
p_values.parent().hide();
|
|
|
|
p_multiple.parent().hide();
|
2008-01-21 00:29:51 +03:00
|
|
|
break;
|
|
|
|
case "date":
|
2012-07-22 17:29:26 +04:00
|
|
|
p_length.parent().hide();
|
|
|
|
p_regexp.parent().hide();
|
|
|
|
p_searchable.parent().hide();
|
|
|
|
p_values.parent().hide();
|
|
|
|
p_multiple.parent().hide();
|
2007-12-14 21:54:55 +03:00
|
|
|
break;
|
|
|
|
case "float":
|
|
|
|
case "int":
|
2012-07-22 17:29:26 +04:00
|
|
|
p_length.parent().show();
|
|
|
|
p_regexp.parent().show();
|
|
|
|
p_searchable.parent().hide();
|
|
|
|
p_values.parent().hide();
|
|
|
|
p_multiple.parent().hide();
|
2006-12-17 17:22:09 +03:00
|
|
|
break;
|
2011-09-18 06:48:22 +04:00
|
|
|
case "user":
|
2011-04-01 17:44:58 +04:00
|
|
|
case "version":
|
2012-07-22 17:29:26 +04:00
|
|
|
p_length.parent().hide();
|
|
|
|
p_regexp.parent().hide();
|
|
|
|
p_searchable.parent().hide();
|
|
|
|
p_values.parent().hide();
|
|
|
|
p_multiple.parent().show();
|
|
|
|
p_default.parent().hide();
|
2011-09-18 06:48:22 +04:00
|
|
|
break;
|
2006-12-17 17:22:09 +03:00
|
|
|
default:
|
2012-07-22 17:29:26 +04:00
|
|
|
p_length.parent().show();
|
|
|
|
p_regexp.parent().show();
|
|
|
|
p_searchable.parent().show();
|
|
|
|
p_values.parent().hide();
|
|
|
|
p_multiple.parent().hide();
|
2006-12-17 17:22:09 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2007-02-03 15:57:33 +03:00
|
|
|
|
|
|
|
//]]>
|
2006-12-17 17:22:09 +03:00
|
|
|
</script>
|
|
|
|
|
2011-12-09 22:15:55 +04:00
|
|
|
<div class="box tabular">
|
2006-12-17 17:22:09 +03:00
|
|
|
<p><%= f.text_field :name, :required => true %></p>
|
2011-04-01 17:44:58 +04:00
|
|
|
<p><%= f.select :field_format, custom_field_formats_for_select(@custom_field), {}, :onchange => "toggle_custom_field_format();",
|
2011-09-18 06:48:22 +04:00
|
|
|
:disabled => !@custom_field.new_record? %></p>
|
2012-01-30 01:10:18 +04:00
|
|
|
<p><%= f.check_box :multiple, :disabled => @custom_field.multiple && !@custom_field.new_record? %></p>
|
2006-09-02 17:33:23 +04:00
|
|
|
<p><label for="custom_field_min_length"><%=l(:label_min_max_length)%></label>
|
2006-12-17 17:22:09 +03:00
|
|
|
<%= f.text_field :min_length, :size => 5, :no_label => true %> -
|
2011-08-21 04:59:31 +04:00
|
|
|
<%= f.text_field :max_length, :size => 5, :no_label => true %><br />(<%=l(:text_min_max_length_info)%>)</p>
|
|
|
|
<p><%= f.text_field :regexp, :size => 50 %><br />(<%=l(:text_regexp_info)%>)</p>
|
2011-03-04 17:55:33 +03:00
|
|
|
<p>
|
2011-09-18 06:48:22 +04:00
|
|
|
<%= f.text_area :possible_values, :value => @custom_field.possible_values.to_a.join("\n"), :rows => 15 %>
|
2012-02-03 00:07:37 +04:00
|
|
|
<em class="info"><%= l(:text_custom_field_possible_values_info) %></em>
|
2011-03-04 17:55:33 +03:00
|
|
|
</p>
|
2008-01-21 00:29:51 +03:00
|
|
|
<p><%= @custom_field.field_format == 'bool' ? f.check_box(:default_value) : f.text_field(:default_value) %></p>
|
2009-03-21 03:22:59 +03:00
|
|
|
<%= call_hook(:view_custom_fields_form_upper_box, :custom_field => @custom_field, :form => f) %>
|
2007-03-12 20:59:02 +03:00
|
|
|
</div>
|
2006-06-28 22:11:03 +04:00
|
|
|
|
2011-12-09 22:15:55 +04:00
|
|
|
<div class="box tabular">
|
2009-01-17 11:25:55 +03:00
|
|
|
<% case @custom_field.class.name
|
2007-03-12 20:59:02 +03:00
|
|
|
when "IssueCustomField" %>
|
2011-08-02 16:42:08 +04:00
|
|
|
|
2007-03-12 20:59:02 +03:00
|
|
|
<fieldset><legend><%=l(:label_tracker_plural)%></legend>
|
2012-05-26 00:18:55 +04:00
|
|
|
<% Tracker.sorted.all.each do |tracker| %>
|
2011-10-30 04:27:33 +04:00
|
|
|
<%= check_box_tag "custom_field[tracker_ids][]",
|
|
|
|
tracker.id,
|
|
|
|
(@custom_field.trackers.include? tracker),
|
|
|
|
:id => "custom_field_tracker_ids_#{tracker.id}" %>
|
|
|
|
<label class="no-css" for="custom_field_tracker_ids_<%=tracker.id%>">
|
|
|
|
<%= h(tracker.name) %>
|
|
|
|
</label>
|
2006-12-17 17:22:09 +03:00
|
|
|
<% end %>
|
2011-09-18 06:48:22 +04:00
|
|
|
<%= hidden_field_tag "custom_field[tracker_ids][]", '' %>
|
2007-03-12 20:59:02 +03:00
|
|
|
</fieldset>
|
2006-12-17 17:22:09 +03:00
|
|
|
|
|
|
|
<p><%= f.check_box :is_required %></p>
|
|
|
|
<p><%= f.check_box :is_for_all %></p>
|
2007-04-17 14:53:20 +04:00
|
|
|
<p><%= f.check_box :is_filter %></p>
|
2007-12-14 21:54:55 +03:00
|
|
|
<p><%= f.check_box :searchable %></p>
|
2011-08-02 16:42:08 +04:00
|
|
|
|
2006-12-17 17:22:09 +03:00
|
|
|
<% when "UserCustomField" %>
|
|
|
|
<p><%= f.check_box :is_required %></p>
|
2010-11-07 17:15:01 +03:00
|
|
|
<p><%= f.check_box :visible %></p>
|
2009-01-17 14:18:04 +03:00
|
|
|
<p><%= f.check_box :editable %></p>
|
2006-07-29 13:32:58 +04:00
|
|
|
|
2006-12-17 17:22:09 +03:00
|
|
|
<% when "ProjectCustomField" %>
|
|
|
|
<p><%= f.check_box :is_required %></p>
|
2010-11-07 17:15:01 +03:00
|
|
|
<p><%= f.check_box :visible %></p>
|
2010-02-28 13:55:24 +03:00
|
|
|
<p><%= f.check_box :searchable %></p>
|
2006-07-29 13:32:58 +04:00
|
|
|
|
2008-07-22 22:52:00 +04:00
|
|
|
<% when "TimeEntryCustomField" %>
|
|
|
|
<p><%= f.check_box :is_required %></p>
|
|
|
|
|
2009-10-22 02:34:22 +04:00
|
|
|
<% else %>
|
|
|
|
<p><%= f.check_box :is_required %></p>
|
2011-08-02 16:42:08 +04:00
|
|
|
|
2006-07-29 13:32:58 +04:00
|
|
|
<% end %>
|
2009-03-21 03:22:59 +03:00
|
|
|
<%= call_hook(:"view_custom_fields_form_#{@custom_field.type.to_s.underscore}", :custom_field => @custom_field, :form => f) %>
|
2006-07-29 13:32:58 +04:00
|
|
|
</div>
|
2007-12-14 21:54:55 +03:00
|
|
|
<%= javascript_tag "toggle_custom_field_format();" %>
|