use new formbuilder for timelines form

pull/2612/head
Florian Kraft 10 years ago
parent def506a9bc
commit aa254d56ec
No known key found for this signature in database
GPG Key ID: 786CD08D94605A9E
  1. 21
      app/assets/javascripts/timelines_select_boxes.js
  2. 4
      app/helpers/timelines_helper.rb
  3. 90
      app/views/timelines/_comparison.html.erb
  4. 14
      app/views/timelines/_form.html.erb
  5. 105
      app/views/timelines/_general.html.erb
  6. 14
      app/views/timelines/_vertical_planning_elements.html.erb
  7. 4
      app/views/timelines/edit.html.erb
  8. 146
      app/views/timelines/filter/_planning_elements.html.erb
  9. 245
      app/views/timelines/filter/_projects.html.erb
  10. 117
      app/views/timelines/group/_grouping.html.erb
  11. 2
      app/views/timelines/new.html.erb

@ -146,25 +146,4 @@ jQuery(document).ready(function($) {
ajax: {null_element: {id: -1, name: I18n.t("js.filter.noneElement")}}
});
});
$("#content").find("input").each(function (index, e) {
e = $(e);
if (
((e.attr("type") === "text" || e.attr("type") === "hidden") && e.val() !== "" && !e.hasClass("select2-input")) ||
(e.attr("type") === "checkbox" && e.attr("checked"))
) {
showFieldSet(e);
}
});
$('#content').find('.cf_boolean_select').each(function (index, field) {
field = $(field);
if (field.val() !== '') {
showFieldSet(field);
}
});
function showFieldSet(field) {
field.closest("fieldset").removeClass('collapsed').children("div").show();
}
});

@ -316,4 +316,8 @@ module TimelinesHelper
gon.timeline_options ||= {}
gon.timeline_options[timeline.id] = timeline.options.reverse_merge(project_id: project_id)
end
def timeline_options
OpenStruct.new @timeline.options
end
end

@ -33,65 +33,35 @@ See doc/COPYRIGHT.rdoc for more details.
</legend>
<div style="display:none;">
<div>
<p class="tl-form-overflow">
<%= label_tag 'timeline_options_comparison_none',
l('timelines.filter.comparison.none') %>
<%= radio_button("timeline[options]",
:comparison,
'none',
:checked => (timeline.comparison == 'none')) %>
</p>
<p class="tl-form-overflow">
<%= label_tag 'timeline_options_comparison_relative',
l('timelines.filter.comparison.relative') %>
<%= radio_button("timeline[options]",
:comparison,
'relative',
:checked => (timeline.comparison == 'relative')) %>
<% relative_text = text_field_tag "timeline[options][compare_to_relative]",
timeline.options["compare_to_relative"],
:size => 3
relative_select = select("timeline[options]",
:compare_to_relative_unit,
[ [l('timelines.filter.time_relative.days'), 0],
[l('timelines.filter.time_relative.weeks'), '1'],
[l('timelines.filter.time_relative.months'), '2']
],
{ :selected => timeline.options['compare_to_relative_unit'] },
{ :multiple => false, :size => 1})
%>
<%= l('timelines.filter.comparison.compare_relative',
:timespan => relative_text + relative_select).html_safe %>
</p>
<p class="tl-form-overflow">
<%= label_tag 'timeline_options_comparison_absolute',
l('timelines.filter.comparison.absolute') %>
<%= radio_button("timeline[options]",
:comparison,
'absolute',
:checked => (timeline.comparison == 'absolute')) %>
<% absolute_text = text_field_tag("timeline[options][compare_to_absolute]",
timeline.options["compare_to_absolute"],
:size => 10)
absolute_calendar = calendar_for('timeline_options_compare_to_absolute') %>
<%= l('timelines.filter.comparison.compare_absolute',
:date => absolute_text + absolute_calendar).html_safe %>
</p>
</div>
<%= f.fields_for :options, timeline_options do |ff| %>
<div class="form--field">
<%= ff.label :comparison, l('timelines.filter.comparison.none'), for: :timeline_options_comparison_none %>
<div class="form--field-container">
<%= ff.radio_button :comparison, "none", no_label: true %>
</div>
</div>
<div class="form--field">
<%= ff.label :comparison, l('timelines.filter.comparison.relative'), for: :timeline_options_comparison_relative %>
<div class="form--field-container">
<%= ff.radio_button :comparison, "relative", no_label: true %>
<%= ff.label :compare_to_relative, l('timelines.filter.comparison.compare_relative', timespan: "") %>
<%= ff.text_field :compare_to_relative, no_label: true %>
<%= ff.select :compare_to_relative_unit,
[ [l('timelines.filter.time_relative.days'), 0],
[l('timelines.filter.time_relative.weeks'), '1'],
[l('timelines.filter.time_relative.months'), '2']
], label: "" # FIXME: this breaks with no_label: true
%>
</div>
</div>
<div class="form--field">
<%= ff.label :comparison, l('timelines.filter.comparison.absolute'), for: :timeline_options_comparison_absolute %>
<div class="form--field-container">
<%= ff.radio_button :comparison, "absolute", no_label: true %>
<%= ff.text_field :compare_to_absolute, label: l('timelines.filter.comparison.compare_absolute', date: "") %>
<%= calendar_for('timeline_options_compare_to_absolute') %>
</div>
</div>
<% end %>
</div>
</fieldset>

