Skip to content

Commit

Permalink
Fixes review comments:
Browse files Browse the repository at this point in the history
- add parameter to initResourceReference function;
- fixes same as button size.
  • Loading branch information
boyan-tonchev committed Aug 9, 2023
1 parent 68c6ef6 commit 0848434
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
12 changes: 6 additions & 6 deletions src/js/angular/explore/controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,23 +104,23 @@ function ExploreCtrl(
return ClassInstanceDetailsService.getLocalName(uri);
};

const initResourceReference = () => {
const initResourceReference = (resourceInfo) => {
if ($routeParams.prefix && $routeParams.localName && usedPrefixes[$routeParams.prefix]) {
// /resource/PREFIX/LOCAL -> URI = expanded PREFIX + LOCAL
$scope.resourceInfo.uri = usedPrefixes[$routeParams.prefix] + $routeParams.localName;
resourceInfo.uri = usedPrefixes[$routeParams.prefix] + $routeParams.localName;
} else if ($location.search().uri) {
// uri parameter -> URI
$scope.resourceInfo.uri = $location.search().uri + ($location.hash() ? '#' + $location.hash() : '');
resourceInfo.uri = $location.search().uri + ($location.hash() ? '#' + $location.hash() : '');
} else if ($location.search().triple) {
// uri parameter -> URI
$scope.resourceInfo.triple = $location.search().triple + ($location.hash() ? '#' + $location.hash() : '');
resourceInfo.triple = $location.search().triple + ($location.hash() ? '#' + $location.hash() : '');
} else {
// absolute URI -> URI
$scope.resourceInfo.uri = $location.absUrl();
resourceInfo.uri = $location.absUrl();
}
// remove angle brackets which were allowed when filling out the search input field
// but are forbidden when passing the uri as a query parameter
$scope.resourceInfo.uri = $scope.resourceInfo.uri && $scope.resourceInfo.uri.replace(/<|>/g, "");
resourceInfo.uri = resourceInfo.uri && resourceInfo.uri.replace(/<|>/g, "");
};

$scope.loadResource = () => {
Expand Down
5 changes: 2 additions & 3 deletions src/pages/explore.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,15 @@ <h1 fit-text fit-text-min="30">
</select>
</label>

<button type="button" class="btn btn-link same-as-btn"
<button type="button" class="btn btn-link same-as-btn btn-sm"
ng-model="sameAs"
ng-class="loading ? 'disabled' : ''"
ng-if="resourceInfo.contextType !== ContextTypes.EXPLICIT"
ng-click="toggleSameAs()"
uib-popover="{{'sidepanel.expand.results.sameas' | translate}}: {{resourceInfo.sameAs ? 'common.on.btn' : 'common.off.btn' | translate}}"
popover-trigger="mouseenter"
popover-placement="bottom">
<span class="icon-2-5x"
ng-class="{'icon-sameas-on':resourceInfo.sameAs, 'icon-sameas-off':!resourceInfo.sameAs}"></span>
<span ng-class="{'icon-sameas-on':resourceInfo.sameAs, 'icon-sameas-off':!resourceInfo.sameAs}"></span>
</button>

<button type="button"
Expand Down

0 comments on commit 0848434

Please sign in to comment.