Merge branch 'feature/18329-foundation-apps-framework-forms-refactor' of github.com:opf/openproject into feature/18329-foundation-apps-framework-forms-refactor

pull/2612/head
Florian Kraft 10 years ago
commit 74c891a092
  1. 13
      app/helpers/custom_fields_helper.rb
  2. 1
      app/helpers/timelines_helper.rb
  3. 4
      app/views/planning_element_type_colors/_form.html.erb
  4. 4
      app/views/planning_element_type_colors/confirm_destroy.html.erb
  5. 20
      app/views/work_packages/bulk/destroy.html.erb
  6. 151
      app/views/work_packages/bulk/edit.html.erb
  7. 134
      app/views/work_packages/moves/new.html.erb

@ -91,7 +91,8 @@ module CustomFieldsHelper
def blank_custom_field_label_tag(name, custom_field)
content_tag 'label', h(custom_field.name) +
(custom_field.is_required? ? content_tag('span', ' *', class: 'required') : ''),
for: "#{name}_custom_field_values_#{custom_field.id}"
for: "#{name}_custom_field_values_#{custom_field.id}",
class: 'form--label'
end
# Return custom field tag with its label tag
@ -105,18 +106,18 @@ module CustomFieldsHelper
field_format = Redmine::CustomFieldFormat.find_by_name(custom_field.field_format)
case field_format.try(:edit_as)
when 'date'
text_field_tag(field_name, '', id: field_id, size: 10) +
styled_text_field_tag(field_name, '', id: field_id, size: 10) +
calendar_for(field_id)
when 'text'
text_area_tag(field_name, '', id: field_id, rows: 3, style: 'width:90%')
styled_text_area_tag(field_name, '', id: field_id, rows: 3)
when 'bool'
select_tag(field_name, options_for_select([[l(:label_no_change_option), ''],
styled_select_tag(field_name, options_for_select([[l(:label_no_change_option), ''],
[l(:general_text_yes), '1'],
[l(:general_text_no), '0']]), id: field_id)
when 'list'
select_tag(field_name, options_for_select([[l(:label_no_change_option), '']] + custom_field.possible_values_options), id: field_id)
styled_select_tag(field_name, options_for_select([[l(:label_no_change_option), '']] + custom_field.possible_values_options), id: field_id)
else
text_field_tag(field_name, '', id: field_id)
styled_text_field_tag(field_name, '', id: field_id)
end
end

@ -192,7 +192,6 @@ module TimelinesHelper
margin-left: 1em;
line-height: 2em;
}
.timelines-color-properties label,
.timelines-pet-properties label,
.timelines-pt-properties label {
display: inline-block;

@ -31,8 +31,8 @@ See doc/COPYRIGHT.rdoc for more details.
<h2><%= color.new_record? ? l('timelines.new_color') : l('timelines.edit_color') %></h2>
<fieldset class="timelines-color-properties">
<legend><%= l('timelines.properties') %></legend>
<fieldset class="form--fieldset">
<legend class="form--fieldset-legend"><%= l('timelines.properties') %></legend>
<div class="form--field">
<%= f.text_field :name, required: true %>

@ -41,8 +41,8 @@ See doc/COPYRIGHT.rdoc for more details.
<%=h @color.name %>
</h2>
<fieldset class="timelines-color-properties">
<legend><%= l('timelines.properties') %></legend>
<fieldset class="form--fieldset">
<legend class="form--fieldset-legend"><%= l('timelines.properties') %></legend>
<p>
<label for="color_hexcode">

@ -31,12 +31,12 @@ See doc/COPYRIGHT.rdoc for more details.
<%= error_messages_for work_packages.first %>
<%= form_tag work_packages_bulk_path, :method => :delete do %>
<%= styled_form_tag work_packages_bulk_path, :method => :delete do %>
<% work_packages.each do |work_package| %>
<%= hidden_field_tag 'ids[]', work_package.id %>
<% end %>
<div class="box">
<div class="form--section">
<%= work_package_associations_to_address(associated) %>
@ -44,20 +44,20 @@ See doc/COPYRIGHT.rdoc for more details.
<strong><%= l(:text_destroy_what_to_do) %></strong>
</p>
<%= fields_for :to_do do |f| %>
<p>
<%= fields_for :to_do, builder: TabularFormBuilder do |f| %>
<div class="form--field">
<%= f.radio_button 'action', 'destroy' %>
<%= f.label 'action_destroy', l(:text_destroy) %>
</p>
<p>
</div>
<div class="form--field">
<%= f.radio_button 'action' , 'nullify' %>
<%= f.label 'action_nullify', l(:text_assign_to_project) %>
</p>
<p>
</div>
<div class="form--field">
<%= f.radio_button 'action', 'reassign', :onclick => 'if(jQuery("#to_do_action_reassign").prop("checked")) { jQuery("#to_do_reassign_to_id").focus(); }' %>
<%= f.label 'action_reassign', l(:text_reassign) %>
@ -65,10 +65,10 @@ See doc/COPYRIGHT.rdoc for more details.
<%= f.label 'reassign_to_id', l(:text_reassign_to) %>
<%= f.text_field 'reassign_to_id', :value => params[:reassign_to_id], :size => 6, :onfocus => 'jQuery("#to_do_action_reassign").prop("checked", true);' %>
</p>
</div>
<% end %>
</div>
<%= submit_tag l(:button_apply), class: 'button -highlight' %>
<%= styled_submit_tag l(:button_apply), class: '-highlight' %>
<% end %>

@ -28,98 +28,123 @@ See doc/COPYRIGHT.rdoc for more details.
++#%>
<h2><%= l(:label_bulk_edit_selected_work_packages) %></h2>
<ul><%= @work_packages.collect {|i| content_tag('li', link_to(h("#{i.type} ##{i.id}"), work_package_path(i)) + h(": #{i.subject}")) }.join("\n").html_safe %></ul>
<%= form_tag(url_for(controller: '/work_packages/bulk', action: :update, ids: @work_packages),
<%= styled_form_tag(url_for(controller: '/work_packages/bulk', action: :update, ids: @work_packages),
method: :put) do %>
<%= @work_packages.collect {|i| hidden_field_tag('ids[]', i.id)}.join.html_safe %>
<div class="box tabular">
<fieldset class="attributes">
<legend><%= l(:label_change_properties) %></legend>
<section class="form--section">
<fieldset class="form--fieldset">
<legend class="form--fieldset-legend"><%= l(:label_change_properties) %></legend>
<div class="grid-block">
<div class="grid-content">
<p>
<label for="work_package_type_id"><%= WorkPackage.human_attribute_name(:type) %></label>
<%= select_tag('work_package[type_id]', "<option value=\"\">#{l(:label_no_change_option)}</option>".html_safe + options_from_collection_for_select(@types, :id, :name)) %>
</p>
<div class="form--field">
<label class="form--label" for="work_package_type_id"><%= WorkPackage.human_attribute_name(:type) %></label>
<div class="form--field-container">
<%= styled_select_tag('work_package[type_id]', "<option value=\"\">#{l(:label_no_change_option)}</option>".html_safe + options_from_collection_for_select(@types, :id, :name)) %>
</div>
</div>
<% if @available_statuses.any? %>
<p>
<label for='status_id'><%= WorkPackage.human_attribute_name(:status) %></label>
<%= select_tag('work_package[status_id]', "<option value=\"\">#{l(:label_no_change_option)}</option>".html_safe + options_from_collection_for_select(@available_statuses, :id, :name)) %>
</p>
<div class="form--field">
<label class="form--label" for='status_id'><%= WorkPackage.human_attribute_name(:status) %></label>
<div class="form--field-container">
<%= styled_select_tag('work_package[status_id]', "<option value=\"\">#{l(:label_no_change_option)}</option>".html_safe + options_from_collection_for_select(@available_statuses, :id, :name)) %>
</div>
</div>
<% end %>
<p>
<label for='work_package_priority_id'><%= WorkPackage.human_attribute_name(:priority) %></label>
<%= select_tag('work_package[priority_id]', "<option value=\"\">#{l(:label_no_change_option)}</option>".html_safe + options_from_collection_for_select(IssuePriority.all, :id, :name)) %>
</p>
<p>
<label for='work_package_assigned_to_id'><%= WorkPackage.human_attribute_name(:assigned_to) %></label>
<%= select_tag('work_package[assigned_to_id]', content_tag('option', l(:label_no_change_option), :value => '') +
content_tag('option', l(:label_nobody), :value => 'none') +
options_from_collection_for_select(@assignables, :id, :name)) %>
</p>
<p>
<label for='work_package_responsible_id'><%= WorkPackage.human_attribute_name(:responsible) %></label>
<%= select_tag('work_package[responsible_id]', content_tag('option', l(:label_no_change_option), :value => '') +
content_tag('option', l(:label_nobody), :value => 'none') +
options_from_collection_for_select(@responsibles, :id, :name)) %>
</p>
<div class="form--field">
<label class="form--label" for='work_package_priority_id'><%= WorkPackage.human_attribute_name(:priority) %></label>
<div class="form--field-container">
<%= styled_select_tag('work_package[priority_id]', "<option value=\"\">#{l(:label_no_change_option)}</option>".html_safe + options_from_collection_for_select(IssuePriority.all, :id, :name)) %>
</div>
</div>
<div class="form--field">
<label class="form--label" for='work_package_assigned_to_id'><%= WorkPackage.human_attribute_name(:assigned_to) %></label>
<div class="form--field-container">
<%= styled_select_tag('work_package[assigned_to_id]', content_tag('option', l(:label_no_change_option), :value => '') +
content_tag('option', l(:label_nobody), :value => 'none') +
options_from_collection_for_select(@assignables, :id, :name)) %>
</div>
</div>
<div class="form--field">
<label class="form--label" for='work_package_responsible_id'><%= WorkPackage.human_attribute_name(:responsible) %></label>
<div class="form--field-container">
<%= styled_select_tag('work_package[responsible_id]', content_tag('option', l(:label_no_change_option), :value => '') +
content_tag('option', l(:label_nobody), :value => 'none') +
options_from_collection_for_select(@responsibles, :id, :name)) %>
</div>
</div>
<% if @project %>
<p>
<label for='category_id'><%= WorkPackage.human_attribute_name(:category) %></label>
<%= select_tag('work_package[category_id]', content_tag('option', l(:label_no_change_option), :value => '') +
content_tag('option', l(:label_none), :value => 'none') +
options_from_collection_for_select(@project.categories, :id, :name)) %>
</p>
<div class="form--field">
<label class="form--label" for='category_id'><%= WorkPackage.human_attribute_name(:category) %></label>
<div class="form--field-container">
<%= styled_select_tag('work_package[category_id]', content_tag('option', l(:label_no_change_option), :value => '') +
content_tag('option', l(:label_none), :value => 'none') +
options_from_collection_for_select(@project.categories, :id, :name)) %>
</div>
</div>
<% end %>
<% #TODO: allow editing versions when multiple projects %>
<% if @project %>
<p>
<label for='work_package_fixed_version_id'><%= WorkPackage.human_attribute_name(:fixed_version) %></label>
<%= select_tag('work_package[fixed_version_id]', content_tag('option', l(:label_no_change_option), :value => '') +
content_tag('option', l(:label_none), :value => 'none') +
version_options_for_select(@project.shared_versions.open.sort)) %>
</p>
<div class="form--field">
<label class="form--label" for='work_package_fixed_version_id'><%= WorkPackage.human_attribute_name(:fixed_version) %></label>
<div class="form--field-container">
<%= styled_select_tag('work_package[fixed_version_id]', content_tag('option', l(:label_no_change_option), :value => '') +
content_tag('option', l(:label_none), :value => 'none') +
version_options_for_select(@project.shared_versions.open.sort)) %>
</div>
</div>
<% end %>
<% @custom_fields.each do |custom_field| %>
<p>
<div class="form--field">
<%= blank_custom_field_label_tag('work_package', custom_field) %>
<%= custom_field_tag_for_bulk_edit('work_package', custom_field) %>
</p>
<div class="form--field-container">
<%= custom_field_tag_for_bulk_edit('work_package', custom_field) %>
</div>
</div>
<% end %>
<%= call_hook(:view_work_packages_bulk_edit_details_bottom, { work_packages: @work_packages }) %>
</div>
<div class="grid-content">
<% if @project && User.current.allowed_to?(:manage_subtasks, @project) %>
<p>
<label for='work_package_parent_id'><%= WorkPackage.human_attribute_name(:parent) %></label>
<%= text_field_tag 'work_package[parent_id]', '', :size => 10 %>
</p>
<div class="form--field">
<label class="form--label" for='work_package_parent_id'><%= WorkPackage.human_attribute_name(:parent) %></label>
<div class="form--field-container">
<%= styled_text_field_tag 'work_package[parent_id]', '', :size => 10 %>
</div>
</div>
<div id="parent_work_package_candidates" class="autocomplete"></div>
<%= javascript_tag "observeParentIssueField('#{work_packages_auto_complete_path(project_id: @project.id)}')" %>
<% end %>
<p>
<label for='work_package_start_date'><%= WorkPackage.human_attribute_name(:start_date) %></label>
<%= text_field_tag 'work_package[start_date]', '', :size => 10 %><%= calendar_for('work_package_start_date') %>
</p>
<p>
<label for='work_package_due_date'><%= WorkPackage.human_attribute_name(:due_date) %></label>
<%= text_field_tag 'work_package[due_date]', '', :size => 10 %><%= calendar_for('work_package_due_date') %>
</p>
<div class="form--field">
<label class="form--label" for='work_package_start_date'><%= WorkPackage.human_attribute_name(:start_date) %></label>
<div class="form--field-container">
<%= styled_text_field_tag 'work_package[start_date]', '', :size => 10 %><%= calendar_for('work_package_start_date') %>
</div>
</div>
<div class="form--field">
<label class="form--label" for='work_package_due_date'><%= WorkPackage.human_attribute_name(:due_date) %></label>
<div class="form--field-container">
<%= styled_text_field_tag 'work_package[due_date]', '', :size => 10 %><%= calendar_for('work_package_due_date') %>
</div>
</div>
<% if WorkPackage.use_field_for_done_ratio? %>
<p>
<label for='work_package_done_ratio'><%= WorkPackage.human_attribute_name(:done_ratio) %></label>
<%= select_tag 'work_package[done_ratio]', options_for_select([[l(:label_no_change_option), '']] + (0..10).to_a.collect {|r| ["#{r*10} %", r*10] }) %>
</p>
<div class="form--field">
<label class="form--label" for='work_package_done_ratio'><%= WorkPackage.human_attribute_name(:done_ratio) %></label>
<div class="form--field-container">
<%= styled_select_tag 'work_package[done_ratio]', options_for_select([[l(:label_no_change_option), '']] + (0..10).to_a.collect {|r| ["#{r*10} %", r*10] }) %>
</div>
</div>
<% end %>
</div>
</div>
</fieldset>
<fieldset><legend><%= Journal.human_attribute_name(:notes) %></legend>
<fieldset class="form--fieldset">
<legend class="form--fieldset-legend"><%= Journal.human_attribute_name(:notes) %></legend>
<%= label_tag 'notes', Journal.human_attribute_name(:notes), :class => 'hidden-for-sighted' %>
<%= text_area_tag 'notes', @notes, :cols => 60, :rows => 10, :class => 'wiki-edit',
<%= styled_text_area_tag 'notes', @notes, :cols => 60, :rows => 10, :class => 'wiki-edit',
:'data-wp_autocomplete_url' => work_packages_auto_complete_path(:project_id => @project, :format => :json) %>
<%= wikitoolbar_for 'notes' %>
<p><%= send_notification_option %></p>
</fieldset>
</div>
<p><%= submit_tag l(:button_submit), class: 'button -highlight' %></p>
</section>
<p><%= styled_submit_tag l(:button_submit), class: '-highlight' %></p>
<% end %>

@ -33,79 +33,99 @@ See doc/COPYRIGHT.rdoc for more details.
<li><%= link_to_work_package work_package %></li>
<% end -%>
</ul>
<%= form_tag({:action => 'create'}, :id => 'move_form') do %>
<%= styled_form_tag({:action => 'create'}, :id => 'move_form') do %>
<%= @work_packages.collect {|i| hidden_field_tag('ids[]', i.id)}.join.html_safe %>
<div class="box tabular">
<fieldset class="attributes">
<legend><%= l(:label_change_properties) %></legend>
<section class="form--section">
<fieldset class="form--fieldset">
<legend class="form--fieldset-legend"><%= l(:label_change_properties) %></legend>
<div class="grid-block">
<div class="grid-content">
<p><label for="new_project_id"><%= WorkPackage.human_attribute_name(:project) %>:</label>
<%= select_tag "new_project_id",
project_tree_options_for_select(@allowed_projects, :selected => @target_project),
:onchange => remote_function(:url => { :action => 'new' },
:method => :get,
:update => 'content',
:with => "Form.serialize('move_form')") %></p>
<p><label for="new_type_id"><%= WorkPackage.human_attribute_name(:type) %>:</label>
<%= select_tag("new_type_id",
content_tag('option', l(:label_no_change_option), :value => '') +
options_from_collection_for_select(@types, "id", "name")) %>
</p>
<p>
<label for='status_id'><%= WorkPackage.human_attribute_name(:status) %></label>
<%= select_tag('status_id',
content_tag('option', l(:label_no_change_option), :value => '') +
options_from_collection_for_select(@available_statuses, :id, :name)) %>
</p>
<p>
<label for='priority_id'><%= WorkPackage.human_attribute_name(:priority) %></label>
<%= select_tag('priority_id',
content_tag('option', l(:label_no_change_option), :value => '') +
options_from_collection_for_select(IssuePriority.all, :id, :name)) %>
</p>
<p>
<label for='assigned_to_id'><%= WorkPackage.human_attribute_name(:assigned_to) %></label>
<%= select_tag('assigned_to_id',
content_tag('option', l(:label_no_change_option), :value => '') +
content_tag('option', l(:label_nobody), :value => 'none') +
options_from_collection_for_select(@target_project.possible_assignees, :id, :name)) %>
</p>
<p>
<label for='responsible_id'><%= WorkPackage.human_attribute_name(:responsible) %></label>
<%= select_tag('responsible_id',
content_tag('option', l(:label_no_change_option), :value => '') +
content_tag('option', l(:label_nobody), :value => 'none') +
options_from_collection_for_select(@target_project.possible_responsibles, :id, :name)) %>
</p>
<div class="form--field">
<label class="form--label" for="new_project_id"><%= WorkPackage.human_attribute_name(:project) %>:</label>
<div class="form--field-container">
<%= styled_select_tag "new_project_id",
project_tree_options_for_select(@allowed_projects, :selected => @target_project),
:onchange => remote_function(:url => { :action => 'new' },
:method => :get,
:update => 'content',
:with => "Form.serialize('move_form')") %>
</div>
</div>
<div class="form--field">
<label class="form--label" for="new_type_id"><%= WorkPackage.human_attribute_name(:type) %>:</label>
<div class="form--field-container">
<%= styled_select_tag("new_type_id",
content_tag('option', l(:label_no_change_option), :value => '') +
options_from_collection_for_select(@types, "id", "name")) %>
</div>
</div>
<div class="form--field">
<label class="form--label" for='status_id'><%= WorkPackage.human_attribute_name(:status) %></label>
<div class="form--field-container">
<%= styled_select_tag('status_id',
content_tag('option', l(:label_no_change_option), :value => '') +
options_from_collection_for_select(@available_statuses, :id, :name)) %>
</div>
</div>
<div class="form--field">
<label class="form--label" for='priority_id'><%= WorkPackage.human_attribute_name(:priority) %></label>
<div class="form--field-container">
<%= styled_select_tag('priority_id',
content_tag('option', l(:label_no_change_option), :value => '') +
options_from_collection_for_select(IssuePriority.all, :id, :name)) %>
</div>
</div>
<div class="form--field">
<label class="form--label" for='assigned_to_id'><%= WorkPackage.human_attribute_name(:assigned_to) %></label>
<div class="form--field-container">
<%= styled_select_tag('assigned_to_id',
content_tag('option', l(:label_no_change_option), :value => '') +
content_tag('option', l(:label_nobody), :value => 'none') +
options_from_collection_for_select(@target_project.possible_assignees, :id, :name)) %>
</div>
</div>
<div class="form--field">
<label class="form--label" for='responsible_id'><%= WorkPackage.human_attribute_name(:responsible) %></label>
<div class="form--field-container">
<%= styled_select_tag('responsible_id',
content_tag('option', l(:label_no_change_option), :value => '') +
content_tag('option', l(:label_nobody), :value => 'none') +
options_from_collection_for_select(@target_project.possible_responsibles, :id, :name)) %>
</div>
</div>
</div>
<div class="grid-content">
<p>
<label for='start_date'><%= WorkPackage.human_attribute_name(:start_date) %></label>
<%= text_field_tag 'start_date', '', :size => 10 %><%= calendar_for('start_date') %>
</p>
<p>
<label for='due_date'><%= WorkPackage.human_attribute_name(:due_date) %></label>
<%= text_field_tag 'due_date', '', :size => 10 %><%= calendar_for('due_date') %>
</p>
<div class="form--field">
<label class="form--label" for='start_date'><%= WorkPackage.human_attribute_name(:start_date) %></label>
<div class="form--field-container">
<%= styled_text_field_tag 'start_date', '', :size => 10 %><%= calendar_for('start_date') %>
</div>
</div>
<div class="form--field">
<label class="form--label" for='due_date'><%= WorkPackage.human_attribute_name(:due_date) %></label>
<div class="form--field-container">
<%= styled_text_field_tag 'due_date', '', :size => 10 %><%= calendar_for('due_date') %>
</div>
</div>
</div>
</div>
</fieldset>
<fieldset><legend><%= Journal.human_attribute_name(:notes) %></legend>
<fieldset class="form--fieldset">
<legend class="form--fieldset-legend"><%= Journal.human_attribute_name(:notes) %></legend>
<%= label_tag 'notes', Journal.human_attribute_name(:notes), :class => 'hidden-for-sighted' %>
<%= text_area_tag 'notes', @notes, :cols => 60, :rows => 10, :class => 'wiki-edit',
<%= styled_text_area_tag 'notes', @notes, :cols => 60, :rows => 10, :class => 'wiki-edit',
:'data-wp_autocomplete_url' => work_packages_auto_complete_path(:project_id => @target_project, :format => :json) %>
<%= wikitoolbar_for 'notes' %>
</fieldset>
<%= call_hook(:view_work_packages_move_bottom, :work_packages => @work_packages, :target_project => @target_project, :copy => !!@copy) %>
</div>
</section>
<% if @copy %>
<%= hidden_field_tag("copy") %>
<%= submit_tag l(:button_copy), class: 'button -highlight' %>
<%= submit_tag l(:button_copy_and_follow), :name => 'follow', class: 'button -highlight' %>
<%= styled_submit_tag l(:button_copy), class: '-highlight' %>
<%= styled_submit_tag l(:button_copy_and_follow), :name => 'follow', class: '-highlight' %>
<% else %>
<%= submit_tag l(:button_move), class: 'button -highlight' %>
<%= submit_tag l(:button_move_and_follow), :name => 'follow', class: 'button -highlight' %>
<%= styled_submit_tag l(:button_move), class: '-highlight' %>
<%= styled_submit_tag l(:button_move_and_follow), :name => 'follow', class: '-highlight' %>
<% end %>
<% end %>
<% content_for :header_tags do %>

Loading…
Cancel
Save