Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not append title to breadcrumbs on show_list pages #5904

Merged
merged 2 commits into from Aug 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions app/controllers/cloud_network_controller.rb
Expand Up @@ -263,8 +263,7 @@ def breadcrumbs_options
{
:breadcrumbs => [
{:title => _("Networks")},
{:title => _("Networks")},
{:url => controller_url, :title => _("Cloud Networks")},
{:title => _("Networks"), :url => controller_url},
],
:record_info => @network,
}
Expand Down
Expand Up @@ -137,8 +137,7 @@ def breadcrumbs_options
:breadcrumbs => [
{:title => _("Storage")},
{:title => _("Object Storage")},
{:title => _("Object Store Containers")},
{:url => controller_url, :title => _("Cloud Object Store Containers")},
{:title => _("Object Store Containers"), :url => controller_url},
],
:record_info => @record,
:record_title => :key,
Expand Down
3 changes: 1 addition & 2 deletions app/controllers/cloud_object_store_object_controller.rb
Expand Up @@ -39,8 +39,7 @@ def breadcrumbs_options
:breadcrumbs => [
{:title => _("Storage")},
{:title => _("Object Storage")},
{:title => _("Object Store Objects")},
{:url => controller_url, :title => _("Cloud Object Store Objects")},
{:title => _("Object Store Objects"), :url => controller_url},
],
}
end
Expand Down
3 changes: 1 addition & 2 deletions app/controllers/cloud_subnet_controller.rb
Expand Up @@ -330,8 +330,7 @@ def breadcrumbs_options
{
:breadcrumbs => [
{:title => _("Networks")},
{:title => _("Subnets")},
{:url => controller_url, :title => _("Cloud Subnets")},
{:title => _("Subnets"), :url => controller_url},
],
}
end
Expand Down
3 changes: 1 addition & 2 deletions app/controllers/cloud_tenant_controller.rb
Expand Up @@ -257,8 +257,7 @@ def breadcrumbs_options
:breadcrumbs => [
{:title => _("Compute")},
{:title => _("Clouds")},
{:title => _("Tenants")},
{:url => controller_url, :title => _("Cloud Tenants")},
{:title => _("Tenants"), :url => controller_url},
],
:record_info => @tenant,
}.compact
Expand Down
3 changes: 1 addition & 2 deletions app/controllers/cloud_volume_backup_controller.rb
Expand Up @@ -115,8 +115,7 @@ def breadcrumbs_options
:breadcrumbs => [
{:title => _("Storage")},
{:title => _("Block Storage")},
{:title => _("Volume Backups")},
{:url => controller_url, :title => _("Cloud Volume Backups")},
{:title => _("Volume Backups"), :url => controller_url},
],
}
end
Expand Down
3 changes: 1 addition & 2 deletions app/controllers/cloud_volume_controller.rb
Expand Up @@ -620,8 +620,7 @@ def breadcrumbs_options
:breadcrumbs => [
{:title => _("Storage")},
{:title => _("Block Storage")},
{:title => _("Volumes")},
{:url => controller_url, :title => _("Cloud Volumes")},
{:title => _("Volumes"), :url => controller_url},
],
:record_info => @volume,
}.compact
Expand Down
3 changes: 1 addition & 2 deletions app/controllers/cloud_volume_snapshot_controller.rb
Expand Up @@ -80,8 +80,7 @@ def breadcrumbs_options
:breadcrumbs => [
{:title => _("Storage")},
{:title => _("Block Storage")},
{:title => _("Volume Snapshots")},
{:url => controller_url, :title => _("Cloud Volume Snapshots")},
{:title => _("Volume Snapshots"), :url => controller_url},
],
}
end
Expand Down
3 changes: 1 addition & 2 deletions app/controllers/cloud_volume_type_controller.rb
Expand Up @@ -22,8 +22,7 @@ def breadcrumbs_options
:breadcrumbs => [
{:title => _("Storage")},
{:title => _("Block Storage")},
{:title => _("Volume Types")},
{:url => controller_url, :title => _("Cloud Volume Types")},
{:title => _("Volume Types"), :url => controller_url},
],
}
end
Expand Down
3 changes: 1 addition & 2 deletions app/controllers/configuration_job_controller.rb
Expand Up @@ -64,8 +64,7 @@ def breadcrumbs_options
:breadcrumbs => [
{:title => _("Automation")},
{:title => _("Ansible Tower")},
{:title => _("Jobs")},
{:url => controller_url, :title => _("Ansible Tower Jobs")},
{:title => _("Jobs"), :url => controller_url},
],
}
end
Expand Down
3 changes: 1 addition & 2 deletions app/controllers/container_dashboard_controller.rb
Expand Up @@ -111,8 +111,7 @@ def breadcrumbs_options
:breadcrumbs => [
{:title => _("Compute")},
{:title => _("Containers")},
{:title => _("Overview")},
{:url => controller_url, :title => _("Container Dashboard")},
{:title => _("Overview"), :url => controller_url},
],
}
end
Expand Down
3 changes: 1 addition & 2 deletions app/controllers/container_group_controller.rb
Expand Up @@ -30,8 +30,7 @@ def breadcrumbs_options
:breadcrumbs => [
{:title => _("Compute")},
{:title => _("Containers")},
{:title => _("Pods")},
{:url => controller_url, :title => _("Container Pods")},
{:title => _("Pods"), :url => controller_url},
],
}
end
Expand Down
3 changes: 1 addition & 2 deletions app/controllers/container_image_controller.rb
Expand Up @@ -50,8 +50,7 @@ def breadcrumbs_options
:breadcrumbs => [
{:title => _("Compute")},
{:title => _("Containers")},
{:title => _("Images")},
{:url => controller_url, :title => _("Container Images")},
{:title => _("Images"), :url => controller_url},
],
}
end
Expand Down
3 changes: 1 addition & 2 deletions app/controllers/container_image_registry_controller.rb
Expand Up @@ -21,8 +21,7 @@ def breadcrumbs_options
:breadcrumbs => [
{:title => _("Compute")},
{:title => _("Containers")},
{:title => _("Image Registries")},
{:url => controller_url, :title => _("Container Image Registries")},
{:title => _("Image Registries"), :url => controller_url},
],
}
end
Expand Down
3 changes: 1 addition & 2 deletions app/controllers/container_node_controller.rb
Expand Up @@ -49,8 +49,7 @@ def breadcrumbs_options
:breadcrumbs => [
{:title => _("Compute")},
{:title => _("Containers")},
{:title => _("Nodes")},
{:url => controller_url, :title => _("Container Nodes")},
{:title => _("Nodes"), :url => controller_url},
],
}
end
Expand Down
3 changes: 1 addition & 2 deletions app/controllers/container_project_controller.rb
Expand Up @@ -25,8 +25,7 @@ def breadcrumbs_options
:breadcrumbs => [
{:title => _("Compute")},
{:title => _("Containers")},
{:title => _("Projects")},
{:url => controller_url, :title => _("Container Projects")},
{:title => _("Projects"), :url => controller_url},
],
}
end
Expand Down
3 changes: 1 addition & 2 deletions app/controllers/container_replicator_controller.rb
Expand Up @@ -21,8 +21,7 @@ def breadcrumbs_options
:breadcrumbs => [
{:title => _("Compute")},
{:title => _("Containers")},
{:title => _("Replicators")},
{:url => controller_url, :title => _("Container Replicators")},
{:title => _("Replicators"), :url => controller_url},
],
}
end
Expand Down
3 changes: 1 addition & 2 deletions app/controllers/container_route_controller.rb
Expand Up @@ -19,8 +19,7 @@ def breadcrumbs_options
:breadcrumbs => [
{:title => _("Compute")},
{:title => _("Containers")},
{:title => _("Routes")},
{:url => controller_url, :title => _("Container Routes")},
{:title => _("Routes"), :url => controller_url},
],
}
end
Expand Down
3 changes: 1 addition & 2 deletions app/controllers/container_service_controller.rb
Expand Up @@ -21,8 +21,7 @@ def breadcrumbs_options
:breadcrumbs => [
{:title => _("Compute")},
{:title => _("Containers")},
{:title => _("Services")},
{:url => controller_url, :title => _("Container Services")},
{:title => _("Services"), :url => controller_url},
],
}
end
Expand Down
3 changes: 1 addition & 2 deletions app/controllers/container_template_controller.rb
Expand Up @@ -19,8 +19,7 @@ def breadcrumbs_options
:breadcrumbs => [
{:title => _("Compute")},
{:title => _("Containers")},
{:title => _("Templates")},
{:url => controller_url, :title => _("Container Templates")},
{:title => _("Templates"), :url => controller_url},
],
:record_info => (action_name == "service_dialog_from_ct" ? {:title => params["id"], :id => params["id"]} : nil),
:record_title => :title,
Expand Down
3 changes: 1 addition & 2 deletions app/controllers/ems_cloud_controller.rb
Expand Up @@ -123,8 +123,7 @@ def breadcrumbs_options
:breadcrumbs => [
{:title => _("Compute")},
{:title => _("Clouds")},
{:title => _("Providers")},
{:url => controller_url, :title => _("Cloud Providers")},
{:title => _("Providers"), :url => controller_url},
],
:record_info => @ems,
}.compact
Expand Down
3 changes: 1 addition & 2 deletions app/controllers/ems_container_controller.rb
Expand Up @@ -152,8 +152,7 @@ def breadcrumbs_options
:breadcrumbs => [
{:title => _("Compute")},
{:title => _("Containers")},
{:title => _("Providers")},
{:url => controller_url, :title => _("Container Providers")},
{:title => _("Providers"), :url => controller_url},
],
:record_info => @ems,
}.compact
Expand Down
3 changes: 1 addition & 2 deletions app/controllers/ems_infra_controller.rb
Expand Up @@ -335,8 +335,7 @@ def breadcrumbs_options
:breadcrumbs => [
{:title => _("Compute")},
{:title => _("Infrastructure")},
{:title => _("Providers")},
{:url => controller_url, :title => _("Infrastructure Providers")},
{:title => _("Providers"), :url => controller_url},
],
:record_info => @ems,
}.compact
Expand Down
3 changes: 1 addition & 2 deletions app/controllers/ems_network_controller.rb
Expand Up @@ -47,8 +47,7 @@ def breadcrumbs_options
{
:breadcrumbs => [
{:title => _("Networks")},
{:title => _("Providers")},
{:url => controller_url, :title => _("Network Managers")},
{:title => _("Providers"), :url => controller_url},
],
:record_info => @ems,
}.compact
Expand Down
3 changes: 1 addition & 2 deletions app/controllers/ems_object_storage_controller.rb
Expand Up @@ -48,8 +48,7 @@ def breadcrumbs_options
:breadcrumbs => [
{:title => _("Storage")},
{:title => _("Object Storage")},
{:title => _("Managers")},
{:url => controller_url, :title => _("Object Storage Managers")},
{:title => _("Managers"), :url => controller_url},
],
}
end
Expand Down
3 changes: 1 addition & 2 deletions app/controllers/ems_physical_infra_controller.rb
Expand Up @@ -89,8 +89,7 @@ def breadcrumbs_options
:breadcrumbs => [
{:title => _("Compute")},
{:title => _("Physical Infrastructure")},
{:title => _("Providers")},
{:url => controller_url, :title => _("Physical Infrastructure Providers")},
{:title => _("Providers"), :url => controller_url},
],
:record_info => @ems,
}.compact
Expand Down
17 changes: 16 additions & 1 deletion app/controllers/mixins/breadcrumbs_mixin.rb
Expand Up @@ -24,7 +24,8 @@ def data_for_breadcrumbs
breadcrumbs.push(special_page_breadcrumb(@tagitems || @politems || @ownershipitems || @retireitems))

