fine tuning

This commit is contained in:
Mads Rasmussen
2017-01-13 13:16:47 +01:00
parent eba8181d0c
commit 4fa36cd424
5 changed files with 36 additions and 27 deletions

View File

@@ -16,10 +16,8 @@
name: "=",
description: "=?",
sortable: "=?",
allowEdit: "=?",
allowOpen: "=?",
allowRemove: "=?",
onEdit: "&?",
onOpen: "&?",
onRemove: "&?"
},

View File

@@ -1,11 +1,11 @@
.umb-node-preview {
padding: 5px 15px;
margin-bottom: 5px;
border: 2px solid #f8f8f8;
background: @grayLighter;
border-radius: 3px;
display: flex;
align-items: center;
background: @white;
max-width: 66.6%;
}
.umb-node-preview--sortable {
@@ -38,22 +38,28 @@
}
.umb-node-preview__description {
font-size: 12px;
font-size: 11px;
line-height: 1.5em;
}
.umb-node-preview__actions {
flex: 0 0 auto;
display: flex;
align-items: center;
}
.umb-node-preview__action {
margin-left: 5px;
margin-right: 5px;
font-size: 16px;
font-size: 13px;
font-weight: bold;
opacity: 0.5;
}
.umb-node-preview__action:hover {
color: @blue;
text-decoration: none;
opacity: 1;
}
.umb-node-preview-add {
@@ -64,6 +70,7 @@
color: @blue;
font-weight: bold;
padding: 5px 15px;
max-width: 66.6%;
}
.umb-node-preview-add:hover {

View File

@@ -5,9 +5,8 @@
<div ng-if="description" class="umb-node-preview__description">{{ description }}</div>
</div>
<div class="umb-node-preview__actions">
<a class="umb-node-preview__action" title="Edit" href="" ng-if="allowEdit" ng-click="onEdit()"><i class="icon-edit"></i></a>
<a class="umb-node-preview__action" title="Open" href="" ng-if="allowOpen" ng-click="onOpen()"><i class="icon-out"></i></a>
<a class="umb-node-preview__action" title="Remove" href="" ng-if="allowRemove" ng-click="onRemove()"><i class="icon-trash"></i></a>
<a class="umb-node-preview__action" title="Open" href="" ng-if="allowOpen" ng-click="onOpen()">Open</a>
<a class="umb-node-preview__action" title="Remove" href="" ng-if="allowRemove" ng-click="onRemove()">Remove</i></a>
<div>
</div>

View File

@@ -1,7 +1,7 @@
//this controller simply tells the dialogs service to open a mediaPicker window
//with a specified callback, this callback will receive an object with a selection on it
function contentPickerController($scope, dialogService, entityResource, editorState, $log, iconHelper, $routeParams, fileManager, contentEditingHelper, angularHelper, navigationService, $location, $timeout, miniEditorHelper) {
function contentPickerController($scope, dialogService, entityResource, contentResource, editorState, $log, iconHelper, $routeParams, fileManager, contentEditingHelper, angularHelper, navigationService, $location, $timeout, miniEditorHelper) {
function trim(str, chr) {
var rgxtrim = (!chr) ? new RegExp('^\\s+|\\s+$', 'g') : new RegExp('^' + chr + '+|' + chr + '+$', 'g');
@@ -221,26 +221,32 @@ function contentPickerController($scope, dialogService, entityResource, editorSt
//load current data
var modelIds = $scope.model.value ? $scope.model.value.split(',') : [];
entityResource.getByIds(modelIds, entityType).then(function (data) {
var nodePromise = (entityType === "Document") ? contentResource.getByIds(modelIds) : entityResource.getByIds(modelIds, entityType);
//Ensure we populate the render model in the same order that the ids were stored!
_.each(modelIds, function (id, i) {
var entity = _.find(data, function (d) {
return d.id == id;
});
if (entity) {
entity.icon = iconHelper.convertFromLegacyIcon(entity.icon);
$scope.renderModel.push({ name: entity.name, id: entity.id, icon: entity.icon, path: entity.path });
}
nodePromise.then(function (data) {
_.each(modelIds, function (id, i) {
var entity = _.find(data, function (d) {
return d.id == id;
});
if (entity) {
entity.icon = iconHelper.convertFromLegacyIcon(entity.icon);
var url = (entity.urls && entity.urls.length > 0) ? entity.urls[0] : "";
var path = ($scope.model.config.showPathOnHover) ? entity.path : "";
$scope.renderModel.push({ name: entity.name, id: entity.id, icon: entity.icon, path: path, url: url });
}
});
});
//everything is loaded, start the watch on the model
startWatch();
});
}
angular.module('umbraco').controller("Umbraco.PropertyEditors.ContentPickerController", contentPickerController);

View File

@@ -1,20 +1,19 @@
<div ng-controller="Umbraco.PropertyEditors.ContentPickerController" class="umb-editor umb-contentpicker">
<ng-form name="contentPickerForm">
<div ui-sortable ng-model="renderModel">
<umb-node-preview
ng-title="{{node.path}}"
ng-repeat="node in renderModel"
icon="node.icon"
name="node.name"
description="node.path"
description="node.url"
sortable="sortable"
allow-remove="allowRemoveButton"
allow-open="model.config.showOpenButton && allowOpenButton && !dialogEditor"
allow-edit="model.config.showEditButton && allowEditButton && !dialogEditor"
on-remove="remove($index)"
on-open="showNode($index)"
on-edit="openMiniEditor(node)">
on-open="openMiniEditor(node)">
</umb-node-preview>
</div>