summaryrefslogtreecommitdiffstats
path: root/app/views/custom_fields/_form.html.erb
blob: 1157ab9fc22caa6aca20a579a0e659dfa233dfe6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<%= error_messages_for 'custom_field' %>

<div class="box tabular">
<p><%= f.text_field :name, :required => true %></p>
<p><%= f.select :field_format, custom_field_formats_for_select(@custom_field), {}, :disabled => !@custom_field.new_record? %></p>

<% if @custom_field.format_in? 'list', 'user', 'version' %>
<p>
  <%= f.check_box :multiple %>
  <% if !@custom_field.new_record? && @custom_field.multiple %>
  <em class="info"><%= l(:text_turning_multiple_off) %></em>
  <% end %>
</p>
<% end %>

<% unless @custom_field.format_in? 'list', 'bool', 'date', 'user', 'version' %>
<p><label for="custom_field_min_length"><%=l(:label_min_max_length)%></label>
   <%= 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>
<p><%= f.text_field :regexp, :size => 50 %><br />(<%=l(:text_regexp_info)%>)</p>
<% end %>

<% if @custom_field.format_in? 'list' %>
<p>
  <%= f.text_area :possible_values, :value => @custom_field.possible_values.to_a.join("\n"), :rows => 15 %>
  <em class="info"><%= l(:text_custom_field_possible_values_info) %></em>
</p>
<% end %>

<% case @custom_field.field_format %>
<% when 'bool' %>
  <p><%= f.check_box(:default_value) %></p>
<% when 'text' %>
  <p><%= f.text_area(:default_value, :rows => 8) %></p>
<% when 'user', 'version' %>
<% else %>
  <p><%= f.text_field(:default_value) %></p>
<% end %>

<%= call_hook(:view_custom_fields_form_upper_box, :custom_field => @custom_field, :form => f) %>
</div>

<div class="box tabular">
<% case @custom_field.class.name
when "IssueCustomField" %>

    <fieldset><legend><%=l(:label_tracker_plural)%></legend>
    <% Tracker.sorted.all.each do |tracker| %>
      <%= 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>
    <% end %>
    <%= hidden_field_tag "custom_field[tracker_ids][]", '' %>
    </fieldset>
    &nbsp;
    <p><%= f.check_box :is_required %></p>
    <p><%= f.check_box :is_for_all %></p>
    <p><%= f.check_box :is_filter %></p>
    <p><%= f.check_box :searchable %></p>

<% when "UserCustomField" %>
    <p><%= f.check_box :is_required %></p>
    <p><%= f.check_box :visible %></p>
    <p><%= f.check_box :editable %></p>
    <p><%= f.check_box :is_filter %></p>

<% when "ProjectCustomField" %>
    <p><%= f.check_box :is_required %></p>
    <p><%= f.check_box :visible %></p>
    <p><%= f.check_box :searchable %></p>
    <p><%= f.check_box :is_filter %></p>

<% when "VersionCustomField" %>
    <p><%= f.check_box :is_required %></p>
    <p><%= f.check_box :is_filter %></p>

<% when "GroupCustomField" %>
    <p><%= f.check_box :is_required %></p>
    <p><%= f.check_box :is_filter %></p>

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

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

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