# Append title breadcrumb if they exist and not same as previous breadcrumb (eg "Editing name")
if @title && @title != breadcrumbs.compact.last.try(:[], :title) && !options[:hide_title]
# Also do not append when user is on show_list page, the menu title is used instead of it
if @title && !same_as_last_breadcrumb?(breadcrumbs, @title) && !show_list_page? && !options[:hide_title]
breadcrumbs.push(:title => @title)
end
else
Expand Down Expand Up @@ -154,6 +155,20 @@ def not_show_page?
(action_name == "show" && params["display"] && !%w[dashboard main].include?(params["display"])) || (action_name != "show")
end

# User is on show_list page
# A lot of pages has different header than last item in menu
# The last item in menu is an abbreviation of the header
# So, breadcrumbs should contain only the abbreviation
def show_list_page?
action_name == "show_list"
end

# Checks if the title is same as the last item in breadcrumbs
# If so, then there is no reason to append the title to breadcrumbs
def same_as_last_breadcrumb?(breadcrumbs, title)
title == breadcrumbs.compact.last.try(:[], :title)
end

# Controls on tagging screen if the tagged item is floating_ip
def floating_ip_address?(variable)
(variable&.respond_to?(:has_attribute?) && variable&.has_attribute?(:address)) || controller_name == 'floating_ips'
Expand Down
3 changes: 1 addition & 2 deletions app/controllers/orchestration_stack_controller.rb
Expand Up @@ -248,8 +248,7 @@ def breadcrumbs_options
:breadcrumbs => [
{:title => _("Compute")},
{:title => _("Clouds")},
{:title => _("Stacks")},
{:url => controller_url, :title => _("Orchestration Stacks")},
{:title => _("Stacks"), :url => controller_url},
],
:record_info => (
unless @retireitems.nil? || @retireitems.length != 1
Expand Down
3 changes: 1 addition & 2 deletions app/controllers/persistent_volume_controller.rb
Expand Up @@ -23,8 +23,7 @@ def breadcrumbs_options
:breadcrumbs => [
{:title => _("Compute")},
{:title => _("Containers")},
{:title => _("Volumes")},
{:url => controller_url, :title => _("Persistent Volumes")},
{:title => _("Volumes"), :url => controller_url},
],
}
end
Expand Down
3 changes: 1 addition & 2 deletions app/controllers/physical_chassis_controller.rb
Expand Up @@ -37,8 +37,7 @@ def breadcrumbs_options
:breadcrumbs => [
{:title => _("Compute")},
{:title => _("Physical Infrastructure")},
{:title => _("Chassis")},
{:url => controller_url, :title => _("Physical Chassis")},
{:title => _("Chassis"), :url => controller_url},
],
}
end
Expand Down
3 changes: 1 addition & 2 deletions app/controllers/physical_rack_controller.rb
Expand Up @@ -51,8 +51,7 @@ def breadcrumbs_options
:breadcrumbs => [
{:title => _("Compute")},
{:title => _("Physical Infrastructure")},
{:title => _("Racks")},
{:url => controller_url, :title => _("Physical Racks")},
{:title => _("Racks"), :url => controller_url},
],
}
end
Expand Down
3 changes: 1 addition & 2 deletions app/controllers/physical_server_controller.rb
Expand Up @@ -138,8 +138,7 @@ def breadcrumbs_options
:breadcrumbs => [
{:title => _("Compute")},
{:title => _("Physical Infrastructure")},
{:title => _("Servers")},
{:url => controller_url, :title => _("Physical Servers")},
{:title => _("Servers"), :url => controller_url},
],
}
end
Expand Down
3 changes: 1 addition & 2 deletions app/controllers/physical_storage_controller.rb
Expand Up @@ -41,8 +41,7 @@ def breadcrumbs_options
:breadcrumbs => [
{:title => _("Compute")},
{:title => _("Physical Infrastructure")},
{:title => _("Storages")},
{:url => controller_url, :title => _("Physical Storages")},
{:title => _("Storages"), :url => controller_url},
],
}
end
Expand Down
3 changes: 1 addition & 2 deletions app/controllers/physical_switch_controller.rb
Expand Up @@ -50,8 +50,7 @@ def breadcrumbs_options
:breadcrumbs => [
{:title => _("Compute")},
{:title => _("Physical Infrastructure")},
{:title => _("Switches")},
{:url => controller_url, :title => _("Physical Switches")},
{:title => _("Switches"), :url => controller_url},
],
}
end
Expand Down