use item.editPath for new tab URL

This commit is contained in:
Niels Lyngsø
2019-03-11 14:52:16 +01:00
parent 829980adb2
commit 1098db1632
8 changed files with 16 additions and 34 deletions

View File

@@ -115,17 +115,13 @@ Use this directive to generate a list of content items presented as a flexbox gr
scope.onClick(item, $event, $index);
}
};
scope.getItemUrl = function(item) {
if(scope.getItemUrl) {
scope.getItemUrl(item);
}
};
scope.clickItemName = function(item, $event, $index) {
if(scope.onClickName) {
if(scope.onClickName && !($event.metaKey || $event.ctrlKey)) {
scope.onClickName(item, $event, $index);
$event.preventDefault();
}
$event.stopPropagation();
};
}
@@ -137,7 +133,6 @@ Use this directive to generate a list of content items presented as a flexbox gr
scope: {
content: '=',
contentProperties: "=",
getItemUrl: "&",
onClick: "=",
onClickName: "="
},

View File

@@ -117,16 +117,11 @@
var vm = this;
vm.clickItem = function (item, $event) {
if (vm.onClick) {
if (vm.onClick && !($event.metaKey || $event.ctrlKey)) {
vm.onClick({ item: item});
$event.stopPropagation();
}
};
vm.getItemUrl = function (item) {
if (vm.getItemUrl) {
vm.getItemUrl({ item: item});
$event.preventDefault();
}
$event.stopPropagation();
};
vm.selectItem = function (item, $index, $event) {
@@ -177,7 +172,6 @@
allowSelectAll: '<',
onSelect: '&',
onClick: '&',
getItemUrl: '&',
onSelectAll: '&',
onSelectedAll: '&',
onSortingDirection: '&',

View File

@@ -13,7 +13,6 @@
user-select: none;
box-shadow: 0 1px 1px 0 rgba(0,0,0,0.16);
border-radius: 3px;
}
.umb-content-grid__item.-selected {
@@ -59,7 +58,8 @@
display: inline-flex;
color: @ui-option-type;
&:hover {
&:hover, &:focus {
text-decoration: none;
color:@ui-option-type-hover;
}
}

View File

@@ -10,10 +10,13 @@
<div class="umb-content-grid__content">
<div class="umb-content-grid__item-name" ng-click="clickItemName(item, $event, $index)" ng-class="{'-light': !item.published && item.updater != null}">
<a class="umb-content-grid__item-name"
ng-href="{{'#' + item.editPath}}"
ng-click="clickItemName(item, $event, $index)"
ng-class="{'-light': !item.published && item.updater != null}">
<i class="umb-content-grid__icon {{ item.icon }}"></i>
<span>{{ item.name }}</span>
</div>
</a>
<ul class="umb-content-grid__details-list" ng-class="{'-light': !item.published && item.updater != null}">
<li class="umb-content-grid__details-item" ng-if="item.state">

View File

@@ -41,7 +41,7 @@
</div>
<div class="umb-table-cell umb-table__name">
<a title="{{ item.name }}" class="umb-table-body__link"
ng-href="vm.getItemUrl(item)"
ng-href="{{'#' + item.editPath}}"
ng-click="vm.clickItem(item, $event)"
ng-bind="item.name">
</a>

View File

@@ -116,15 +116,6 @@
listViewHelper.selectHandler(folder, $index, $scope.folders, $scope.selection, $event);
}
function getItemUrl(item) {
// if item.id is 2147483647 (int.MaxValue) use item.key
console.log("request URL for", item)
console.log($scope.entityType + '/' + $scope.entityType + '/edit/' + (item.id === 2147483647 ? item.key : item.id))
return $scope.entityType + '/' + $scope.entityType + '/edit/' + (item.id === 2147483647 ? item.key : item.id);
}
function goToItem(node, $event, $index) {
var contentEditor = {

View File

@@ -44,7 +44,6 @@
item-properties="options.includeProperties"
on-select="vm.selectItem(item, $index, $event)"
on-click="vm.clickItem(item)"
get-item-url="vm.getItemUrl(item)"
on-select-all="vm.selectAll($event)"
on-selected-all="vm.isSelectedAll()"
on-sorting-direction="vm.isSortDirection(col, direction)"

View File

@@ -19,7 +19,7 @@
vm.activeDrag = false;
vm.isRecycleBin = $scope.contentId === '-21' || $scope.contentId === '-20';
vm.acceptedMediatypes = [];
vm.selectItem = selectItem;
vm.clickItem = clickItem;
vm.selectAll = selectAll;
@@ -55,7 +55,7 @@
function clickItem(item) {
// if item.id is 2147483647 (int.MaxValue) use item.key
$location.path($scope.entityType + '/' + $scope.entityType + '/edit/' + (item.id === 2147483647 ? item.key : item.id));
}
}
function isSortDirection(col, direction) {
return listViewHelper.setSortingDirection(col, direction, $scope.options);