@ -39,20 +39,20 @@ See doc/COPYRIGHT.rdoc for more details.
<div class="edit_form">
<%= render :partial => "timelines/general", :locals => {:timeline => @timeline, :f => f}%>
<%= render partial: "timelines/general", locals: { timeline: @timeline, f: f }%>
<%= render :partial => "timelines/comparison", :locals => {:timeline => @timeline} %>
<%= render partial: "timelines/comparison", locals: { timeline: @timeline, f: f } %>
<%= render :partial => "timelines/vertical_planning_elements", :locals => {:timeline => @timeline}%>
<%= render partial: "timelines/vertical_planning_elements", locals: { timeline: @timeline, f: f } %>
<%= render :partial => "timelines/filter/planning_elements", :locals => {:timeline => @timeline} %>
<%= render partial: "timelines/filter/planning_elements", locals: { timeline: @timeline, f: f } %>
<%= render :partial => "timelines/filter/projects", :locals => {:timeline => @timeline} %>
<%= render partial: "timelines/filter/projects", locals: { timeline: @timeline, f: f } %>
<%= render :partial => "timelines/group/grouping", :locals => {:timeline => @timeline} %>
<%= render partial: "timelines/group/grouping", locals: { timeline: @timeline, f: f } %>
</div>
<% content_for :header_tags do %>
<%= stylesheet_link_tag 'timelines.css', :media => "all" %>
<%= stylesheet_link_tag 'timelines.css', media: "all" %>
<% end %>

