Merge remote-tracking branch 'origin/dev-v7' into dev-v7.7
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* @ngdoc filter
|
||||
* @name umbraco.filters.preserveNewLineInHtml
|
||||
* @description
|
||||
* Used when rendering a string as HTML (i.e. with ng-bind-html) to convert line-breaks to <br /> tags
|
||||
**/
|
||||
angular.module("umbraco.filters").filter('preserveNewLineInHtml', function () {
|
||||
return function (text) {
|
||||
return text.replace(/\n/g, '<br />');
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//used for the media picker dialog
|
||||
angular.module("umbraco")
|
||||
.controller("Umbraco.Overlays.MediaPickerController",
|
||||
function ($scope, mediaResource, umbRequestHelper, entityResource, $log, mediaHelper, mediaTypeHelper, eventsService, treeService, $element, $timeout, $cookies, localStorageService, localizationService) {
|
||||
function($scope, mediaResource, umbRequestHelper, entityResource, $log, mediaHelper, mediaTypeHelper, eventsService, treeService, $element, $timeout, $cookies, localStorageService, localizationService) {
|
||||
|
||||
if (!$scope.model.title) {
|
||||
$scope.model.title = localizationService.localize("defaultdialogs_selectMedia");
|
||||
@@ -96,7 +96,6 @@ angular.module("umbraco")
|
||||
};
|
||||
|
||||
$scope.gotoFolder = function(folder) {
|
||||
|
||||
if (!$scope.multiPicker) {
|
||||
deselectAllImages($scope.model.selectedImages);
|
||||
}
|
||||
@@ -108,7 +107,6 @@ angular.module("umbraco")
|
||||
if (folder.id > 0) {
|
||||
entityResource.getAncestors(folder.id, "media")
|
||||
.then(function(anc) {
|
||||
// anc.splice(0,1);
|
||||
$scope.path = _.filter(anc,
|
||||
function(f) {
|
||||
return f.path.indexOf($scope.startNodeId) !== -1;
|
||||
@@ -123,12 +121,12 @@ angular.module("umbraco")
|
||||
$scope.path = [];
|
||||
}
|
||||
|
||||
getChildren(folder.id);
|
||||
$scope.currentFolder = folder;
|
||||
localStorageService.set("umbLastOpenedMediaNodeId", folder.id);
|
||||
return getChildren(folder.id);
|
||||
};
|
||||
|
||||
$scope.clickHandler = function (image, event, index) {
|
||||
$scope.clickHandler = function(image, event, index) {
|
||||
if (image.isFolder) {
|
||||
if ($scope.disableFolderSelect) {
|
||||
$scope.gotoFolder(image);
|
||||
@@ -143,7 +141,7 @@ angular.module("umbraco")
|
||||
$scope.target = image;
|
||||
|
||||
// handle both entity and full media object
|
||||
if(image.image) {
|
||||
if (image.image) {
|
||||
$scope.target.url = image.image;
|
||||
} else {
|
||||
$scope.target.url = mediaHelper.resolveFile(image);
|
||||
@@ -188,8 +186,12 @@ angular.module("umbraco")
|
||||
images.length = 0;
|
||||
}
|
||||
|
||||
$scope.onUploadComplete = function() {
|
||||
$scope.gotoFolder($scope.currentFolder);
|
||||
$scope.onUploadComplete = function(files) {
|
||||
$scope.gotoFolder($scope.currentFolder).then(function() {
|
||||
if (files.length === 1 && $scope.model.selectedImages.length === 0) {
|
||||
selectImage($scope.images[$scope.images.length - 1]);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.onFilesQueue = function() {
|
||||
@@ -203,8 +205,7 @@ angular.module("umbraco")
|
||||
if (nodePath.indexOf($scope.startNodeId.toString()) !== -1) {
|
||||
$scope.gotoFolder({ id: $scope.lastOpenedNode, name: "Media", icon: "icon-folder" });
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$scope.gotoFolder({ id: $scope.startNodeId, name: "Media", icon: "icon-folder" });
|
||||
return false;
|
||||
}
|
||||
@@ -219,26 +220,25 @@ angular.module("umbraco")
|
||||
if ($scope.lastOpenedNode && $scope.lastOpenedNode !== -1) {
|
||||
entityResource.getById($scope.lastOpenedNode, "media")
|
||||
.then(ensureWithinStartNode, gotoStartNode);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
gotoStartNode();
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
//if a target is specified, go look it up - generally this target will just contain ids not the actual full
|
||||
//media object so we need to look it up
|
||||
var id = $scope.target.udi ? $scope.target.udi : $scope.target.id
|
||||
var altText = $scope.target.altText;
|
||||
mediaResource.getById(id)
|
||||
.then(function (node) {
|
||||
$scope.target = node;
|
||||
if (ensureWithinStartNode(node)) {
|
||||
selectImage(node);
|
||||
$scope.target.url = mediaHelper.resolveFile(node);
|
||||
$scope.target.altText = altText;
|
||||
$scope.openDetailsDialog();
|
||||
}
|
||||
}, gotoStartNode);
|
||||
.then(function(node) {
|
||||
$scope.target = node;
|
||||
if (ensureWithinStartNode(node)) {
|
||||
selectImage(node);
|
||||
$scope.target.url = mediaHelper.resolveFile(node);
|
||||
$scope.target.altText = altText;
|
||||
$scope.openDetailsDialog();
|
||||
}
|
||||
},
|
||||
gotoStartNode);
|
||||
}
|
||||
|
||||
$scope.openDetailsDialog = function() {
|
||||
@@ -260,6 +260,24 @@ angular.module("umbraco")
|
||||
};
|
||||
};
|
||||
|
||||
var debounceSearchMedia = _.debounce(function() {
|
||||
$scope.$apply(function() {
|
||||
if ($scope.searchOptions.filter) {
|
||||
searchMedia();
|
||||
} else {
|
||||
// reset pagination
|
||||
$scope.searchOptions = {
|
||||
pageNumber: 1,
|
||||
pageSize: 100,
|
||||
totalItems: 0,
|
||||
totalPages: 0,
|
||||
filter: ''
|
||||
};
|
||||
getChildren($scope.currentFolder.id);
|
||||
}
|
||||
});
|
||||
}, 500);
|
||||
|
||||
$scope.changeSearch = function() {
|
||||
$scope.loading = true;
|
||||
debounceSearchMedia();
|
||||
@@ -271,50 +289,33 @@ angular.module("umbraco")
|
||||
searchMedia();
|
||||
};
|
||||
|
||||
var debounceSearchMedia = _.debounce(function () {
|
||||
$scope.$apply(function () {
|
||||
if ($scope.searchOptions.filter) {
|
||||
searchMedia();
|
||||
} else {
|
||||
// reset pagination
|
||||
$scope.searchOptions = {
|
||||
pageNumber: 1,
|
||||
pageSize: 100,
|
||||
totalItems: 0,
|
||||
totalPages: 0,
|
||||
filter: ''
|
||||
};
|
||||
getChildren($scope.currentFolder.id);
|
||||
}
|
||||
});
|
||||
}, 500);
|
||||
|
||||
function searchMedia() {
|
||||
$scope.loading = true;
|
||||
entityResource.getPagedDescendants($scope.startNodeId, "Media", $scope.searchOptions)
|
||||
.then(function (data) {
|
||||
.then(function(data) {
|
||||
// update image data to work with image grid
|
||||
angular.forEach(data.items, function(mediaItem){
|
||||
// set thumbnail and src
|
||||
mediaItem.thumbnail = mediaHelper.resolveFileFromEntity(mediaItem, true);
|
||||
mediaItem.image = mediaHelper.resolveFileFromEntity(mediaItem, false);
|
||||
// set properties to match a media object
|
||||
if (mediaItem.metaData &&
|
||||
mediaItem.metaData.umbracoWidth &&
|
||||
mediaItem.metaData.umbracoHeight) {
|
||||
|
||||
mediaItem.properties = [
|
||||
{
|
||||
alias: "umbracoWidth",
|
||||
value: mediaItem.metaData.umbracoWidth.Value
|
||||
},
|
||||
{
|
||||
alias: "umbracoHeight",
|
||||
value: mediaItem.metaData.umbracoHeight.Value
|
||||
}
|
||||
];
|
||||
}
|
||||
});
|
||||
angular.forEach(data.items,
|
||||
function(mediaItem) {
|
||||
// set thumbnail and src
|
||||
mediaItem.thumbnail = mediaHelper.resolveFileFromEntity(mediaItem, true);
|
||||
mediaItem.image = mediaHelper.resolveFileFromEntity(mediaItem, false);
|
||||
// set properties to match a media object
|
||||
if (mediaItem.metaData &&
|
||||
mediaItem.metaData.umbracoWidth &&
|
||||
mediaItem.metaData.umbracoHeight) {
|
||||
|
||||
mediaItem.properties = [
|
||||
{
|
||||
alias: "umbracoWidth",
|
||||
value: mediaItem.metaData.umbracoWidth.Value
|
||||
},
|
||||
{
|
||||
alias: "umbracoHeight",
|
||||
value: mediaItem.metaData.umbracoHeight.Value
|
||||
}
|
||||
];
|
||||
}
|
||||
});
|
||||
// update images
|
||||
$scope.images = data.items ? data.items : [];
|
||||
// update pagination
|
||||
@@ -332,7 +333,7 @@ angular.module("umbraco")
|
||||
|
||||
function getChildren(id) {
|
||||
$scope.loading = true;
|
||||
mediaResource.getChildren(id)
|
||||
return mediaResource.getChildren(id)
|
||||
.then(function(data) {
|
||||
$scope.searchOptions.filter = "";
|
||||
$scope.images = data.items ? data.items : [];
|
||||
@@ -358,11 +359,10 @@ angular.module("umbraco")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (imageIsSelected) {
|
||||
folderImage.selected = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -11,7 +11,7 @@
|
||||
<span ng-if="property.validation.mandatory">
|
||||
<strong class="umb-control-required">*</strong>
|
||||
</span>
|
||||
<small ng-bind-html="property.description"></small>
|
||||
<small ng-bind-html="property.description | preserveNewLineInHtml"></small>
|
||||
</label>
|
||||
|
||||
<div class="controls" ng-transclude>
|
||||
|
||||
@@ -1 +1 @@
|
||||
<input type="text" ng-model="model.value" class="umb-editor umb-textstring" />
|
||||
<input type="text" ng-model="model.value" ng-trim="false" class="umb-editor umb-textstring" />
|
||||
@@ -9,30 +9,29 @@
|
||||
ui-sortable
|
||||
ng-model="model.value.templates">
|
||||
|
||||
<li ng-repeat="template in model.value.templates">
|
||||
<li ng-repeat="template in model.value.templates" class="clearfix">
|
||||
|
||||
<div ng-click="configureTemplate(template)"
|
||||
class="preview-rows layout" style="margin-top: 5px; margin-bottom: 20px; float:left">
|
||||
class="preview-rows layout" style="margin-top: 5px; margin-bottom: 20px; float:left">
|
||||
|
||||
<div class="preview-row">
|
||||
<div class="preview-col"
|
||||
ng-class="{last:$last}"
|
||||
ng-repeat="section in template.sections | filter:zeroWidthFilter"
|
||||
ng-style="{width: percentage(section.grid) + '%', height: '60px'}">
|
||||
ng-class="{last:$last}"
|
||||
ng-repeat="section in template.sections | filter:zeroWidthFilter"
|
||||
ng-style="{width: percentage(section.grid) + '%', height: '60px', 'max-width': '100%'}">
|
||||
<div class="preview-cell"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
{{template.name}} <br/>
|
||||
{{template.name}} <br />
|
||||
<i class="icon-delete red"></i>
|
||||
<a class="btn btn-small btn-link"
|
||||
href
|
||||
ng-click="deleteTemplate($index)"><localize key="general_delete" /></a>
|
||||
</div>
|
||||
|
||||
<br style="clear: both" />
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@@ -55,7 +54,7 @@
|
||||
ui-sortable
|
||||
ng-model="model.value.layouts">
|
||||
|
||||
<li ng-repeat="layout in model.value.layouts">
|
||||
<li ng-repeat="layout in model.value.layouts" class="clearfix">
|
||||
|
||||
<div ng-click="configureLayout(layout)"
|
||||
class="preview-rows columns" style="margin-top: 5px; margin-bottom: 25px; float:left">
|
||||
@@ -64,7 +63,7 @@
|
||||
<div class="preview-col"
|
||||
ng-class="{last:$last}"
|
||||
ng-repeat="area in layout.areas | filter:zeroWidthFilter"
|
||||
ng-style="{width: percentage(area.grid) + '%'}">
|
||||
ng-style="{width: percentage(area.grid) + '%', 'max-width': '100%'}">
|
||||
|
||||
<div class="preview-cell"></div>
|
||||
</div>
|
||||
@@ -79,12 +78,11 @@
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<br style="clear: both" />
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<button class="btn btn-small" prevent-default ng-click="configureLayout()">
|
||||
<i class="icon-add"></i> <localize key="grid_addRowConfiguration" />
|
||||
<i class="icon-add"></i> <localize key="grid_addRowConfiguration" />
|
||||
</button>
|
||||
|
||||
</div>
|
||||
@@ -98,7 +96,7 @@
|
||||
<umb-control-group
|
||||
label="@grid_columns"
|
||||
description="@grid_columnsDetails">
|
||||
<input type="text" class="" ng-model="model.value.columns" />
|
||||
<input type="number" min="1" ng-model="model.value.columns" />
|
||||
</umb-control-group>
|
||||
|
||||
<umb-control-group
|
||||
@@ -107,7 +105,7 @@
|
||||
|
||||
<ul class="unstyled list-icons umb-contentpicker"
|
||||
ui-sortable
|
||||
ng-model="model.config">
|
||||
ng-model="model.value.config">
|
||||
|
||||
<li ng-repeat="configValue in model.value.config">
|
||||
<i class="icon icon-navigation handle"></i>
|
||||
@@ -133,8 +131,11 @@
|
||||
|
||||
|
||||
|
||||
<umb-control-group label="@grid_styles" description="@grid_stylesDetails">
|
||||
<ul class="unstyled list-icons umb-contentpicker"
|
||||
<umb-control-group
|
||||
label="@grid_styles"
|
||||
description="@grid_stylesDetails">
|
||||
|
||||
<ul class="unstyled list-icons umb-contentpicker"
|
||||
ui-sortable
|
||||
ng-model="model.value.styles">
|
||||
|
||||
|
||||
Reference in New Issue
Block a user