Skip to content

Commit

Permalink
Merge pull request #183 from TimothyJones/add-matrix-link
Browse files Browse the repository at this point in the history
Add matrix link to pact rows on index pages
  • Loading branch information
bethesque authored Feb 4, 2018
2 parents fcf4b0e + baa2131 commit 8a2b75c
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 9 deletions.
3 changes: 3 additions & 0 deletions lib/pact_broker/ui/helpers/url_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ def group_url pacticipant_name
"/groups/#{ERB::Util.url_encode(pacticipant_name)}"
end

def matrix_url consumer_name, provider_name
"/matrix/provider/#{ERB::Util.url_encode(provider_name)}/consumer/#{ERB::Util.url_encode(consumer_name)}"
end
end
end
end
Expand Down
4 changes: 4 additions & 0 deletions lib/pact_broker/ui/view_models/index_item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ def pact_url
"#{pactigration_base_url('', @relationship)}/latest"
end

def pact_matrix_url
Helpers::URLHelper.matrix_url consumer_name, provider_name
end

def any_webhooks?
@relationship.any_webhooks?
end
Expand Down
9 changes: 6 additions & 3 deletions lib/pact_broker/ui/views/index/show-with-tags.haml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@
%span{style: 'color:gray'}
= index_item.tag_names
%td.pact
%a{ href: index_item.pact_url, title: "View pact" }
%span.pact
%span.pact
%a{ href: index_item.pact_url, title: "View pact" }
%span.pact-matrix
%a{ href: index_item.pact_matrix_url, title: "View pact matrix" }
%td.provider
%a{ href: index_item.provider_group_url }
= index_item.provider_name
Expand All @@ -74,7 +76,8 @@
});

$(document).ready(function(){
$("span.pact").load("/images/doc-text.svg");
$("span.pact a").load("/images/doc-text.svg");
$("span.pact-matrix a").load("/images/doc-matrix.svg");
$('td[data-toggle="tooltip"]').each(function(index, td){
//appended tooltip div screws up table if it's appended after a
//td, so need to append it to a div
Expand Down
9 changes: 6 additions & 3 deletions lib/pact_broker/ui/views/index/show.haml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@
%a{ href: index_item.consumer_group_url }
= index_item.consumer_name
%td.pact
%a{ href: index_item.pact_url, :title => "View pact" }
%span.pact
%span.pact
%a{ href: index_item.pact_url, :title => "View pact" }
%span.pact-matrix
%a{ href: index_item.pact_matrix_url, title: "View pact matrix" }
%td.provider
%a{ href: index_item.provider_group_url }
= index_item.provider_name
Expand All @@ -66,7 +68,8 @@
});

$(document).ready(function(){
$("span.pact").load("/images/doc-text.svg");
$("span.pact a").load("/images/doc-text.svg");
$("span.pact-matrix a").load("/images/doc-matrix.svg");
$('td[data-toggle="tooltip"]').each(function(index, td){
//appended tooltip div screws up table if it's appended after a
//td, so need to append it to a div
Expand Down
15 changes: 15 additions & 0 deletions public/images/doc-matrix.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 5 additions & 3 deletions public/stylesheets/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,18 @@ span.pact {
display: inline-block;
}

span.pact svg {
span.pact svg, span.pact-matrix svg {
width: 20px !important;
height: 20px !important;
overflow: visible;
}

span.pact svg path {
span.pact svg path, span.pact-matrix svg path {
fill: #111111;
stroke: #111111;
}

span.pact:hover svg path {
span.pact:hover svg path, span.pact-matrix:hover svg path {
fill: #2a6496;
stroke: #2a6496;
}
1 change: 1 addition & 0 deletions spec/lib/pact_broker/ui/view_models/index_item_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ module ViewDomain
its(:consumer_name) { should eq 'Consumer Name'}
its(:provider_name) { should eq 'Provider Name'}
its(:pact_url) { should eq "/pacts/provider/Provider%20Name/consumer/Consumer%20Name/latest" }
its(:pact_matrix_url) { should eq "/matrix/provider/Provider%20Name/consumer/Consumer%20Name" }
its(:consumer_group_url) { should eq "/groups/Consumer%20Name" }
its(:provider_group_url) { should eq "/groups/Provider%20Name" }

Expand Down

0 comments on commit 8a2b75c

Please sign in to comment.