diff --git a/app/assets/javascripts/timelines_select_boxes.js b/app/assets/javascripts/timelines_select_boxes.js index 8f39af3953..2b0b55f337 100644 --- a/app/assets/javascripts/timelines_select_boxes.js +++ b/app/assets/javascripts/timelines_select_boxes.js @@ -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(); - } }); diff --git a/app/helpers/timelines_helper.rb b/app/helpers/timelines_helper.rb index cdc9a787ac..c6d3f9c2e6 100644 --- a/app/helpers/timelines_helper.rb +++ b/app/helpers/timelines_helper.rb @@ -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 diff --git a/app/views/timelines/_comparison.html.erb b/app/views/timelines/_comparison.html.erb index 492af893d6..e6b0f262b1 100644 --- a/app/views/timelines/_comparison.html.erb +++ b/app/views/timelines/_comparison.html.erb @@ -33,65 +33,35 @@ See doc/COPYRIGHT.rdoc for more details.
-
- -

- <%= label_tag 'timeline_options_comparison_none', - l('timelines.filter.comparison.none') %> - - <%= radio_button("timeline[options]", - :comparison, - 'none', - :checked => (timeline.comparison == 'none')) %> - -

-

- - <%= 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 %> - -

-

- - <%= 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 %> - -

-
+ <%= f.fields_for :options, timeline_options do |ff| %> +
+ <%= ff.label :comparison, l('timelines.filter.comparison.none'), for: :timeline_options_comparison_none %> +
+ <%= ff.radio_button :comparison, "none", no_label: true %> +
+
+
+ <%= ff.label :comparison, l('timelines.filter.comparison.relative'), for: :timeline_options_comparison_relative %> +
+ <%= 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 + %> +
+
+
+ <%= ff.label :comparison, l('timelines.filter.comparison.absolute'), for: :timeline_options_comparison_absolute %> +
+ <%= 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') %> +
+
+ <% end %>
diff --git a/app/views/timelines/_form.html.erb b/app/views/timelines/_form.html.erb index b43d26cf12..e8e8f24d95 100644 --- a/app/views/timelines/_form.html.erb +++ b/app/views/timelines/_form.html.erb @@ -39,20 +39,20 @@ See doc/COPYRIGHT.rdoc for more details.
- <%= 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 } %>
<% content_for :header_tags do %> - <%= stylesheet_link_tag 'timelines.css', :media => "all" %> + <%= stylesheet_link_tag 'timelines.css', media: "all" %> <% end %> diff --git a/app/views/timelines/_general.html.erb b/app/views/timelines/_general.html.erb index df6de6b9d0..ec243c1481 100644 --- a/app/views/timelines/_general.html.erb +++ b/app/views/timelines/_general.html.erb @@ -32,69 +32,54 @@ See doc/COPYRIGHT.rdoc for more details. <%= l('timelines.filter.timeline') %> -
-
-
- <%= f.text_field :name %> - <%= hidden_field_tag 'timeline[options][exist]' %> -
- <%= f.fields_for :options do |ff| %> -
- <%= ff.hidden_field :exist %> - <%= ff.check_box :hide_chart, label: l('timelines.filter.hide_chart') %> -
- -
- <%= 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}) %> -
+
+ <%= f.text_field :name, required: true %> +
+ <%= f.fields_for :options, timeline_options do |ff| %> +
+ <%= ff.hidden_field :exist %> + <%= ff.check_box :hide_chart, label: l('timelines.filter.hide_chart') %> +
-
- <%= 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}) %> +
+ <%= ff.select(:zoom_factor, + filter_select_i18n_array_with_index_and_none( + timeline.available_zoom_factors, + 'timelines.zoom.'), label: l("timelines.filter.zoom")) %> +
-
-

- <%= l('timelines.filter.timeframe') %> -

-
- <%= ff.text_field :timeframe_start, label: l('timelines.filter.timeframe_start') %> - <%= calendar_for('timeline_options_timeframe_start') %> -
-
- <%= ff.text_field :timeframe_end, label: l('timelines.filter.timeframe_end') %> - <%= calendar_for('timeline_options_timeframe_end') %> -
-
- <% 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 %> -
-
- <%= ff.select :project_sort, - [[l('timelines.filter.sort.date'), 0], [l('timelines.filter.sort.alphabet'), '1']], +
+ <%= 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} %> -
+
+