@ -32,69 +32,54 @@ See doc/COPYRIGHT.rdoc for more details.
<a href="javascript:"><%= l('timelines.filter.timeline') %></a>
</legend>
<div>
<div>
<div class="form--field -required">
<%= f.text_field :name %>
<%= hidden_field_tag 'timeline[options][exist]' %>
</div>
<%= f.fields_for :options do |ff| %>
<div class="form--field">
<%= ff.hidden_field :exist %>
<%= ff.check_box :hide_chart, label: l('timelines.filter.hide_chart') %>
</div>
<div class="form--field">
<%= ff.select(:zoom_factor,
filter_select_i18n_array_with_index_and_none(
timeline.available_zoom_factors,
'timelines.zoom.'),
{:selected => timeline.selected_zoom_factor, label: l("timelines.filter.zoom") },
{:multiple => false,
:size => 1}) %>
</div>
<div class="form--field">
<%= f.text_field :name, required: true %>
</div>
<%= f.fields_for :options, timeline_options do |ff| %>
<div class="form--field">
<%= ff.hidden_field :exist %>
<%= ff.check_box :hide_chart, label: l('timelines.filter.hide_chart') %>
</div>
<div class="form--field">
<%= ff.select(:initial_outline_expansion,
filter_select_i18n_array_with_index_and_none(
timeline.available_initial_outline_expansions,
'timelines.outlines.'),
{:selected => timeline.selected_initial_outline_expansion, label: l("timelines.filter.outline")},
{:multiple => false,
:size => 1}) %>
<div class="form--field">
<%= ff.select(:zoom_factor,
filter_select_i18n_array_with_index_and_none(
timeline.available_zoom_factors,
'timelines.zoom.'), label: l("timelines.filter.zoom")) %>
</div>
</div>
<h4>
<%= l('timelines.filter.timeframe') %>
</h4>
<div class="form--field">
<%= ff.text_field :timeframe_start, label: l('timelines.filter.timeframe_start') %>
<%= calendar_for('timeline_options_timeframe_start') %>
</div>
<div class="form--field">
<%= ff.text_field :timeframe_end, label: l('timelines.filter.timeframe_end') %>
<%= calendar_for('timeline_options_timeframe_end') %>
</div>
<div class="form--field">
<% if User.current.impaired? %>
<%= ff.select :columns, internationalized_columns_select(timeline.available_columns),
{:selected => timeline.selected_columns},
{:multiple => true,
:size => 12} %>
<% else %>
<%= ff.label :columns, l("timelines.filter.columns") %>
<%= ff.hidden_field :columns, name: "timeline[options][columns][]", id: "timeline_options_columns_", value: timeline.selected_columns.join(","), :"data-values" => internationalized_columns_select_object(timeline.available_columns).concat(timeline.custom_field_columns).to_json %>
<% end %>
</div>
<div class="form--field">
<%= ff.select :project_sort,
[[l('timelines.filter.sort.date'), 0], [l('timelines.filter.sort.alphabet'), '1']],
<div class="form--field">
<%= ff.select(:initial_outline_expansion,
filter_select_i18n_array_with_index_and_none(
timeline.available_initial_outline_expansions,
'timelines.outlines.'),
label: l("timelines.filter.outline")) %>
{:selected => timeline.options['project_sort'], label: l('timelines.filter.sort.project_sortation') },
{:multiple => false,
:size => 1} %>
</div>
</div>
<h4>
<%= l('timelines.filter.timeframe') %>
</h4>
<div class="form--field">
<%= ff.text_field :timeframe_start, label: l('timelines.filter.timeframe_start') %>
<%= calendar_for('timeline_options_timeframe_start') %>
</div>
<div class="form--field">
<%= ff.text_field :timeframe_end, label: l('timelines.filter.timeframe_end') %>
<%= calendar_for('timeline_options_timeframe_end') %>
</div>
<div class="form--field">
<% if User.current.impaired? %>
<%= ff.select :columns, internationalized_columns_select(timeline.available_columns),
{:selected => timeline.selected_columns},
{:multiple => true,
:size => 12} %>
<% else %>
<%= ff.label :columns, l("timelines.filter.columns") %>
<%= ff.hidden_field :columns, name: "timeline[options][columns][]", id: "timeline_options_columns_", value: timeline.selected_columns.join(","), :"data-values" => internationalized_columns_select_object(timeline.available_columns).concat(timeline.custom_field_columns).to_json %>
<% end %>
</div>
</div>
<div class="form--field">
<%= ff.select :project_sort, [[l('timelines.filter.sort.date'), 0], [l('timelines.filter.sort.alphabet'), '1']], label: l('timelines.filter.sort.project_sortation') %>
</div>
<% end %>
</fieldset>

@ -33,14 +33,10 @@ See doc/COPYRIGHT.rdoc for more details.
</legend>
<div style="display:none;">
<div>
<p class="tl-form-overflow">
<%= label_tag :timeline_options_vertical_planning_elements,
l('timelines.vertical_work_package') %>
<%= text_field_tag "timeline[options][vertical_planning_elements]",
timeline.options["vertical_planning_elements"],
:size => 60, :class => "twoBlocks" %>
</p>
</div>
<%= f.fields_for :options, timeline_options do |ff| %>
<div class="form--field">
<%= ff.text_field :vertical_planning_elements, label:l('timelines.vertical_work_package') %>
</div>
<% end %>
</div>
</fieldset>

@ -31,9 +31,9 @@ See doc/COPYRIGHT.rdoc for more details.
<%=I18n.t("timelines.edit_timeline", :timeline => @timeline.name)%>
</h2>
<%= form_for(:timeline,
<%= labelled_tabular_form_for(@timeline,
:url => project_timeline_path(@project, @timeline),
:html => {:class => "tabular", :method => 'put'}) do |f| %>
:html => {:class => "tabular form", :method => 'put'}) do |f| %>
<%= render(:partial => "timelines/form",
:locals => {:f => f, :timeline => @timeline}) %>

