diff --git a/app/assets/stylesheets/base.scss b/app/assets/stylesheets/base.scss index 778ff335116..4ac632ef054 100644 --- a/app/assets/stylesheets/base.scss +++ b/app/assets/stylesheets/base.scss @@ -193,6 +193,12 @@ select { padding-bottom: 12px; } +.breadcrumb-line { + margin-top: -15px; + margin-right: -60px; + margin-left: -60px; +} + .grey, .gray { color: #808080 !important; diff --git a/app/controllers/audits_controller.rb b/app/controllers/audits_controller.rb index fe05a4b509e..b6ae1155137 100644 --- a/app/controllers/audits_controller.rb +++ b/app/controllers/audits_controller.rb @@ -5,6 +5,7 @@ class AuditsController < ApplicationController def index @audits = resource_base_search_and_page.with_taxonomy_scope.preload(:user) + @host = resource_finder(Host.authorized(:view_hosts), params[:host_id]) if params[:host_id] end def show diff --git a/app/controllers/config_reports_controller.rb b/app/controllers/config_reports_controller.rb index 119c4de3da5..2bdb2c8caa8 100644 --- a/app/controllers/config_reports_controller.rb +++ b/app/controllers/config_reports_controller.rb @@ -7,6 +7,7 @@ class ConfigReportsController < ApplicationController def index respond_to do |format| format.html do + @host = resource_finder(Host.authorized(:view_hosts), params[:host_id]) if params[:host_id] @config_reports = resource_base_search_and_page(:host) render :index end diff --git a/app/controllers/images_controller.rb b/app/controllers/images_controller.rb index b6ba3894b5b..56fa558442e 100644 --- a/app/controllers/images_controller.rb +++ b/app/controllers/images_controller.rb @@ -8,7 +8,7 @@ def index # Listing images in /hosts/new consumes this method as JSON @images = resource_base.where(:compute_resource_id => @compute_resource.id).includes(:operatingsystem) respond_to do |format| - format.html { render :partial => 'images/list' } + format.html { params[:partial] ? render(:partial => 'images/list') : render(:index) } format.json { render :json => @images.where(:operatingsystem_id => params[:operatingsystem_id], :architecture_id => params[:architecture_id]).order(:name) } end end diff --git a/app/helpers/layout_helper.rb b/app/helpers/layout_helper.rb index 609320b001d..5e8fa688d70 100644 --- a/app/helpers/layout_helper.rb +++ b/app/helpers/layout_helper.rb @@ -16,6 +16,21 @@ def search_bar(*elements) content_for(:search_bar) { elements.join(" ").html_safe } end + def mount_breadcrumbs(&block) + index_page = {caption: _(controller_name.humanize), url: try("#{controller_name}_path")} + default_menu = [(index_page unless action_name == 'index'), + {caption: @page_header, url: '#' }].compact unless block_given? + + mount_react_component("Breadcrumb", "#breadcrumb", + { menu: default_menu || yield }.to_json) + end + + def breadcrumbs(&block) + content_for(:breadcrumbs) do + mount_breadcrumbs(&block) + end + end + def stylesheet(*args) content_for(:stylesheets) { stylesheet_link_tag(*args.push("data-turbolinks-track" => true)) } end diff --git a/app/views/architectures/edit.html.erb b/app/views/architectures/edit.html.erb index 3fc9354132f..ccd85bd33ed 100644 --- a/app/views/architectures/edit.html.erb +++ b/app/views/architectures/edit.html.erb @@ -1,3 +1,3 @@ -<% title _("Edit Architecture") %> +<% title _("Edit %s") % @architecture.to_s %> <%= render :partial => 'form' %> diff --git a/app/views/audits/index.html.erb b/app/views/audits/index.html.erb index c981a96f522..0a7e575707f 100644 --- a/app/views/audits/index.html.erb +++ b/app/views/audits/index.html.erb @@ -1,3 +1,12 @@ + <%= if @host + breadcrumbs do + [ + {caption: _("Hosts"), url: (url_for(hosts_path) if authorized_for(hash_for_hosts_path))}, + {caption: @host.name, url: (host_path(@host) if authorized_for(hash_for_host_path(@host)))}, + {caption: _('Audits'), url: url_for(audits_path)}, + ] + end +end %> <% title _("Audits") %> <% title_actions documentation_button('4.1.4Auditing') %> <%= render :partial => 'list', :locals =>{:audits => @audits}%> diff --git a/app/views/audits/show.html.erb b/app/views/audits/show.html.erb index 800e2707bf3..1a576c4475a 100644 --- a/app/views/audits/show.html.erb +++ b/app/views/audits/show.html.erb @@ -8,7 +8,6 @@ hash_for_host_path(:id => @audit.associated.to_param).merge(:auth_object => @audit.associated, :auth_action => 'view'), :title => _("Host details"), :class => 'btn btn-default') if @audit.auditable_type.match(/^Nic/) && @audit.associated_type == 'Host::Base' && @audit.associated %> -<%= title_actions link_to 'Back', :back, :class=>'btn btn-default' %> <% tmplt = audit_template?(@audit) %>
diff --git a/app/views/auth_source_ldaps/edit.html.erb b/app/views/auth_source_ldaps/edit.html.erb index 0a8aa2f6064..096bc05ce89 100644 --- a/app/views/auth_source_ldaps/edit.html.erb +++ b/app/views/auth_source_ldaps/edit.html.erb @@ -1,3 +1,3 @@ -<% title _("Edit LDAP Auth Source") %> +<% title _("Edit %s") % @auth_source_ldap.to_s %> <%= render :partial => 'form' %> diff --git a/app/views/bookmarks/edit.html.erb b/app/views/bookmarks/edit.html.erb index 018351b8b3f..1ec7d3f247d 100644 --- a/app/views/bookmarks/edit.html.erb +++ b/app/views/bookmarks/edit.html.erb @@ -1,3 +1,3 @@ -<% title _("Edit Bookmark") %> +<% title _("Edit %s") % @bookmark.to_s %> <%= render :partial => 'form' %> diff --git a/app/views/common_parameters/edit.html.erb b/app/views/common_parameters/edit.html.erb index 106f0444743..3e37e59cae2 100644 --- a/app/views/common_parameters/edit.html.erb +++ b/app/views/common_parameters/edit.html.erb @@ -1,3 +1,3 @@ -<% title _("Edit Global Parameter") %> +<% title _("Edit %s") % @common_parameter.to_s %> <%= render :partial => 'form' %> diff --git a/app/views/compute_attributes/edit.html.erb b/app/views/compute_attributes/edit.html.erb index d8887cbf49c..a9ff6dcb2e9 100644 --- a/app/views/compute_attributes/edit.html.erb +++ b/app/views/compute_attributes/edit.html.erb @@ -1,3 +1,9 @@ -<% title _("Edit compute profile on %s") % @set.compute_resource.to_label %> - +<%= breadcrumbs do + [ + {caption: _("Compute Resources"), url: (url_for(compute_resources_path) if authorized_for(hash_for_compute_resources_path))}, + {caption: @set.compute_resource.to_label, url: (compute_resource_path(@set.compute_resource) if authorized_for(hash_for_compute_resource_path(@set.compute_resource)))}, + {caption: _("Compute Profiles"), url: (url_for(compute_profiles_path) if authorized_for(hash_for_compute_profiles_path))}, + {caption: _('Edit %s' % @set.compute_profile.to_label)} + ] + end %> <%= render 'form' %> diff --git a/app/views/compute_attributes/new.html.erb b/app/views/compute_attributes/new.html.erb index 6b63d48fe5a..063cb4118d0 100644 --- a/app/views/compute_attributes/new.html.erb +++ b/app/views/compute_attributes/new.html.erb @@ -1,3 +1,9 @@ -<% title _("New compute profile on %s") % @set.compute_resource.to_label %> - +<%= breadcrumbs do + [ + {caption: _("Compute Resources"), url: (url_for(compute_resources_path) if authorized_for(hash_for_compute_resources_path))}, + {caption: @set.compute_resource.to_label, url: (compute_resource_path(@set.compute_resource) if authorized_for(hash_for_compute_resource_path(@set.compute_resource)))}, + {caption: _("Compute Profiles"), url: (url_for(compute_profiles_path) if authorized_for(hash_for_compute_profiles_path))}, + {caption: _('New %s' % @set.compute_profile.to_label)} + ] + end %> <%= render 'form' %> diff --git a/app/views/compute_profiles/show.html.erb b/app/views/compute_profiles/show.html.erb index 31cc3884bb9..d2587b4029d 100644 --- a/app/views/compute_profiles/show.html.erb +++ b/app/views/compute_profiles/show.html.erb @@ -1,4 +1,4 @@ -<% title(_("Edit Compute profile: %s") % @compute_profile.name) %> +<% title(@compute_profile.name) %> <% title_actions display_link_if_authorized(_("Back"), hash_for_compute_profiles_path, :class => 'btn btn-default') %> diff --git a/app/views/compute_resources/show.html.erb b/app/views/compute_resources/show.html.erb index 8fca921ac04..9b75dd78720 100644 --- a/app/views/compute_resources/show.html.erb +++ b/app/views/compute_resources/show.html.erb @@ -48,7 +48,7 @@ <% if @compute_resource.capabilities.include?(:image) %>
<%= title_actions(new_link(_("Create Image"), { :compute_resource_id => @compute_resource.id, :controller => :images }, { :data=>{:target=>"full-page"} })) %> -
> +
true }) %>> <%= spinner(_('Loading images information ...')) %>
diff --git a/app/views/config_groups/edit.html.erb b/app/views/config_groups/edit.html.erb index 9fd63dc3f19..de8bcbcfc9d 100644 --- a/app/views/config_groups/edit.html.erb +++ b/app/views/config_groups/edit.html.erb @@ -1,3 +1,3 @@ -<% title _("Edit Config group") %> +<% title _("Edit %s") % @config_group.to_s %> <%= render 'form' %> diff --git a/app/views/config_reports/index.html.erb b/app/views/config_reports/index.html.erb index 36225478ea2..6f0ca0f5d17 100644 --- a/app/views/config_reports/index.html.erb +++ b/app/views/config_reports/index.html.erb @@ -1,3 +1,12 @@ +<%= if @host + breadcrumbs do + [ + {caption: _("Hosts"), url: (url_for(hosts_path) if authorized_for(hash_for_hosts_path))}, + {caption: @host.name, url: (host_path(@host) if authorized_for(hash_for_host_path(@host)))}, + {caption: _('Reports'), url: url_for(config_reports_path(search: 'eventful=true'))}, + ] + end +end %> <% title _("Reports") %> <% title_actions csv_link, documentation_button('3.5.4PuppetReports') %> <%= render :partial => 'list' %> diff --git a/app/views/config_reports/show.html.erb b/app/views/config_reports/show.html.erb index fdb1e06dead..17c14572548 100644 --- a/app/views/config_reports/show.html.erb +++ b/app/views/config_reports/show.html.erb @@ -15,8 +15,7 @@ <%= render report_origin_output_partial(@config_report.origin), :logs => @config_report.logs %> <%= render 'metrics', :status => @config_report.status, :metrics => @config_report.metrics["time"] if @config_report.metrics["time"] %> -<%= title_actions link_to(_('Back'), :back, :class => 'btn btn-default'), - display_delete_if_authorized(hash_for_config_report_path(:id => @config_report), :class=> "btn btn-danger"), +<%= title_actions display_delete_if_authorized(hash_for_config_report_path(:id => @config_report), :class=> "btn btn-danger"), link_to(_("Host details"), @config_report.host, :class => 'btn btn-default'), link_to(_("Other reports for this host"), host_config_reports_path(@config_report.host), :class => 'btn btn-default') %> diff --git a/app/views/domains/edit.html.erb b/app/views/domains/edit.html.erb index 8e28ae8e7a1..f3c6a2dc1be 100644 --- a/app/views/domains/edit.html.erb +++ b/app/views/domains/edit.html.erb @@ -1,3 +1,3 @@ -<% title _("Edit Domain") %> +<% title _("Edit %s") % @domain.to_s %> <%= render :partial => 'form' %> diff --git a/app/views/environments/edit.html.erb b/app/views/environments/edit.html.erb index 99fe722627d..253339aef49 100644 --- a/app/views/environments/edit.html.erb +++ b/app/views/environments/edit.html.erb @@ -1,3 +1,3 @@ -<% title _("Edit Environment") %> +<% title _("Edit %s") % @environment.to_s %> <%= render :partial => 'form' %> diff --git a/app/views/fact_values/index.html.erb b/app/views/fact_values/index.html.erb index a7765d46c57..ac9be12f86b 100644 --- a/app/views/fact_values/index.html.erb +++ b/app/views/fact_values/index.html.erb @@ -1,7 +1,13 @@ <%= javascript 'charts' %> <% if params[:host_id].present? - title(_("Fact Values | %{host_name}") % {:host_name => params[:host_id]}) + breadcrumbs do + [ + {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')} + ] + end else title(_("Fact Values")) end diff --git a/app/views/filters/edit.html.erb b/app/views/filters/edit.html.erb index 2188e33ad27..2294e618518 100644 --- a/app/views/filters/edit.html.erb +++ b/app/views/filters/edit.html.erb @@ -1,3 +1,9 @@ -<% title _("Edit Filter") %> +<%= breadcrumbs do + [ + (@role.present? ? {caption: _('Roles'), url: (url_for(roles_path) if authorized_for(hash_for_roles_path))} : {caption: _("Filters"), url: filters_path}), + ({caption: _("%s filters") % @role.to_s, url: filters_path(role_id: @role.id)} if @role.present?), + {caption: _('Edit %s') % @filter.to_s}, + ].compact + end %> <%= render 'form' %> diff --git a/app/views/filters/index.html.erb b/app/views/filters/index.html.erb index b9181846748..1b850335375 100644 --- a/app/views/filters/index.html.erb +++ b/app/views/filters/index.html.erb @@ -1,5 +1,10 @@ <% if @role - title _("Filters for role %s") % @role.to_s + breadcrumbs do + [ + {caption: _("Roles"), url: (url_for(roles_path) if authorized_for(hash_for_roles_path))}, + {caption: _("%s filters") % @role.to_s} + ] + end else title _("Filters") end %> diff --git a/app/views/filters/new.html.erb b/app/views/filters/new.html.erb index e1fd6bf58e4..ff286033b74 100644 --- a/app/views/filters/new.html.erb +++ b/app/views/filters/new.html.erb @@ -1,3 +1,8 @@ -<% title _("Create Filter") %> - +<%= breadcrumbs do + [ + (@role.present? ? {caption: _('Roles'), url: (url_for(roles_path) if authorized_for(hash_for_roles_path))} : {caption: _("Filters"), url: filters_path}), + ({caption: _("%s filters") % @role.to_s, url: filters_path(role_id: @role.id)} if @role.present?), + {caption: _('Create Filter')}, + ].compact + end %> <%= render 'form' %> diff --git a/app/views/hosts/_form.html.erb b/app/views/hosts/_form.html.erb index 7f21f290b08..f8c148a69dc 100644 --- a/app/views/hosts/_form.html.erb +++ b/app/views/hosts/_form.html.erb @@ -9,7 +9,7 @@ <%= base_errors_for @host %>