+ <%= l('timelines.filter.timeframe') %> +

+
+ <%= ff.text_field :timeframe_start, label: l('timelines.filter.timeframe_start') %> + <%= calendar_for('timeline_options_timeframe_start') %> +
+
+ <%= ff.text_field :timeframe_end, label: l('timelines.filter.timeframe_end') %> + <%= calendar_for('timeline_options_timeframe_end') %> +
+
+ <% 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 %>
-
+
+ <%= ff.select :project_sort, [[l('timelines.filter.sort.date'), 0], [l('timelines.filter.sort.alphabet'), '1']], label: l('timelines.filter.sort.project_sortation') %> +
+ <% end %> diff --git a/app/views/timelines/_vertical_planning_elements.html.erb b/app/views/timelines/_vertical_planning_elements.html.erb index 65ecd06f35..bd66727d5d 100644 --- a/app/views/timelines/_vertical_planning_elements.html.erb +++ b/app/views/timelines/_vertical_planning_elements.html.erb @@ -33,14 +33,10 @@ See doc/COPYRIGHT.rdoc for more details.
-
-

- <%= 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" %> -

-
+ <%= f.fields_for :options, timeline_options do |ff| %> +
+ <%= ff.text_field :vertical_planning_elements, label:l('timelines.vertical_work_package') %> +
+ <% end %>
diff --git a/app/views/timelines/edit.html.erb b/app/views/timelines/edit.html.erb index 093357b80e..c71b432ef8 100644 --- a/app/views/timelines/edit.html.erb +++ b/app/views/timelines/edit.html.erb @@ -31,9 +31,9 @@ See doc/COPYRIGHT.rdoc for more details. <%=I18n.t("timelines.edit_timeline", :timeline => @timeline.name)%> -<%= 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}) %> diff --git a/app/views/timelines/filter/_planning_elements.html.erb b/app/views/timelines/filter/_planning_elements.html.erb index 055f1090b3..9bade74126 100644 --- a/app/views/timelines/filter/_planning_elements.html.erb +++ b/app/views/timelines/filter/_planning_elements.html.erb @@ -33,121 +33,69 @@ See doc/COPYRIGHT.rdoc for more details.
-
-

- <%= 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?) %> -

- - -

- <%= label_tag 'timeline_options_planning_element_status', - l("timelines.filter.status") %> + <%= f.fields_for :options, timeline_options do |ff| %> +

+ <%= ff.check_box :exclude_own_planning_elements, label:l('timelines.filter.exclude_own_work_packages') %> +
+
<% 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 %> -

- -

- <%= label_tag 'timeline_options_planning_element_types', - l("timelines.filter.types") %> - +

+
<% 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 %> -

- -

- <%= label_tag 'timeline_options_planning_element_responsibles', - l("timelines.filter.work_package_responsible") %> - +

+
<% 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 %> -

- -

- <%= label_tag 'timeline_options_planning_element_assignee', - l("timelines.filter.work_package_assignee") %> - +

+
<% 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 %> -

- <%= render :partial => "timelines/custom_fields", :locals => {:timeline => @timeline, :custom_fields => timeline.get_custom_fields}%> -
+
+ + <% end %> + <%= render :partial => "timelines/custom_fields", :locals => {:timeline => @timeline, :custom_fields => timeline.get_custom_fields } %>
diff --git a/app/views/timelines/filter/_projects.html.erb b/app/views/timelines/filter/_projects.html.erb index cf4a414eff..9303d5af73 100644 --- a/app/views/timelines/filter/_projects.html.erb +++ b/app/views/timelines/filter/_projects.html.erb @@ -33,42 +33,27 @@ See doc/COPYRIGHT.rdoc for more details.
-
-

- <%= label_tag :timeline_options_exclude_reporters, - l('timelines.filter.exclude_reporters') %> - - <%= check_box_tag("timeline[options][exclude_reporters]", - :yes, - timeline.options["exclude_reporters"].present?) %> -

- -