@ -33,121 +33,69 @@ See doc/COPYRIGHT.rdoc for more details.
</legend>
<div style="display:none;">
<div>
<p class="tl-form-overflow">
<%= label_tag :timeline_options_exclude_own_planning_elements,
l('timelines.filter.exclude_own_work_packages') %>
<%= check_box_tag("timeline[options][exclude_own_planning_elements]",
:yes,
timeline.options["exclude_own_planning_elements"].present?) %>
</p>
<p class="tl-form-overflow">
<%= label_tag 'timeline_options_planning_element_status',
l("timelines.filter.status") %>
<%= f.fields_for :options, timeline_options do |ff| %>
<div class="form--field">
<%= ff.check_box :exclude_own_planning_elements, label:l('timelines.filter.exclude_own_work_packages') %>
</div>
<div class="form--field">
<% if User.current.impaired? %>
<%= select("timeline[options]",
:planning_element_status,
filter_select_with_none(
<%= ff.select :planning_element_status, filter_select_with_none(
timeline.available_planning_element_status,
:name, :id),
{:selected => timeline.selected_planning_element_status.map(&:id)},
{:multiple => true,
:size => 12}) %>
{ selected: timeline.selected_planning_element_status.map(&:id), label: l("timelines.filter.status") },
{ multiple: true } %>
<% else %>
<%= select("timeline[options]", :planning_element_status,
options_for_select([]),
{},
{ :'data-ajaxURL' => api_v2_paginate_statuses_path,
:multiple => true,
:'data-selected' => filter_select(
timeline.selected_planning_element_status,
:name, :id).to_json
}) %>
<%= ff.select :planning_element_status, options_for_select([]), { label: l("timelines.filter.status") },
:'data-ajaxURL' => api_v2_paginate_statuses_path,
multiple: true,
:'data-selected' => filter_select(timeline.selected_planning_element_status, :name, :id).to_json %>
<% end %>
</p>
<p class="tl-form-overflow">
<%= label_tag 'timeline_options_planning_element_types',
l("timelines.filter.types") %>
</div>
<div class="form--field">
<% if User.current.impaired? %>
<%= select("timeline[options]",
:planning_element_types,
filter_select_with_none(
<%= ff.select :planning_element_types, filter_select_with_none(
timeline.available_planning_element_types,
:name, :id),
{:selected => timeline.selected_planning_element_types.map(&:id)},
{:multiple => true,
:size => 12}) %>
{ selected: timeline.selected_planning_element_types.map(&:id), label: l("timelines.filter.types") },
{ multiple: true } %>
<% else %>
<%= select("timeline[options]", :planning_element_types,
options_for_select([]),
{},
{ :'data-ajaxURL' => api_v2_paginate_types_path,
:multiple => true,
:'data-selected' => filter_select(
timeline.selected_planning_element_types,
:name, :id).to_json
}) %>
<%= ff.select :planning_element_types, options_for_select([]), { label: l("timelines.filter.types") },
:'data-ajaxURL' => api_v2_paginate_types_path,
multiple: true,
:'data-selected' => filter_select(timeline.selected_planning_element_types, :name, :id).to_json %>
<% end %>
</p>
<p class="tl-form-overflow">
<%= label_tag 'timeline_options_planning_element_responsibles',
l("timelines.filter.work_package_responsible") %>
</div>
<div class="form--field">
<% if User.current.impaired? %>
<%= select("timeline[options]",
:planning_element_responsibles,
filter_select_with_none(
timeline.available_responsibles,
:name, :id),
{:selected => timeline.selected_planning_element_responsibles.map(&:id)},
{:multiple => true,
:size => 12}) %>
<%= ff.select :planning_element_responsibles, filter_select_with_none(
timeline.available_planning_element_responsibles,
:name, :id),
{ selected: timeline.selected_planning_element_responsibles.map(&:id), label: l("timelines.filter.work_package_responsible") },
{ multiple: true } %>
<% else %>
<%= select "timeline[options]", :planning_element_responsibles,
options_for_select([]),
{},
{ :'data-ajaxURL' => api_v2_paginate_users_path,
:multiple => true,
:'data-selected' => filter_select(
timeline.selected_planning_element_responsibles,
:name, :id).to_json
} %>
<%= ff.select :planning_element_responsibles, options_for_select([]), { label: l("timelines.filter.work_package_responsible") },
:'data-ajaxURL' => api_v2_paginate_users_path,
multiple: true,
:'data-selected' => filter_select(timeline.selected_planning_element_responsibles, :name, :id).to_json %>
<% end %>
</p>
<p class="tl-form-overflow">
<%= label_tag 'timeline_options_planning_element_assignee',
l("timelines.filter.work_package_assignee") %>
</div>
<div class="form--field">
<% if User.current.impaired? %>
<%= select("timeline[options]",
:planning_element_assignee,
filter_select_with_none(
timeline.available_responsibles,
:name, :id),
{:selected => timeline.selected_planning_element_assignee.map(&:id)},
{:multiple => true,
:size => 12}) %>
<%= ff.select :planning_element_assignee, filter_select_with_none(
timeline.available_planning_element_responsibles,
:name, :id),
{ selected: timeline.selected_planning_element_assignee.map(&:id), label: l("timelines.filter.work_package_assignee") },
{ multiple: true } %>
<% else %>
<%= select "timeline[options]", :planning_element_assignee,
options_for_select([]),
{},
{ :'data-ajaxURL' => api_v2_paginate_users_path,
:multiple => true,
:'data-selected' => filter_select(
timeline.selected_planning_element_assignee,
:name, :id).to_json
} %>
<%= ff.select :planning_element_assignee, options_for_select([]), { label: l("timelines.filter.work_package_assignee") },
:'data-ajaxURL' => api_v2_paginate_users_path,
multiple: true,
:'data-selected' => filter_select(timeline.selected_planning_element_assignee, :name, :id).to_json %>
<% end %>
</p>
<%= render :partial => "timelines/custom_fields", :locals => {:timeline => @timeline, :custom_fields => timeline.get_custom_fields}%>
</div>
</div>
<% end %>
<%= render :partial => "timelines/custom_fields", :locals => {:timeline => @timeline, :custom_fields => timeline.get_custom_fields } %>
</div>
</fieldset>

@ -33,42 +33,27 @@ See doc/COPYRIGHT.rdoc for more details.
</legend>
<div style="display:none;">
<div>
<p class="tl-form-overflow">
<%= label_tag :timeline_options_exclude_reporters,
l('timelines.filter.exclude_reporters') %>
<%= check_box_tag("timeline[options][exclude_reporters]",
:yes,
timeline.options["exclude_reporters"].present?) %>
</p>
<p class="tl-form-overflow">
<%= label_tag :timeline_options_exclude_empty,
l('timelines.filter.exclude_empty') %>
<%= check_box_tag("timeline[options][exclude_empty]",
:yes,
timeline.options["exclude_empty"].present?) %>
</p>
<p class="tl-form-overflow">
<%= label_tag 'timeline_options_project_types',
l("timelines.filter.project_types") %>
<%= f.fields_for :options, timeline_options do |ff| %>
<div class="form--field">
<%= ff.check_box :exclude_reporters, label: l('timelines.filter.exclude_reporters') %>
</div>
<div class="form--field">
<%= ff.check_box :exclude_empty, label: l('timelines.filter.exclude_empty') %>
</div>
<div class="form--field">
<% if User.current.impaired? %>
<%= select("timeline[options]",
:project_types,
filter_select_with_none(
timeline.available_project_types,
:name, :id),
{:selected => timeline.selected_project_types.map(&:id)},
{:multiple => true,
:size => 12}) %>
<%= ff.select :project_types,
filter_select_with_none(
timeline.available_project_types,
:name, :id
),
{ selected: timeline.selected_project_types.map(&:id), label: l("timelines.filter.project_types") },
multiple: true
%>
<% else %>
<%= select("timeline[options]",
:project_types,
<%= ff.select(:project_types,
options_for_select([]),
{},
{ label: l("timelines.filter.project_types") },
{ :'data-ajaxURL' => api_v2_paginate_project_types_path,
:multiple => true,
:'data-selected' => filter_select(
@ -76,27 +61,20 @@ See doc/COPYRIGHT.rdoc for more details.
:name, :id).to_json
}) %>
<% end %>
</p>
<p class="tl-form-overflow">
<%= label_tag 'timeline_options_project_status',
l("timelines.filter.project_status") %>
</div>
<div class="form--field">
<% if User.current.impaired? %>
<%= select("timeline[options]",
:project_status,
<%= ff.select(:project_status,
filter_select_with_none(
timeline.available_project_status,
:name, :id),
{:selected => timeline.selected_project_status.map(&:id)},
{:selected => timeline.selected_project_status.map(&:id), label: l("timelines.filter.project_status") },
{:multiple => true,
:size => 12}) %>
<% else %>
<%= select("timeline[options]",
:project_status,
<%= ff.select(:project_status,
options_for_select([]),
{},
{ label: l("timelines.filter.project_status") },
{ :'data-ajaxURL' => api_v2_paginate_reported_project_statuses_path,
:multiple => true,
:'data-selected' => filter_select(
@ -104,25 +82,20 @@ See doc/COPYRIGHT.rdoc for more details.
:name, :id).to_json
}) %>
<% end %>
</p>
<p class="tl-form-overflow">
<%= label_tag 'timeline_options_project_responsibles',
l("timelines.filter.project_responsible") %>
<% if User.current.impaired? %>
<%= select("timeline[options]",
:project_responsibles,
</div>
<div class="form--field">
<% if User.current.impaired? %>
<%= ff.select(:project_responsibles,
filter_select_with_none(
timeline.available_responsibles,
:name, :id),
{:selected => timeline.selected_project_responsibles.map(&:id)},
{:selected => timeline.selected_project_responsibles.map(&:id), label: l("timelines.filter.project_responsible") },
{:multiple => true,
:size => 12}) %>
<% else %>
<%= select("timeline[options]",
:project_responsibles,
<%= ff.select(:project_responsibles,
options_for_select([]),
{},
{ label: l("timelines.filter.project_responsible") },
{ :'data-ajaxURL' => api_v2_paginate_users_path,
:multiple => true,
:'data-selected' => filter_select(
@ -130,26 +103,20 @@ See doc/COPYRIGHT.rdoc for more details.
:name, :id).to_json
}) %>
<% end %>
</p>
<p class="tl-form-overflow">
<%= label_tag 'timeline_options_parents',
l("timelines.filter.parent") %>
<% if User.current.impaired? %>
<%= select("timeline[options]",
:parents,
</div>
<div class="form--field">
<% if User.current.impaired? %>
<%= ff.select(:parents,
filter_select_with_none(
timeline.available_parents,
:name, :id),
{:selected => timeline.selected_parents.map(&:id)},
{:selected => timeline.selected_parents.map(&:id), label: l("timelines.filter.parent") },
{:multiple => true,
:size => 12}) %>
<% else %>
<%= select("timeline[options]",
:parents,
<%= ff.select(:parents,
options_for_select([]),
{},
{ label: l("timelines.filter.parent") },
{ :'data-ajaxURL' => api_v2_paginate_projects_path,
:multiple => true,
:'data-selected' => filter_select(
@ -157,24 +124,21 @@ See doc/COPYRIGHT.rdoc for more details.
:name, :id).to_json
}) %>
<% end %>
</p>
<p class="tl-form-overflow">
<%= label_tag 'timeline_options_planning_element_time_types',
l('timelines.filter.project_time_filter') %>
</div>
<% if User.current.impaired? %>
<%= select("timeline[options]",
:planning_element_time_types,
<div class="form--field">
<% if User.current.impaired? %>
<%= ff.select(:planning_element_time_types,
filter_select_with_none(
timeline.available_planning_element_types,
:name, :id),
{:selected => timeline.selected_planning_element_time_types.map(&:id)},
{:selected => timeline.selected_planning_element_time_types.map(&:id), label: l('timelines.filter.project_time_filter') },
{:multiple => true,
:size => 12}) %>
<% else %>
<%= select("timeline[options]", :planning_element_time_types,
<%= ff.select(:planning_element_time_types,
options_for_select([]),
{},
{ label: l('timelines.filter.project_time_filter') },
{ :'data-ajaxURL' => api_v2_paginate_types_path,
:multiple => true,
:'data-selected' => filter_select(
@ -182,101 +146,28 @@ See doc/COPYRIGHT.rdoc for more details.
:name, :id).to_json
}) %>
<% end %>
</p>
<p class="tl-form-overflow">
<%= label_tag 'timeline_options_planning_element_time_absolute',
l('timelines.filter.project_time_filter_absolute_timeframe') %>
<%= radio_button("timeline[options]",
:planning_element_time,
'absolute',
:checked => (timeline.planning_element_time == 'absolute')) %>
<%
historical_label_start = label_tag 'timeline_options_planning_element_time_absolute_one',
l('timelines.filter.project_time_filter_historical_from'),
class: 'inline-label'
historical_text1 = text_field_tag "timeline[options][planning_element_time_absolute_one]",
timeline.options["planning_element_time_absolute_one"],
:size => 10
historical_calendar1 = calendar_for('timeline_options_planning_element_time_absolute_one')
historical_label_end = label_tag 'timeline_options_planning_element_time_absolute_two',
l('timelines.filter.project_time_filter_historical_to'),
class: 'inline-label'
historical_text2 = text_field_tag "timeline[options][planning_element_time_absolute_two]",
timeline.options["planning_element_time_absolute_two"],
:size => 10
historical_calendar2 = calendar_for('timeline_options_planning_element_time_absolute_two')
%>
<%= l('timelines.filter.project_time_filter_historical',
start_label: historical_label_start,
startdate: historical_text1 + historical_calendar1,
end_label: historical_label_end,
enddate: historical_text2 + historical_calendar2).html_safe %>
</p>
<p class="tl-form-overflow">
<%= label_tag 'timeline_options_planning_element_time_relative',
l('timelines.filter.project_time_filter_relative_timeframe') %>
<%= radio_button("timeline[options]",
:planning_element_time,
'relative',
:checked => (timeline.planning_element_time == 'relative')) %>
<%
relative_label_start = label_tag 'timeline_options_planning_element_time_relative_one',
l('timelines.filter.project_time_filter_historical_from'),
class: 'inline-label'
relative_text1 = text_field_tag "timeline[options][planning_element_time_relative_one]",
timeline.options["planning_element_time_relative_one"],
:size => 3
relative_select1 = select("timeline[options]",
:planning_element_time_relative_one_unit,
[ [l('timelines.filter.time_relative.days'), 0],
[l('timelines.filter.time_relative.weeks'), '1'],
[l('timelines.filter.time_relative.months'), '2']
],
{ :selected => timeline.options['planning_element_time_relative_one_unit'] },
{ :multiple => false, :size => 1})
relative_label_end = label_tag 'timeline_options_planning_element_time_relative_two',
l('timelines.filter.project_time_filter_historical_to'),
class: 'inline-label'
relative_text2 = text_field_tag "timeline[options][planning_element_time_relative_two]",
timeline.options["planning_element_time_relative_two"],
:size => 3
relative_select2 = select("timeline[options]",
:planning_element_time_relative_two_unit,
[ [l('timelines.filter.time_relative.days'), 0],
[l('timelines.filter.time_relative.weeks'), '1'],
[l('timelines.filter.time_relative.months'), '2']
],
{ :selected => timeline.options['planning_element_time_relative_two_unit'] },
{ :multiple => false, :size => 1})
%>
<%= l('timelines.filter.project_time_filter_relative',
start_label: relative_label_start,
startspan: relative_text1,
startspanunit: relative_select1,
end_label: relative_label_end,
endspan: relative_text2,
endspanunit: relative_select2
).html_safe %>
</p>
</div>
</div>
<h4><%= l('timelines.filter.project_time_filter_absolute_timeframe') %></h4>
<div class="form--field">
<%= ff.radio_button :planning_element_time, 'absolute' %>
</div>
<div class="form--field-container">
<%= ff.label :planning_element_time_absolute_one %>
<%= ff.text_field :planning_element_time_absolute_one, label: l('timelines.filter.project_time_filter_historical_from') %>
<%= calendar_for :timeline_options_planning_element_time_absolute_one %>
<%= ff.text_field :planning_element_time_absolute_two, label: l('timelines.filter.project_time_filter_historical_to') %>
<%= calendar_for :timeline_options_planning_element_time_absolute_two %>
</div>
<h4><%= l('timelines.filter.project_time_filter_relative_timeframe') %></h4>
<div class="form--field">
<%= ff.radio_button :planning_element_time, 'relative' %>
</div>
<div class="form--field-container">
<%= ff.text_field :planning_element_time_relative_one, label: l('timelines.filter.project_time_filter_historical_from') %>
<%= calendar_for :timeline_options_planning_element_time_relative_one %>
<%= ff.text_field :planning_element_time_relative_two, label: l('timelines.filter.project_time_filter_historical_to') %>
<%= calendar_for :timeline_optionsplanning_element_time_relative_two %>
</div>
<% end %>
</div>
</fieldset>

@ -33,34 +33,23 @@ See doc/COPYRIGHT.rdoc for more details.
</legend>
<div style="display:none;">
<div>
<p class="tl-form-overflow">
<%= label_tag :timeline_options_grouping_one_enabled,
l('timelines.filter.grouping_one') %>
<%= check_box_tag("timeline[options][grouping_one_enabled]",
:yes,
timeline.options["grouping_one_enabled"].present?) %>
<span>
<%= label_tag :timeline_options_grouping_one_selection,
l('timelines.filter.grouping_one_phrase'),
class: 'inline-label' %>
</span>
<%= f.fields_for :options, timeline_options do |ff| %>
<div class="form--field">
<%= ff.check_box :grouping_one_enabled, label: l('timelines.filter.grouping_one') %>
</div>
<div class="form--field">
<% if User.current.impaired? %>
<%= select("timeline[options]",
:grouping_one_selection,
<%= ff.select(:grouping_one_selection,
filter_select_with_none(
timeline.available_grouping_projects,
:name, :id),
{:selected => timeline.selected_grouping_projects.map(&:id)},
{:selected => timeline.selected_grouping_projects.map(&:id), label: l('timelines.filter.grouping_one_phrase') },
{:multiple => true,
:size => 12}) %>
<% else %>
<%= select "timeline[options]", :grouping_one_selection,
<%= ff.select :grouping_one_selection,
options_for_select([]),
{},
{ label: l('timelines.filter.grouping_one_phrase') },
{ :'data-ajaxURL' => api_v2_paginate_projects_path,
:multiple => true,
:'data-selected' => filter_select(
@ -69,52 +58,29 @@ See doc/COPYRIGHT.rdoc for more details.
}
%>
<% end %>
</p>
<p class="tl-form-overflow">
<%= label_tag :timeline_options_grouping_one_sort,
l('timelines.filter.sort.sortation') %>
<span>
<%= select("timeline[options]",
:grouping_one_sort,
[[l('timelines.filter.sort.alphabet'), '0'], [l('timelines.filter.sort.explicit_order'), '1']],
{:selected => timeline.options['grouping_one_sort']},
{:multiple => false,
:size => 1}) %>
</span>
</p>
<p class="tl-form-overflow">
<%= label_tag :timeline_options_grouping_two_enabled,
l('timelines.filter.grouping_two') %>
<%= check_box_tag("timeline[options][grouping_two_enabled]",
:yes,
timeline.options["grouping_two_enabled"].present?) %>
<span>
<%= label_tag :timeline_options_grouping_two_selection,
l('timelines.filter.grouping_two_phrase'),
class: 'inline-label' %>
</span>
</div>
<div class="form--field">
<%= ff.select(:grouping_one_sort,
[[l('timelines.filter.sort.alphabet'), '0'], [l('timelines.filter.sort.explicit_order'), '1']],
{ label: l('timelines.filter.sort.sortation') }) %>
</div>
<div class="form--field">
<%= ff.check_box :grouping_two_enabled, label: l('timelines.filter.grouping_two') %>
</div>
<div class="form--field">
<% if User.current.impaired? %>
<%= select("timeline[options]",
:grouping_two_selection,
<%= ff.select(:grouping_two_selection,
filter_select_with_none(
timeline.available_grouping_project_types,
:name, :id),
{:selected => timeline.selected_grouping_project_types.map(&:id)},
{:selected => timeline.selected_grouping_project_types.map(&:id), label: l('timelines.filter.grouping_two_phrase') },
{:multiple => true,
:size => 12}) %>
<% else %>
<%= select("timeline[options]", :grouping_two_selection,
<%= ff.select(:grouping_two_selection,
options_for_select([]),
{},
{ label: l('timelines.filter.grouping_two_phrase') },
{ :'data-ajaxURL' => api_v2_paginate_project_types_path,
:multiple => true,
:'data-selected' => filter_select(
@ -123,32 +89,13 @@ See doc/COPYRIGHT.rdoc for more details.
})
%>
<% end %>
</p>
<p class="tl-form-overflow">
<%= label_tag :timeline_options_grouping_two_sort,
l('timelines.filter.sort.sortation') %>
<span>
<%= select("timeline[options]",
:grouping_two_sort,
[[l('timelines.filter.sort.default'), '0'], [l('timelines.filter.sort.date'), '1'], [l('timelines.filter.sort.alphabet'), '2']],
{:selected => timeline.options['grouping_two_sort']},
{:multiple => false,
:size => 1}) %>
</span>
</p>
<p class="tl-form-overflow">
<%= label_tag :timeline_options_hide_other_group,
I18n.t('timelines.filter.grouping_hide_group', :group => l('timelines.filter.grouping_other')) %>
<%= check_box_tag("timeline[options][hide_other_group]",
:yes,
timeline.options["hide_other_group"].present?) %>
</p>
</div>
</div>
<div class="form--field">
<%= ff.select(:grouping_two_sort, [[l('timelines.filter.sort.default'), '0'], [l('timelines.filter.sort.date'), '1'], [l('timelines.filter.sort.alphabet'), '2']], label: l('timelines.filter.sort.sortation') ) %>
</div>
<div class="form--field">
<%= ff.check_box :hide_other_group, label: I18n.t('timelines.filter.grouping_hide_group', :group => l('timelines.filter.grouping_other')) %>
</div>
<% end %>
</div>
</fieldset>

@ -33,7 +33,7 @@ See doc/COPYRIGHT.rdoc for more details.
<%= labelled_tabular_form_for(@timeline,
:url => project_timelines_path,
:html => {:class => "tabular", :method => 'post'}) do |f| %>
:html => {:class => "tabular form", :method => 'post'}) do |f| %>
<%= render(:partial => "timelines/form",
:locals => {:f => f, :timeline => @timeline}) %>

Loading…
Cancel
Save