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() {
|
|
|
|
format = $("custom_field_field_format");
|
|
|
|
p_length = $("custom_field_min_length");
|
|
|
|
p_regexp = $("custom_field_regexp");
|
|
|
|
p_values = $("custom_field_possible_values");
|
2007-12-14 21:54:55 +03:00
|
|
|
p_searchable = $("custom_field_searchable");
|
2008-01-21 00:29:51 +03:00
|
|
|
p_default = $("custom_field_default_value");
|
|
|
|
|
|
|
|
p_default.setAttribute('type','text');
|
|
|
|
Element.show(p_default.parentNode);
|
|
|
|
|
2006-12-17 17:22:09 +03:00
|
|
|
switch (format.value) {
|
|
|
|
case "list":
|
|
|
|
Element.hide(p_length.parentNode);
|
|
|
|
Element.hide(p_regexp.parentNode);
|
2008-01-21 00:29:51 +03:00
|
|
|
if (p_searchable) Element.show(p_searchable.parentNode);
|
2007-02-03 15:57:33 +03:00
|
|
|
Element.show(p_values);
|
2006-12-17 17:22:09 +03:00
|
|
|
break;
|
|
|
|
case "bool":
|
2008-01-21 00:29:51 +03:00
|
|
|
p_default.setAttribute('type','checkbox');
|
|
|
|
Element.hide(p_length.parentNode);
|
|
|
|
Element.hide(p_regexp.parentNode);
|
|
|
|
if (p_searchable) Element.hide(p_searchable.parentNode);
|
|
|
|
Element.hide(p_values);
|
|
|
|
break;
|
|
|
|
case "date":
|
2006-12-17 17:22:09 +03:00
|
|
|
Element.hide(p_length.parentNode);
|
|
|
|
Element.hide(p_regexp.parentNode);
|
2008-01-21 00:29:51 +03:00
|
|
|
if (p_searchable) Element.hide(p_searchable.parentNode);
|
2007-12-14 21:54:55 +03:00
|
|
|
Element.hide(p_values);
|
|
|
|
break;
|
|
|
|
case "float":
|
|
|
|
case "int":
|
|
|
|
Element.show(p_length.parentNode);
|
|
|
|
Element.show(p_regexp.parentNode);
|
2008-01-21 00:29:51 +03:00
|
|
|
if (p_searchable) Element.hide(p_searchable.parentNode);
|
2007-02-03 15:57:33 +03:00
|
|
|
Element.hide(p_values);
|
2006-12-17 17:22:09 +03:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
Element.show(p_length.parentNode);
|
|
|
|
Element.show(p_regexp.parentNode);
|
2008-01-21 00:29:51 +03:00
|
|
|
if (p_searchable) Element.show(p_searchable.parentNode);
|
2007-10-25 21:38:05 +04:00
|
|
|
Element.hide(p_values);
|
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>
|
|
|
|
|
2006-07-29 13:32:58 +04:00
|
|
|
<div class="box">
|
2006-12-17 17:22:09 +03:00
|
|
|
<p><%= f.text_field :name, :required => true %></p>
|
2007-03-12 20:59:02 +03:00
|
|
|
<p><%= f.select :field_format, custom_field_formats_for_select, {}, :onchange => "toggle_custom_field_format();" %></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 %> -
|
|
|
|
<%= f.text_field :max_length, :size => 5, :no_label => true %><br>(<%=l(:text_min_max_length_info)%>)</p>
|
2007-03-12 20:59:02 +03:00
|
|
|
<p><%= f.text_field :regexp, :size => 50 %><br>(<%=l(:text_regexp_info)%>)</p>
|
2009-01-17 00:02:03 +03:00
|
|
|
<p id="custom_field_possible_values"><%= f.text_area :possible_values, :value => @custom_field.possible_values.to_a.join("\n"),
|
|
|
|
:cols => 20,
|
|
|
|
:rows => 15 %>
|
|
|
|
<br /><em><%= l(:text_custom_field_possible_values_info) %></em></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>
|
2007-03-12 20:59:02 +03:00
|
|
|
</div>
|
2006-06-28 22:11:03 +04:00
|
|
|
|
2006-07-29 13:32:58 +04:00
|
|
|
<div class="box">
|
2009-01-17 11:25:55 +03:00
|
|
|
<% case @custom_field.class.name
|
2007-03-12 20:59:02 +03:00
|
|
|
when "IssueCustomField" %>
|
|
|
|
|
|
|
|
<fieldset><legend><%=l(:label_tracker_plural)%></legend>
|
2006-12-17 17:22:09 +03:00
|
|
|
<% for tracker in @trackers %>
|
2009-01-17 11:25:55 +03:00
|
|
|
<%= check_box_tag "custom_field[tracker_ids][]", tracker.id, (@custom_field.trackers.include? tracker) %> <%= tracker.name %>
|
2006-12-17 17:22:09 +03:00
|
|
|
<% end %>
|
2009-01-17 11:25:55 +03: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>
|
2006-12-17 17:22:09 +03:00
|
|
|
|
|
|
|
<% when "UserCustomField" %>
|
|
|
|
<p><%= f.check_box :is_required %></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>
|
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>
|
|
|
|
|
2006-07-29 13:32:58 +04:00
|
|
|
<% end %>
|
|
|
|
</div>
|
2007-12-14 21:54:55 +03:00
|
|
|
<%= javascript_tag "toggle_custom_field_format();" %>
|