- <%= label_tag :timeline_options_exclude_empty, - l('timelines.filter.exclude_empty') %> - - <%= check_box_tag("timeline[options][exclude_empty]", - :yes, - timeline.options["exclude_empty"].present?) %> -

- -

- <%= label_tag 'timeline_options_project_types', - l("timelines.filter.project_types") %> + <%= f.fields_for :options, timeline_options do |ff| %> +

+ <%= ff.check_box :exclude_reporters, label: l('timelines.filter.exclude_reporters') %> +
+
+ <%= ff.check_box :exclude_empty, label: l('timelines.filter.exclude_empty') %> +
+
<% 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 %> - -

- -

- <%= label_tag 'timeline_options_project_status', - l("timelines.filter.project_status") %> - +

+
<% 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 %> -

-

- <%= label_tag 'timeline_options_project_responsibles', - l("timelines.filter.project_responsible") %> - - <% if User.current.impaired? %> - <%= select("timeline[options]", - :project_responsibles, +

+
+ <% 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 %> -

- -

- <%= label_tag 'timeline_options_parents', - l("timelines.filter.parent") %> - - <% if User.current.impaired? %> - <%= select("timeline[options]", - :parents, +

+
+ <% 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 %> -

-

- <%= label_tag 'timeline_options_planning_element_time_types', - l('timelines.filter.project_time_filter') %> +

- <% if User.current.impaired? %> - <%= select("timeline[options]", - :planning_element_time_types, +
+ <% 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 %> -

- -

- <%= 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 %> -

- -

- - <%= 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 %> - -

-
+
+

<%= l('timelines.filter.project_time_filter_absolute_timeframe') %>

+
+ <%= ff.radio_button :planning_element_time, 'absolute' %> +
+
+ <%= 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 %> +
+

<%= l('timelines.filter.project_time_filter_relative_timeframe') %>

+
+ <%= ff.radio_button :planning_element_time, 'relative' %> +
+
+ <%= 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 %> +
+ <% end %>
diff --git a/app/views/timelines/group/_grouping.html.erb b/app/views/timelines/group/_grouping.html.erb index 04652aa1cf..fda695626e 100644 --- a/app/views/timelines/group/_grouping.html.erb +++ b/app/views/timelines/group/_grouping.html.erb @@ -33,34 +33,23 @@ See doc/COPYRIGHT.rdoc for more details.
-
-

- <%= 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?) %> - - - <%= label_tag :timeline_options_grouping_one_selection, - l('timelines.filter.grouping_one_phrase'), - class: 'inline-label' %> - - + <%= f.fields_for :options, timeline_options do |ff| %> +

+ <%= ff.check_box :grouping_one_enabled, label: l('timelines.filter.grouping_one') %> +
+
<% 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 %> - -

- -

- <%= label_tag :timeline_options_grouping_one_sort, - l('timelines.filter.sort.sortation') %> - - - <%= 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}) %> - - -

- -

- <%= 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?) %> - - - <%= label_tag :timeline_options_grouping_two_selection, - l('timelines.filter.grouping_two_phrase'), - class: 'inline-label' %> - - +

+
+ <%= ff.select(:grouping_one_sort, + [[l('timelines.filter.sort.alphabet'), '0'], [l('timelines.filter.sort.explicit_order'), '1']], + + { label: l('timelines.filter.sort.sortation') }) %> +
+
+ <%= ff.check_box :grouping_two_enabled, label: l('timelines.filter.grouping_two') %> +
+
<% 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 %> -

- -

- <%= label_tag :timeline_options_grouping_two_sort, - l('timelines.filter.sort.sortation') %> - - - <%= 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}) %> - - -

- -

- <%= 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?) %> -

-
+
+
+ <%= 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') ) %> +
+
+ <%= ff.check_box :hide_other_group, label: I18n.t('timelines.filter.grouping_hide_group', :group => l('timelines.filter.grouping_other')) %> +
+ <% end %>
diff --git a/app/views/timelines/new.html.erb b/app/views/timelines/new.html.erb index 7d66a5d6ec..2630c18314 100644 --- a/app/views/timelines/new.html.erb +++ b/app/views/timelines/new.html.erb @@ -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}) %>