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

Fix Policy breadcrumbs when coming from GTL page #5814

Merged
merged 4 commits into from
Jul 26, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/controllers/mixins/breadcrumbs_mixin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ def build_breadcrumbs_no_explorer(record_info, record_title)
def special_page_breadcrumb(variable)
# breadcrumb_url = url(controller_url, notshow, variable.first[:id])
# EMS has key instead of name
return unless variable
return if !variable || variable.count != 1

if variable.first[:key]
title = variable.first[:key]
# FloatingIps do not have name
Expand Down
10 changes: 10 additions & 0 deletions spec/controllers/mixins/breadcrumbs_mixin_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,16 @@ class TestMixin < ApplicationController
expect(mixin.special_page_breadcrumb(mixin.instance_variable_get(:@tagitems))).to eq(nil)
end
end

context "more than one item is selected in GTL page" do
before do
mixin.instance_variable_set(:@tagitems, [{:id => "1789", :description => "item"}, {:id => "1984", :description => "thing"}])
end

it "returns nil" do
expect(mixin.special_page_breadcrumb(mixin.instance_variable_get(:@tagitems))).to eq(nil)
end
end
end

describe "#ancestry_parents" do
Expand Down