Skip to content

Commit

Permalink
Have labels with URLs in them turn into links
Browse files Browse the repository at this point in the history
  • Loading branch information
Joseph Schorr committed Jan 6, 2020
1 parent d8bd445 commit 291967b
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 6 deletions.
8 changes: 8 additions & 0 deletions static/css/directives/ui/label-view.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,11 @@
overflow: hidden;
text-overflow: ellipsis;
}

.label-view-element-link.is-link .key {
text-transform: uppercase;
font-size: 8px;
margin-right: 2px;
position: relative;
top: -1px;
}
24 changes: 18 additions & 6 deletions static/directives/label-view.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
<a class="label-view-element" ng-click="viewLabelValue()">
<span class="kind">{{ getKind(label) }}</span>
<span class="label-value">
<span class="label-view-element">
<a class="label-view-element-link" ng-click="viewLabelValue()" ng-if="!isUrl(label.value)">
<span class="kind" ng-show="getKind(label)">{{ getKind(label) }}</span>
<span class="label-value">
<span class="key">{{ label.key }}</span>
<span class="equals">=</span>
<span class="value">{{ label.value }}</span>
</span>
</a>
<a class="label-view-element-link is-link"
ng-if="isUrl(label.value)"
ng-href="{{ label.value }}"
rel="nofollow noopener"
target="_blank">
<span class="label-value">
<span class="key">{{ label.key }}</span>
<span class="equals">=</span>
<span class="value">{{ label.value }}</span>
</span>
</a>
</span>
</a>
</span>
4 changes: 4 additions & 0 deletions static/js/directives/ui/label-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ angular.module('quay').directive('labelView', function () {
return '';
};

$scope.isUrl = function(value) {
return value && value.indexOf('https:') == 0;
};

$scope.viewLabelValue = function() {
bootbox.alert({
size: "small",
Expand Down

0 comments on commit 291967b

Please sign in to comment.