mirror of
https://github.com/meineerde/redmine.git
synced 2025-12-24 09:21:12 +00:00
Refactor custom fields form (#31859).
Patch by Marius BALTEANU. git-svn-id: http://svn.redmine.org/redmine/trunk@18376 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
0d4ed12388
commit
79a47823b2
@ -31,101 +31,37 @@
|
||||
</div>
|
||||
|
||||
<div class="splitcontentright">
|
||||
<% case @custom_field.class.name
|
||||
when "IssueCustomField" %>
|
||||
<div class="box tabular">
|
||||
<p><%= f.check_box :is_required %></p>
|
||||
<% if @custom_field.format.is_filter_supported %>
|
||||
<p><%= f.check_box :is_filter %></p>
|
||||
<% end %>
|
||||
<% if @custom_field.format.searchable_supported %>
|
||||
<p><%= f.check_box :searchable %></p>
|
||||
<% end %>
|
||||
</div>
|
||||
<%= render :partial => 'visibility_by_role_selector' %>
|
||||
|
||||
<% when "UserCustomField" %>
|
||||
<div class="box tabular">
|
||||
<p><%= f.check_box :is_required %></p>
|
||||
<p><%= f.check_box :visible %></p>
|
||||
<p><%= f.check_box :editable %></p>
|
||||
<% if @custom_field.format.is_filter_supported %>
|
||||
<p><%= f.check_box :is_filter %></p>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% when "ProjectCustomField" %>
|
||||
<div class="box tabular">
|
||||
<p><%= f.check_box :is_required %></p>
|
||||
<p><%= f.check_box :visible %></p>
|
||||
<% if @custom_field.format.searchable_supported %>
|
||||
<p><%= f.check_box :searchable %></p>
|
||||
<% end %>
|
||||
<% if @custom_field.format.is_filter_supported %>
|
||||
<p><%= f.check_box :is_filter %></p>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% when "VersionCustomField" %>
|
||||
<div class="box tabular">
|
||||
<p><%= f.check_box :is_required %></p>
|
||||
<% if @custom_field.format.is_filter_supported %>
|
||||
<p><%= f.check_box :is_filter %></p>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% when "GroupCustomField" %>
|
||||
<div class="box tabular">
|
||||
<p><%= f.check_box :is_required %></p>
|
||||
<% if @custom_field.format.is_filter_supported %>
|
||||
<p><%= f.check_box :is_filter %></p>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% when "TimeEntryCustomField" %>
|
||||
<div class="box tabular">
|
||||
<p><%= f.check_box :is_required %></p>
|
||||
<% if @custom_field.format.is_filter_supported %>
|
||||
<p><%= f.check_box :is_filter %></p>
|
||||
<% end %>
|
||||
</div>
|
||||
<%= render :partial => 'visibility_by_role_selector' %>
|
||||
|
||||
<% else %>
|
||||
<div class="box tabular">
|
||||
<p><%= f.check_box :is_required %></p>
|
||||
|
||||
<% if %w(UserCustomField ProjectCustomField).include?(@custom_field.class.name) %>
|
||||
<p><%= f.check_box :visible %></p>
|
||||
<% end %>
|
||||
|
||||
<% if @custom_field.is_a?(UserCustomField) %>
|
||||
<p><%= f.check_box :editable %></p>
|
||||
<% end %>
|
||||
|
||||
<% if %w(IssueCustomField UserCustomField ProjectCustomField VersionCustomField GroupCustomField TimeEntryCustomField).include?(@custom_field.class.name) &&
|
||||
@custom_field.format.is_filter_supported %>
|
||||
<p><%= f.check_box :is_filter %></p>
|
||||
<% end %>
|
||||
|
||||
<% if %w(IssueCustomField ProjectCustomField).include?(@custom_field.class.name) && @custom_field.format.searchable_supported %>
|
||||
<p><%= f.check_box :searchable %></p>
|
||||
<% end %>
|
||||
<%= call_hook(:"view_custom_fields_form_#{@custom_field.type.to_s.underscore}", :custom_field => @custom_field, :form => f) %>
|
||||
</div>
|
||||
<% end %>
|
||||
<%= call_hook(:"view_custom_fields_form_#{@custom_field.type.to_s.underscore}", :custom_field => @custom_field, :form => f) %>
|
||||
|
||||
<% if @custom_field.is_a?(IssueCustomField) %>
|
||||
|
||||
<fieldset class="box" id="custom_field_tracker_ids"><legend><%= toggle_checkboxes_link("#custom_field_tracker_ids input[type=checkbox]") %><%=l(:label_tracker_plural)%></legend>
|
||||
<% tracker_ids = @custom_field.tracker_ids %>
|
||||
<% Tracker.sorted.each do |tracker| %>
|
||||
<%= check_box_tag "custom_field[tracker_ids][]",
|
||||
tracker.id,
|
||||
tracker_ids.include?(tracker.id),
|
||||
:id => "custom_field_tracker_ids_#{tracker.id}" %>
|
||||
<label class="no-css" for="custom_field_tracker_ids_<%=tracker.id%>">
|
||||
<%= tracker.name %>
|
||||
</label>
|
||||
<% if %w(IssueCustomField TimeEntryCustomField).include?(@custom_field.class.name) %>
|
||||
<%= render :partial => 'visibility_by_role_selector', :locals => { :f => f } %>
|
||||
<% end %>
|
||||
<%= hidden_field_tag "custom_field[tracker_ids][]", '' %>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="box"><legend><%= toggle_checkboxes_link("#custom_field_project_ids input[type=checkbox]:enabled") %><%= l(:label_project_plural) %></legend>
|
||||
<p><%= f.check_box :is_for_all, :data => {:disables => '#custom_field_project_ids input'} %></p>
|
||||
<% if @custom_field.is_a?(IssueCustomField) %>
|
||||
<%= render :partial => 'visibility_by_tracker_selector', :locals => { :f => f } %>
|
||||
|
||||
<div id="custom_field_project_ids">
|
||||
<% project_ids = @custom_field.project_ids.to_a %>
|
||||
<%= render_project_nested_lists(Project.all) do |p|
|
||||
content_tag('label', check_box_tag('custom_field[project_ids][]', p.id, project_ids.include?(p.id), :id => nil) + ' ' + p)
|
||||
end %>
|
||||
<%= hidden_field_tag('custom_field[project_ids][]', '', :id => nil) %>
|
||||
</div>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
<%= render :partial => 'visibility_by_project_selector', :locals => { :f => f } %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@ -0,0 +1,11 @@
|
||||
<fieldset class="box"><legend><%= toggle_checkboxes_link("#custom_field_project_ids input[type=checkbox]:enabled") %><%= l(:label_project_plural) %></legend>
|
||||
<p><%= f.check_box :is_for_all, :data => {:disables => '#custom_field_project_ids input'} %></p>
|
||||
|
||||
<div id="custom_field_project_ids">
|
||||
<% project_ids = @custom_field.project_ids.to_a %>
|
||||
<%= render_project_nested_lists(Project.all) do |p|
|
||||
content_tag('label', check_box_tag('custom_field[project_ids][]', p.id, project_ids.include?(p.id), :id => nil) + ' ' + p)
|
||||
end %>
|
||||
<%= hidden_field_tag('custom_field[project_ids][]', '', :id => nil) %>
|
||||
</div>
|
||||
</fieldset>
|
||||
@ -0,0 +1,13 @@
|
||||
<fieldset class="box" id="custom_field_tracker_ids"><legend><%= toggle_checkboxes_link("#custom_field_tracker_ids input[type=checkbox]") %><%=l(:label_tracker_plural)%></legend>
|
||||
<% tracker_ids = @custom_field.tracker_ids %>
|
||||
<% Tracker.sorted.each do |tracker| %>
|
||||
<%= check_box_tag "custom_field[tracker_ids][]",
|
||||
tracker.id,
|
||||
tracker_ids.include?(tracker.id),
|
||||
:id => "custom_field_tracker_ids_#{tracker.id}" %>
|
||||
<label class="no-css" for="custom_field_tracker_ids_<%=tracker.id%>">
|
||||
<%= tracker.name %>
|
||||
</label>
|
||||
<% end %>
|
||||
<%= hidden_field_tag "custom_field[tracker_ids][]", '' %>
|
||||
</fieldset>
|
||||
Loading…
x
Reference in New Issue
Block a user