From 10c714be994926a68bcc8d2a361405a2c25ce103 Mon Sep 17 00:00:00 2001 From: Amir Fefer Date: Tue, 9 Oct 2018 23:39:44 +0300 Subject: [PATCH] Fixes #24276 - add resource switcher to facts page --- app/helpers/fact_values_helper.rb | 17 +++++++++++++++++ app/views/fact_values/index.html.erb | 16 +--------------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/app/helpers/fact_values_helper.rb b/app/helpers/fact_values_helper.rb index f01cfd20217..da546d2c455 100644 --- a/app/helpers/fact_values_helper.rb +++ b/app/helpers/fact_values_helper.rb @@ -49,4 +49,21 @@ def fact_origin_icon(origin) return origin if origin == 'N/A' image_tag(origin + ".png", :title => origin) end + + def fact_breadcrumbs + breadcrumbs( + items: [ + { + caption: _("Facts Values"), + url: (url_for(fact_values_path) if authorized_for(hash_for_fact_values_path)) + }, + { + caption: params[:host_id] + } + ], + resource_url: api_hosts_path(thin: true), + switcher_item_url: host_facts_path(':name'), + switchable: true + ) + end end diff --git a/app/views/fact_values/index.html.erb b/app/views/fact_values/index.html.erb index 1cb769ca84b..2b6e024e93c 100644 --- a/app/views/fact_values/index.html.erb +++ b/app/views/fact_values/index.html.erb @@ -1,20 +1,6 @@ <% if params[:host_id].present? - breadcrumbs( - items: [ - { - caption: _("Facts"), - url: (url_for(fact_values_path) if authorized_for(hash_for_fact_values_path)) - }, - { - caption: params[:host_id], - url: (host_path(params[:host_id]) if authorized_for(hash_for_host_path(params[:host_id]))) - }, - { - caption: _('values') - } - ] - ) + fact_breadcrumbs else title(_("Fact Values")) end