From 7f1cc7f13deda9939627a70c3376b31717aabe21 Mon Sep 17 00:00:00 2001 From: Adrian Toth Date: Wed, 30 Aug 2017 10:27:25 +0200 Subject: [PATCH] Remove TASK_TIME_PERIODS from UiConstants --- app/helpers/miq_task_helper.rb | 11 +++++++++++ app/helpers/ui_constants.rb | 10 ---------- app/views/miq_task/_tasks_options.html.haml | 2 +- 3 files changed, 12 insertions(+), 11 deletions(-) create mode 100644 app/helpers/miq_task_helper.rb diff --git a/app/helpers/miq_task_helper.rb b/app/helpers/miq_task_helper.rb new file mode 100644 index 00000000000..62cf39cadb8 --- /dev/null +++ b/app/helpers/miq_task_helper.rb @@ -0,0 +1,11 @@ +module MiqTaskHelper + TASK_TIME_PERIODS = { + 0 => N_("Today"), + 1 => N_("1 Day Ago"), + 2 => N_("2 Days Ago"), + 3 => N_("3 Days Ago"), + 4 => N_("4 Days Ago"), + 5 => N_("5 Days Ago"), + 6 => N_("6 Days Ago") + }.freeze +end diff --git a/app/helpers/ui_constants.rb b/app/helpers/ui_constants.rb index dad8f4b6694..3a205737306 100644 --- a/app/helpers/ui_constants.rb +++ b/app/helpers/ui_constants.rb @@ -5,16 +5,6 @@ module UiConstants VALID_PLANNING_VM_MODES = PlanningHelper::PLANNING_VM_MODES.keys.index_by(&:to_s) - TASK_TIME_PERIODS = { - 0 => N_("Today"), - 1 => N_("1 Day Ago"), - 2 => N_("2 Days Ago"), - 3 => N_("3 Days Ago"), - 4 => N_("4 Days Ago"), - 5 => N_("5 Days Ago"), - 6 => N_("6 Days Ago") - } - PROV_TIME_PERIODS = { 1 => N_("Last 24 Hours"), 7 => N_("Last 7 Days"), diff --git a/app/views/miq_task/_tasks_options.html.haml b/app/views/miq_task/_tasks_options.html.haml index b90fe82f5f5..c802448c46c 100644 --- a/app/views/miq_task/_tasks_options.html.haml +++ b/app/views/miq_task/_tasks_options.html.haml @@ -32,7 +32,7 @@ = _("24 Hour Time Period") .col-md-8 = select_tag("time_period", - options_for_select(Array(TASK_TIME_PERIODS.invert).sort_by(&:last).map{|x| [_(x[0]), x[1]]}, @tasks_options[@tabform][:time_period]), + options_for_select(Array(MiqTaskHelper::TASK_TIME_PERIODS.invert).sort_by(&:last).map{|x| [_(x[0]), x[1]]}, @tasks_options[@tabform][:time_period]), :class => "selectpicker") :javascript miqInitSelectPicker();