Merge remote-tracking branch 'origin/v8/dev' into netcore/dev
# Conflicts: # src/Umbraco.Core/Models/PublishedContent/PublishedContentType.cs # src/Umbraco.Core/PublishedCache/PublishedSnapshotServiceBase.cs # src/Umbraco.Core/PublishedModelFactoryExtensions.cs # src/Umbraco.Web.UI.Client/package-lock.json # src/Umbraco.Web.UI.Client/src/views/propertyeditors/imagecropper/imagecropper.controller.js # src/Umbraco.Web.UI.Client/src/views/users/user.controller.js # src/Umbraco.Web.UI/Umbraco/Views/Default.cshtml
This commit is contained in:
1075
src/Umbraco.Web.UI.Client/package-lock.json
generated
1075
src/Umbraco.Web.UI.Client/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -42,7 +42,7 @@
|
||||
"npm": "6.13.6",
|
||||
"signalr": "2.4.0",
|
||||
"spectrum-colorpicker": "1.8.0",
|
||||
"tinymce": "4.9.7",
|
||||
"tinymce": "4.9.9",
|
||||
"typeahead.js": "0.11.1",
|
||||
"underscore": "1.9.1"
|
||||
},
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
function AppHeaderDirective(eventsService, appState, userService, focusService) {
|
||||
function AppHeaderDirective(eventsService, appState, userService, focusService, backdropService) {
|
||||
|
||||
function link(scope, el, attr, ctrl) {
|
||||
|
||||
@@ -18,20 +18,20 @@
|
||||
];
|
||||
|
||||
// when a user logs out or timesout
|
||||
evts.push(eventsService.on("app.notAuthenticated", function() {
|
||||
evts.push(eventsService.on("app.notAuthenticated", function () {
|
||||
scope.authenticated = false;
|
||||
scope.user = null;
|
||||
}));
|
||||
|
||||
// when the application is ready and the user is authorized setup the data
|
||||
evts.push(eventsService.on("app.ready", function(evt, data) {
|
||||
|
||||
evts.push(eventsService.on("app.ready", function (evt, data) {
|
||||
|
||||
scope.authenticated = true;
|
||||
scope.user = data.user;
|
||||
|
||||
if (scope.user.avatars) {
|
||||
scope.avatar = [];
|
||||
if (angular.isArray(scope.user.avatars)) {
|
||||
if (Utilities.isArray(scope.user.avatars)) {
|
||||
for (var i = 0; i < scope.user.avatars.length; i++) {
|
||||
scope.avatar.push({ value: scope.user.avatars[i] });
|
||||
}
|
||||
@@ -40,13 +40,13 @@
|
||||
|
||||
}));
|
||||
|
||||
evts.push(eventsService.on("app.userRefresh", function(evt) {
|
||||
userService.refreshCurrentUser().then(function(data) {
|
||||
evts.push(eventsService.on("app.userRefresh", function (evt) {
|
||||
userService.refreshCurrentUser().then(function (data) {
|
||||
scope.user = data;
|
||||
|
||||
|
||||
if (scope.user.avatars) {
|
||||
scope.avatar = [];
|
||||
if (angular.isArray(scope.user.avatars)) {
|
||||
if (Utilities.isArray(scope.user.avatars)) {
|
||||
for (var i = 0; i < scope.user.avatars.length; i++) {
|
||||
scope.avatar.push({ value: scope.user.avatars[i] });
|
||||
}
|
||||
@@ -54,10 +54,10 @@
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
|
||||
scope.rememberFocus = focusService.rememberFocus;
|
||||
|
||||
scope.searchClick = function() {
|
||||
|
||||
scope.searchClick = function () {
|
||||
var showSearch = appState.getSearchState("show");
|
||||
appState.setSearchState("show", !showSearch);
|
||||
};
|
||||
@@ -71,13 +71,15 @@
|
||||
};
|
||||
|
||||
scope.avatarClick = function () {
|
||||
if(!scope.userDialog) {
|
||||
if (!scope.userDialog) {
|
||||
backdropService.open();
|
||||
scope.userDialog = {
|
||||
view: "user",
|
||||
show: true,
|
||||
close: function (oldModel) {
|
||||
scope.userDialog.show = false;
|
||||
scope.userDialog = null;
|
||||
backdropService.close();
|
||||
}
|
||||
};
|
||||
} else {
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
|
||||
var events = [];
|
||||
|
||||
scope.clickBackdrop = function(event) {
|
||||
if(scope.disableEventsOnClick === true) {
|
||||
scope.clickBackdrop = function (event) {
|
||||
if (scope.disableEventsOnClick === true) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
}
|
||||
@@ -22,16 +22,16 @@
|
||||
|
||||
}
|
||||
|
||||
function setHighlight () {
|
||||
function setHighlight() {
|
||||
|
||||
scope.loading = true;
|
||||
|
||||
$timeout(function () {
|
||||
|
||||
// The element to highlight
|
||||
var highlightElement = angular.element(scope.highlightElement);
|
||||
var highlightElement = $(scope.highlightElement);
|
||||
|
||||
if(highlightElement && highlightElement.length > 0) {
|
||||
if (highlightElement && highlightElement.length > 0) {
|
||||
|
||||
var offset = highlightElement.offset();
|
||||
var width = highlightElement.outerWidth();
|
||||
@@ -48,7 +48,7 @@
|
||||
var rectRight = el.find(".umb-backdrop__rect--right");
|
||||
var rectBottom = el.find(".umb-backdrop__rect--bottom");
|
||||
var rectLeft = el.find(".umb-backdrop__rect--left");
|
||||
|
||||
|
||||
// Add the css
|
||||
scope.rectTopCss = { "height": topDistance, "left": leftDistance + "px", opacity: scope.backdropOpacity };
|
||||
scope.rectRightCss = { "left": leftAndWidth + "px", "top": topDistance + "px", "height": height, opacity: scope.backdropOpacity };
|
||||
@@ -56,14 +56,14 @@
|
||||
scope.rectLeftCss = { "width": leftDistance, opacity: scope.backdropOpacity };
|
||||
|
||||
// Prevent interaction in the highlighted area
|
||||
if(scope.highlightPreventClick) {
|
||||
if (scope.highlightPreventClick) {
|
||||
var preventClickElement = el.find(".umb-backdrop__highlight-prevent-click");
|
||||
preventClickElement.css({ "width": width, "height": height, "left": offset.left, "top": offset.top });
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
scope.loading = false;
|
||||
scope.loading = false;
|
||||
|
||||
});
|
||||
|
||||
@@ -74,8 +74,8 @@
|
||||
}
|
||||
|
||||
events.push(scope.$watch("highlightElement", function (newValue, oldValue) {
|
||||
if(!newValue) {return;}
|
||||
if(newValue === oldValue) {return;}
|
||||
if (!newValue) { return; }
|
||||
if (newValue === oldValue) { return; }
|
||||
setHighlight();
|
||||
}));
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
onClose: "&"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
function umbSearchController($timeout, backdropService, searchService, focusService) {
|
||||
|
||||
var vm = this;
|
||||
@@ -25,7 +25,7 @@
|
||||
vm.handleKeyDown = handleKeyDown;
|
||||
vm.closeSearch = closeSearch;
|
||||
vm.focusSearch = focusSearch;
|
||||
|
||||
|
||||
//we need to capture the focus before this element is initialized.
|
||||
vm.focusBeforeOpening = focusService.getLastKnownFocus();
|
||||
|
||||
@@ -66,8 +66,8 @@
|
||||
*/
|
||||
function focusSearch() {
|
||||
vm.searchHasFocus = false;
|
||||
$timeout(function(){
|
||||
vm.searchHasFocus = true;
|
||||
$timeout(function () {
|
||||
vm.searchHasFocus = true;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -76,14 +76,14 @@
|
||||
* @param {object} event
|
||||
*/
|
||||
function handleKeyDown(event) {
|
||||
|
||||
|
||||
// esc
|
||||
if(event.keyCode === 27) {
|
||||
if (event.keyCode === 27) {
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
|
||||
|
||||
closeSearch();
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
// up/down (navigate search results)
|
||||
@@ -132,7 +132,7 @@
|
||||
}
|
||||
|
||||
$timeout(function () {
|
||||
var resultElementLink = angular.element(".umb-search-item[active-result='true'] .umb-search-result__link");
|
||||
var resultElementLink = $(".umb-search-item[active-result='true'] .umb-search-result__link");
|
||||
resultElementLink[0].focus();
|
||||
});
|
||||
}
|
||||
@@ -142,10 +142,10 @@
|
||||
* Used to proxy a callback
|
||||
*/
|
||||
function closeSearch() {
|
||||
if(vm.focusBeforeOpening) {
|
||||
if (vm.focusBeforeOpening) {
|
||||
vm.focusBeforeOpening.focus();
|
||||
}
|
||||
if(vm.onClose) {
|
||||
if (vm.onClose) {
|
||||
vm.onClose();
|
||||
}
|
||||
}
|
||||
@@ -155,9 +155,9 @@
|
||||
* @param {string} searchQuery
|
||||
*/
|
||||
function search(searchQuery) {
|
||||
if(searchQuery.length > 0) {
|
||||
var search = {"term": searchQuery};
|
||||
searchService.searchAll(search).then(function(result){
|
||||
if (searchQuery.length > 0) {
|
||||
var search = { "term": searchQuery };
|
||||
searchService.searchAll(search).then(function (result) {
|
||||
//result is a dictionary of group Title and it's results
|
||||
var filtered = {};
|
||||
_.each(result, function (value, key) {
|
||||
|
||||
@@ -198,27 +198,27 @@ In the following example you see how to run some custom logic before a step goes
|
||||
scope.loadingStep = false;
|
||||
scope.elementNotFound = false;
|
||||
|
||||
scope.model.nextStep = function() {
|
||||
scope.model.nextStep = function () {
|
||||
nextStep();
|
||||
};
|
||||
|
||||
scope.model.endTour = function() {
|
||||
scope.model.endTour = function () {
|
||||
unbindEvent();
|
||||
tourService.endTour(scope.model);
|
||||
backdropService.close();
|
||||
};
|
||||
|
||||
scope.model.completeTour = function() {
|
||||
scope.model.completeTour = function () {
|
||||
unbindEvent();
|
||||
tourService.completeTour(scope.model).then(function() {
|
||||
backdropService.close();
|
||||
tourService.completeTour(scope.model).then(function () {
|
||||
backdropService.close();
|
||||
});
|
||||
};
|
||||
|
||||
scope.model.disableTour = function() {
|
||||
scope.model.disableTour = function () {
|
||||
unbindEvent();
|
||||
tourService.disableTour(scope.model).then(function() {
|
||||
backdropService.close();
|
||||
tourService.disableTour(scope.model).then(function () {
|
||||
backdropService.close();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -227,7 +227,7 @@ In the following example you see how to run some custom logic before a step goes
|
||||
pulseElement = el.find(".umb-tour__pulse");
|
||||
popover.hide();
|
||||
scope.model.currentStepIndex = 0;
|
||||
backdropService.open({disableEventsOnClick: true});
|
||||
backdropService.open({ disableEventsOnClick: true });
|
||||
startStep();
|
||||
}
|
||||
|
||||
@@ -249,20 +249,20 @@ In the following example you see how to run some custom logic before a step goes
|
||||
}
|
||||
|
||||
function nextStep() {
|
||||
|
||||
|
||||
popover.hide();
|
||||
pulseElement.hide();
|
||||
$timeout.cancel(pulseTimer);
|
||||
scope.model.currentStepIndex++;
|
||||
|
||||
// make sure we don't go too far
|
||||
if(scope.model.currentStepIndex !== scope.model.steps.length) {
|
||||
if (scope.model.currentStepIndex !== scope.model.steps.length) {
|
||||
startStep();
|
||||
// tour completed - final step
|
||||
// tour completed - final step
|
||||
} else {
|
||||
scope.loadingStep = true;
|
||||
|
||||
waitForPendingRerequests().then(function(){
|
||||
waitForPendingRerequests().then(function () {
|
||||
scope.loadingStep = false;
|
||||
// clear current step
|
||||
scope.model.currentStep = {};
|
||||
@@ -280,17 +280,17 @@ In the following example you see how to run some custom logic before a step goes
|
||||
backdropService.setOpacity(scope.model.steps[scope.model.currentStepIndex].backdropOpacity);
|
||||
backdropService.setHighlight(null);
|
||||
|
||||
waitForPendingRerequests().then(function() {
|
||||
waitForPendingRerequests().then(function () {
|
||||
|
||||
scope.model.currentStep = scope.model.steps[scope.model.currentStepIndex];
|
||||
|
||||
setView();
|
||||
|
||||
|
||||
// if highlight element is set - find it
|
||||
findHighlightElement();
|
||||
|
||||
// if a custom event needs to be bound we do it now
|
||||
if(scope.model.currentStep.event) {
|
||||
if (scope.model.currentStep.event) {
|
||||
bindEvent();
|
||||
}
|
||||
|
||||
@@ -301,7 +301,7 @@ In the following example you see how to run some custom logic before a step goes
|
||||
|
||||
function findHighlightElement() {
|
||||
|
||||
scope.elementNotFound = false;
|
||||
scope.elementNotFound = false;
|
||||
|
||||
$timeout(function () {
|
||||
// clear element when step as marked as intro, so it always displays in the center
|
||||
@@ -312,15 +312,15 @@ In the following example you see how to run some custom logic before a step goes
|
||||
}
|
||||
|
||||
// if an element isn't set - show the popover in the center
|
||||
if(scope.model.currentStep && !scope.model.currentStep.element) {
|
||||
if (scope.model.currentStep && !scope.model.currentStep.element) {
|
||||
setPopoverPosition(null);
|
||||
return;
|
||||
}
|
||||
|
||||
var element = angular.element(scope.model.currentStep.element);
|
||||
var element = $(scope.model.currentStep.element);
|
||||
|
||||
// we couldn't find the element in the dom - abort and show error
|
||||
if(element.length === 0) {
|
||||
if (element.length === 0) {
|
||||
scope.elementNotFound = true;
|
||||
setPopoverPosition(null);
|
||||
return;
|
||||
@@ -337,7 +337,7 @@ In the following example you see how to run some custom logic before a step goes
|
||||
el = el.offsetParent();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var scrollToCenterOfContainer = offsetTop - (scrollParent[0].clientHeight / 2);
|
||||
if (element[0].clientHeight < scrollParent[0].clientHeight) {
|
||||
scrollToCenterOfContainer += (element[0].clientHeight / 2);
|
||||
@@ -366,7 +366,7 @@ In the following example you see how to run some custom logic before a step goes
|
||||
function setPopoverPosition(element) {
|
||||
|
||||
$timeout(function () {
|
||||
|
||||
|
||||
var position = "center";
|
||||
var margin = 20;
|
||||
var css = {};
|
||||
@@ -374,10 +374,10 @@ In the following example you see how to run some custom logic before a step goes
|
||||
var popoverWidth = popover.outerWidth();
|
||||
var popoverHeight = popover.outerHeight();
|
||||
var popoverOffset = popover.offset();
|
||||
var documentWidth = angular.element(document).width();
|
||||
var documentHeight = angular.element(document).height();
|
||||
var documentWidth = $(document).width();
|
||||
var documentHeight = $(document).height();
|
||||
|
||||
if(element) {
|
||||
if (element) {
|
||||
|
||||
var offset = element.offset();
|
||||
var width = element.outerWidth();
|
||||
@@ -436,29 +436,29 @@ In the following example you see how to run some custom logic before a step goes
|
||||
|
||||
} else {
|
||||
// if there is no dom element center the popover
|
||||
css.top = "calc(50% - " + popoverHeight/2 + "px)";
|
||||
css.left = "calc(50% - " + popoverWidth/2 + "px)";
|
||||
css.top = "calc(50% - " + popoverHeight / 2 + "px)";
|
||||
css.left = "calc(50% - " + popoverWidth / 2 + "px)";
|
||||
}
|
||||
|
||||
popover.css(css).fadeIn("fast");
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
function setPulsePosition() {
|
||||
if(scope.model.currentStep.event) {
|
||||
if (scope.model.currentStep.event) {
|
||||
|
||||
pulseTimer = $timeout(function () {
|
||||
|
||||
pulseTimer = $timeout(function(){
|
||||
|
||||
var clickElementSelector = scope.model.currentStep.eventElement ? scope.model.currentStep.eventElement : scope.model.currentStep.element;
|
||||
var clickElement = $(clickElementSelector);
|
||||
|
||||
|
||||
var offset = clickElement.offset();
|
||||
var width = clickElement.outerWidth();
|
||||
var height = clickElement.outerHeight();
|
||||
|
||||
|
||||
pulseElement.css({ "width": width, "height": height, "left": offset.left, "top": offset.top });
|
||||
pulseElement.fadeIn();
|
||||
|
||||
@@ -468,24 +468,24 @@ In the following example you see how to run some custom logic before a step goes
|
||||
|
||||
function waitForPendingRerequests() {
|
||||
var deferred = $q.defer();
|
||||
var timer = window.setInterval(function(){
|
||||
|
||||
var timer = window.setInterval(function () {
|
||||
|
||||
var requestsReady = false;
|
||||
var animationsDone = false;
|
||||
|
||||
// check for pending requests both in angular and on the document
|
||||
if($http.pendingRequests.length === 0 && document.readyState === "complete") {
|
||||
if ($http.pendingRequests.length === 0 && document.readyState === "complete") {
|
||||
requestsReady = true;
|
||||
}
|
||||
|
||||
// check for animations. ng-enter and ng-leave are default angular animations.
|
||||
// Also check for infinite editors animating
|
||||
if(document.querySelectorAll(".ng-enter, .ng-leave, .umb-editor--animating").length === 0) {
|
||||
if (document.querySelectorAll(".ng-enter, .ng-leave, .umb-editor--animating").length === 0) {
|
||||
animationsDone = true;
|
||||
}
|
||||
|
||||
if(requestsReady && animationsDone) {
|
||||
$timeout(function(){
|
||||
if (requestsReady && animationsDone) {
|
||||
$timeout(function () {
|
||||
deferred.resolve();
|
||||
clearInterval(timer);
|
||||
});
|
||||
@@ -512,14 +512,14 @@ In the following example you see how to run some custom logic before a step goes
|
||||
var bindToElement = scope.model.currentStep.element;
|
||||
var eventName = scope.model.currentStep.event + ".step-" + scope.model.currentStepIndex;
|
||||
var removeEventName = "remove.step-" + scope.model.currentStepIndex;
|
||||
var handled = false;
|
||||
var handled = false;
|
||||
|
||||
if(scope.model.currentStep.eventElement) {
|
||||
if (scope.model.currentStep.eventElement) {
|
||||
bindToElement = scope.model.currentStep.eventElement;
|
||||
}
|
||||
|
||||
$(bindToElement).on(eventName, function(){
|
||||
if(!handled) {
|
||||
$(bindToElement).on(eventName, function () {
|
||||
if (!handled) {
|
||||
unbindEvent();
|
||||
nextStep();
|
||||
handled = true;
|
||||
@@ -530,7 +530,7 @@ In the following example you see how to run some custom logic before a step goes
|
||||
// for some reason it seems the elements gets removed before the event is raised. This is a temp solution which assumes:
|
||||
// "if you ask me to click on an element, and it suddenly gets removed from the dom, let's go on to the next step".
|
||||
$(bindToElement).on(removeEventName, function () {
|
||||
if(!handled) {
|
||||
if (!handled) {
|
||||
unbindEvent();
|
||||
nextStep();
|
||||
handled = true;
|
||||
@@ -542,13 +542,13 @@ In the following example you see how to run some custom logic before a step goes
|
||||
function unbindEvent() {
|
||||
var eventName = scope.model.currentStep.event + ".step-" + scope.model.currentStepIndex;
|
||||
var removeEventName = "remove.step-" + scope.model.currentStepIndex;
|
||||
|
||||
if(scope.model.currentStep.eventElement) {
|
||||
angular.element(scope.model.currentStep.eventElement).off(eventName);
|
||||
angular.element(scope.model.currentStep.eventElement).off(removeEventName);
|
||||
|
||||
if (scope.model.currentStep.eventElement) {
|
||||
$(scope.model.currentStep.eventElement).off(eventName);
|
||||
$(scope.model.currentStep.eventElement).off(removeEventName);
|
||||
} else {
|
||||
angular.element(scope.model.currentStep.element).off(eventName);
|
||||
angular.element(scope.model.currentStep.element).off(removeEventName);
|
||||
$(scope.model.currentStep.element).off(eventName);
|
||||
$(scope.model.currentStep.element).off(removeEventName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
//watch for changes to isNew, set the page.isNew accordingly and load the breadcrumb if we can
|
||||
$scope.$watch('isNew', function (newVal, oldVal) {
|
||||
|
||||
|
||||
$scope.page.isNew = Object.toBoolean(newVal);
|
||||
|
||||
//We fetch all ancestors of the node to generate the footer breadcrumb navigation
|
||||
@@ -182,32 +182,32 @@
|
||||
}
|
||||
}));
|
||||
|
||||
evts.push(eventsService.on("editors.content.reload", function (name, args) {
|
||||
evts.push(eventsService.on("editors.content.reload", function (name, args) {
|
||||
if (args && args.node && $scope.content.id === args.node.id) {
|
||||
reload();
|
||||
loadBreadcrumb();
|
||||
syncTreeNode($scope.content, $scope.content.path);
|
||||
}
|
||||
}));
|
||||
|
||||
evts.push(eventsService.on("rte.file.uploading", function(){
|
||||
|
||||
evts.push(eventsService.on("rte.file.uploading", function () {
|
||||
$scope.page.saveButtonState = "busy";
|
||||
$scope.page.buttonGroupState = "busy";
|
||||
|
||||
}));
|
||||
|
||||
evts.push(eventsService.on("rte.file.uploaded", function(){
|
||||
evts.push(eventsService.on("rte.file.uploaded", function () {
|
||||
$scope.page.saveButtonState = "success";
|
||||
$scope.page.buttonGroupState = "success";
|
||||
}));
|
||||
|
||||
evts.push(eventsService.on("rte.shortcut.save", function(){
|
||||
evts.push(eventsService.on("rte.shortcut.save", function () {
|
||||
if ($scope.page.showSaveButton) {
|
||||
$scope.save();
|
||||
}
|
||||
}));
|
||||
|
||||
evts.push(eventsService.on("content.saved", function(){
|
||||
evts.push(eventsService.on("content.saved", function () {
|
||||
// Clear out localstorage keys that start with tinymce__
|
||||
// When we save/perist a content node
|
||||
// NOTE: clearAll supports a RegEx pattern of items to remove
|
||||
@@ -323,7 +323,7 @@
|
||||
.then(function (syncArgs) {
|
||||
$scope.page.menu.currentNode = syncArgs.node;
|
||||
if (reloadChildren && syncArgs.node.expanded) {
|
||||
treeService.loadNodeChildren({node: syncArgs.node});
|
||||
treeService.loadNodeChildren({ node: syncArgs.node });
|
||||
}
|
||||
}, function () {
|
||||
//handle the rejection
|
||||
@@ -784,7 +784,7 @@
|
||||
var dialog = {
|
||||
parentScope: $scope,
|
||||
view: "views/content/overlays/schedule.html",
|
||||
variants: angular.copy($scope.content.variants), //set a model property for the dialog
|
||||
variants: Utilities.copy($scope.content.variants), //set a model property for the dialog
|
||||
skipFormValidation: true, //when submitting the overlay form, skip any client side validation
|
||||
submitButtonLabelKey: "buttons_schedulePublish",
|
||||
submit: function (model) {
|
||||
@@ -818,7 +818,7 @@
|
||||
}
|
||||
model.submitButtonState = "error";
|
||||
//re-map the dialog model since we've re-bound the properties
|
||||
dialog.variants = angular.copy($scope.content.variants);
|
||||
dialog.variants = Utilities.copy($scope.content.variants);
|
||||
//don't reject, we've handled the error
|
||||
return $q.when(err);
|
||||
});
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
|
||||
/** Called when the component initializes */
|
||||
function onInit() {
|
||||
prevContentDateUpdated = angular.copy(vm.content.updateDate);
|
||||
prevContentDateUpdated = Utilities.copy(vm.content.updateDate);
|
||||
setActiveCulture();
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
function doCheck() {
|
||||
if (!angular.equals(vm.content.updateDate, prevContentDateUpdated)) {
|
||||
setActiveCulture();
|
||||
prevContentDateUpdated = angular.copy(vm.content.updateDate);
|
||||
prevContentDateUpdated = Utilities.copy(vm.content.updateDate);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@
|
||||
|
||||
//copy the apps from the main model if not assigned yet to the variant
|
||||
if (!variant.apps) {
|
||||
variant.apps = angular.copy(vm.content.apps);
|
||||
variant.apps = Utilities.copy(vm.content.apps);
|
||||
}
|
||||
|
||||
//if this is a variant has a culture/language than we need to assign the language drop down info
|
||||
@@ -185,7 +185,7 @@
|
||||
|
||||
// keep track of the open variants across the different split views
|
||||
// push the first variant then update the variant index based on the editor index
|
||||
if(vm.openVariants && vm.openVariants.length === 0) {
|
||||
if (vm.openVariants && vm.openVariants.length === 0) {
|
||||
vm.openVariants.push(variant.language.culture);
|
||||
} else {
|
||||
vm.openVariants[editorIndex] = variant.language.culture;
|
||||
@@ -205,10 +205,10 @@
|
||||
}
|
||||
|
||||
// make sure the same app it set to active in the new variant
|
||||
if(activeAppAlias) {
|
||||
angular.forEach(variant.apps, function(app) {
|
||||
if (activeAppAlias) {
|
||||
angular.forEach(variant.apps, function (app) {
|
||||
app.active = false;
|
||||
if(app.alias === activeAppAlias) {
|
||||
if (app.alias === activeAppAlias) {
|
||||
app.active = true;
|
||||
}
|
||||
});
|
||||
@@ -283,10 +283,10 @@
|
||||
function selectVariant(variant, editorIndex) {
|
||||
|
||||
// prevent variants already open in a split view to be opened
|
||||
if(vm.openVariants.indexOf(variant.language.culture) !== -1) {
|
||||
if (vm.openVariants.indexOf(variant.language.culture) !== -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//if the editor index is zero, then update the query string to track the lang selection, otherwise if it's part
|
||||
//of a 2nd split view editor then update the model directly.
|
||||
if (editorIndex === 0) {
|
||||
@@ -313,7 +313,7 @@
|
||||
|
||||
//update the editors collection
|
||||
insertVariantEditor(editorIndex, contentVariant);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -322,21 +322,21 @@
|
||||
* @param {any} app This is the model of the selected app
|
||||
*/
|
||||
function selectApp(app) {
|
||||
if(vm.onSelectApp) {
|
||||
vm.onSelectApp({"app": app});
|
||||
if (vm.onSelectApp) {
|
||||
vm.onSelectApp({ "app": app });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function selectAppAnchor(app, anchor) {
|
||||
if(vm.onSelectAppAnchor) {
|
||||
vm.onSelectAppAnchor({"app": app, "anchor": anchor});
|
||||
if (vm.onSelectAppAnchor) {
|
||||
vm.onSelectAppAnchor({ "app": app, "anchor": anchor });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$scope.$on("editors.apps.appChanged", function($event, $args) {
|
||||
|
||||
|
||||
$scope.$on("editors.apps.appChanged", function ($event, $args) {
|
||||
var app = $args.app;
|
||||
if(app && app.alias) {
|
||||
if (app && app.alias) {
|
||||
activeAppAlias = app.alias;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -9,7 +9,7 @@ angular.module('umbraco.directives')
|
||||
.directive('checklistModel', ['$parse', '$compile', function($parse, $compile) {
|
||||
// contains
|
||||
function contains(arr, item) {
|
||||
if (angular.isArray(arr)) {
|
||||
if (Utilities.isArray(arr)) {
|
||||
for (var i = 0; i < arr.length; i++) {
|
||||
if (angular.equals(arr[i], item)) {
|
||||
return true;
|
||||
@@ -21,7 +21,7 @@ angular.module('umbraco.directives')
|
||||
|
||||
// add
|
||||
function add(arr, item) {
|
||||
arr = angular.isArray(arr) ? arr : [];
|
||||
arr = Utilities.isArray(arr) ? arr : [];
|
||||
for (var i = 0; i < arr.length; i++) {
|
||||
if (angular.equals(arr[i], item)) {
|
||||
return arr;
|
||||
@@ -33,7 +33,7 @@ angular.module('umbraco.directives')
|
||||
|
||||
// remove
|
||||
function remove(arr, item) {
|
||||
if (angular.isArray(arr)) {
|
||||
if (Utilities.isArray(arr)) {
|
||||
for (var i = 0; i < arr.length; i++) {
|
||||
if (angular.equals(arr[i], item)) {
|
||||
arr.splice(i, 1);
|
||||
|
||||
@@ -32,7 +32,7 @@ function fixNumber($parse) {
|
||||
|
||||
//always try to format the model value as an int
|
||||
ctrl.$formatters.push(function (value) {
|
||||
if (angular.isString(value)) {
|
||||
if (Utilities.isString(value)) {
|
||||
return parseFloat(value, 10);
|
||||
}
|
||||
return value;
|
||||
@@ -55,4 +55,4 @@ function fixNumber($parse) {
|
||||
}
|
||||
};
|
||||
}
|
||||
angular.module('umbraco.directives').directive("fixNumber", fixNumber);
|
||||
angular.module('umbraco.directives').directive("fixNumber", fixNumber);
|
||||
|
||||
@@ -7,13 +7,12 @@
|
||||
* a color will not be set.
|
||||
**/
|
||||
function hexBgColor() {
|
||||
return {
|
||||
return {
|
||||
restrict: "A",
|
||||
link: function (scope, element, attr, formCtrl) {
|
||||
|
||||
function setBackgroundColor(color) {
|
||||
// note: can't use element.css(), it doesn't support hexa background colors
|
||||
angular.element(element)[0].style.backgroundColor = "#" + color;
|
||||
element[0].style.backgroundColor = "#" + color;
|
||||
}
|
||||
|
||||
// Only add inline hex background color if defined and not "true".
|
||||
@@ -24,7 +23,7 @@ function hexBgColor() {
|
||||
// Set the orig based on the attribute if there is one.
|
||||
origColor = attr.hexBgOrig;
|
||||
}
|
||||
|
||||
|
||||
attr.$observe("hexBgColor", function (newVal) {
|
||||
if (newVal) {
|
||||
if (!origColor) {
|
||||
|
||||
@@ -1,161 +1,88 @@
|
||||
angular.module("umbraco.directives")
|
||||
.directive('umbAutoResize', function($timeout) {
|
||||
return {
|
||||
require: ["^?umbTabs", "ngModel"],
|
||||
link: function(scope, element, attr, controllersArr) {
|
||||
.directive('umbAutoResize', function ($timeout) {
|
||||
return {
|
||||
require: ["^?umbTabs", "ngModel"],
|
||||
link: function (scope, element, attr, controllersArr) {
|
||||
|
||||
var domEl = element[0];
|
||||
var domElType = domEl.type;
|
||||
var umbTabsController = controllersArr[0];
|
||||
var ngModelController = controllersArr[1];
|
||||
var domEl = element[0];
|
||||
var domElType = domEl.type;
|
||||
var umbTabsController = controllersArr[0];
|
||||
var ngModelController = controllersArr[1];
|
||||
|
||||
// IE elements
|
||||
var isIEFlag = false;
|
||||
var wrapper = angular.element('#umb-ie-resize-input-wrapper');
|
||||
var mirror = angular.element('<span style="white-space:pre;"></span>');
|
||||
function resizeInput() {
|
||||
|
||||
function isIE() {
|
||||
|
||||
var ua = window.navigator.userAgent;
|
||||
var msie = ua.indexOf("MSIE ");
|
||||
|
||||
if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./) || navigator.userAgent.match(/Edge\/\d+/)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function activate() {
|
||||
|
||||
// check if browser is Internet Explorere
|
||||
isIEFlag = isIE();
|
||||
|
||||
// scrollWidth on element does not work in IE on inputs
|
||||
// we have to do some dirty dom element copying.
|
||||
if (isIEFlag === true && domElType === "text") {
|
||||
setupInternetExplorerElements();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function setupInternetExplorerElements() {
|
||||
|
||||
if (!wrapper.length) {
|
||||
wrapper = angular.element('<div id="umb-ie-resize-input-wrapper" style="position:fixed; top:-999px; left:0;"></div>');
|
||||
angular.element('body').append(wrapper);
|
||||
}
|
||||
|
||||
angular.forEach(['fontFamily', 'fontSize', 'fontWeight', 'fontStyle',
|
||||
'letterSpacing', 'textTransform', 'wordSpacing', 'textIndent',
|
||||
'boxSizing', 'borderRightWidth', 'borderLeftWidth', 'borderLeftStyle', 'borderRightStyle',
|
||||
'paddingLeft', 'paddingRight', 'marginLeft', 'marginRight'
|
||||
], function(value) {
|
||||
mirror.css(value, element.css(value));
|
||||
});
|
||||
|
||||
wrapper.append(mirror);
|
||||
|
||||
}
|
||||
|
||||
function resizeInternetExplorerInput() {
|
||||
|
||||
mirror.text(element.val() || attr.placeholder);
|
||||
element.css('width', mirror.outerWidth() + 1);
|
||||
|
||||
}
|
||||
|
||||
function resizeInput() {
|
||||
|
||||
if (domEl.scrollWidth !== domEl.clientWidth) {
|
||||
if (ngModelController.$modelValue) {
|
||||
element.width(domEl.scrollWidth);
|
||||
}
|
||||
}
|
||||
|
||||
if(!ngModelController.$modelValue && attr.placeholder) {
|
||||
attr.$set('size', attr.placeholder.length);
|
||||
element.width('auto');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function resizeTextarea() {
|
||||
|
||||
if(domEl.scrollHeight !== domEl.clientHeight) {
|
||||
|
||||
element.height(domEl.scrollHeight);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var update = function(force) {
|
||||
|
||||
|
||||
if (force === true) {
|
||||
|
||||
if (domElType === "textarea") {
|
||||
element.height(0);
|
||||
} else if (domElType === "text") {
|
||||
element.width(0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (isIEFlag === true && domElType === "text") {
|
||||
|
||||
resizeInternetExplorerInput();
|
||||
|
||||
} else {
|
||||
|
||||
if (domElType === "textarea") {
|
||||
|
||||
resizeTextarea();
|
||||
|
||||
} else if (domElType === "text") {
|
||||
|
||||
resizeInput();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
activate();
|
||||
|
||||
//listen for tab changes
|
||||
if (umbTabsController != null) {
|
||||
umbTabsController.onTabShown(function(args) {
|
||||
update();
|
||||
});
|
||||
}
|
||||
|
||||
// listen for ng-model changes
|
||||
var unbindModelWatcher = scope.$watch(function() {
|
||||
return ngModelController.$modelValue;
|
||||
}, function(newValue) {
|
||||
$timeout(
|
||||
function() {
|
||||
update(true);
|
||||
if (domEl.scrollWidth !== domEl.clientWidth) {
|
||||
if (ngModelController.$modelValue) {
|
||||
element.width(domEl.scrollWidth);
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
scope.$on('$destroy', function() {
|
||||
element.off('keyup keydown keypress change', update);
|
||||
element.off('blur', update(true));
|
||||
unbindModelWatcher();
|
||||
if (!ngModelController.$modelValue && attr.placeholder) {
|
||||
attr.$set('size', attr.placeholder.length);
|
||||
element.width('auto');
|
||||
}
|
||||
|
||||
// clean up IE dom element
|
||||
if (isIEFlag === true && domElType === "text") {
|
||||
mirror.remove();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
function resizeTextarea() {
|
||||
|
||||
if (domEl.scrollHeight !== domEl.clientHeight) {
|
||||
|
||||
element.height(domEl.scrollHeight);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var update = function (force) {
|
||||
|
||||
|
||||
if (force === true) {
|
||||
|
||||
if (domElType === "textarea") {
|
||||
element.height(0);
|
||||
} else if (domElType === "text") {
|
||||
element.width(0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (domElType === "textarea") {
|
||||
|
||||
resizeTextarea();
|
||||
|
||||
} else if (domElType === "text") {
|
||||
|
||||
resizeInput();
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
//listen for tab changes
|
||||
if (umbTabsController != null) {
|
||||
umbTabsController.onTabShown(function (args) {
|
||||
update();
|
||||
});
|
||||
}
|
||||
|
||||
// listen for ng-model changes
|
||||
var unbindModelWatcher = scope.$watch(function () {
|
||||
return ngModelController.$modelValue;
|
||||
}, function (newValue) {
|
||||
$timeout(
|
||||
function () {
|
||||
update(true);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
scope.$on('$destroy', function () {
|
||||
element.off('keyup keydown keypress change', update);
|
||||
element.off('blur', update(true));
|
||||
unbindModelWatcher();
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
@@ -9,91 +9,91 @@ will override element type to textarea and add own attribute ngModel tied to jso
|
||||
*/
|
||||
|
||||
angular.module("umbraco.directives")
|
||||
.directive('umbRawModel', function () {
|
||||
return {
|
||||
restrict: 'A',
|
||||
require: 'ngModel',
|
||||
template: '<textarea ng-model="jsonEditing"></textarea>',
|
||||
replace : true,
|
||||
scope: {
|
||||
model: '=umbRawModel',
|
||||
validateOn:'='
|
||||
},
|
||||
link: function (scope, element, attrs, ngModelCtrl) {
|
||||
.directive('umbRawModel', function () {
|
||||
return {
|
||||
restrict: 'A',
|
||||
require: 'ngModel',
|
||||
template: '<textarea ng-model="jsonEditing"></textarea>',
|
||||
replace: true,
|
||||
scope: {
|
||||
model: '=umbRawModel',
|
||||
validateOn: '='
|
||||
},
|
||||
link: function (scope, element, attrs, ngModelCtrl) {
|
||||
|
||||
function setEditing (value) {
|
||||
scope.jsonEditing = angular.copy( jsonToString(value));
|
||||
}
|
||||
function setEditing(value) {
|
||||
scope.jsonEditing = Utilities.copy(jsonToString(value));
|
||||
}
|
||||
|
||||
function updateModel (value) {
|
||||
scope.model = stringToJson(value);
|
||||
}
|
||||
function updateModel(value) {
|
||||
scope.model = stringToJson(value);
|
||||
}
|
||||
|
||||
function setValid() {
|
||||
ngModelCtrl.$setValidity('json', true);
|
||||
}
|
||||
function setValid() {
|
||||
ngModelCtrl.$setValidity('json', true);
|
||||
}
|
||||
|
||||
function setInvalid () {
|
||||
ngModelCtrl.$setValidity('json', false);
|
||||
}
|
||||
function setInvalid() {
|
||||
ngModelCtrl.$setValidity('json', false);
|
||||
}
|
||||
|
||||
function stringToJson(text) {
|
||||
try {
|
||||
return angular.fromJson(text);
|
||||
} catch (err) {
|
||||
setInvalid();
|
||||
return text;
|
||||
}
|
||||
}
|
||||
function stringToJson(text) {
|
||||
try {
|
||||
return JSON.parse(text);
|
||||
} catch (err) {
|
||||
setInvalid();
|
||||
return text;
|
||||
}
|
||||
}
|
||||
|
||||
function jsonToString(object) {
|
||||
// better than JSON.stringify(), because it formats + filters $$hashKey etc.
|
||||
// NOTE that this will remove all $-prefixed values
|
||||
return angular.toJson(object, true);
|
||||
}
|
||||
function jsonToString(object) {
|
||||
// better than JSON.stringify(), because it formats + filters $$hashKey etc.
|
||||
// NOTE that this will remove all $-prefixed values
|
||||
return Utilities.toJson(object, true);
|
||||
}
|
||||
|
||||
function isValidJson(model) {
|
||||
var flag = true;
|
||||
try {
|
||||
angular.fromJson(model);
|
||||
} catch (err) {
|
||||
flag = false;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
function isValidJson(model) {
|
||||
var flag = true;
|
||||
try {
|
||||
JSON.parse(model)
|
||||
} catch (err) {
|
||||
flag = false;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
//init
|
||||
setEditing(scope.model);
|
||||
//init
|
||||
setEditing(scope.model);
|
||||
|
||||
var onInputChange = function(newval,oldval){
|
||||
if (newval !== oldval) {
|
||||
if (isValidJson(newval)) {
|
||||
setValid();
|
||||
updateModel(newval);
|
||||
} else {
|
||||
setInvalid();
|
||||
}
|
||||
}
|
||||
};
|
||||
var onInputChange = function (newval, oldval) {
|
||||
if (newval !== oldval) {
|
||||
if (isValidJson(newval)) {
|
||||
setValid();
|
||||
updateModel(newval);
|
||||
} else {
|
||||
setInvalid();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if(scope.validateOn){
|
||||
element.on(scope.validateOn, function(){
|
||||
scope.$apply(function(){
|
||||
onInputChange(scope.jsonEditing);
|
||||
});
|
||||
});
|
||||
}else{
|
||||
//check for changes going out
|
||||
scope.$watch('jsonEditing', onInputChange, true);
|
||||
}
|
||||
if (scope.validateOn) {
|
||||
element.on(scope.validateOn, function () {
|
||||
scope.$apply(function () {
|
||||
onInputChange(scope.jsonEditing);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
//check for changes going out
|
||||
scope.$watch('jsonEditing', onInputChange, true);
|
||||
}
|
||||
|
||||
//check for changes coming in
|
||||
scope.$watch('model', function (newval, oldval) {
|
||||
if (newval !== oldval) {
|
||||
setEditing(newval);
|
||||
}
|
||||
}, true);
|
||||
//check for changes coming in
|
||||
scope.$watch('model', function (newval, oldval) {
|
||||
if (newval !== oldval) {
|
||||
setEditing(newval);
|
||||
}
|
||||
}, true);
|
||||
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
@@ -29,7 +29,7 @@ angular.module("umbraco.directives")
|
||||
}
|
||||
|
||||
var editorConfig = scope.configuration ? scope.configuration : null;
|
||||
if (!editorConfig || angular.isString(editorConfig)) {
|
||||
if (!editorConfig || Utilities.isString(editorConfig)) {
|
||||
editorConfig = tinyMceService.defaultPrevalues();
|
||||
//for the grid by default, we don't want to include the macro toolbar
|
||||
editorConfig.toolbar = _.without(editorConfig, "umbmacro");
|
||||
|
||||
@@ -30,7 +30,7 @@ angular.module("umbraco.directives")
|
||||
.directive('localize', function ($log, localizationService) {
|
||||
return {
|
||||
restrict: 'E',
|
||||
scope:{
|
||||
scope: {
|
||||
key: '@',
|
||||
tokens: '=',
|
||||
watchTokens: '@'
|
||||
@@ -40,13 +40,13 @@ angular.module("umbraco.directives")
|
||||
link: function (scope, element, attrs) {
|
||||
var key = scope.key;
|
||||
scope.text = "";
|
||||
|
||||
|
||||
// A render function to be able to update tokens as values update.
|
||||
function render() {
|
||||
element.html(localizationService.tokenReplace(scope.text, scope.tokens || null));
|
||||
}
|
||||
|
||||
localizationService.localize(key).then(function(value){
|
||||
|
||||
localizationService.localize(key).then(function (value) {
|
||||
scope.text = value;
|
||||
render();
|
||||
});
|
||||
@@ -64,19 +64,19 @@ angular.module("umbraco.directives")
|
||||
//Support one or more attribute properties to update
|
||||
var keys = attrs.localize.split(',');
|
||||
|
||||
angular.forEach(keys, function(value, key){
|
||||
keys.forEach((value, key) => {
|
||||
var attr = element.attr(value);
|
||||
|
||||
if(attr){
|
||||
if(attr[0] === '@'){
|
||||
if (attr) {
|
||||
if (attr[0] === '@') {
|
||||
//If the translation key starts with @ then remove it
|
||||
attr = attr.substring(1);
|
||||
}
|
||||
|
||||
var t = localizationService.tokenize(attr, scope);
|
||||
|
||||
localizationService.localize(t.key, t.tokens).then(function(val){
|
||||
element.attr(value, val);
|
||||
|
||||
localizationService.localize(t.key, t.tokens).then(function (val) {
|
||||
element.attr(value, val);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -193,352 +193,351 @@ Opens an overlay to show a custom YSOD. </br>
|
||||
@param {string} position The overlay position ("left", "right", "center": "target").
|
||||
**/
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
function OverlayDirective($timeout, formHelper, overlayHelper, localizationService, $q, $templateCache, $http, $compile) {
|
||||
|
||||
function link(scope, el, attr, ctrl) {
|
||||
function link(scope, el, attr, ctrl) {
|
||||
|
||||
scope.directive = {
|
||||
enableConfirmButton: false
|
||||
};
|
||||
|
||||
var overlayNumber = 0;
|
||||
var numberOfOverlays = 0;
|
||||
var isRegistered = false;
|
||||
|
||||
|
||||
var modelCopy = {};
|
||||
var unsubscribe = [];
|
||||
|
||||
function activate() {
|
||||
setView();
|
||||
|
||||
setButtonText();
|
||||
|
||||
modelCopy = makeModelCopy(scope.model);
|
||||
|
||||
$timeout(function() {
|
||||
|
||||
if (scope.position === "target" && scope.model.event) {
|
||||
setTargetPosition();
|
||||
|
||||
// update the position of the overlay on content changes
|
||||
// as these affect the layout/size of the overlay
|
||||
if ('ResizeObserver' in window)
|
||||
{
|
||||
var resizeObserver = new ResizeObserver(setTargetPosition);
|
||||
var contentArea = document.getElementById("contentwrapper");
|
||||
resizeObserver.observe(el[0]);
|
||||
if (contentArea) {
|
||||
resizeObserver.observe(contentArea);
|
||||
}
|
||||
unsubscribe.push(function () {
|
||||
resizeObserver.disconnect();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// this has to be done inside a timeout to ensure the destroy
|
||||
// event on other overlays is run before registering a new one
|
||||
registerOverlay();
|
||||
|
||||
setOverlayIndent();
|
||||
|
||||
focusOnOverlayHeading()
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// Ideally this would focus on the first natively focusable element in the overlay, but as the content can be dynamic, it is focusing on the heading.
|
||||
function focusOnOverlayHeading() {
|
||||
var heading = el.find(".umb-overlay__title");
|
||||
|
||||
if(heading) {
|
||||
heading.focus();
|
||||
}
|
||||
}
|
||||
|
||||
function setView() {
|
||||
|
||||
if (scope.view) {
|
||||
|
||||
if (scope.view.indexOf(".html") === -1) {
|
||||
var viewAlias = scope.view.toLowerCase();
|
||||
scope.view = "views/common/overlays/" + viewAlias + "/" + viewAlias + ".html";
|
||||
}
|
||||
|
||||
//if a custom parent scope is defined then we need to manually compile the view
|
||||
if (scope.parentScope) {
|
||||
var element = el.find(".scoped-view");
|
||||
$http.get(scope.view, { cache: $templateCache })
|
||||
.then(function (response) {
|
||||
var templateScope = scope.parentScope.$new();
|
||||
unsubscribe.push(function() {
|
||||
templateScope.$destroy();
|
||||
});
|
||||
templateScope.model = scope.model;
|
||||
element.html(response.data);
|
||||
element.show();
|
||||
$compile(element.contents())(templateScope);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function setButtonText() {
|
||||
|
||||
var labelKeys = [
|
||||
"general_close",
|
||||
"general_submit"
|
||||
];
|
||||
|
||||
localizationService.localizeMany(labelKeys).then(function (values) {
|
||||
if (!scope.model.closeButtonLabelKey && !scope.model.closeButtonLabel) {
|
||||
scope.model.closeButtonLabel = values[0];
|
||||
}
|
||||
if (!scope.model.submitButtonLabelKey && !scope.model.submitButtonLabel) {
|
||||
scope.model.submitButtonLabel = values[1];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function registerOverlay() {
|
||||
|
||||
overlayNumber = overlayHelper.registerOverlay();
|
||||
|
||||
$(document).on("keydown.overlay-" + overlayNumber, function(event) {
|
||||
|
||||
if (event.which === 27) {
|
||||
|
||||
numberOfOverlays = overlayHelper.getNumberOfOverlays();
|
||||
|
||||
if (numberOfOverlays === overlayNumber && !scope.model.disableEscKey) {
|
||||
scope.$apply(function () {
|
||||
scope.closeOverLay();
|
||||
});
|
||||
}
|
||||
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
if (event.which === 13) {
|
||||
|
||||
numberOfOverlays = overlayHelper.getNumberOfOverlays();
|
||||
|
||||
if(numberOfOverlays === overlayNumber) {
|
||||
|
||||
var activeElementType = document.activeElement.tagName;
|
||||
var clickableElements = ["A", "BUTTON"];
|
||||
var submitOnEnter = document.activeElement.hasAttribute("overlay-submit-on-enter");
|
||||
var submitOnEnterValue = submitOnEnter ? document.activeElement.getAttribute("overlay-submit-on-enter") : "";
|
||||
|
||||
if(clickableElements.indexOf(activeElementType) >= 0) {
|
||||
// don't do anything, let the browser Enter key handle this
|
||||
} else if(activeElementType === "TEXTAREA" && !submitOnEnter) {
|
||||
|
||||
|
||||
} else if (submitOnEnter && submitOnEnterValue === "false") {
|
||||
// don't do anything
|
||||
}else {
|
||||
scope.$apply(function () {
|
||||
scope.submitForm(scope.model);
|
||||
});
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
isRegistered = true;
|
||||
|
||||
}
|
||||
|
||||
function unregisterOverlay() {
|
||||
|
||||
if(isRegistered) {
|
||||
|
||||
overlayHelper.unregisterOverlay();
|
||||
|
||||
$(document).off("keydown.overlay-" + overlayNumber);
|
||||
|
||||
isRegistered = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function makeModelCopy(object) {
|
||||
|
||||
var newObject = {};
|
||||
|
||||
for (var key in object) {
|
||||
if (key !== "event" && key !== "parentScope") {
|
||||
newObject[key] = angular.copy(object[key]);
|
||||
}
|
||||
}
|
||||
|
||||
return newObject;
|
||||
|
||||
}
|
||||
|
||||
function setOverlayIndent() {
|
||||
|
||||
var overlayIndex = overlayNumber - 1;
|
||||
var indentSize = overlayIndex * 20;
|
||||
var overlayWidth = el[0].clientWidth;
|
||||
|
||||
el.css('width', overlayWidth - indentSize);
|
||||
|
||||
if(scope.position === "center" && overlayIndex > 0 || scope.position === "target" && overlayIndex > 0) {
|
||||
var overlayTopPosition = el[0].offsetTop;
|
||||
el.css('top', overlayTopPosition + indentSize);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function setTargetPosition() {
|
||||
|
||||
var container = $("#contentwrapper");
|
||||
var containerLeft = container[0].offsetLeft;
|
||||
var containerRight = containerLeft + container[0].offsetWidth;
|
||||
var containerTop = container[0].offsetTop;
|
||||
var containerBottom = containerTop + container[0].offsetHeight;
|
||||
|
||||
var mousePositionClickX = null;
|
||||
var mousePositionClickY = null;
|
||||
var elementHeight = null;
|
||||
var elementWidth = null;
|
||||
|
||||
var position = {
|
||||
right: "inherit",
|
||||
left: "inherit",
|
||||
top: "inherit",
|
||||
bottom: "inherit"
|
||||
scope.directive = {
|
||||
enableConfirmButton: false
|
||||
};
|
||||
|
||||
// click position
|
||||
mousePositionClickX = scope.model.event.pageX;
|
||||
mousePositionClickY = scope.model.event.pageY;
|
||||
var overlayNumber = 0;
|
||||
var numberOfOverlays = 0;
|
||||
var isRegistered = false;
|
||||
|
||||
// element size
|
||||
elementHeight = el[0].clientHeight;
|
||||
elementWidth = el[0].clientWidth;
|
||||
|
||||
// move element to this position
|
||||
position.left = mousePositionClickX - (elementWidth / 2);
|
||||
position.top = mousePositionClickY - (elementHeight / 2);
|
||||
var modelCopy = {};
|
||||
var unsubscribe = [];
|
||||
|
||||
function activate() {
|
||||
setView();
|
||||
|
||||
setButtonText();
|
||||
|
||||
modelCopy = makeModelCopy(scope.model);
|
||||
|
||||
$timeout(function () {
|
||||
|
||||
if (scope.position === "target" && scope.model.event) {
|
||||
setTargetPosition();
|
||||
|
||||
// update the position of the overlay on content changes
|
||||
// as these affect the layout/size of the overlay
|
||||
if ('ResizeObserver' in window) {
|
||||
var resizeObserver = new ResizeObserver(setTargetPosition);
|
||||
var contentArea = document.getElementById("contentwrapper");
|
||||
resizeObserver.observe(el[0]);
|
||||
if (contentArea) {
|
||||
resizeObserver.observe(contentArea);
|
||||
}
|
||||
unsubscribe.push(function () {
|
||||
resizeObserver.disconnect();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// this has to be done inside a timeout to ensure the destroy
|
||||
// event on other overlays is run before registering a new one
|
||||
registerOverlay();
|
||||
|
||||
setOverlayIndent();
|
||||
|
||||
focusOnOverlayHeading()
|
||||
});
|
||||
|
||||
// check to see if element is outside screen
|
||||
// outside right
|
||||
if (position.left + elementWidth > containerRight) {
|
||||
position.right = 10;
|
||||
position.left = "inherit";
|
||||
}
|
||||
|
||||
// outside bottom
|
||||
if (position.top + elementHeight > containerBottom) {
|
||||
position.bottom = 10;
|
||||
position.top = "inherit";
|
||||
// Ideally this would focus on the first natively focusable element in the overlay, but as the content can be dynamic, it is focusing on the heading.
|
||||
function focusOnOverlayHeading() {
|
||||
var heading = el.find(".umb-overlay__title");
|
||||
|
||||
if (heading) {
|
||||
heading.focus();
|
||||
}
|
||||
}
|
||||
|
||||
// outside left
|
||||
if (position.left < containerLeft) {
|
||||
position.left = containerLeft + 10;
|
||||
position.right = "inherit";
|
||||
function setView() {
|
||||
|
||||
if (scope.view) {
|
||||
|
||||
if (scope.view.indexOf(".html") === -1) {
|
||||
var viewAlias = scope.view.toLowerCase();
|
||||
scope.view = "views/common/overlays/" + viewAlias + "/" + viewAlias + ".html";
|
||||
}
|
||||
|
||||
//if a custom parent scope is defined then we need to manually compile the view
|
||||
if (scope.parentScope) {
|
||||
var element = el.find(".scoped-view");
|
||||
$http.get(scope.view, { cache: $templateCache })
|
||||
.then(function (response) {
|
||||
var templateScope = scope.parentScope.$new();
|
||||
unsubscribe.push(function () {
|
||||
templateScope.$destroy();
|
||||
});
|
||||
templateScope.model = scope.model;
|
||||
element.html(response.data);
|
||||
element.show();
|
||||
$compile(element.contents())(templateScope);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// outside top
|
||||
if (position.top < containerTop) {
|
||||
position.top = 10;
|
||||
position.bottom = "inherit";
|
||||
function setButtonText() {
|
||||
|
||||
var labelKeys = [
|
||||
"general_close",
|
||||
"general_submit"
|
||||
];
|
||||
|
||||
localizationService.localizeMany(labelKeys).then(function (values) {
|
||||
if (!scope.model.closeButtonLabelKey && !scope.model.closeButtonLabel) {
|
||||
scope.model.closeButtonLabel = values[0];
|
||||
}
|
||||
if (!scope.model.submitButtonLabelKey && !scope.model.submitButtonLabel) {
|
||||
scope.model.submitButtonLabel = values[1];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
el.css(position);
|
||||
}
|
||||
function registerOverlay() {
|
||||
|
||||
scope.submitForm = function(model) {
|
||||
if(scope.model.submit) {
|
||||
if (formHelper.submitForm({ scope: scope, skipValidation: scope.model.skipFormValidation})) {
|
||||
|
||||
if (scope.model.confirmSubmit && scope.model.confirmSubmit.enable && !scope.directive.enableConfirmButton) {
|
||||
//wrap in a when since we don't know if this is a promise or not
|
||||
$q.when(scope.model.submit(model, modelCopy, scope.directive.enableConfirmButton)).then(
|
||||
function() {
|
||||
formHelper.resetForm({ scope: scope });
|
||||
});
|
||||
} else {
|
||||
unregisterOverlay();
|
||||
//wrap in a when since we don't know if this is a promise or not
|
||||
$q.when(scope.model.submit(model, modelCopy, scope.directive.enableConfirmButton)).then(
|
||||
function() {
|
||||
formHelper.resetForm({ scope: scope });
|
||||
});
|
||||
}
|
||||
overlayNumber = overlayHelper.registerOverlay();
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
$(document).on("keydown.overlay-" + overlayNumber, function (event) {
|
||||
|
||||
scope.cancelConfirmSubmit = function() {
|
||||
scope.model.confirmSubmit.show = false;
|
||||
};
|
||||
if (event.which === 27) {
|
||||
|
||||
scope.closeOverLay = function() {
|
||||
numberOfOverlays = overlayHelper.getNumberOfOverlays();
|
||||
|
||||
unregisterOverlay();
|
||||
if (numberOfOverlays === overlayNumber && !scope.model.disableEscKey) {
|
||||
scope.$apply(function () {
|
||||
scope.closeOverLay();
|
||||
});
|
||||
}
|
||||
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
if (event.which === 13) {
|
||||
|
||||
numberOfOverlays = overlayHelper.getNumberOfOverlays();
|
||||
|
||||
if (numberOfOverlays === overlayNumber) {
|
||||
|
||||
var activeElementType = document.activeElement.tagName;
|
||||
var clickableElements = ["A", "BUTTON"];
|
||||
var submitOnEnter = document.activeElement.hasAttribute("overlay-submit-on-enter");
|
||||
var submitOnEnterValue = submitOnEnter ? document.activeElement.getAttribute("overlay-submit-on-enter") : "";
|
||||
|
||||
if (clickableElements.indexOf(activeElementType) >= 0) {
|
||||
// don't do anything, let the browser Enter key handle this
|
||||
} else if (activeElementType === "TEXTAREA" && !submitOnEnter) {
|
||||
|
||||
|
||||
} else if (submitOnEnter && submitOnEnterValue === "false") {
|
||||
// don't do anything
|
||||
} else {
|
||||
scope.$apply(function () {
|
||||
scope.submitForm(scope.model);
|
||||
});
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
isRegistered = true;
|
||||
|
||||
if (scope.model && scope.model.close) {
|
||||
scope.model = modelCopy;
|
||||
scope.model.close(scope.model);
|
||||
} else {
|
||||
scope.model.show = false;
|
||||
scope.model = null;
|
||||
}
|
||||
|
||||
};
|
||||
function unregisterOverlay() {
|
||||
|
||||
if (isRegistered) {
|
||||
|
||||
overlayHelper.unregisterOverlay();
|
||||
|
||||
$(document).off("keydown.overlay-" + overlayNumber);
|
||||
|
||||
isRegistered = false;
|
||||
}
|
||||
|
||||
scope.outSideClick = function() {
|
||||
if(!scope.model.disableBackdropClick) {
|
||||
scope.closeOverLay();
|
||||
}
|
||||
|
||||
function makeModelCopy(object) {
|
||||
|
||||
var newObject = {};
|
||||
|
||||
for (var key in object) {
|
||||
if (key !== "event" && key !== "parentScope") {
|
||||
newObject[key] = Utilities.copy(object[key]);
|
||||
}
|
||||
}
|
||||
|
||||
return newObject;
|
||||
|
||||
}
|
||||
|
||||
function setOverlayIndent() {
|
||||
|
||||
var overlayIndex = overlayNumber - 1;
|
||||
var indentSize = overlayIndex * 20;
|
||||
var overlayWidth = el[0].clientWidth;
|
||||
|
||||
el.css('width', overlayWidth - indentSize);
|
||||
|
||||
if (scope.position === "center" && overlayIndex > 0 || scope.position === "target" && overlayIndex > 0) {
|
||||
var overlayTopPosition = el[0].offsetTop;
|
||||
el.css('top', overlayTopPosition + indentSize);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function setTargetPosition() {
|
||||
|
||||
var container = $("#contentwrapper");
|
||||
var containerLeft = container[0].offsetLeft;
|
||||
var containerRight = containerLeft + container[0].offsetWidth;
|
||||
var containerTop = container[0].offsetTop;
|
||||
var containerBottom = containerTop + container[0].offsetHeight;
|
||||
|
||||
var mousePositionClickX = null;
|
||||
var mousePositionClickY = null;
|
||||
var elementHeight = null;
|
||||
var elementWidth = null;
|
||||
|
||||
var position = {
|
||||
right: "inherit",
|
||||
left: "inherit",
|
||||
top: "inherit",
|
||||
bottom: "inherit"
|
||||
};
|
||||
|
||||
// click position
|
||||
mousePositionClickX = scope.model.event.pageX;
|
||||
mousePositionClickY = scope.model.event.pageY;
|
||||
|
||||
// element size
|
||||
elementHeight = el[0].clientHeight;
|
||||
elementWidth = el[0].clientWidth;
|
||||
|
||||
// move element to this position
|
||||
position.left = mousePositionClickX - (elementWidth / 2);
|
||||
position.top = mousePositionClickY - (elementHeight / 2);
|
||||
|
||||
// check to see if element is outside screen
|
||||
// outside right
|
||||
if (position.left + elementWidth > containerRight) {
|
||||
position.right = 10;
|
||||
position.left = "inherit";
|
||||
}
|
||||
|
||||
// outside bottom
|
||||
if (position.top + elementHeight > containerBottom) {
|
||||
position.bottom = 10;
|
||||
position.top = "inherit";
|
||||
}
|
||||
|
||||
// outside left
|
||||
if (position.left < containerLeft) {
|
||||
position.left = containerLeft + 10;
|
||||
position.right = "inherit";
|
||||
}
|
||||
|
||||
// outside top
|
||||
if (position.top < containerTop) {
|
||||
position.top = 10;
|
||||
position.bottom = "inherit";
|
||||
}
|
||||
|
||||
el.css(position);
|
||||
}
|
||||
|
||||
scope.submitForm = function (model) {
|
||||
if (scope.model.submit) {
|
||||
if (formHelper.submitForm({ scope: scope, skipValidation: scope.model.skipFormValidation })) {
|
||||
|
||||
if (scope.model.confirmSubmit && scope.model.confirmSubmit.enable && !scope.directive.enableConfirmButton) {
|
||||
//wrap in a when since we don't know if this is a promise or not
|
||||
$q.when(scope.model.submit(model, modelCopy, scope.directive.enableConfirmButton)).then(
|
||||
function () {
|
||||
formHelper.resetForm({ scope: scope });
|
||||
});
|
||||
} else {
|
||||
unregisterOverlay();
|
||||
//wrap in a when since we don't know if this is a promise or not
|
||||
$q.when(scope.model.submit(model, modelCopy, scope.directive.enableConfirmButton)).then(
|
||||
function () {
|
||||
formHelper.resetForm({ scope: scope });
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
scope.cancelConfirmSubmit = function () {
|
||||
scope.model.confirmSubmit.show = false;
|
||||
};
|
||||
|
||||
scope.closeOverLay = function () {
|
||||
|
||||
unregisterOverlay();
|
||||
|
||||
if (scope.model && scope.model.close) {
|
||||
scope.model = modelCopy;
|
||||
scope.model.close(scope.model);
|
||||
} else {
|
||||
scope.model.show = false;
|
||||
scope.model = null;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
scope.outSideClick = function () {
|
||||
if (!scope.model.disableBackdropClick) {
|
||||
scope.closeOverLay();
|
||||
}
|
||||
};
|
||||
|
||||
unsubscribe.push(unregisterOverlay);
|
||||
scope.$on('$destroy', function () {
|
||||
for (var i = 0; i < unsubscribe.length; i++) {
|
||||
unsubscribe[i]();
|
||||
}
|
||||
});
|
||||
|
||||
activate();
|
||||
|
||||
}
|
||||
|
||||
var directive = {
|
||||
transclude: true,
|
||||
restrict: 'E',
|
||||
replace: true,
|
||||
templateUrl: 'views/components/overlays/umb-overlay.html',
|
||||
scope: {
|
||||
ngShow: "=",
|
||||
model: "=",
|
||||
view: "=",
|
||||
position: "@",
|
||||
size: "=?",
|
||||
parentScope: "=?"
|
||||
},
|
||||
link: link
|
||||
};
|
||||
|
||||
unsubscribe.push(unregisterOverlay);
|
||||
scope.$on('$destroy', function () {
|
||||
for (var i = 0; i < unsubscribe.length; i++) {
|
||||
unsubscribe[i]();
|
||||
}
|
||||
});
|
||||
return directive;
|
||||
}
|
||||
|
||||
activate();
|
||||
|
||||
}
|
||||
|
||||
var directive = {
|
||||
transclude: true,
|
||||
restrict: 'E',
|
||||
replace: true,
|
||||
templateUrl: 'views/components/overlays/umb-overlay.html',
|
||||
scope: {
|
||||
ngShow: "=",
|
||||
model: "=",
|
||||
view: "=",
|
||||
position: "@",
|
||||
size: "=?",
|
||||
parentScope: "=?"
|
||||
},
|
||||
link: link
|
||||
};
|
||||
|
||||
return directive;
|
||||
}
|
||||
|
||||
angular.module('umbraco.directives').directive('umbOverlay', OverlayDirective);
|
||||
angular.module('umbraco.directives').directive('umbOverlay', OverlayDirective);
|
||||
|
||||
})();
|
||||
|
||||
@@ -159,7 +159,7 @@
|
||||
|
||||
function configureViewModel(isInitLoad) {
|
||||
if (vm.value) {
|
||||
if (angular.isString(vm.value) && vm.value.length > 0) {
|
||||
if (Utilities.isString(vm.value) && vm.value.length > 0) {
|
||||
if (vm.config.storageType === "Json") {
|
||||
//json storage
|
||||
vm.viewModel = JSON.parse(vm.value);
|
||||
@@ -191,7 +191,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (angular.isArray(vm.value)) {
|
||||
else if (Utilities.isArray(vm.value)) {
|
||||
vm.viewModel = vm.value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ function umbTreeDirective($q, $rootScope, treeService, notificationsService, use
|
||||
|
||||
/** Helper function to emit tree events */
|
||||
function emitEvent(eventName, args) {
|
||||
if (registeredCallbacks[eventName] && angular.isArray(registeredCallbacks[eventName])) {
|
||||
if (registeredCallbacks[eventName] && Utilities.isArray(registeredCallbacks[eventName])) {
|
||||
_.each(registeredCallbacks[eventName], function (c) {
|
||||
c(args);//call it
|
||||
});
|
||||
@@ -100,7 +100,7 @@ function umbTreeDirective($q, $rootScope, treeService, notificationsService, use
|
||||
* @param {any} args either a string representing the 'section' or an object containing: 'section', 'treeAlias', 'customTreeParams', 'cacheKey'
|
||||
*/
|
||||
function load(args) {
|
||||
if (angular.isString(args)) {
|
||||
if (Utilities.isString(args)) {
|
||||
$scope.section = args;
|
||||
}
|
||||
else if (args) {
|
||||
@@ -147,7 +147,7 @@ function umbTreeDirective($q, $rootScope, treeService, notificationsService, use
|
||||
throw "args.path cannot be null";
|
||||
}
|
||||
|
||||
if (angular.isString(args.path)) {
|
||||
if (Utilities.isString(args.path)) {
|
||||
args.path = args.path.replace('"', '').split(',');
|
||||
}
|
||||
|
||||
|
||||
@@ -24,40 +24,40 @@
|
||||
|
||||
// sets the ace worker path, if running from concatenated
|
||||
// or minified source
|
||||
if (angular.isDefined(opts.workerPath)) {
|
||||
if (Utilities.isDefined(opts.workerPath)) {
|
||||
var config = window.ace.require('ace/config');
|
||||
config.set('workerPath', opts.workerPath);
|
||||
}
|
||||
|
||||
// ace requires loading
|
||||
if (angular.isDefined(opts.require)) {
|
||||
if (Utilities.isDefined(opts.require)) {
|
||||
opts.require.forEach(function(n) {
|
||||
window.ace.require(n);
|
||||
});
|
||||
}
|
||||
|
||||
// Boolean options
|
||||
if (angular.isDefined(opts.showGutter)) {
|
||||
if (Utilities.isDefined(opts.showGutter)) {
|
||||
acee.renderer.setShowGutter(opts.showGutter);
|
||||
}
|
||||
if (angular.isDefined(opts.useWrapMode)) {
|
||||
if (Utilities.isDefined(opts.useWrapMode)) {
|
||||
session.setUseWrapMode(opts.useWrapMode);
|
||||
}
|
||||
if (angular.isDefined(opts.showInvisibles)) {
|
||||
if (Utilities.isDefined(opts.showInvisibles)) {
|
||||
acee.renderer.setShowInvisibles(opts.showInvisibles);
|
||||
}
|
||||
if (angular.isDefined(opts.showIndentGuides)) {
|
||||
if (Utilities.isDefined(opts.showIndentGuides)) {
|
||||
acee.renderer.setDisplayIndentGuides(opts.showIndentGuides);
|
||||
}
|
||||
if (angular.isDefined(opts.useSoftTabs)) {
|
||||
if (Utilities.isDefined(opts.useSoftTabs)) {
|
||||
session.setUseSoftTabs(opts.useSoftTabs);
|
||||
}
|
||||
if (angular.isDefined(opts.showPrintMargin)) {
|
||||
if (Utilities.isDefined(opts.showPrintMargin)) {
|
||||
acee.setShowPrintMargin(opts.showPrintMargin);
|
||||
}
|
||||
|
||||
// commands
|
||||
if (angular.isDefined(opts.disableSearch) && opts.disableSearch) {
|
||||
if (Utilities.isDefined(opts.disableSearch) && opts.disableSearch) {
|
||||
acee.commands.addCommands([{
|
||||
name: 'unfind',
|
||||
bindKey: {
|
||||
@@ -72,15 +72,15 @@
|
||||
}
|
||||
|
||||
// Basic options
|
||||
if (angular.isString(opts.theme)) {
|
||||
if (Utilities.isString(opts.theme)) {
|
||||
acee.setTheme('ace/theme/' + opts.theme);
|
||||
}
|
||||
if (angular.isString(opts.mode)) {
|
||||
if (Utilities.isString(opts.mode)) {
|
||||
session.setMode('ace/mode/' + opts.mode);
|
||||
}
|
||||
// Advanced options
|
||||
if (angular.isDefined(opts.firstLineNumber)) {
|
||||
if (angular.isNumber(opts.firstLineNumber)) {
|
||||
if (Utilities.isDefined(opts.firstLineNumber)) {
|
||||
if (Utilities.isNumber(opts.firstLineNumber)) {
|
||||
session.setOption('firstLineNumber', opts.firstLineNumber);
|
||||
} else if (angular.isFunction(opts.firstLineNumber)) {
|
||||
session.setOption('firstLineNumber', opts.firstLineNumber());
|
||||
@@ -89,7 +89,7 @@
|
||||
|
||||
// advanced options
|
||||
var key, obj;
|
||||
if (angular.isDefined(opts.advanced)) {
|
||||
if (Utilities.isDefined(opts.advanced)) {
|
||||
for (key in opts.advanced) {
|
||||
// create a javascript object with the key and value
|
||||
obj = {
|
||||
@@ -102,7 +102,7 @@
|
||||
}
|
||||
|
||||
// advanced options for the renderer
|
||||
if (angular.isDefined(opts.rendererOptions)) {
|
||||
if (Utilities.isDefined(opts.rendererOptions)) {
|
||||
for (key in opts.rendererOptions) {
|
||||
// create a javascript object with the key and value
|
||||
obj = {
|
||||
@@ -206,7 +206,7 @@
|
||||
*/
|
||||
var args = Array.prototype.slice.call(arguments, 1);
|
||||
|
||||
if (angular.isDefined(callback)) {
|
||||
if (Utilities.isDefined(callback)) {
|
||||
scope.$evalAsync(function() {
|
||||
if (angular.isFunction(callback)) {
|
||||
callback(args);
|
||||
|
||||
@@ -67,37 +67,37 @@ Use this directive to render a date time picker
|
||||
@param {callback} onDayCreate (<code>callback</code>): Take full control of every date cell with theonDayCreate()hook.
|
||||
**/
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var umbDateTimePicker = {
|
||||
template: '<ng-transclude>' +
|
||||
'<input type="text" ng-if="!$ctrl.options.inline" ng-model="$ctrl.ngModel" placeholder="Select Date.."></input>' +
|
||||
'<div ng-if="$ctrl.options.inline"></div>' +
|
||||
'</ng-transclude>',
|
||||
controller: umbDateTimePickerCtrl,
|
||||
transclude: true,
|
||||
bindings: {
|
||||
ngModel: '<',
|
||||
options: '<',
|
||||
onSetup: '&?',
|
||||
onChange: '&?',
|
||||
onOpen: '&?',
|
||||
onClose: '&?',
|
||||
onMonthChange: '&?',
|
||||
onYearChange: '&?',
|
||||
onReady: '&?',
|
||||
onValueUpdate: '&?',
|
||||
onDayCreate: '&?'
|
||||
}
|
||||
var umbDateTimePicker = {
|
||||
template: '<ng-transclude>' +
|
||||
'<input type="text" ng-if="!$ctrl.options.inline" ng-model="$ctrl.ngModel" placeholder="Select Date.."></input>' +
|
||||
'<div ng-if="$ctrl.options.inline"></div>' +
|
||||
'</ng-transclude>',
|
||||
controller: umbDateTimePickerCtrl,
|
||||
transclude: true,
|
||||
bindings: {
|
||||
ngModel: '<',
|
||||
options: '<',
|
||||
onSetup: '&?',
|
||||
onChange: '&?',
|
||||
onOpen: '&?',
|
||||
onClose: '&?',
|
||||
onMonthChange: '&?',
|
||||
onYearChange: '&?',
|
||||
onReady: '&?',
|
||||
onValueUpdate: '&?',
|
||||
onDayCreate: '&?'
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
function umbDateTimePickerCtrl($element, $timeout, $scope, assetsService, userService) {
|
||||
|
||||
var ctrl = this;
|
||||
var userLocale = null;
|
||||
|
||||
ctrl.$onInit = function() {
|
||||
ctrl.$onInit = function () {
|
||||
|
||||
// load css file for the date picker
|
||||
assetsService.loadCss('lib/flatpickr/flatpickr.css', $scope).then(function () {
|
||||
@@ -113,27 +113,27 @@ Use this directive to render a date time picker
|
||||
});
|
||||
});
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
function grabElementAndRunFlatpickr() {
|
||||
$timeout(function() {
|
||||
var transcludeEl = $element.find('ng-transclude')[0];
|
||||
var element = transcludeEl.children[0];
|
||||
function grabElementAndRunFlatpickr() {
|
||||
$timeout(function () {
|
||||
var transcludeEl = $element.find('ng-transclude')[0];
|
||||
var element = transcludeEl.children[0];
|
||||
|
||||
setDatepicker(element);
|
||||
}, 0, true);
|
||||
}
|
||||
setDatepicker(element);
|
||||
}, 0, true);
|
||||
}
|
||||
|
||||
function setDatepicker(element) {
|
||||
var fpLib = flatpickr ? flatpickr : FlatpickrInstance;
|
||||
function setDatepicker(element) {
|
||||
var fpLib = flatpickr ? flatpickr : FlatpickrInstance;
|
||||
|
||||
if (!fpLib) {
|
||||
return console.warn('Unable to find any flatpickr installation');
|
||||
}
|
||||
if (!fpLib) {
|
||||
return console.warn('Unable to find any flatpickr installation');
|
||||
}
|
||||
|
||||
var fpInstance;
|
||||
|
||||
setUpCallbacks();
|
||||
setUpCallbacks();
|
||||
|
||||
if (!ctrl.options.locale) {
|
||||
ctrl.options.locale = userLocale;
|
||||
@@ -149,101 +149,101 @@ Use this directive to render a date time picker
|
||||
};
|
||||
|
||||
fpInstance = new fpLib(element, ctrl.options);
|
||||
|
||||
if (ctrl.onSetup) {
|
||||
ctrl.onSetup({
|
||||
fpItem: fpInstance
|
||||
});
|
||||
}
|
||||
|
||||
// If has ngModel set the date
|
||||
if (ctrl.ngModel) {
|
||||
fpInstance.setDate(ctrl.ngModel);
|
||||
}
|
||||
if (ctrl.onSetup) {
|
||||
ctrl.onSetup({
|
||||
fpItem: fpInstance
|
||||
});
|
||||
}
|
||||
|
||||
// destroy the flatpickr instance when the dom element is removed
|
||||
angular.element(element).on('$destroy', function() {
|
||||
fpInstance.destroy();
|
||||
});
|
||||
// If has ngModel set the date
|
||||
if (ctrl.ngModel) {
|
||||
fpInstance.setDate(ctrl.ngModel);
|
||||
}
|
||||
|
||||
// Refresh the scope
|
||||
$scope.$applyAsync();
|
||||
}
|
||||
// destroy the flatpickr instance when the dom element is removed
|
||||
$(element).on('$destroy', function () {
|
||||
fpInstance.destroy();
|
||||
});
|
||||
|
||||
function setUpCallbacks() {
|
||||
// bind hook for onChange
|
||||
if(ctrl.options && ctrl.onChange) {
|
||||
ctrl.options.onChange = function(selectedDates, dateStr, instance) {
|
||||
$timeout(function() {
|
||||
ctrl.onChange({selectedDates: selectedDates, dateStr: dateStr, instance: instance});
|
||||
});
|
||||
};
|
||||
}
|
||||
// Refresh the scope
|
||||
$scope.$applyAsync();
|
||||
}
|
||||
|
||||
// bind hook for onOpen
|
||||
if(ctrl.options && ctrl.onOpen) {
|
||||
ctrl.options.onOpen = function(selectedDates, dateStr, instance) {
|
||||
$timeout(function() {
|
||||
ctrl.onOpen({selectedDates: selectedDates, dateStr: dateStr, instance: instance});
|
||||
});
|
||||
};
|
||||
}
|
||||
function setUpCallbacks() {
|
||||
// bind hook for onChange
|
||||
if (ctrl.options && ctrl.onChange) {
|
||||
ctrl.options.onChange = function (selectedDates, dateStr, instance) {
|
||||
$timeout(function () {
|
||||
ctrl.onChange({ selectedDates: selectedDates, dateStr: dateStr, instance: instance });
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
// bind hook for onOpen
|
||||
if(ctrl.options && ctrl.onClose) {
|
||||
ctrl.options.onClose = function(selectedDates, dateStr, instance) {
|
||||
$timeout(function() {
|
||||
ctrl.onClose({selectedDates: selectedDates, dateStr: dateStr, instance: instance});
|
||||
});
|
||||
};
|
||||
}
|
||||
// bind hook for onOpen
|
||||
if (ctrl.options && ctrl.onOpen) {
|
||||
ctrl.options.onOpen = function (selectedDates, dateStr, instance) {
|
||||
$timeout(function () {
|
||||
ctrl.onOpen({ selectedDates: selectedDates, dateStr: dateStr, instance: instance });
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
// bind hook for onMonthChange
|
||||
if(ctrl.options && ctrl.onMonthChange) {
|
||||
ctrl.options.onMonthChange = function(selectedDates, dateStr, instance) {
|
||||
$timeout(function() {
|
||||
ctrl.onMonthChange({selectedDates: selectedDates, dateStr: dateStr, instance: instance});
|
||||
});
|
||||
};
|
||||
}
|
||||
// bind hook for onOpen
|
||||
if (ctrl.options && ctrl.onClose) {
|
||||
ctrl.options.onClose = function (selectedDates, dateStr, instance) {
|
||||
$timeout(function () {
|
||||
ctrl.onClose({ selectedDates: selectedDates, dateStr: dateStr, instance: instance });
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
// bind hook for onYearChange
|
||||
if(ctrl.options && ctrl.onYearChange) {
|
||||
ctrl.options.onYearChange = function(selectedDates, dateStr, instance) {
|
||||
$timeout(function() {
|
||||
ctrl.onYearChange({selectedDates: selectedDates, dateStr: dateStr, instance: instance});
|
||||
});
|
||||
};
|
||||
}
|
||||
// bind hook for onMonthChange
|
||||
if (ctrl.options && ctrl.onMonthChange) {
|
||||
ctrl.options.onMonthChange = function (selectedDates, dateStr, instance) {
|
||||
$timeout(function () {
|
||||
ctrl.onMonthChange({ selectedDates: selectedDates, dateStr: dateStr, instance: instance });
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
// bind hook for onReady
|
||||
if(ctrl.options && ctrl.onReady) {
|
||||
ctrl.options.onReady = function(selectedDates, dateStr, instance) {
|
||||
$timeout(function() {
|
||||
ctrl.onReady({selectedDates: selectedDates, dateStr: dateStr, instance: instance});
|
||||
});
|
||||
};
|
||||
}
|
||||
// bind hook for onYearChange
|
||||
if (ctrl.options && ctrl.onYearChange) {
|
||||
ctrl.options.onYearChange = function (selectedDates, dateStr, instance) {
|
||||
$timeout(function () {
|
||||
ctrl.onYearChange({ selectedDates: selectedDates, dateStr: dateStr, instance: instance });
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
// bind hook for onValueUpdate
|
||||
if(ctrl.onValueUpdate) {
|
||||
ctrl.options.onValueUpdate = function(selectedDates, dateStr, instance) {
|
||||
$timeout(function() {
|
||||
ctrl.onValueUpdate({selectedDates: selectedDates, dateStr: dateStr, instance: instance});
|
||||
});
|
||||
};
|
||||
}
|
||||
// bind hook for onReady
|
||||
if (ctrl.options && ctrl.onReady) {
|
||||
ctrl.options.onReady = function (selectedDates, dateStr, instance) {
|
||||
$timeout(function () {
|
||||
ctrl.onReady({ selectedDates: selectedDates, dateStr: dateStr, instance: instance });
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
// bind hook for onDayCreate
|
||||
if(ctrl.onDayCreate) {
|
||||
ctrl.options.onDayCreate = function(selectedDates, dateStr, instance) {
|
||||
$timeout(function() {
|
||||
ctrl.onDayCreate({selectedDates: selectedDates, dateStr: dateStr, instance: instance});
|
||||
});
|
||||
};
|
||||
}
|
||||
// bind hook for onValueUpdate
|
||||
if (ctrl.onValueUpdate) {
|
||||
ctrl.options.onValueUpdate = function (selectedDates, dateStr, instance) {
|
||||
$timeout(function () {
|
||||
ctrl.onValueUpdate({ selectedDates: selectedDates, dateStr: dateStr, instance: instance });
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
// bind hook for onDayCreate
|
||||
if (ctrl.onDayCreate) {
|
||||
ctrl.options.onDayCreate = function (selectedDates, dateStr, instance) {
|
||||
$timeout(function () {
|
||||
ctrl.onDayCreate({ selectedDates: selectedDates, dateStr: dateStr, instance: instance });
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// umbFlatpickr (umb-flatpickr) is deprecated, but we keep it for backwards compatibility
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -31,7 +31,7 @@ Use this directive to lazy-load an image only when it is scrolled into view.
|
||||
|
||||
**/
|
||||
|
||||
(function() {
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
function ImageLazyLoadDirective() {
|
||||
@@ -41,7 +41,7 @@ Use this directive to lazy-load an image only when it is scrolled into view.
|
||||
function link(scope, element, attrs) {
|
||||
|
||||
const observer = new IntersectionObserver(loadImg);
|
||||
const img = angular.element(element)[0];
|
||||
const img = element[0];
|
||||
img.src = placeholder;
|
||||
observer.observe(img);
|
||||
|
||||
|
||||
@@ -120,26 +120,26 @@ When this combination is hit an overview is opened with shortcuts based on the m
|
||||
|
||||
scope.toggleShortcutsOverlay = function () {
|
||||
|
||||
if(overlay) {
|
||||
if (overlay) {
|
||||
scope.close();
|
||||
} else {
|
||||
scope.open();
|
||||
}
|
||||
|
||||
if(scope.onToggle) {
|
||||
if (scope.onToggle) {
|
||||
scope.onToggle();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
scope.open = function() {
|
||||
if(!overlay) {
|
||||
scope.open = function () {
|
||||
if (!overlay) {
|
||||
overlay = {
|
||||
title: "Keyboard shortcuts",
|
||||
view: "keyboardshortcuts",
|
||||
hideSubmitButton: true,
|
||||
shortcuts: scope.model,
|
||||
close: function() {
|
||||
close: function () {
|
||||
scope.close();
|
||||
}
|
||||
};
|
||||
@@ -147,20 +147,20 @@ When this combination is hit an overview is opened with shortcuts based on the m
|
||||
}
|
||||
};
|
||||
|
||||
scope.close = function() {
|
||||
if(overlay) {
|
||||
scope.close = function () {
|
||||
if (overlay) {
|
||||
overlayService.close();
|
||||
overlay = null;
|
||||
if(scope.onClose) {
|
||||
if (scope.onClose) {
|
||||
scope.onClose();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function onInit() {
|
||||
angular.forEach(scope.model, function (shortcutGroup) {
|
||||
angular.forEach(shortcutGroup.shortcuts, function (shortcut) {
|
||||
scope.model.forEach(shortcutGroup => {
|
||||
|
||||
shortcutGroup.shortcuts.forEach(shortcut => {
|
||||
shortcut.platformKeys = [];
|
||||
|
||||
// get shortcut keys for mac
|
||||
@@ -173,30 +173,29 @@ When this combination is hit an overview is opened with shortcuts based on the m
|
||||
} else if (shortcut.keys && shortcut && shortcut.keys.length > 0) {
|
||||
shortcut.platformKeys = shortcut.keys;
|
||||
}
|
||||
|
||||
});
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
onInit();
|
||||
|
||||
eventBindings.push(scope.$watch('model', function(newValue, oldValue){
|
||||
eventBindings.push(scope.$watch('model', function (newValue, oldValue) {
|
||||
if (newValue !== oldValue) {
|
||||
onInit();
|
||||
}
|
||||
}));
|
||||
|
||||
eventBindings.push(scope.$watch('showOverlay', function(newValue, oldValue){
|
||||
eventBindings.push(scope.$watch('showOverlay', function (newValue, oldValue) {
|
||||
|
||||
if(newValue === oldValue) {
|
||||
if (newValue === oldValue) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(newValue === true) {
|
||||
if (newValue === true) {
|
||||
scope.open();
|
||||
}
|
||||
|
||||
if(newValue === false) {
|
||||
if (newValue === false) {
|
||||
scope.close();
|
||||
}
|
||||
|
||||
|
||||
@@ -314,7 +314,7 @@ Use this directive to generate a thumbnail grid of media items.
|
||||
};
|
||||
|
||||
var unbindItemsWatcher = scope.$watch('items', function(newValue, oldValue) {
|
||||
if (angular.isArray(newValue)) {
|
||||
if (Utilities.isArray(newValue)) {
|
||||
activate();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
function () {
|
||||
|
||||
var link = function ($scope) {
|
||||
|
||||
|
||||
// Clone the model because some property editors
|
||||
// do weird things like updating and config values
|
||||
// so we want to ensure we start from a fresh every
|
||||
// time, we'll just sync the value back when we need to
|
||||
$scope.model = angular.copy($scope.ngModel);
|
||||
$scope.model = Utilities.copy($scope.ngModel);
|
||||
$scope.nodeContext = $scope.model;
|
||||
|
||||
// Find the selected tab
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
// Tell inner controls we are submitting
|
||||
$scope.$broadcast("formSubmitting", { scope: $scope });
|
||||
|
||||
|
||||
// Sync the values back
|
||||
angular.forEach($scope.ngModel.variants[0].tabs, function (tab) {
|
||||
if (tab.alias.toLowerCase() === selectedTab.alias.toLowerCase()) {
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
/**
|
||||
@ngdoc directive
|
||||
@name umbraco.directives.directive:umbPasswordToggle
|
||||
@restrict E
|
||||
@scope
|
||||
|
||||
@description
|
||||
<strong>Added in Umbraco v. 7.7.4:</strong> Use this directive to render a password toggle.
|
||||
|
||||
**/
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
// comes from https://codepen.io/jakob-e/pen/eNBQaP
|
||||
// works fine with Angular 1.6.5 - alas not with 1.1.5 - binding issue
|
||||
|
||||
function PasswordToggleDirective($compile) {
|
||||
|
||||
var directive = {
|
||||
restrict: 'A',
|
||||
scope: {},
|
||||
link: function(scope, elem, attrs) {
|
||||
scope.tgl = function () { elem.attr("type", (elem.attr("type") === "text" ? "password" : "text")); }
|
||||
var lnk = angular.element("<a data-ng-click=\"tgl()\">Toggle</a>");
|
||||
$compile(lnk)(scope);
|
||||
elem.wrap("<div class=\"password-toggle\"/>").after(lnk);
|
||||
}
|
||||
};
|
||||
|
||||
return directive;
|
||||
|
||||
}
|
||||
|
||||
angular.module('umbraco.directives').directive('umbPasswordToggle', PasswordToggleDirective);
|
||||
|
||||
})();
|
||||
@@ -57,13 +57,13 @@ For extra details about options and events take a look here: https://refreshless
|
||||
**/
|
||||
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var umbRangeSlider = {
|
||||
var umbRangeSlider = {
|
||||
template: '<div class="umb-range-slider"></div>',
|
||||
controller: UmbRangeSliderController,
|
||||
bindings: {
|
||||
controller: UmbRangeSliderController,
|
||||
bindings: {
|
||||
ngModel: '<',
|
||||
options: '<',
|
||||
onSetup: '&?',
|
||||
@@ -73,15 +73,15 @@ For extra details about options and events take a look here: https://refreshless
|
||||
onChange: '&?',
|
||||
onStart: '&?',
|
||||
onEnd: '&?'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function UmbRangeSliderController($element, $timeout, $scope, assetsService) {
|
||||
|
||||
|
||||
function UmbRangeSliderController($element, $timeout, $scope, assetsService) {
|
||||
|
||||
const ctrl = this;
|
||||
let sliderInstance = null;
|
||||
|
||||
ctrl.$onInit = function() {
|
||||
ctrl.$onInit = function () {
|
||||
|
||||
// load css file for the date picker
|
||||
assetsService.loadCss('lib/nouislider/nouislider.min.css', $scope);
|
||||
@@ -94,13 +94,13 @@ For extra details about options and events take a look here: https://refreshless
|
||||
|
||||
};
|
||||
|
||||
function grabElementAndRun() {
|
||||
$timeout(function() {
|
||||
function grabElementAndRun() {
|
||||
$timeout(function () {
|
||||
const element = $element.find('.umb-range-slider')[0];
|
||||
setSlider(element);
|
||||
}, 0, true);
|
||||
setSlider(element);
|
||||
}, 0, true);
|
||||
}
|
||||
|
||||
|
||||
function setSlider(element) {
|
||||
|
||||
sliderInstance = element;
|
||||
@@ -117,82 +117,82 @@ For extra details about options and events take a look here: https://refreshless
|
||||
|
||||
// create new slider
|
||||
noUiSlider.create(sliderInstance, options);
|
||||
|
||||
if (ctrl.onSetup) {
|
||||
ctrl.onSetup({
|
||||
slider: sliderInstance
|
||||
});
|
||||
|
||||
if (ctrl.onSetup) {
|
||||
ctrl.onSetup({
|
||||
slider: sliderInstance
|
||||
});
|
||||
}
|
||||
|
||||
// If has ngModel set the date
|
||||
if (ctrl.ngModel) {
|
||||
if (ctrl.ngModel) {
|
||||
sliderInstance.noUiSlider.set(ctrl.ngModel);
|
||||
}
|
||||
|
||||
// destroy the slider instance when the dom element is removed
|
||||
angular.element(element).on('$destroy', function() {
|
||||
$(element).on('$destroy', function () {
|
||||
sliderInstance.noUiSlider.off();
|
||||
});
|
||||
|
||||
setUpCallbacks();
|
||||
|
||||
// Refresh the scope
|
||||
$scope.$applyAsync();
|
||||
// Refresh the scope
|
||||
$scope.$applyAsync();
|
||||
}
|
||||
|
||||
|
||||
function setUpCallbacks() {
|
||||
if(sliderInstance) {
|
||||
if (sliderInstance) {
|
||||
|
||||
// bind hook for update
|
||||
if(ctrl.onUpdate) {
|
||||
sliderInstance.noUiSlider.on('update', function (values, handle, unencoded, tap, positions) {
|
||||
$timeout(function() {
|
||||
ctrl.onUpdate({values: values, handle: handle, unencoded: unencoded, tap: tap, positions: positions});
|
||||
if (ctrl.onUpdate) {
|
||||
sliderInstance.noUiSlider.on('update', function (values, handle, unencoded, tap, positions) {
|
||||
$timeout(function () {
|
||||
ctrl.onUpdate({ values: values, handle: handle, unencoded: unencoded, tap: tap, positions: positions });
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// bind hook for slide
|
||||
if(ctrl.onSlide) {
|
||||
sliderInstance.noUiSlider.on('slide', function (values, handle, unencoded, tap, positions) {
|
||||
$timeout(function() {
|
||||
ctrl.onSlide({values: values, handle: handle, unencoded: unencoded, tap: tap, positions: positions});
|
||||
if (ctrl.onSlide) {
|
||||
sliderInstance.noUiSlider.on('slide', function (values, handle, unencoded, tap, positions) {
|
||||
$timeout(function () {
|
||||
ctrl.onSlide({ values: values, handle: handle, unencoded: unencoded, tap: tap, positions: positions });
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// bind hook for set
|
||||
if(ctrl.onSet) {
|
||||
sliderInstance.noUiSlider.on('set', function (values, handle, unencoded, tap, positions) {
|
||||
$timeout(function() {
|
||||
ctrl.onSet({values: values, handle: handle, unencoded: unencoded, tap: tap, positions: positions});
|
||||
if (ctrl.onSet) {
|
||||
sliderInstance.noUiSlider.on('set', function (values, handle, unencoded, tap, positions) {
|
||||
$timeout(function () {
|
||||
ctrl.onSet({ values: values, handle: handle, unencoded: unencoded, tap: tap, positions: positions });
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// bind hook for change
|
||||
if(ctrl.onChange) {
|
||||
sliderInstance.noUiSlider.on('change', function (values, handle, unencoded, tap, positions) {
|
||||
$timeout(function() {
|
||||
ctrl.onChange({values: values, handle: handle, unencoded: unencoded, tap: tap, positions: positions});
|
||||
if (ctrl.onChange) {
|
||||
sliderInstance.noUiSlider.on('change', function (values, handle, unencoded, tap, positions) {
|
||||
$timeout(function () {
|
||||
ctrl.onChange({ values: values, handle: handle, unencoded: unencoded, tap: tap, positions: positions });
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// bind hook for start
|
||||
if(ctrl.onStart) {
|
||||
sliderInstance.noUiSlider.on('start', function (values, handle, unencoded, tap, positions) {
|
||||
$timeout(function() {
|
||||
ctrl.onStart({values: values, handle: handle, unencoded: unencoded, tap: tap, positions: positions});
|
||||
if (ctrl.onStart) {
|
||||
sliderInstance.noUiSlider.on('start', function (values, handle, unencoded, tap, positions) {
|
||||
$timeout(function () {
|
||||
ctrl.onStart({ values: values, handle: handle, unencoded: unencoded, tap: tap, positions: positions });
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// bind hook for end
|
||||
if(ctrl.onEnd) {
|
||||
sliderInstance.noUiSlider.on('end', function (values, handle, unencoded, tap, positions) {
|
||||
$timeout(function() {
|
||||
ctrl.onEnd({values: values, handle: handle, unencoded: unencoded, tap: tap, positions: positions});
|
||||
if (ctrl.onEnd) {
|
||||
sliderInstance.noUiSlider.on('end', function (values, handle, unencoded, tap, positions) {
|
||||
$timeout(function () {
|
||||
ctrl.onEnd({ values: values, handle: handle, unencoded: unencoded, tap: tap, positions: positions });
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -201,7 +201,7 @@ For extra details about options and events take a look here: https://refreshless
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
angular.module('umbraco.directives').component('umbRangeSlider', umbRangeSlider);
|
||||
|
||||
|
||||
})();
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
}
|
||||
|
||||
//set the model defaults
|
||||
if (!angular.isObject(vm.passwordValues)) {
|
||||
if (!Utilities.isObject(vm.passwordValues)) {
|
||||
//if it's not an object then just create a new one
|
||||
vm.passwordValues = {
|
||||
newPassword: null,
|
||||
|
||||
@@ -21,7 +21,7 @@ angular.module("umbraco.directives")
|
||||
|
||||
var totalOffset = 0;
|
||||
var offsety = parseInt(attrs.autoScale, 10);
|
||||
var window = angular.element($window);
|
||||
var window = $($window);
|
||||
if (offsety !== undefined) {
|
||||
totalOffset += offsety;
|
||||
}
|
||||
@@ -34,7 +34,7 @@ angular.module("umbraco.directives")
|
||||
el.height(window.height() - (el.offset().top + totalOffset));
|
||||
}
|
||||
|
||||
var resizeCallback = function() {
|
||||
var resizeCallback = function () {
|
||||
setElementSize();
|
||||
};
|
||||
|
||||
|
||||
@@ -1,46 +1,46 @@
|
||||
angular.module("umbraco.directives")
|
||||
.directive('disableTabindex', function (tabbableService) {
|
||||
|
||||
return {
|
||||
restrict: 'A', //Can only be used as an attribute,
|
||||
scope: {
|
||||
"disableTabindex": "<"
|
||||
},
|
||||
link: function (scope, element, attrs) {
|
||||
return {
|
||||
restrict: 'A', //Can only be used as an attribute,
|
||||
scope: {
|
||||
"disableTabindex": "<"
|
||||
},
|
||||
link: function (scope, element, attrs) {
|
||||
|
||||
if(scope.disableTabindex) {
|
||||
//Select the node that will be observed for mutations (native DOM element not jQLite version)
|
||||
var targetNode = element[0];
|
||||
if (scope.disableTabindex) {
|
||||
//Select the node that will be observed for mutations (native DOM element not jQLite version)
|
||||
var targetNode = element[0];
|
||||
|
||||
//Watch for DOM changes - so when the property editor subview loads in
|
||||
//We can be notified its updated the child elements inside the DIV we are watching
|
||||
var observer = new MutationObserver(domChange);
|
||||
//Watch for DOM changes - so when the property editor subview loads in
|
||||
//We can be notified its updated the child elements inside the DIV we are watching
|
||||
var observer = new MutationObserver(domChange);
|
||||
|
||||
// Options for the observer (which mutations to observe)
|
||||
var config = { attributes: true, childList: true, subtree: true };
|
||||
// Options for the observer (which mutations to observe)
|
||||
var config = { attributes: true, childList: true, subtree: true };
|
||||
|
||||
function domChange(mutationsList, observer) {
|
||||
for(var mutation of mutationsList) {
|
||||
function domChange(mutationsList, observer) {
|
||||
for (var mutation of mutationsList) {
|
||||
|
||||
//DOM items have been added or removed
|
||||
if (mutation.type == 'childList') {
|
||||
//DOM items have been added or removed
|
||||
if (mutation.type == 'childList') {
|
||||
|
||||
//Check if any child items in mutation.target contain an input
|
||||
var childInputs = tabbableService.tabbable(mutation.target);
|
||||
//Check if any child items in mutation.target contain an input
|
||||
var childInputs = tabbableService.tabbable(mutation.target);
|
||||
|
||||
//For each item in childInputs - override or set HTML attribute tabindex="-1"
|
||||
angular.forEach(childInputs, function(element){
|
||||
angular.element(element).attr('tabindex', '-1');
|
||||
});
|
||||
//For each item in childInputs - override or set HTML attribute tabindex="-1"
|
||||
angular.forEach(childInputs, function (element) {
|
||||
$(element).attr('tabindex', '-1');
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Start observing the target node for configured mutations
|
||||
//GO GO GO
|
||||
observer.observe(targetNode, config);
|
||||
}
|
||||
|
||||
// Start observing the target node for configured mutations
|
||||
//GO GO GO
|
||||
observer.observe(targetNode, config);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
@@ -101,7 +101,7 @@ function valPropertyMsg(serverValidationManager, localizationService) {
|
||||
var errCount = 0;
|
||||
|
||||
for (var e in formCtrl.$error) {
|
||||
if (angular.isArray(formCtrl.$error[e])) {
|
||||
if (Utilities.isArray(formCtrl.$error[e])) {
|
||||
errCount++;
|
||||
}
|
||||
}
|
||||
@@ -111,8 +111,8 @@ function valPropertyMsg(serverValidationManager, localizationService) {
|
||||
// is the only one, then we'll clear.
|
||||
|
||||
if (errCount === 0
|
||||
|| (errCount === 1 && angular.isArray(formCtrl.$error.valPropertyMsg))
|
||||
|| (formCtrl.$invalid && angular.isArray(formCtrl.$error.valServer))) {
|
||||
|| (errCount === 1 && Utilities.isArray(formCtrl.$error.valPropertyMsg))
|
||||
|| (formCtrl.$invalid && Utilities.isArray(formCtrl.$error.valServer))) {
|
||||
scope.errorMsg = "";
|
||||
formCtrl.$setValidity('valPropertyMsg', true);
|
||||
} else if (showValidation && scope.errorMsg === "") {
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
function link(scope, el, attr, ctrl) {
|
||||
|
||||
//if there are no containing form or valFormManager controllers, then we do nothing
|
||||
if (!ctrl || !angular.isArray(ctrl) || ctrl.length !== 2 || !ctrl[0] || !ctrl[1]) {
|
||||
if (!ctrl || !Utilities.isArray(ctrl) || ctrl.length !== 2 || !ctrl[0] || !ctrl[1]) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
function umbWordLimitFilter() {
|
||||
return function (collection, property) {
|
||||
|
||||
if (!angular.isString(collection)) {
|
||||
if (!Utilities.isString(collection)) {
|
||||
return collection;
|
||||
}
|
||||
|
||||
@@ -35,4 +35,4 @@
|
||||
|
||||
angular.module('umbraco.filters').filter('umbWordLimit', umbWordLimitFilter);
|
||||
|
||||
})();
|
||||
})();
|
||||
|
||||
@@ -1,40 +1,40 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
function removeProperty(obj, propertyPrefix) {
|
||||
for (var property in obj) {
|
||||
if (obj.hasOwnProperty(property)) {
|
||||
|
||||
|
||||
if (property.startsWith(propertyPrefix) && obj[property] !== undefined) {
|
||||
obj[property] = undefined;
|
||||
}
|
||||
|
||||
|
||||
if (typeof obj[property] === "object") {
|
||||
removeProperty(obj[property], propertyPrefix);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
function transform(data){
|
||||
|
||||
function transform(data) {
|
||||
removeProperty(data, "$");
|
||||
}
|
||||
|
||||
|
||||
function doNotPostDollarVariablesRequestInterceptor($q, urlHelper) {
|
||||
return {
|
||||
//dealing with requests:
|
||||
'request': function(config) {
|
||||
if(config.method === "POST"){
|
||||
var clone = angular.copy(config);
|
||||
'request': function (config) {
|
||||
if (config.method === "POST") {
|
||||
var clone = Utilities.copy(config);
|
||||
transform(clone.data);
|
||||
return clone;
|
||||
}
|
||||
|
||||
|
||||
return config;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
angular.module('umbraco.interceptors').factory('doNotPostDollarVariablesOnPostRequestInterceptor', doNotPostDollarVariablesRequestInterceptor);
|
||||
})();
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
var headers = config.headers ? config.headers : {};
|
||||
|
||||
//Here we'll check if we should ignore the error (either based on the original header set or the request configuration)
|
||||
if (headers["x-umb-ignore-error"] === "ignore" || config.umbIgnoreErrors === true || (angular.isArray(config.umbIgnoreStatus) && config.umbIgnoreStatus.indexOf(rejection.status) !== -1)) {
|
||||
if (headers["x-umb-ignore-error"] === "ignore" || config.umbIgnoreErrors === true || (Utilities.isArray(config.umbIgnoreStatus) && config.umbIgnoreStatus.indexOf(rejection.status) !== -1)) {
|
||||
//exit/ignore
|
||||
return $q.reject(rejection);
|
||||
}
|
||||
|
||||
@@ -1,113 +1,113 @@
|
||||
angular.module('umbraco.mocks').
|
||||
factory('dataTypeMocks', ['$httpBackend', 'mocksUtils', function ($httpBackend, mocksUtils) {
|
||||
'use strict';
|
||||
|
||||
function returnById(status, data, headers) {
|
||||
factory('dataTypeMocks', ['$httpBackend', 'mocksUtils', function ($httpBackend, mocksUtils) {
|
||||
'use strict';
|
||||
|
||||
if (!mocksUtils.checkAuth()) {
|
||||
return [401, null, null];
|
||||
}
|
||||
function returnById(status, data, headers) {
|
||||
|
||||
var id = mocksUtils.getParameterByName(data, "id") || 1234;
|
||||
if (!mocksUtils.checkAuth()) {
|
||||
return [401, null, null];
|
||||
}
|
||||
|
||||
var selectedId = String.CreateGuid();
|
||||
var id = mocksUtils.getParameterByName(data, "id") || 1234;
|
||||
|
||||
var dataType = mocksUtils.getMockDataType(id, selectedId);
|
||||
|
||||
return [200, dataType, null];
|
||||
}
|
||||
|
||||
function returnEmpty(status, data, headers) {
|
||||
var selectedId = String.CreateGuid();
|
||||
|
||||
if (!mocksUtils.checkAuth()) {
|
||||
return [401, null, null];
|
||||
}
|
||||
var dataType = mocksUtils.getMockDataType(id, selectedId);
|
||||
|
||||
var response = returnById(200, "", null);
|
||||
var node = response[1];
|
||||
return [200, dataType, null];
|
||||
}
|
||||
|
||||
node.name = "";
|
||||
node.selectedEditor = "";
|
||||
node.id = 0;
|
||||
node.preValues = [];
|
||||
function returnEmpty(status, data, headers) {
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
function returnPreValues(status, data, headers) {
|
||||
if (!mocksUtils.checkAuth()) {
|
||||
return [401, null, null];
|
||||
}
|
||||
|
||||
if (!mocksUtils.checkAuth()) {
|
||||
return [401, null, null];
|
||||
}
|
||||
var response = returnById(200, "", null);
|
||||
var node = response[1];
|
||||
|
||||
var editorId = mocksUtils.getParameterByName(data, "editorId") || "83E9AD36-51A7-4440-8C07-8A5623AC6979";
|
||||
node.name = "";
|
||||
node.selectedEditor = "";
|
||||
node.id = 0;
|
||||
node.preValues = [];
|
||||
|
||||
var preValues = [
|
||||
{
|
||||
label: "Custom pre value 1 for editor " + editorId,
|
||||
description: "Enter a value for this pre-value",
|
||||
key: "myPreVal",
|
||||
view: "requiredfield",
|
||||
validation: [
|
||||
{
|
||||
type: "Required"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: "Custom pre value 2 for editor " + editorId,
|
||||
description: "Enter a value for this pre-value",
|
||||
key: "myPreVal",
|
||||
view: "requiredfield",
|
||||
validation: [
|
||||
{
|
||||
type: "Required"
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
return [200, preValues, null];
|
||||
}
|
||||
|
||||
function returnSave(status, data, headers) {
|
||||
if (!mocksUtils.checkAuth()) {
|
||||
return [401, null, null];
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
var postedData = angular.fromJson(headers);
|
||||
function returnPreValues(status, data, headers) {
|
||||
|
||||
var dataType = mocksUtils.getMockDataType(postedData.id, postedData.selectedEditor);
|
||||
dataType.notifications = [{
|
||||
header: "Saved",
|
||||
message: "Data type saved",
|
||||
type: 0
|
||||
}];
|
||||
if (!mocksUtils.checkAuth()) {
|
||||
return [401, null, null];
|
||||
}
|
||||
|
||||
return [200, dataType, null];
|
||||
}
|
||||
var editorId = mocksUtils.getParameterByName(data, "editorId") || "83E9AD36-51A7-4440-8C07-8A5623AC6979";
|
||||
|
||||
return {
|
||||
register: function() {
|
||||
|
||||
$httpBackend
|
||||
.whenPOST(mocksUtils.urlRegex('/umbraco/UmbracoApi/DataType/PostSave'))
|
||||
.respond(returnSave);
|
||||
|
||||
$httpBackend
|
||||
.whenGET(mocksUtils.urlRegex('/umbraco/UmbracoApi/DataType/GetById'))
|
||||
.respond(returnById);
|
||||
|
||||
$httpBackend
|
||||
.whenGET(mocksUtils.urlRegex('/umbraco/UmbracoApi/DataType/GetEmpty'))
|
||||
.respond(returnEmpty);
|
||||
|
||||
$httpBackend
|
||||
.whenGET(mocksUtils.urlRegex('/umbraco/UmbracoApi/DataType/GetPreValues'))
|
||||
.respond(returnPreValues);
|
||||
},
|
||||
expectGetById: function() {
|
||||
$httpBackend
|
||||
.expectGET(mocksUtils.urlRegex('/umbraco/UmbracoApi/DataType/GetById'));
|
||||
}
|
||||
};
|
||||
}]);
|
||||
var preValues = [
|
||||
{
|
||||
label: "Custom pre value 1 for editor " + editorId,
|
||||
description: "Enter a value for this pre-value",
|
||||
key: "myPreVal",
|
||||
view: "requiredfield",
|
||||
validation: [
|
||||
{
|
||||
type: "Required"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: "Custom pre value 2 for editor " + editorId,
|
||||
description: "Enter a value for this pre-value",
|
||||
key: "myPreVal",
|
||||
view: "requiredfield",
|
||||
validation: [
|
||||
{
|
||||
type: "Required"
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
return [200, preValues, null];
|
||||
}
|
||||
|
||||
function returnSave(status, data, headers) {
|
||||
if (!mocksUtils.checkAuth()) {
|
||||
return [401, null, null];
|
||||
}
|
||||
|
||||
var postedData = JSON.parse(headers);
|
||||
|
||||
var dataType = mocksUtils.getMockDataType(postedData.id, postedData.selectedEditor);
|
||||
dataType.notifications = [{
|
||||
header: "Saved",
|
||||
message: "Data type saved",
|
||||
type: 0
|
||||
}];
|
||||
|
||||
return [200, dataType, null];
|
||||
}
|
||||
|
||||
return {
|
||||
register: function () {
|
||||
|
||||
$httpBackend
|
||||
.whenPOST(mocksUtils.urlRegex('/umbraco/UmbracoApi/DataType/PostSave'))
|
||||
.respond(returnSave);
|
||||
|
||||
$httpBackend
|
||||
.whenGET(mocksUtils.urlRegex('/umbraco/UmbracoApi/DataType/GetById'))
|
||||
.respond(returnById);
|
||||
|
||||
$httpBackend
|
||||
.whenGET(mocksUtils.urlRegex('/umbraco/UmbracoApi/DataType/GetEmpty'))
|
||||
.respond(returnEmpty);
|
||||
|
||||
$httpBackend
|
||||
.whenGET(mocksUtils.urlRegex('/umbraco/UmbracoApi/DataType/GetPreValues'))
|
||||
.respond(returnPreValues);
|
||||
},
|
||||
expectGetById: function () {
|
||||
$httpBackend
|
||||
.expectGET(mocksUtils.urlRegex('/umbraco/UmbracoApi/DataType/GetById'));
|
||||
}
|
||||
};
|
||||
}]);
|
||||
|
||||
@@ -30,7 +30,7 @@ function authResource($q, $http, umbRequestHelper, angularHelper) {
|
||||
umbRequestHelper.getApiUrl(
|
||||
"authenticationApiBaseUrl",
|
||||
"PostSend2FACode"),
|
||||
angular.toJson(provider)),
|
||||
Utilities.toJson(provider)),
|
||||
'Could not send code');
|
||||
},
|
||||
|
||||
|
||||
@@ -610,10 +610,10 @@ function contentResource($q, $http, umbDataFormatter, umbRequestHelper) {
|
||||
|
||||
//converts the value to a js bool
|
||||
function toBool(v) {
|
||||
if (angular.isNumber(v)) {
|
||||
if (Utilities.isNumber(v)) {
|
||||
return v > 0;
|
||||
}
|
||||
if (angular.isString(v)) {
|
||||
if (Utilities.isString(v)) {
|
||||
return v === "true";
|
||||
}
|
||||
if (typeof v === "boolean") {
|
||||
@@ -1003,10 +1003,10 @@ function contentResource($q, $http, umbDataFormatter, umbRequestHelper) {
|
||||
loginPageId: loginPageId,
|
||||
errorPageId: errorPageId
|
||||
};
|
||||
if (angular.isArray(groups) && groups.length) {
|
||||
if (Utilities.isArray(groups) && groups.length) {
|
||||
publicAccess.groups = groups;
|
||||
}
|
||||
else if (angular.isArray(usernames) && usernames.length) {
|
||||
else if (Utilities.isArray(usernames) && usernames.length) {
|
||||
publicAccess.usernames = usernames;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -87,7 +87,7 @@ function currentUserResource($q, $http, umbRequestHelper, umbDataFormatter) {
|
||||
umbRequestHelper.getApiUrl(
|
||||
"currentUserApiBaseUrl",
|
||||
"PostSetInvitedUserPassword"),
|
||||
angular.toJson(newPassword)),
|
||||
Utilities.toJson(newPassword)),
|
||||
'Failed to change password');
|
||||
},
|
||||
|
||||
|
||||
@@ -348,10 +348,10 @@ function mediaResource($q, $http, umbDataFormatter, umbRequestHelper) {
|
||||
|
||||
//converts the value to a js bool
|
||||
function toBool(v) {
|
||||
if (angular.isNumber(v)) {
|
||||
if (Utilities.isNumber(v)) {
|
||||
return v > 0;
|
||||
}
|
||||
if (angular.isString(v)) {
|
||||
if (Utilities.isString(v)) {
|
||||
return v === "true";
|
||||
}
|
||||
if (typeof v === "boolean") {
|
||||
|
||||
@@ -53,10 +53,10 @@ function memberResource($q, $http, umbDataFormatter, umbRequestHelper) {
|
||||
|
||||
//converts the value to a js bool
|
||||
function toBool(v) {
|
||||
if (angular.isNumber(v)) {
|
||||
if (Utilities.isNumber(v)) {
|
||||
return v > 0;
|
||||
}
|
||||
if (angular.isString(v)) {
|
||||
if (Utilities.isString(v)) {
|
||||
return v === "true";
|
||||
}
|
||||
if (typeof v === "boolean") {
|
||||
|
||||
@@ -33,7 +33,7 @@ function angularHelper($q) {
|
||||
//this is sequential promise chaining, it's not pretty but we need to do it this way.
|
||||
//$q.all doesn't execute promises in sequence but that's what we want to do here.
|
||||
|
||||
if (!angular.isArray(promises)) {
|
||||
if (!Utilities.isArray(promises)) {
|
||||
throw "promises must be an array";
|
||||
}
|
||||
|
||||
|
||||
@@ -256,7 +256,7 @@ angular.module('umbraco.services')
|
||||
load: function (pathArray, scope, defaultAssetType) {
|
||||
var promise;
|
||||
|
||||
if (!angular.isArray(pathArray)) {
|
||||
if (!Utilities.isArray(pathArray)) {
|
||||
throw "pathArray must be an array";
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ function contentEditingHelper(fileManager, $q, $location, $routeParams, editorSt
|
||||
function isValidIdentifier(id) {
|
||||
|
||||
//empty id <= 0
|
||||
if (angular.isNumber(id)) {
|
||||
if (Utilities.isNumber(id)) {
|
||||
if (id === 0) {
|
||||
return false;
|
||||
}
|
||||
@@ -39,7 +39,7 @@ function contentEditingHelper(fileManager, $q, $location, $routeParams, editorSt
|
||||
|
||||
/** Used by the content editor and mini content editor to perform saving operations */
|
||||
contentEditorPerformSave: function (args) {
|
||||
if (!angular.isObject(args)) {
|
||||
if (!Utilities.isObject(args)) {
|
||||
throw "args must be an object";
|
||||
}
|
||||
if (!args.scope) {
|
||||
@@ -152,7 +152,7 @@ function contentEditingHelper(fileManager, $q, $location, $routeParams, editorSt
|
||||
here we'll build the buttons according to the chars of the user. */
|
||||
configureContentEditorButtons: function (args) {
|
||||
|
||||
if (!angular.isObject(args)) {
|
||||
if (!Utilities.isObject(args)) {
|
||||
throw "args must be an object";
|
||||
}
|
||||
if (!args.content) {
|
||||
|
||||
@@ -7,21 +7,21 @@ function contentTypeHelper(contentTypeResource, dataTypeResource, $filter, $inje
|
||||
|
||||
var contentTypeHelperService = {
|
||||
|
||||
createIdArray: function(array) {
|
||||
createIdArray: function (array) {
|
||||
|
||||
var newArray = [];
|
||||
var newArray = [];
|
||||
|
||||
angular.forEach(array, function(arrayItem){
|
||||
angular.forEach(array, function (arrayItem) {
|
||||
|
||||
if(angular.isObject(arrayItem)) {
|
||||
newArray.push(arrayItem.id);
|
||||
} else {
|
||||
newArray.push(arrayItem);
|
||||
}
|
||||
if (Utilities.isObject(arrayItem)) {
|
||||
newArray.push(arrayItem.id);
|
||||
} else {
|
||||
newArray.push(arrayItem);
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
return newArray;
|
||||
return newArray;
|
||||
|
||||
},
|
||||
|
||||
@@ -30,18 +30,18 @@ function contentTypeHelper(contentTypeResource, dataTypeResource, $filter, $inje
|
||||
var modelsResource = $injector.has("modelsBuilderManagementResource") ? $injector.get("modelsBuilderManagementResource") : null;
|
||||
var modelsBuilderEnabled = Umbraco.Sys.ServerVariables.umbracoPlugins.modelsBuilder.enabled;
|
||||
if (modelsBuilderEnabled && modelsResource) {
|
||||
modelsResource.buildModels().then(function(result) {
|
||||
modelsResource.buildModels().then(function (result) {
|
||||
deferred.resolve(result);
|
||||
|
||||
//just calling this to get the servar back to life
|
||||
modelsResource.getModelsOutOfDateStatus();
|
||||
|
||||
}, function(e) {
|
||||
}, function (e) {
|
||||
deferred.reject(e);
|
||||
});
|
||||
}
|
||||
else {
|
||||
deferred.resolve(false);
|
||||
else {
|
||||
deferred.resolve(false);
|
||||
}
|
||||
return deferred.promise;
|
||||
},
|
||||
@@ -49,10 +49,10 @@ function contentTypeHelper(contentTypeResource, dataTypeResource, $filter, $inje
|
||||
checkModelsBuilderStatus: function () {
|
||||
var deferred = $q.defer();
|
||||
var modelsResource = $injector.has("modelsBuilderManagementResource") ? $injector.get("modelsBuilderManagementResource") : null;
|
||||
var modelsBuilderEnabled = (Umbraco && Umbraco.Sys && Umbraco.Sys.ServerVariables && Umbraco.Sys.ServerVariables.umbracoPlugins && Umbraco.Sys.ServerVariables.umbracoPlugins.modelsBuilder && Umbraco.Sys.ServerVariables.umbracoPlugins.modelsBuilder.enabled === true);
|
||||
|
||||
var modelsBuilderEnabled = (Umbraco && Umbraco.Sys && Umbraco.Sys.ServerVariables && Umbraco.Sys.ServerVariables.umbracoPlugins && Umbraco.Sys.ServerVariables.umbracoPlugins.modelsBuilder && Umbraco.Sys.ServerVariables.umbracoPlugins.modelsBuilder.enabled === true);
|
||||
|
||||
if (modelsBuilderEnabled && modelsResource) {
|
||||
modelsResource.getModelsOutOfDateStatus().then(function(result) {
|
||||
modelsResource.getModelsOutOfDateStatus().then(function (result) {
|
||||
//Generate models buttons should be enabled if it is 0
|
||||
deferred.resolve(result.status === 0);
|
||||
});
|
||||
@@ -64,37 +64,37 @@ function contentTypeHelper(contentTypeResource, dataTypeResource, $filter, $inje
|
||||
},
|
||||
|
||||
makeObjectArrayFromId: function (idArray, objectArray) {
|
||||
var newArray = [];
|
||||
var newArray = [];
|
||||
|
||||
for (var idIndex = 0; idArray.length > idIndex; idIndex++) {
|
||||
var id = idArray[idIndex];
|
||||
for (var idIndex = 0; idArray.length > idIndex; idIndex++) {
|
||||
var id = idArray[idIndex];
|
||||
|
||||
for (var objectIndex = 0; objectArray.length > objectIndex; objectIndex++) {
|
||||
var object = objectArray[objectIndex];
|
||||
if (id === object.id) {
|
||||
newArray.push(object);
|
||||
}
|
||||
}
|
||||
for (var objectIndex = 0; objectArray.length > objectIndex; objectIndex++) {
|
||||
var object = objectArray[objectIndex];
|
||||
if (id === object.id) {
|
||||
newArray.push(object);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return newArray;
|
||||
return newArray;
|
||||
},
|
||||
|
||||
validateAddingComposition: function(contentType, compositeContentType) {
|
||||
validateAddingComposition: function (contentType, compositeContentType) {
|
||||
|
||||
//Validate that by adding this group that we are not adding duplicate property type aliases
|
||||
|
||||
var propertiesAdding = _.flatten(_.map(compositeContentType.groups, function(g) {
|
||||
return _.map(g.properties, function(p) {
|
||||
var propertiesAdding = _.flatten(_.map(compositeContentType.groups, function (g) {
|
||||
return _.map(g.properties, function (p) {
|
||||
return p.alias;
|
||||
});
|
||||
}));
|
||||
var propAliasesExisting = _.filter(_.flatten(_.map(contentType.groups, function(g) {
|
||||
return _.map(g.properties, function(p) {
|
||||
var propAliasesExisting = _.filter(_.flatten(_.map(contentType.groups, function (g) {
|
||||
return _.map(g.properties, function (p) {
|
||||
return p.alias;
|
||||
});
|
||||
})), function(f) {
|
||||
})), function (f) {
|
||||
return f !== null && f !== undefined;
|
||||
});
|
||||
|
||||
@@ -108,7 +108,7 @@ function contentTypeHelper(contentTypeResource, dataTypeResource, $filter, $inje
|
||||
return [];
|
||||
},
|
||||
|
||||
mergeCompositeContentType: function(contentType, compositeContentType) {
|
||||
mergeCompositeContentType: function (contentType, compositeContentType) {
|
||||
|
||||
//Validate that there are no overlapping aliases
|
||||
var overlappingAliases = this.validateAddingComposition(contentType, compositeContentType);
|
||||
@@ -116,107 +116,107 @@ function contentTypeHelper(contentTypeResource, dataTypeResource, $filter, $inje
|
||||
throw new Error("Cannot add this composition, these properties already exist on the content type: " + overlappingAliases.join());
|
||||
}
|
||||
|
||||
angular.forEach(compositeContentType.groups, function(compositionGroup) {
|
||||
angular.forEach(compositeContentType.groups, function (compositionGroup) {
|
||||
|
||||
// order composition groups based on sort order
|
||||
compositionGroup.properties = $filter('orderBy')(compositionGroup.properties, 'sortOrder');
|
||||
// order composition groups based on sort order
|
||||
compositionGroup.properties = $filter('orderBy')(compositionGroup.properties, 'sortOrder');
|
||||
|
||||
// get data type details
|
||||
angular.forEach(compositionGroup.properties, function(property) {
|
||||
dataTypeResource.getById(property.dataTypeId)
|
||||
.then(function(dataType) {
|
||||
property.dataTypeIcon = dataType.icon;
|
||||
property.dataTypeName = dataType.name;
|
||||
});
|
||||
});
|
||||
// get data type details
|
||||
angular.forEach(compositionGroup.properties, function (property) {
|
||||
dataTypeResource.getById(property.dataTypeId)
|
||||
.then(function (dataType) {
|
||||
property.dataTypeIcon = dataType.icon;
|
||||
property.dataTypeName = dataType.name;
|
||||
});
|
||||
});
|
||||
|
||||
// set inherited state on tab
|
||||
compositionGroup.inherited = true;
|
||||
// set inherited state on tab
|
||||
compositionGroup.inherited = true;
|
||||
|
||||
// set inherited state on properties
|
||||
angular.forEach(compositionGroup.properties, function(compositionProperty) {
|
||||
compositionProperty.inherited = true;
|
||||
});
|
||||
// set inherited state on properties
|
||||
angular.forEach(compositionGroup.properties, function (compositionProperty) {
|
||||
compositionProperty.inherited = true;
|
||||
});
|
||||
|
||||
// set tab state
|
||||
compositionGroup.tabState = "inActive";
|
||||
// set tab state
|
||||
compositionGroup.tabState = "inActive";
|
||||
|
||||
// if groups are named the same - merge the groups
|
||||
angular.forEach(contentType.groups, function(contentTypeGroup) {
|
||||
// if groups are named the same - merge the groups
|
||||
angular.forEach(contentType.groups, function (contentTypeGroup) {
|
||||
|
||||
if (contentTypeGroup.name === compositionGroup.name) {
|
||||
if (contentTypeGroup.name === compositionGroup.name) {
|
||||
|
||||
// set flag to show if properties has been merged into a tab
|
||||
compositionGroup.groupIsMerged = true;
|
||||
// set flag to show if properties has been merged into a tab
|
||||
compositionGroup.groupIsMerged = true;
|
||||
|
||||
// make group inherited
|
||||
contentTypeGroup.inherited = true;
|
||||
// make group inherited
|
||||
contentTypeGroup.inherited = true;
|
||||
|
||||
// add properties to the top of the array
|
||||
contentTypeGroup.properties = compositionGroup.properties.concat(contentTypeGroup.properties);
|
||||
// add properties to the top of the array
|
||||
contentTypeGroup.properties = compositionGroup.properties.concat(contentTypeGroup.properties);
|
||||
|
||||
// update sort order on all properties in merged group
|
||||
contentTypeGroup.properties = contentTypeHelperService.updatePropertiesSortOrder(contentTypeGroup.properties);
|
||||
// update sort order on all properties in merged group
|
||||
contentTypeGroup.properties = contentTypeHelperService.updatePropertiesSortOrder(contentTypeGroup.properties);
|
||||
|
||||
// make parentTabContentTypeNames to an array so we can push values
|
||||
if (contentTypeGroup.parentTabContentTypeNames === null || contentTypeGroup.parentTabContentTypeNames === undefined) {
|
||||
contentTypeGroup.parentTabContentTypeNames = [];
|
||||
}
|
||||
|
||||
// push name to array of merged composite content types
|
||||
contentTypeGroup.parentTabContentTypeNames.push(compositeContentType.name);
|
||||
|
||||
// make parentTabContentTypes to an array so we can push values
|
||||
if (contentTypeGroup.parentTabContentTypes === null || contentTypeGroup.parentTabContentTypes === undefined) {
|
||||
contentTypeGroup.parentTabContentTypes = [];
|
||||
}
|
||||
|
||||
// push id to array of merged composite content types
|
||||
contentTypeGroup.parentTabContentTypes.push(compositeContentType.id);
|
||||
|
||||
// get sort order from composition
|
||||
contentTypeGroup.sortOrder = compositionGroup.sortOrder;
|
||||
|
||||
// splice group to the top of the array
|
||||
var contentTypeGroupCopy = Utilities.copy(contentTypeGroup);
|
||||
var index = contentType.groups.indexOf(contentTypeGroup);
|
||||
contentType.groups.splice(index, 1);
|
||||
contentType.groups.unshift(contentTypeGroupCopy);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// if group is not merged - push it to the end of the array - before init tab
|
||||
if (compositionGroup.groupIsMerged === false || compositionGroup.groupIsMerged === undefined) {
|
||||
|
||||
// make parentTabContentTypeNames to an array so we can push values
|
||||
if (contentTypeGroup.parentTabContentTypeNames === null || contentTypeGroup.parentTabContentTypeNames === undefined) {
|
||||
contentTypeGroup.parentTabContentTypeNames = [];
|
||||
if (compositionGroup.parentTabContentTypeNames === null || compositionGroup.parentTabContentTypeNames === undefined) {
|
||||
compositionGroup.parentTabContentTypeNames = [];
|
||||
}
|
||||
|
||||
// push name to array of merged composite content types
|
||||
contentTypeGroup.parentTabContentTypeNames.push(compositeContentType.name);
|
||||
compositionGroup.parentTabContentTypeNames.push(compositeContentType.name);
|
||||
|
||||
// make parentTabContentTypes to an array so we can push values
|
||||
if (contentTypeGroup.parentTabContentTypes === null || contentTypeGroup.parentTabContentTypes === undefined) {
|
||||
contentTypeGroup.parentTabContentTypes = [];
|
||||
if (compositionGroup.parentTabContentTypes === null || compositionGroup.parentTabContentTypes === undefined) {
|
||||
compositionGroup.parentTabContentTypes = [];
|
||||
}
|
||||
|
||||
// push id to array of merged composite content types
|
||||
contentTypeGroup.parentTabContentTypes.push(compositeContentType.id);
|
||||
compositionGroup.parentTabContentTypes.push(compositeContentType.id);
|
||||
|
||||
// get sort order from composition
|
||||
contentTypeGroup.sortOrder = compositionGroup.sortOrder;
|
||||
// push group before placeholder tab
|
||||
contentType.groups.unshift(compositionGroup);
|
||||
|
||||
// splice group to the top of the array
|
||||
var contentTypeGroupCopy = angular.copy(contentTypeGroup);
|
||||
var index = contentType.groups.indexOf(contentTypeGroup);
|
||||
contentType.groups.splice(index, 1);
|
||||
contentType.groups.unshift(contentTypeGroupCopy);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
// sort all groups by sortOrder property
|
||||
contentType.groups = $filter('orderBy')(contentType.groups, 'sortOrder');
|
||||
|
||||
// if group is not merged - push it to the end of the array - before init tab
|
||||
if (compositionGroup.groupIsMerged === false || compositionGroup.groupIsMerged === undefined) {
|
||||
|
||||
// make parentTabContentTypeNames to an array so we can push values
|
||||
if (compositionGroup.parentTabContentTypeNames === null || compositionGroup.parentTabContentTypeNames === undefined) {
|
||||
compositionGroup.parentTabContentTypeNames = [];
|
||||
}
|
||||
|
||||
// push name to array of merged composite content types
|
||||
compositionGroup.parentTabContentTypeNames.push(compositeContentType.name);
|
||||
|
||||
// make parentTabContentTypes to an array so we can push values
|
||||
if (compositionGroup.parentTabContentTypes === null || compositionGroup.parentTabContentTypes === undefined) {
|
||||
compositionGroup.parentTabContentTypes = [];
|
||||
}
|
||||
|
||||
// push id to array of merged composite content types
|
||||
compositionGroup.parentTabContentTypes.push(compositeContentType.id);
|
||||
|
||||
// push group before placeholder tab
|
||||
contentType.groups.unshift(compositionGroup);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// sort all groups by sortOrder property
|
||||
contentType.groups = $filter('orderBy')(contentType.groups, 'sortOrder');
|
||||
|
||||
return contentType;
|
||||
return contentType;
|
||||
|
||||
},
|
||||
|
||||
@@ -224,22 +224,22 @@ function contentTypeHelper(contentTypeResource, dataTypeResource, $filter, $inje
|
||||
|
||||
var groups = [];
|
||||
|
||||
angular.forEach(contentType.groups, function(contentTypeGroup){
|
||||
angular.forEach(contentType.groups, function (contentTypeGroup) {
|
||||
|
||||
if( contentTypeGroup.tabState !== "init" ) {
|
||||
if (contentTypeGroup.tabState !== "init") {
|
||||
|
||||
var idIndex = contentTypeGroup.parentTabContentTypes.indexOf(compositeContentType.id);
|
||||
var nameIndex = contentTypeGroup.parentTabContentTypeNames.indexOf(compositeContentType.name);
|
||||
var groupIndex = contentType.groups.indexOf(contentTypeGroup);
|
||||
|
||||
|
||||
if( idIndex !== -1 ) {
|
||||
if (idIndex !== -1) {
|
||||
|
||||
var properties = [];
|
||||
|
||||
// remove all properties from composite content type
|
||||
angular.forEach(contentTypeGroup.properties, function(property){
|
||||
if(property.contentTypeId !== compositeContentType.id) {
|
||||
angular.forEach(contentTypeGroup.properties, function (property) {
|
||||
if (property.contentTypeId !== compositeContentType.id) {
|
||||
properties.push(property);
|
||||
}
|
||||
});
|
||||
@@ -252,22 +252,22 @@ function contentTypeHelper(contentTypeResource, dataTypeResource, $filter, $inje
|
||||
contentTypeGroup.parentTabContentTypeNames.splice(nameIndex, 1);
|
||||
|
||||
// remove inherited state if there are no inherited properties
|
||||
if(contentTypeGroup.parentTabContentTypes.length === 0) {
|
||||
if (contentTypeGroup.parentTabContentTypes.length === 0) {
|
||||
contentTypeGroup.inherited = false;
|
||||
}
|
||||
|
||||
// remove group if there are no properties left
|
||||
if(contentTypeGroup.properties.length > 1) {
|
||||
if (contentTypeGroup.properties.length > 1) {
|
||||
//contentType.groups.splice(groupIndex, 1);
|
||||
groups.push(contentTypeGroup);
|
||||
}
|
||||
|
||||
} else {
|
||||
groups.push(contentTypeGroup);
|
||||
groups.push(contentTypeGroup);
|
||||
}
|
||||
|
||||
} else {
|
||||
groups.push(contentTypeGroup);
|
||||
groups.push(contentTypeGroup);
|
||||
}
|
||||
|
||||
// update sort order on properties
|
||||
@@ -281,67 +281,67 @@ function contentTypeHelper(contentTypeResource, dataTypeResource, $filter, $inje
|
||||
|
||||
updatePropertiesSortOrder: function (properties) {
|
||||
|
||||
var sortOrder = 0;
|
||||
var sortOrder = 0;
|
||||
|
||||
angular.forEach(properties, function(property) {
|
||||
if( !property.inherited && property.propertyState !== "init") {
|
||||
property.sortOrder = sortOrder;
|
||||
}
|
||||
sortOrder++;
|
||||
});
|
||||
angular.forEach(properties, function (property) {
|
||||
if (!property.inherited && property.propertyState !== "init") {
|
||||
property.sortOrder = sortOrder;
|
||||
}
|
||||
sortOrder++;
|
||||
});
|
||||
|
||||
return properties;
|
||||
return properties;
|
||||
|
||||
},
|
||||
|
||||
getTemplatePlaceholder: function() {
|
||||
getTemplatePlaceholder: function () {
|
||||
|
||||
var templatePlaceholder = {
|
||||
"name": "",
|
||||
"icon": "icon-layout",
|
||||
"alias": "templatePlaceholder",
|
||||
"placeholder": true
|
||||
};
|
||||
var templatePlaceholder = {
|
||||
"name": "",
|
||||
"icon": "icon-layout",
|
||||
"alias": "templatePlaceholder",
|
||||
"placeholder": true
|
||||
};
|
||||
|
||||
return templatePlaceholder;
|
||||
return templatePlaceholder;
|
||||
|
||||
},
|
||||
|
||||
insertDefaultTemplatePlaceholder: function(defaultTemplate) {
|
||||
insertDefaultTemplatePlaceholder: function (defaultTemplate) {
|
||||
|
||||
// get template placeholder
|
||||
var templatePlaceholder = contentTypeHelperService.getTemplatePlaceholder();
|
||||
// get template placeholder
|
||||
var templatePlaceholder = contentTypeHelperService.getTemplatePlaceholder();
|
||||
|
||||
// add as default template
|
||||
defaultTemplate = templatePlaceholder;
|
||||
// add as default template
|
||||
defaultTemplate = templatePlaceholder;
|
||||
|
||||
return defaultTemplate;
|
||||
return defaultTemplate;
|
||||
|
||||
},
|
||||
|
||||
insertTemplatePlaceholder: function(array) {
|
||||
insertTemplatePlaceholder: function (array) {
|
||||
|
||||
// get template placeholder
|
||||
var templatePlaceholder = contentTypeHelperService.getTemplatePlaceholder();
|
||||
// get template placeholder
|
||||
var templatePlaceholder = contentTypeHelperService.getTemplatePlaceholder();
|
||||
|
||||
// add as selected item
|
||||
array.push(templatePlaceholder);
|
||||
// add as selected item
|
||||
array.push(templatePlaceholder);
|
||||
|
||||
return array;
|
||||
return array;
|
||||
|
||||
},
|
||||
},
|
||||
|
||||
insertChildNodePlaceholder: function (array, name, icon, id) {
|
||||
insertChildNodePlaceholder: function (array, name, icon, id) {
|
||||
|
||||
var placeholder = {
|
||||
"name": name,
|
||||
"icon": icon,
|
||||
"id": id
|
||||
};
|
||||
var placeholder = {
|
||||
"name": name,
|
||||
"icon": icon,
|
||||
"id": id
|
||||
};
|
||||
|
||||
array.push(placeholder);
|
||||
array.push(placeholder);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -164,14 +164,14 @@ When building a custom infinite editor view you can use the same components as a
|
||||
"use strict";
|
||||
|
||||
function editorService(eventsService, keyboardService, $timeout) {
|
||||
|
||||
|
||||
|
||||
|
||||
let editorsKeyboardShorcuts = [];
|
||||
var editors = [];
|
||||
var isEnabled = true;
|
||||
var lastElementInFocus = null;
|
||||
|
||||
|
||||
|
||||
|
||||
// events for backdrop
|
||||
eventsService.on("appState.backdrop", function (name, args) {
|
||||
if (args.show === true) {
|
||||
@@ -180,7 +180,7 @@ When building a custom infinite editor view you can use the same components as a
|
||||
focus();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
@@ -205,7 +205,7 @@ When building a custom infinite editor view you can use the same components as a
|
||||
function getNumberOfEditors() {
|
||||
return editors.length;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.services.editorService#blur
|
||||
@@ -232,7 +232,7 @@ When building a custom infinite editor view you can use the same components as a
|
||||
* Method to tell editors that they are gaining focus again.
|
||||
*/
|
||||
function focus() {
|
||||
if(isEnabled === false) {
|
||||
if (isEnabled === false) {
|
||||
/* keyboard shortcuts will be overwritten by the new infinite editor
|
||||
so we need to store the shortcuts for the current editor so they can be rebound
|
||||
when the infinite editor closes
|
||||
@@ -241,7 +241,7 @@ When building a custom infinite editor view you can use the same components as a
|
||||
isEnabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.services.editorService#open
|
||||
@@ -305,7 +305,7 @@ When building a custom infinite editor view you can use the same components as a
|
||||
|
||||
// delay required to map the properties to the correct editor due
|
||||
// to another delay in the closing animation of the editor
|
||||
$timeout(function() {
|
||||
$timeout(function () {
|
||||
// rebind keyboard shortcuts for the new editor in focus
|
||||
rebindKeyboardShortcuts();
|
||||
|
||||
@@ -651,7 +651,7 @@ When building a custom infinite editor view you can use the same components as a
|
||||
editor.view = "views/mediatypes/edit.html";
|
||||
open(editor);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.services.editorService#memberTypeEditor
|
||||
@@ -928,21 +928,21 @@ When building a custom infinite editor view you can use the same components as a
|
||||
open(editor);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.services.editorService#memberPicker
|
||||
* @methodOf umbraco.services.editorService
|
||||
*
|
||||
* @description
|
||||
* Opens a member picker in infinite editing, the submit callback returns an array of selected items
|
||||
*
|
||||
* @param {Object} editor rendering options
|
||||
* @param {Boolean} editor.multiPicker Pick one or multiple items
|
||||
* @param {Function} editor.submit Callback function when the submit button is clicked. Returns the editor model object
|
||||
* @param {Function} editor.close Callback function when the close button is clicked.
|
||||
*
|
||||
* @returns {Object} editor object
|
||||
*/
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.services.editorService#memberPicker
|
||||
* @methodOf umbraco.services.editorService
|
||||
*
|
||||
* @description
|
||||
* Opens a member picker in infinite editing, the submit callback returns an array of selected items
|
||||
*
|
||||
* @param {Object} editor rendering options
|
||||
* @param {Boolean} editor.multiPicker Pick one or multiple items
|
||||
* @param {Function} editor.submit Callback function when the submit button is clicked. Returns the editor model object
|
||||
* @param {Function} editor.close Callback function when the close button is clicked.
|
||||
*
|
||||
* @returns {Object} editor object
|
||||
*/
|
||||
function memberPicker(editor) {
|
||||
editor.view = "views/common/infiniteeditors/treepicker/treepicker.html";
|
||||
if (!editor.size) editor.size = "small";
|
||||
@@ -985,7 +985,7 @@ When building a custom infinite editor view you can use the same components as a
|
||||
*
|
||||
*/
|
||||
function unbindKeyboardShortcuts() {
|
||||
const shortcuts = angular.copy(keyboardService.keyboardEvent);
|
||||
const shortcuts = Utilities.copy(keyboardService.keyboardEvent);
|
||||
editorsKeyboardShorcuts.push(shortcuts);
|
||||
|
||||
// unbind the current shortcuts because we only want to
|
||||
|
||||
@@ -27,10 +27,10 @@ function fileManager($rootScope) {
|
||||
setFiles: function (args) {
|
||||
|
||||
//propertyAlias, files
|
||||
if (!angular.isString(args.propertyAlias)) {
|
||||
if (!Utilities.isString(args.propertyAlias)) {
|
||||
throw "args.propertyAlias must be a non empty string";
|
||||
}
|
||||
if (!angular.isObject(args.files)) {
|
||||
if (!Utilities.isObject(args.files)) {
|
||||
throw "args.files must be an object";
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ function fileManager($rootScope) {
|
||||
}
|
||||
|
||||
var metaData = [];
|
||||
if (angular.isArray(args.metaData)) {
|
||||
if (Utilities.isArray(args.metaData)) {
|
||||
metaData = args.metaData;
|
||||
}
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ function formHelper(angularHelper, serverValidationManager, notificationsService
|
||||
if (!args || !args.notifications) {
|
||||
return false;
|
||||
}
|
||||
if (angular.isArray(args.notifications)) {
|
||||
if (Utilities.isArray(args.notifications)) {
|
||||
for (var i = 0; i < args.notifications.length; i++) {
|
||||
notificationsService.showNotification(args.notifications[i]);
|
||||
}
|
||||
|
||||
@@ -332,14 +332,14 @@
|
||||
|
||||
selection.length = 0;
|
||||
|
||||
if (angular.isArray(items)) {
|
||||
if (Utilities.isArray(items)) {
|
||||
for (i = 0; items.length > i; i++) {
|
||||
var item = items[i];
|
||||
item.selected = false;
|
||||
}
|
||||
}
|
||||
|
||||
if(angular.isArray(folders)) {
|
||||
if(Utilities.isArray(folders)) {
|
||||
for (i = 0; folders.length > i; i++) {
|
||||
var folder = folders[i];
|
||||
folder.selected = false;
|
||||
@@ -366,7 +366,7 @@
|
||||
var checkbox = $event.target;
|
||||
var clearSelection = false;
|
||||
|
||||
if (!angular.isArray(items)) {
|
||||
if (!Utilities.isArray(items)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -413,7 +413,7 @@
|
||||
|
||||
function selectAllItemsToggle(items, selection) {
|
||||
|
||||
if (!angular.isArray(items)) {
|
||||
if (!Utilities.isArray(items)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -62,12 +62,12 @@ function macroService() {
|
||||
val = val ? val : "";
|
||||
//need to detect if the val is a string or an object
|
||||
var keyVal;
|
||||
if (angular.isString(val)) {
|
||||
if (Utilities.isString(val)) {
|
||||
keyVal = key + "=\"" + (val ? val : "") + "\" ";
|
||||
}
|
||||
else {
|
||||
//if it's not a string we'll send it through the json serializer
|
||||
var json = angular.toJson(val);
|
||||
var json = Utilities.toJson(val);
|
||||
//then we need to url encode it so that it's safe
|
||||
var encoded = encodeURIComponent(json);
|
||||
keyVal = key + "=\"" + encoded + "\" ";
|
||||
@@ -142,7 +142,7 @@ function macroService() {
|
||||
|
||||
if (item.value !== null && item.value !== undefined && !_.isString(item.value)) {
|
||||
try {
|
||||
val = angular.toJson(val);
|
||||
val = Utilities.toJson(val);
|
||||
}
|
||||
catch (e) {
|
||||
// not json
|
||||
|
||||
@@ -45,7 +45,7 @@ function mediaHelper(umbRequestHelper, $http, $log) {
|
||||
|
||||
//this performs a simple check to see if we have a media file as value
|
||||
//it doesnt catch everything, but better then nothing
|
||||
if (angular.isString(item.value) && item.value.indexOf(mediaRoot) === 0) {
|
||||
if (Utilities.isString(item.value) && item.value.indexOf(mediaRoot) === 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ function mediaHelper(umbRequestHelper, $http, $log) {
|
||||
*/
|
||||
resolveFileFromEntity: function (mediaEntity, thumbnail) {
|
||||
|
||||
var mediaPath = angular.isObject(mediaEntity.metaData) ? mediaEntity.metaData.MediaPath : null;
|
||||
var mediaPath = Utilities.isObject(mediaEntity.metaData) ? mediaEntity.metaData.MediaPath : null;
|
||||
|
||||
if (!mediaPath) {
|
||||
//don't throw since this image legitimately might not contain a media path, but output a warning
|
||||
|
||||
@@ -26,60 +26,60 @@ function navigationService($routeParams, $location, $q, $injector, eventsService
|
||||
navReadyPromise.resolve(mainTreeApi);
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
//A list of query strings defined that when changed will not cause a reload of the route
|
||||
var nonRoutingQueryStrings = ["mculture", "cculture", "lq", "sr"];
|
||||
var retainedQueryStrings = ["mculture"];
|
||||
|
||||
|
||||
function setMode(mode) {
|
||||
switch (mode) {
|
||||
case 'tree':
|
||||
appState.setGlobalState("navMode", "tree");
|
||||
appState.setGlobalState("showNavigation", true);
|
||||
appState.setMenuState("showMenu", false);
|
||||
appState.setMenuState("showMenuDialog", false);
|
||||
appState.setGlobalState("stickyNavigation", false);
|
||||
appState.setGlobalState("showTray", false);
|
||||
break;
|
||||
case 'menu':
|
||||
appState.setGlobalState("navMode", "menu");
|
||||
appState.setGlobalState("showNavigation", true);
|
||||
appState.setMenuState("showMenu", true);
|
||||
appState.setMenuState("showMenuDialog", false);
|
||||
appState.setGlobalState("stickyNavigation", true);
|
||||
break;
|
||||
case 'dialog':
|
||||
appState.setGlobalState("navMode", "dialog");
|
||||
appState.setGlobalState("stickyNavigation", true);
|
||||
appState.setGlobalState("showNavigation", true);
|
||||
appState.setMenuState("showMenu", false);
|
||||
appState.setMenuState("showMenuDialog", true);
|
||||
appState.setMenuState("allowHideMenuDialog", true);
|
||||
break;
|
||||
case 'search':
|
||||
appState.setGlobalState("navMode", "search");
|
||||
appState.setGlobalState("stickyNavigation", false);
|
||||
appState.setGlobalState("showNavigation", true);
|
||||
appState.setMenuState("showMenu", false);
|
||||
appState.setSectionState("showSearchResults", true);
|
||||
appState.setMenuState("showMenuDialog", false);
|
||||
break;
|
||||
default:
|
||||
appState.setGlobalState("navMode", "default");
|
||||
appState.setMenuState("showMenu", false);
|
||||
appState.setMenuState("showMenuDialog", false);
|
||||
appState.setMenuState("allowHideMenuDialog", true);
|
||||
appState.setSectionState("showSearchResults", false);
|
||||
appState.setGlobalState("stickyNavigation", false);
|
||||
appState.setGlobalState("showTray", false);
|
||||
appState.setMenuState("currentNode", null);
|
||||
case 'tree':
|
||||
appState.setGlobalState("navMode", "tree");
|
||||
appState.setGlobalState("showNavigation", true);
|
||||
appState.setMenuState("showMenu", false);
|
||||
appState.setMenuState("showMenuDialog", false);
|
||||
appState.setGlobalState("stickyNavigation", false);
|
||||
appState.setGlobalState("showTray", false);
|
||||
break;
|
||||
case 'menu':
|
||||
appState.setGlobalState("navMode", "menu");
|
||||
appState.setGlobalState("showNavigation", true);
|
||||
appState.setMenuState("showMenu", true);
|
||||
appState.setMenuState("showMenuDialog", false);
|
||||
appState.setGlobalState("stickyNavigation", true);
|
||||
break;
|
||||
case 'dialog':
|
||||
appState.setGlobalState("navMode", "dialog");
|
||||
appState.setGlobalState("stickyNavigation", true);
|
||||
appState.setGlobalState("showNavigation", true);
|
||||
appState.setMenuState("showMenu", false);
|
||||
appState.setMenuState("showMenuDialog", true);
|
||||
appState.setMenuState("allowHideMenuDialog", true);
|
||||
break;
|
||||
case 'search':
|
||||
appState.setGlobalState("navMode", "search");
|
||||
appState.setGlobalState("stickyNavigation", false);
|
||||
appState.setGlobalState("showNavigation", true);
|
||||
appState.setMenuState("showMenu", false);
|
||||
appState.setSectionState("showSearchResults", true);
|
||||
appState.setMenuState("showMenuDialog", false);
|
||||
break;
|
||||
default:
|
||||
appState.setGlobalState("navMode", "default");
|
||||
appState.setMenuState("showMenu", false);
|
||||
appState.setMenuState("showMenuDialog", false);
|
||||
appState.setMenuState("allowHideMenuDialog", true);
|
||||
appState.setSectionState("showSearchResults", false);
|
||||
appState.setGlobalState("stickyNavigation", false);
|
||||
appState.setGlobalState("showTray", false);
|
||||
appState.setMenuState("currentNode", null);
|
||||
|
||||
if (appState.getGlobalState("isTablet") === true) {
|
||||
appState.setGlobalState("showNavigation", false);
|
||||
}
|
||||
if (appState.getGlobalState("isTablet") === true) {
|
||||
appState.setGlobalState("showNavigation", false);
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ function navigationService($routeParams, $location, $q, $injector, eventsService
|
||||
* @param {any} requestPath
|
||||
*/
|
||||
function pathToRouteParts(requestPath) {
|
||||
if (!angular.isString(requestPath)) {
|
||||
if (!Utilities.isString(requestPath)) {
|
||||
throw "The value for requestPath is not a string";
|
||||
}
|
||||
var pathAndQuery = requestPath.split("#")[1];
|
||||
@@ -114,7 +114,7 @@ function navigationService($routeParams, $location, $q, $injector, eventsService
|
||||
}
|
||||
|
||||
var service = {
|
||||
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.services.navigationService#isRouteChangingNavigation
|
||||
@@ -130,11 +130,11 @@ function navigationService($routeParams, $location, $q, $injector, eventsService
|
||||
*/
|
||||
isRouteChangingNavigation: function (currUrlParams, nextUrlParams) {
|
||||
|
||||
if (angular.isString(currUrlParams)) {
|
||||
if (Utilities.isString(currUrlParams)) {
|
||||
currUrlParams = pathToRouteParts(currUrlParams);
|
||||
}
|
||||
|
||||
if (angular.isString(nextUrlParams)) {
|
||||
if (Utilities.isString(nextUrlParams)) {
|
||||
nextUrlParams = pathToRouteParts(nextUrlParams);
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ function navigationService($routeParams, $location, $q, $injector, eventsService
|
||||
var nextRoutingKeys = _.difference(_.keys(nextUrlParams), nonRoutingQueryStrings);
|
||||
var diff1 = _.difference(currRoutingKeys, nextRoutingKeys);
|
||||
var diff2 = _.difference(nextRoutingKeys, currRoutingKeys);
|
||||
|
||||
|
||||
//if the routing parameter keys are the same, we'll compare their values to see if any have changed and if so then the routing will be allowed.
|
||||
if (diff1.length === 0 && diff2.length === 0) {
|
||||
var partsChanged = 0;
|
||||
@@ -223,7 +223,7 @@ function navigationService($routeParams, $location, $q, $injector, eventsService
|
||||
* @param {Object} nextRouteParams The next route parameters
|
||||
*/
|
||||
retainQueryStrings: function (currRouteParams, nextRouteParams) {
|
||||
var toRetain = angular.copy(nextRouteParams);
|
||||
var toRetain = Utilities.copy(nextRouteParams);
|
||||
var updated = false;
|
||||
|
||||
_.each(retainedQueryStrings, function (r) {
|
||||
@@ -260,7 +260,7 @@ function navigationService($routeParams, $location, $q, $injector, eventsService
|
||||
* and load the dashboard related to the section
|
||||
* @param {string} sectionAlias The alias of the section
|
||||
*/
|
||||
changeSection: function(sectionAlias, force) {
|
||||
changeSection: function (sectionAlias, force) {
|
||||
setMode("default-opensection");
|
||||
|
||||
if (force && appState.getSectionState("currentSection") === sectionAlias) {
|
||||
@@ -360,19 +360,19 @@ function navigationService($routeParams, $location, $q, $injector, eventsService
|
||||
|
||||
TODO: Delete this if not required
|
||||
*/
|
||||
_syncPath: function(path, forceReload) {
|
||||
_syncPath: function (path, forceReload) {
|
||||
return navReadyPromise.promise.then(function () {
|
||||
return mainTreeApi.syncTree({ path: path, forceReload: forceReload });
|
||||
});
|
||||
},
|
||||
|
||||
reloadNode: function(node) {
|
||||
|
||||
reloadNode: function (node) {
|
||||
return navReadyPromise.promise.then(function () {
|
||||
return mainTreeApi.reloadNode(node);
|
||||
});
|
||||
},
|
||||
|
||||
reloadSection: function(sectionAlias) {
|
||||
|
||||
reloadSection: function (sectionAlias) {
|
||||
return navReadyPromise.promise.then(function () {
|
||||
treeService.clearCache({ section: sectionAlias });
|
||||
return mainTreeApi.load(sectionAlias);
|
||||
@@ -387,11 +387,11 @@ function navigationService($routeParams, $location, $q, $injector, eventsService
|
||||
* @description
|
||||
* Hides the tree by hiding the containing dom element
|
||||
*/
|
||||
hideTree: function() {
|
||||
hideTree: function () {
|
||||
|
||||
if (appState.getGlobalState("isTablet") === true && !appState.getGlobalState("stickyNavigation")) {
|
||||
//reset it to whatever is in the url
|
||||
appState.setSectionState("currentSection", $routeParams.section);
|
||||
appState.setSectionState("currentSection", $routeParams.section);
|
||||
|
||||
setMode("default-hidesectiontree");
|
||||
}
|
||||
@@ -409,19 +409,19 @@ function navigationService($routeParams, $location, $q, $injector, eventsService
|
||||
*
|
||||
* @param {Event} event the click event triggering the method, passed from the DOM element
|
||||
*/
|
||||
showMenu: function(args) {
|
||||
|
||||
showMenu: function (args) {
|
||||
|
||||
var self = this;
|
||||
|
||||
return treeService.getMenu({ treeNode: args.node })
|
||||
.then(function(data) {
|
||||
.then(function (data) {
|
||||
|
||||
//check for a default
|
||||
//NOTE: event will be undefined when a call to hideDialog is made so it won't re-load the default again.
|
||||
// but perhaps there's a better way to deal with with an additional parameter in the args ? it works though.
|
||||
if (data.defaultAlias && !args.skipDefault) {
|
||||
|
||||
var found = _.find(data.menuItems, function(item) {
|
||||
var found = _.find(data.menuItems, function (item) {
|
||||
return item.alias = data.defaultAlias;
|
||||
});
|
||||
|
||||
@@ -450,7 +450,7 @@ function navigationService($routeParams, $location, $q, $injector, eventsService
|
||||
|
||||
return $q.resolve();
|
||||
});
|
||||
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -461,7 +461,7 @@ function navigationService($routeParams, $location, $q, $injector, eventsService
|
||||
* @description
|
||||
* Hides the menu by hiding the containing dom element
|
||||
*/
|
||||
hideMenu: function() {
|
||||
hideMenu: function () {
|
||||
//SD: Would we ever want to access the last action'd node instead of clearing it here?
|
||||
appState.setMenuState("currentNode", null);
|
||||
appState.setMenuState("menuActions", []);
|
||||
@@ -483,14 +483,14 @@ function navigationService($routeParams, $location, $q, $injector, eventsService
|
||||
|
||||
appState.setMenuState("currentNode", node);
|
||||
|
||||
if (action.metaData && action.metaData["actionRoute"] && angular.isString(action.metaData["actionRoute"])) {
|
||||
if (action.metaData && action.metaData["actionRoute"] && Utilities.isString(action.metaData["actionRoute"])) {
|
||||
//first check if the menu item simply navigates to a route
|
||||
var parts = action.metaData["actionRoute"].split("?");
|
||||
$location.path(parts[0]).search(parts.length > 1 ? parts[1] : "");
|
||||
this.hideNavigation();
|
||||
return;
|
||||
}
|
||||
else if (action.metaData && action.metaData["jsAction"] && angular.isString(action.metaData["jsAction"])) {
|
||||
else if (action.metaData && action.metaData["jsAction"] && Utilities.isString(action.metaData["jsAction"])) {
|
||||
|
||||
//we'll try to get the jsAction from the injector
|
||||
var menuAction = action.metaData["jsAction"].split('.');
|
||||
@@ -532,7 +532,7 @@ function navigationService($routeParams, $location, $q, $injector, eventsService
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
@@ -553,7 +553,7 @@ function navigationService($routeParams, $location, $q, $injector, eventsService
|
||||
* @param {Scope} args.scope current scope passed to the dialog
|
||||
* @param {Object} args.action the clicked action containing `name` and `alias`
|
||||
*/
|
||||
showDialog: function(args) {
|
||||
showDialog: function (args) {
|
||||
|
||||
if (!args) {
|
||||
throw "showDialog is missing the args parameter";
|
||||
@@ -578,20 +578,20 @@ function navigationService($routeParams, $location, $q, $injector, eventsService
|
||||
if (args.action.metaData["actionView"]) {
|
||||
templateUrl = args.action.metaData["actionView"];
|
||||
}
|
||||
else {
|
||||
else {
|
||||
var treeAlias = treeService.getTreeAlias(args.node);
|
||||
if (!treeAlias) {
|
||||
throw "Could not get tree alias for node " + args.node.id;
|
||||
}
|
||||
}
|
||||
templateUrl = this.getTreeTemplateUrl(treeAlias, args.action.alias);
|
||||
}
|
||||
|
||||
setMode("dialog");
|
||||
|
||||
if(templateUrl) {
|
||||
if (templateUrl) {
|
||||
appState.setMenuState("dialogTemplateUrl", templateUrl);
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
/**
|
||||
* @ngdoc method
|
||||
@@ -607,7 +607,7 @@ function navigationService($routeParams, $location, $q, $injector, eventsService
|
||||
* we will also check for a 'packageName' for the current tree, if it exists then the convention will be:
|
||||
* for example: /App_Plugins/{mypackage}/backoffice/{treetype}/create.html
|
||||
*/
|
||||
getTreeTemplateUrl: function(treeAlias, action) {
|
||||
getTreeTemplateUrl: function (treeAlias, action) {
|
||||
var packageTreeFolder = treeService.getTreePackageFolder(treeAlias);
|
||||
if (packageTreeFolder) {
|
||||
return Umbraco.Sys.ServerVariables.umbracoSettings.appPluginsPath +
|
||||
@@ -661,7 +661,7 @@ function navigationService($routeParams, $location, $q, $injector, eventsService
|
||||
* @description
|
||||
* shows the search pane
|
||||
*/
|
||||
showSearch: function() {
|
||||
showSearch: function () {
|
||||
setMode("search");
|
||||
},
|
||||
/**
|
||||
@@ -672,7 +672,7 @@ function navigationService($routeParams, $location, $q, $injector, eventsService
|
||||
* @description
|
||||
* hides the search pane
|
||||
*/
|
||||
hideSearch: function() {
|
||||
hideSearch: function () {
|
||||
setMode("default-hidesearch");
|
||||
},
|
||||
/**
|
||||
@@ -683,7 +683,7 @@ function navigationService($routeParams, $location, $q, $injector, eventsService
|
||||
* @description
|
||||
* hides any open navigation panes and resets the tree, actions and the currently selected node
|
||||
*/
|
||||
hideNavigation: function() {
|
||||
hideNavigation: function () {
|
||||
appState.setMenuState("menuActions", []);
|
||||
setMode("default");
|
||||
}
|
||||
|
||||
@@ -245,7 +245,7 @@ angular.module('umbraco.services')
|
||||
* @param {Int} index index where the notication should be removed from
|
||||
*/
|
||||
remove: function (index) {
|
||||
if(angular.isObject(index)){
|
||||
if (Utilities.isObject(index)){
|
||||
var i = nArray.indexOf(index);
|
||||
angularHelper.safeApply($rootScope, function() {
|
||||
nArray.splice(i, 1);
|
||||
|
||||
@@ -25,7 +25,7 @@ function serverValidationManager($timeout) {
|
||||
}
|
||||
|
||||
function getFieldErrors(self, fieldName) {
|
||||
if (!angular.isString(fieldName)) {
|
||||
if (!Utilities.isString(fieldName)) {
|
||||
throw "fieldName must be a string";
|
||||
}
|
||||
|
||||
@@ -36,10 +36,10 @@ function serverValidationManager($timeout) {
|
||||
}
|
||||
|
||||
function getPropertyErrors(self, propertyAlias, culture, fieldName) {
|
||||
if (!angular.isString(propertyAlias)) {
|
||||
if (!Utilities.isString(propertyAlias)) {
|
||||
throw "propertyAlias must be a string";
|
||||
}
|
||||
if (fieldName && !angular.isString(fieldName)) {
|
||||
if (fieldName && !Utilities.isString(fieldName)) {
|
||||
throw "fieldName must be a string";
|
||||
}
|
||||
|
||||
|
||||
@@ -485,7 +485,7 @@ function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, s
|
||||
//now we need to check if this custom config key is defined in our baseline, if it is we don't want to
|
||||
//overwrite the baseline config item if it is an array, we want to concat the items in the array, otherwise
|
||||
//if it's an object it will overwrite the baseline
|
||||
if (angular.isArray(config[i]) && angular.isArray(tinyMceConfig.customConfig[i])) {
|
||||
if (Utilities.isArray(config[i]) && Utilities.isArray(tinyMceConfig.customConfig[i])) {
|
||||
//concat it and below this concat'd array will overwrite the baseline in angular.extend
|
||||
tinyMceConfig.customConfig[i] = config[i].concat(tinyMceConfig.customConfig[i]);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
'use strict';
|
||||
|
||||
function tourService(eventsService, currentUserResource, $q, tourResource) {
|
||||
|
||||
|
||||
var tours = [];
|
||||
var currentTour = null;
|
||||
|
||||
@@ -18,14 +18,16 @@
|
||||
*/
|
||||
function registerAllTours() {
|
||||
tours = [];
|
||||
return tourResource.getTours().then(function(tourFiles) {
|
||||
angular.forEach(tourFiles, function (tourFile) {
|
||||
angular.forEach(tourFile.tours, function(newTour) {
|
||||
return tourResource.getTours().then(function (tourFiles) {
|
||||
tourFiles.forEach(tourFile => {
|
||||
|
||||
tourFile.tours.forEach(newTour => {
|
||||
validateTour(newTour);
|
||||
validateTourRegistration(newTour);
|
||||
tours.push(newTour);
|
||||
tours.push(newTour);
|
||||
});
|
||||
});
|
||||
|
||||
eventsService.emit("appState.tour.updatedTours", tours);
|
||||
});
|
||||
}
|
||||
@@ -74,7 +76,7 @@
|
||||
tour.disabled = true;
|
||||
currentUserResource
|
||||
.saveTourStatus({ alias: tour.alias, disabled: tour.disabled, completed: tour.completed }).then(
|
||||
function() {
|
||||
function () {
|
||||
eventsService.emit("appState.tour.end", tour);
|
||||
currentTour = null;
|
||||
deferred.resolve(tour);
|
||||
@@ -96,7 +98,7 @@
|
||||
tour.completed = true;
|
||||
currentUserResource
|
||||
.saveTourStatus({ alias: tour.alias, disabled: tour.disabled, completed: tour.completed }).then(
|
||||
function() {
|
||||
function () {
|
||||
eventsService.emit("appState.tour.complete", tour);
|
||||
currentTour = null;
|
||||
deferred.resolve(tour);
|
||||
@@ -130,10 +132,10 @@
|
||||
function getGroupedTours() {
|
||||
var deferred = $q.defer();
|
||||
var tours = getTours();
|
||||
setTourStatuses(tours).then(function() {
|
||||
setTourStatuses(tours).then(function () {
|
||||
var groupedTours = [];
|
||||
tours.forEach(function (item) {
|
||||
|
||||
|
||||
if (item.contentType === null || item.contentType === '') {
|
||||
var groupExists = false;
|
||||
var newGroup = {
|
||||
@@ -149,9 +151,9 @@
|
||||
}
|
||||
groupExists = true;
|
||||
|
||||
if(item.hidden === false){
|
||||
group.tours.push(item);
|
||||
}
|
||||
if (item.hidden === false) {
|
||||
group.tours.push(item);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -162,7 +164,7 @@
|
||||
newGroup.groupOrder = item.groupOrder;
|
||||
}
|
||||
|
||||
if(item.hidden === false){
|
||||
if (item.hidden === false) {
|
||||
newGroup.tours.push(item);
|
||||
groupedTours.push(newGroup);
|
||||
}
|
||||
@@ -242,14 +244,14 @@
|
||||
throw "Tour " + tour.alias + " is missing the required sections";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Validates a tour before it gets registered in the service
|
||||
* @param {any} tour
|
||||
*/
|
||||
function validateTourRegistration(tour) {
|
||||
// check for existing tours with the same alias
|
||||
angular.forEach(tours, function (existingTour) {
|
||||
tours.forEach(existingTour => {
|
||||
if (existingTour.alias === tour.alias) {
|
||||
throw "A tour with the alias " + tour.alias + " is already registered";
|
||||
}
|
||||
@@ -265,16 +267,17 @@
|
||||
var deferred = $q.defer();
|
||||
currentUserResource.getTours().then(function (storedTours) {
|
||||
|
||||
angular.forEach(storedTours, function (storedTour) {
|
||||
storedTours.forEach(storedTour => {
|
||||
|
||||
if (storedTour.completed === true) {
|
||||
angular.forEach(tours, function (tour) {
|
||||
tours.forEach(tour => {
|
||||
if (storedTour.alias === tour.alias) {
|
||||
tour.completed = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
if (storedTour.disabled === true) {
|
||||
angular.forEach(tours, function (tour) {
|
||||
tours.forEach(tour => {
|
||||
if (storedTour.alias === tour.alias) {
|
||||
tour.disabled = true;
|
||||
}
|
||||
@@ -296,7 +299,7 @@
|
||||
getCurrentTour: getCurrentTour,
|
||||
getGroupedTours: getGroupedTours,
|
||||
getTourByAlias: getTourByAlias,
|
||||
getToursForDoctype : getToursForDoctype
|
||||
getToursForDoctype: getToursForDoctype
|
||||
};
|
||||
|
||||
return service;
|
||||
|
||||
@@ -47,7 +47,7 @@ function treeService($q, treeResource, iconHelper, notificationsService, eventsS
|
||||
|
||||
/** Internal method to track expanded paths on a tree */
|
||||
_trackExpandedPaths: function (node, expandedPaths) {
|
||||
if (!node.children || !angular.isArray(node.children) || node.children.length == 0) {
|
||||
if (!node.children || !Utilities.isArray(node.children) || node.children.length == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ function treeService($q, treeResource, iconHelper, notificationsService, eventsS
|
||||
//we determine this based on the server variables
|
||||
if (Umbraco.Sys.ServerVariables.umbracoPlugins &&
|
||||
Umbraco.Sys.ServerVariables.umbracoPlugins.trees &&
|
||||
angular.isArray(Umbraco.Sys.ServerVariables.umbracoPlugins.trees)) {
|
||||
Utilities.isArray(Umbraco.Sys.ServerVariables.umbracoPlugins.trees)) {
|
||||
|
||||
var found = _.find(Umbraco.Sys.ServerVariables.umbracoPlugins.trees, function (item) {
|
||||
return invariantEquals(item.alias, treeAlias);
|
||||
@@ -473,7 +473,7 @@ function treeService($q, treeResource, iconHelper, notificationsService, eventsS
|
||||
|
||||
for (var i = 0; i < treeNode.children.length; i++) {
|
||||
var child = treeNode.children[i];
|
||||
if (child.children && angular.isArray(child.children) && child.children.length > 0) {
|
||||
if (child.children && Utilities.isArray(child.children) && child.children.length > 0) {
|
||||
//recurse
|
||||
found = this.getDescendantNode(child, id);
|
||||
if (found) {
|
||||
@@ -773,7 +773,7 @@ function treeService($q, treeResource, iconHelper, notificationsService, eventsS
|
||||
if (!args.path) {
|
||||
throw "No path defined on args object for syncTree";
|
||||
}
|
||||
if (!angular.isArray(args.path)) {
|
||||
if (!Utilities.isArray(args.path)) {
|
||||
throw "Path must be an array";
|
||||
}
|
||||
if (args.path.length < 1) {
|
||||
|
||||
@@ -158,7 +158,7 @@
|
||||
var currGroups = saveModel.userGroups;
|
||||
var formattedGroups = [];
|
||||
for (var i = 0; i < currGroups.length; i++) {
|
||||
if (!angular.isString(currGroups[i])) {
|
||||
if (!Utilities.isString(currGroups[i])) {
|
||||
formattedGroups.push(currGroups[i].alias);
|
||||
}
|
||||
else {
|
||||
@@ -229,7 +229,7 @@
|
||||
var currSections = saveModel.sections;
|
||||
var formattedSections = [];
|
||||
for (var i = 0; i < currSections.length; i++) {
|
||||
if (!angular.isString(currSections[i])) {
|
||||
if (!Utilities.isString(currSections[i])) {
|
||||
formattedSections.push(currSections[i].alias);
|
||||
}
|
||||
else {
|
||||
@@ -242,7 +242,7 @@
|
||||
var currUsers = saveModel.users;
|
||||
var formattedUsers = [];
|
||||
for (var j = 0; j < currUsers.length; j++) {
|
||||
if (!angular.isNumber(currUsers[j])) {
|
||||
if (!Utilities.isNumber(currUsers[j])) {
|
||||
formattedUsers.push(currUsers[j].id);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -44,7 +44,7 @@ function umbRequestHelper($http, $q, notificationsService, eventsService, formHe
|
||||
*/
|
||||
dictionaryToQueryString: function (queryStrings) {
|
||||
|
||||
if (angular.isArray(queryStrings)) {
|
||||
if (Utilities.isArray(queryStrings)) {
|
||||
return _.map(queryStrings, function (item) {
|
||||
var key = null;
|
||||
var val = null;
|
||||
@@ -59,7 +59,7 @@ function umbRequestHelper($http, $q, notificationsService, eventsService, formHe
|
||||
return encodeURIComponent(key) + "=" + encodeURIComponent(val);
|
||||
}).join("&");
|
||||
}
|
||||
else if (angular.isObject(queryStrings)) {
|
||||
else if (Utilities.isObject(queryStrings)) {
|
||||
|
||||
//this allows for a normal object to be passed in (ie. a dictionary)
|
||||
return decodeURIComponent($.param(queryStrings));
|
||||
@@ -91,7 +91,7 @@ function umbRequestHelper($http, $q, notificationsService, eventsService, formHe
|
||||
}
|
||||
|
||||
return Umbraco.Sys.ServerVariables["umbracoUrls"][apiName] + actionName +
|
||||
(!queryStrings ? "" : "?" + (angular.isString(queryStrings) ? queryStrings : this.dictionaryToQueryString(queryStrings)));
|
||||
(!queryStrings ? "" : "?" + (Utilities.isString(queryStrings) ? queryStrings : this.dictionaryToQueryString(queryStrings)));
|
||||
|
||||
},
|
||||
|
||||
@@ -129,7 +129,7 @@ function umbRequestHelper($http, $q, notificationsService, eventsService, formHe
|
||||
|
||||
var err = {
|
||||
//NOTE: the default error message here should never be used based on the above docs!
|
||||
errorMsg: (angular.isString(opts) ? opts : 'An error occurred!'),
|
||||
errorMsg: (Utilities.isString(opts) ? opts : 'An error occurred!'),
|
||||
data: data,
|
||||
status: status
|
||||
};
|
||||
@@ -254,7 +254,7 @@ function umbRequestHelper($http, $q, notificationsService, eventsService, formHe
|
||||
// so we know which property it belongs to on the server side
|
||||
var fileKey = "file_" + args.files[f].alias + "_" + (args.files[f].culture ? args.files[f].culture : "");
|
||||
|
||||
if (angular.isArray(args.files[f].metaData) && args.files[f].metaData.length > 0) {
|
||||
if (Utilities.isArray(args.files[f].metaData) && args.files[f].metaData.length > 0) {
|
||||
fileKey += ("_" + args.files[f].metaData.join("_"));
|
||||
}
|
||||
formData.append(fileKey, args.files[f].file);
|
||||
@@ -322,7 +322,7 @@ function umbRequestHelper($http, $q, notificationsService, eventsService, formHe
|
||||
//validate input, jsonData can be an array of key/value pairs or just one key/value pair.
|
||||
if (!jsonData) { throw "jsonData cannot be null"; }
|
||||
|
||||
if (angular.isArray(jsonData)) {
|
||||
if (Utilities.isArray(jsonData)) {
|
||||
_.each(jsonData, function (item) {
|
||||
if (!item.key || !item.value) { throw "jsonData array item must have both a key and a value property"; }
|
||||
});
|
||||
@@ -340,13 +340,13 @@ function umbRequestHelper($http, $q, notificationsService, eventsService, formHe
|
||||
transformRequest: function(data) {
|
||||
var formData = new FormData();
|
||||
//add the json data
|
||||
if (angular.isArray(data)) {
|
||||
if (Utilities.isArray(data)) {
|
||||
_.each(data, function(item) {
|
||||
formData.append(item.key, !angular.isString(item.value) ? angular.toJson(item.value) : item.value);
|
||||
formData.append(item.key, !Utilities.isString(item.value) ? Utilities.toJson(item.value) : item.value);
|
||||
});
|
||||
}
|
||||
else {
|
||||
formData.append(data.key, !angular.isString(data.value) ? angular.toJson(data.value) : data.value);
|
||||
formData.append(data.key, !Utilities.isString(data.value) ? Utilities.toJson(data.value) : data.value);
|
||||
}
|
||||
|
||||
//call the callback
|
||||
|
||||
@@ -128,7 +128,7 @@ angular.module('umbraco.services')
|
||||
function setUserTimeoutInternal(newTimeout) {
|
||||
|
||||
var asNumber = parseFloat(newTimeout);
|
||||
if (!isNaN(asNumber) && currentUser && angular.isNumber(asNumber)) {
|
||||
if (!isNaN(asNumber) && currentUser && Utilities.isNumber(asNumber)) {
|
||||
currentUser.remainingAuthSeconds = newTimeout;
|
||||
lastServerTimeoutSet = new Date();
|
||||
}
|
||||
|
||||
@@ -206,11 +206,11 @@ function umbSessionStorage($window) {
|
||||
return {
|
||||
|
||||
get: function (key) {
|
||||
return angular.fromJson(storage["umb_" + key]);
|
||||
return JSON.parse(storage["umb_" + key]);
|
||||
},
|
||||
|
||||
set: function (key, value) {
|
||||
storage["umb_" + key] = angular.toJson(value);
|
||||
storage["umb_" + key] = Utilities.toJson(value);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -34,7 +34,7 @@ app.run(['$rootScope', '$route', '$location', 'urlHelper', 'navigationService',
|
||||
else {
|
||||
|
||||
const introTourShown = localStorageService.get("introTourShown");
|
||||
if(!introTourShown){
|
||||
if (!introTourShown) {
|
||||
// Go & show email marketing tour (ONLY when intro tour is completed or been dismissed)
|
||||
tourService.getTourByAlias("umbEmailMarketing").then(function (emailMarketingTour) {
|
||||
// Only show the email marketing tour one time - dismissing it or saying no will make sure it never appears again
|
||||
@@ -45,7 +45,7 @@ app.run(['$rootScope', '$route', '$location', 'urlHelper', 'navigationService',
|
||||
// Only show the email tour once per logged in session
|
||||
// The localstorage key is removed on logout or user session timeout
|
||||
const emailMarketingTourShown = localStorageService.get("emailMarketingTourShown");
|
||||
if(!emailMarketingTourShown){
|
||||
if (!emailMarketingTourShown) {
|
||||
tourService.startTour(emailMarketingTour);
|
||||
localStorageService.set("emailMarketingTourShown", true);
|
||||
}
|
||||
@@ -89,7 +89,7 @@ app.run(['$rootScope', '$route', '$location', 'urlHelper', 'navigationService',
|
||||
currentRouteParams = toRetain;
|
||||
}
|
||||
else {
|
||||
currentRouteParams = angular.copy(current.params);
|
||||
currentRouteParams = Utilities.copy(current.params);
|
||||
}
|
||||
|
||||
|
||||
@@ -183,7 +183,7 @@ app.run(['$rootScope', '$route', '$location', 'urlHelper', 'navigationService',
|
||||
currentRouteParams = toRetain;
|
||||
}
|
||||
else {
|
||||
currentRouteParams = angular.copy(next.params);
|
||||
currentRouteParams = Utilities.copy(next.params);
|
||||
}
|
||||
|
||||
//always clear the 'sr' query string (soft redirect) if it exists
|
||||
@@ -191,7 +191,7 @@ app.run(['$rootScope', '$route', '$location', 'urlHelper', 'navigationService',
|
||||
currentRouteParams.sr = null;
|
||||
$route.updateParams(currentRouteParams);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -31,6 +31,6 @@
|
||||
border: none;
|
||||
}
|
||||
|
||||
.umb-dashboard__header .umb-tabs-nav .umb-tab > a {
|
||||
.umb-dashboard__header .umb-tabs-nav .umb-tab > .umb-tab-button {
|
||||
padding-bottom: 25px;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
border-right: 5px solid @brownGrayLight;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin: -10px -5px 10px;
|
||||
margin: -10px -1px 10px;
|
||||
position: relative;
|
||||
top: 0;
|
||||
box-sizing: border-box;
|
||||
@@ -34,6 +34,7 @@
|
||||
transition: box-shadow 240ms;
|
||||
position:sticky;
|
||||
z-index: 30;
|
||||
width: calc(100% + 2px);
|
||||
|
||||
&.umb-sticky-bar--active {
|
||||
box-shadow: 0 6px 3px -3px rgba(0,0,0,.16);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
.umb-editors {
|
||||
.absolute();
|
||||
overflow: hidden;
|
||||
z-index: 7500;
|
||||
|
||||
.umb-editor {
|
||||
box-shadow: 0px 0 30px 0 rgba(0,0,0,.3);
|
||||
@@ -104,4 +105,4 @@
|
||||
i {
|
||||
margin-right:5px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
position: fixed;
|
||||
overflow: hidden;
|
||||
background: @white;
|
||||
z-index: @zindexUmbOverlay;
|
||||
z-index: 7501;
|
||||
animation: fadeIn 0.2s;
|
||||
box-shadow: 0 10px 50px rgba(0,0,0,0.1), 0 6px 20px rgba(0,0,0,0.16);
|
||||
text-align: left;
|
||||
|
||||
@@ -13,25 +13,31 @@
|
||||
top: 1px;
|
||||
}
|
||||
|
||||
.umb-tab > a {
|
||||
|
||||
.umb-tab-button {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
|
||||
|
||||
cursor: pointer;
|
||||
//border-bottom: 4px solid transparent;
|
||||
color: @ui-light-type;
|
||||
padding: 5px 20px 15px 20px;
|
||||
transition: color 150ms ease-in-out;
|
||||
|
||||
&:focus {
|
||||
color: @ui-light-type-hover;
|
||||
|
||||
body:not(.tabbing-active) &{
|
||||
outline: none;
|
||||
}
|
||||
}
|
||||
|
||||
&:hover {
|
||||
color: @ui-light-type-hover;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
&::after {
|
||||
content: "";
|
||||
height: 0px;
|
||||
@@ -42,12 +48,21 @@
|
||||
bottom: 0;
|
||||
border-radius: 3px 3px 0 0;
|
||||
opacity: 0;
|
||||
transition: all .2s linear;
|
||||
transition: all 0.2s linear;
|
||||
}
|
||||
|
||||
&--expand > i {
|
||||
height: 5px;
|
||||
width: 5px;
|
||||
border-radius: 50%;
|
||||
background: @black;
|
||||
display: inline-block;
|
||||
margin: 0 5px 0 0;
|
||||
opacity: 0.6;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.umb-tab--active > a {
|
||||
.umb-tab--active > .umb-tab-button {
|
||||
color: @ui-light-active-type;
|
||||
//border-bottom-color: @ui-active;
|
||||
/*
|
||||
@@ -64,19 +79,19 @@
|
||||
}
|
||||
}
|
||||
|
||||
.show-validation .umb-tab--error > a,
|
||||
.show-validation .umb-tab--error > a:hover,
|
||||
.show-validation .umb-tab--error > a:focus {
|
||||
color: @white !important;
|
||||
background-color: @red !important;
|
||||
border-color: @errorBorder;
|
||||
.show-validation .umb-tab--error > .umb-tab-button,
|
||||
.show-validation .umb-tab--error > .umb-tab-button:hover,
|
||||
.show-validation .umb-tab--error > .umb-tab-button:focus {
|
||||
color: @white !important;
|
||||
background-color: @red !important;
|
||||
border-color: @errorBorder;
|
||||
}
|
||||
|
||||
.show-validation .umb-tab--error a:before {
|
||||
content: "\e25d";
|
||||
font-family: 'icomoon';
|
||||
margin-right: 5px;
|
||||
vertical-align: top;
|
||||
.show-validation .umb-tab--error .umb-tab-button:before {
|
||||
content: "\e25d";
|
||||
font-family: "icomoon";
|
||||
margin-right: 5px;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
// tabs tray
|
||||
@@ -86,20 +101,10 @@
|
||||
left: auto;
|
||||
}
|
||||
|
||||
.umb-tabs-tray > a {
|
||||
.umb-tabs-tray > .umb-tab-button {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.umb-tabs-tray-item--active {
|
||||
border-left: 2px solid @ui-active;
|
||||
}
|
||||
|
||||
.umb-tab--expand > a > i {
|
||||
height: 5px;
|
||||
width: 5px;
|
||||
border-radius: 50%;
|
||||
background: @black;
|
||||
display: inline-block;
|
||||
margin: 0 5px 0 0;
|
||||
opacity: .6;
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ function NavigationController($scope, $rootScope, $location, $log, $q, $routePar
|
||||
args.event.stopPropagation();
|
||||
args.event.preventDefault();
|
||||
|
||||
if (n.metaData && n.metaData["jsClickCallback"] && angular.isString(n.metaData["jsClickCallback"]) && n.metaData["jsClickCallback"] !== "") {
|
||||
if (n.metaData && n.metaData["jsClickCallback"] && Utilities.isString(n.metaData["jsClickCallback"]) && n.metaData["jsClickCallback"] !== "") {
|
||||
//this is a legacy tree node!
|
||||
var jsPrefix = "javascript:";
|
||||
var js;
|
||||
@@ -142,7 +142,7 @@ function NavigationController($scope, $rootScope, $location, $log, $q, $routePar
|
||||
|
||||
var isInit = false;
|
||||
var evts = [];
|
||||
|
||||
|
||||
//Listen for global state changes
|
||||
evts.push(eventsService.on("appState.globalState.changed", function (e, args) {
|
||||
if (args.key === "showNavigation") {
|
||||
@@ -200,7 +200,7 @@ function NavigationController($scope, $rootScope, $location, $log, $q, $routePar
|
||||
$scope.treeApi.load({ section: $scope.currentSection, customTreeParams: $scope.customTreeParams, cacheKey: $scope.treeCacheKey });
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//show/hide search results
|
||||
if (args.key === "showSearchResults") {
|
||||
$scope.showSearchResults = args.value;
|
||||
@@ -222,7 +222,7 @@ function NavigationController($scope, $rootScope, $location, $log, $q, $routePar
|
||||
} else {
|
||||
$location.search("mculture", null);
|
||||
}
|
||||
|
||||
|
||||
var currentEditorState = editorState.getCurrent();
|
||||
if (currentEditorState && currentEditorState.path) {
|
||||
$scope.treeApi.syncTree({ path: currentEditorState.path, activate: true });
|
||||
@@ -233,13 +233,13 @@ function NavigationController($scope, $rootScope, $location, $log, $q, $routePar
|
||||
|
||||
//Emitted when a language is created or an existing one saved/edited
|
||||
evts.push(eventsService.on("editors.languages.languageSaved", function (e, args) {
|
||||
if(args.isNew){
|
||||
if (args.isNew) {
|
||||
//A new language has been created - reload languages for tree
|
||||
loadLanguages().then(function (languages) {
|
||||
$scope.languages = languages;
|
||||
});
|
||||
}
|
||||
else if(args.language.isDefault){
|
||||
else if (args.language.isDefault) {
|
||||
//A language was saved and was set to be the new default (refresh the tree, so its at the top)
|
||||
loadLanguages().then(function (languages) {
|
||||
$scope.languages = languages;
|
||||
@@ -282,7 +282,7 @@ function NavigationController($scope, $rootScope, $location, $log, $q, $routePar
|
||||
|
||||
/**
|
||||
* For multi language sites, this ensures that mculture is set to either the last selected language or the default one
|
||||
*/
|
||||
*/
|
||||
function ensureMainCulture() {
|
||||
if ($location.search().mculture) {
|
||||
return;
|
||||
@@ -295,7 +295,7 @@ function NavigationController($scope, $rootScope, $location, $log, $q, $routePar
|
||||
$timeout(function () {
|
||||
$scope.selectLanguage(language);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Based on the current state of the application, this configures the scope variables that control the main tree and language drop down
|
||||
@@ -432,7 +432,7 @@ function NavigationController($scope, $rootScope, $location, $log, $q, $routePar
|
||||
|
||||
//the nav is ready, let the app know
|
||||
eventsService.emit("app.navigationReady", { treeApi: $scope.treeApi });
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -469,7 +469,7 @@ function NavigationController($scope, $rootScope, $location, $log, $q, $routePar
|
||||
// add the selected culture to a cookie so the user will log back into the same culture later on (cookie lifetime = one year)
|
||||
var expireDate = new Date();
|
||||
expireDate.setDate(expireDate.getDate() + 365);
|
||||
$cookies.put("UMB_MCULTURE", language.culture, {path: "/", expires: expireDate});
|
||||
$cookies.put("UMB_MCULTURE", language.culture, { path: "/", expires: expireDate });
|
||||
|
||||
// close the language selector
|
||||
$scope.page.languageSelectorIsOpen = false;
|
||||
@@ -495,9 +495,10 @@ function NavigationController($scope, $rootScope, $location, $log, $q, $routePar
|
||||
//execute them sequentially
|
||||
|
||||
// set selected language to active
|
||||
angular.forEach($scope.languages, function(language){
|
||||
$scope.languages.forEach(language => {
|
||||
language.active = false;
|
||||
});
|
||||
|
||||
language.active = true;
|
||||
|
||||
angularHelper.executeSequentialPromises(promises);
|
||||
@@ -538,7 +539,7 @@ function NavigationController($scope, $rootScope, $location, $log, $q, $routePar
|
||||
closeTree();
|
||||
};
|
||||
|
||||
$scope.onOutsideClick = function() {
|
||||
$scope.onOutsideClick = function () {
|
||||
closeTree();
|
||||
};
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
var app = angular.module("umbraco.preview", ['umbraco.resources', 'umbraco.services'])
|
||||
|
||||
.controller("previewController", function ($scope, $window, $location) {
|
||||
|
||||
$scope.currentCulture = {iso:'', title:'...', icon:'icon-loading'}
|
||||
|
||||
$scope.currentCulture = { iso: '', title: '...', icon: 'icon-loading' }
|
||||
var cultures = [];
|
||||
|
||||
$scope.tabbingActive = false;
|
||||
@@ -21,7 +21,7 @@ var app = angular.module("umbraco.preview", ['umbraco.resources', 'umbraco.servi
|
||||
window.addEventListener('mousedown', disableTabbingActive);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function disableTabbingActive(evt) {
|
||||
$scope.tabbingActive = false;
|
||||
$scope.$digest();
|
||||
@@ -113,10 +113,10 @@ var app = angular.module("umbraco.preview", ['umbraco.resources', 'umbraco.servi
|
||||
$scope.sizeOpen = false;
|
||||
$scope.cultureOpen = false;
|
||||
|
||||
$scope.toggleSizeOpen = function() {
|
||||
$scope.toggleSizeOpen = function () {
|
||||
$scope.sizeOpen = toggleMenu($scope.sizeOpen);
|
||||
}
|
||||
$scope.toggleCultureOpen = function() {
|
||||
$scope.toggleCultureOpen = function () {
|
||||
$scope.cultureOpen = toggleMenu($scope.cultureOpen);
|
||||
}
|
||||
|
||||
@@ -132,8 +132,8 @@ var app = angular.module("umbraco.preview", ['umbraco.resources', 'umbraco.servi
|
||||
$scope.sizeOpen = false;
|
||||
$scope.cultureOpen = false;
|
||||
}
|
||||
|
||||
$scope.windowClickHandler = function() {
|
||||
|
||||
$scope.windowClickHandler = function () {
|
||||
closeOthers();
|
||||
}
|
||||
function windowBlurHandler() {
|
||||
@@ -141,16 +141,16 @@ var app = angular.module("umbraco.preview", ['umbraco.resources', 'umbraco.servi
|
||||
$scope.$digest();
|
||||
}
|
||||
|
||||
var win = angular.element($window);
|
||||
var win = $($window);
|
||||
|
||||
win.on("blur", windowBlurHandler);
|
||||
|
||||
|
||||
$scope.$on("$destroy", function () {
|
||||
win.off("blur", handleBlwindowBlurHandlerur );
|
||||
win.off("blur", handleBlwindowBlurHandlerur);
|
||||
});
|
||||
|
||||
|
||||
function setPageUrl(){
|
||||
|
||||
function setPageUrl() {
|
||||
$scope.pageId = $location.search().id || getParameterByName("id");
|
||||
var culture = $location.search().culture || getParameterByName("culture");
|
||||
|
||||
@@ -204,27 +204,27 @@ var app = angular.module("umbraco.preview", ['umbraco.resources', 'umbraco.servi
|
||||
/* Change culture */
|
||||
/*****************************************************************************/
|
||||
$scope.changeCulture = function (iso) {
|
||||
if($location.search().culture !== iso) {
|
||||
if ($location.search().culture !== iso) {
|
||||
$scope.frameLoaded = false;
|
||||
$scope.currentCultureIso = iso;
|
||||
$location.search("culture", iso);
|
||||
setPageUrl();
|
||||
}
|
||||
};
|
||||
$scope.registerCulture = function(iso, title, isDefault) {
|
||||
var cultureObject = {iso: iso, title: title, isDefault: isDefault};
|
||||
$scope.registerCulture = function (iso, title, isDefault) {
|
||||
var cultureObject = { iso: iso, title: title, isDefault: isDefault };
|
||||
cultures.push(cultureObject);
|
||||
}
|
||||
|
||||
$scope.$watch("currentCultureIso", function(oldIso, newIso) {
|
||||
$scope.$watch("currentCultureIso", function (oldIso, newIso) {
|
||||
// if no culture is selected, we will pick the default one:
|
||||
if ($scope.currentCultureIso === null) {
|
||||
$scope.currentCulture = cultures.find(function(culture) {
|
||||
$scope.currentCulture = cultures.find(function (culture) {
|
||||
return culture.isDefault === true;
|
||||
})
|
||||
return;
|
||||
}
|
||||
$scope.currentCulture = cultures.find(function(culture) {
|
||||
$scope.currentCulture = cultures.find(function (culture) {
|
||||
return culture.iso === $scope.currentCultureIso;
|
||||
})
|
||||
});
|
||||
@@ -252,7 +252,7 @@ var app = angular.module("umbraco.preview", ['umbraco.resources', 'umbraco.servi
|
||||
});
|
||||
}
|
||||
|
||||
function hideUmbracoPreviewBadge (iframe) {
|
||||
function hideUmbracoPreviewBadge(iframe) {
|
||||
if (iframe && iframe.contentDocument && iframe.contentDocument.getElementById("umbracoPreviewBadge")) {
|
||||
iframe.contentDocument.getElementById("umbracoPreviewBadge").style.display = "none";
|
||||
}
|
||||
|
||||
@@ -66,6 +66,34 @@
|
||||
*/
|
||||
const isObject = val => val !== null && typeof val === 'object';
|
||||
|
||||
const isWindow = obj => obj && obj.window === obj;
|
||||
|
||||
const isScope = obj => obj && obj.$evalAsync && obj.$watch;
|
||||
|
||||
const toJsonReplacer = (key, value) => {
|
||||
var val = value;
|
||||
if (typeof key === 'string' && key.charAt(0) === '$' && key.charAt(1) === '$') {
|
||||
val = undefined;
|
||||
} else if (isWindow(value)) {
|
||||
val = '$WINDOW';
|
||||
} else if (value && window.document === value) {
|
||||
val = '$DOCUMENT';
|
||||
} else if (isScope(value)) {
|
||||
val = '$SCOPE';
|
||||
}
|
||||
return val;
|
||||
}
|
||||
/**
|
||||
* Equivalent to angular.toJson
|
||||
*/
|
||||
const toJson = (obj, pretty) => {
|
||||
if (isUndefined(obj)) return undefined;
|
||||
if (!isNumber(pretty)) {
|
||||
pretty = pretty ? 2 : null;
|
||||
}
|
||||
return JSON.stringify(obj, toJsonReplacer, pretty);
|
||||
}
|
||||
|
||||
let _utilities = {
|
||||
noop: noop,
|
||||
copy: copy,
|
||||
@@ -77,7 +105,8 @@
|
||||
isDefined: isDefined,
|
||||
isString: isString,
|
||||
isNumber: isNumber,
|
||||
isObject: isObject
|
||||
isObject: isObject,
|
||||
toJson: toJson
|
||||
};
|
||||
|
||||
if (typeof (window.Utilities) === 'undefined') {
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
/* make a copy of the init model so it is possible to roll
|
||||
back the changes on cancel */
|
||||
oldModel = angular.copy($scope.model);
|
||||
oldModel = Utilities.copy($scope.model);
|
||||
|
||||
if (!$scope.model.title) {
|
||||
$scope.model.title = "Compositions";
|
||||
@@ -39,7 +39,7 @@
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function isSelected(alias) {
|
||||
if ($scope.model.contentType.compositeContentTypes.indexOf(alias) !== -1) {
|
||||
@@ -68,7 +68,7 @@
|
||||
or the confirm checkbox has been checked */
|
||||
if (compositionRemoved) {
|
||||
vm.allowSubmit = false;
|
||||
localizationService.localize("general_remove").then(function(value) {
|
||||
localizationService.localize("general_remove").then(function (value) {
|
||||
const dialog = {
|
||||
view: "views/common/infiniteeditors/compositions/overlays/confirmremove.html",
|
||||
title: value,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//used for the media picker dialog
|
||||
angular.module("umbraco").controller("Umbraco.Editors.LinkPickerController",
|
||||
function ($scope, eventsService, entityResource, mediaResource, mediaHelper, udiParser, userService, localizationService, editorService) {
|
||||
|
||||
|
||||
var vm = this;
|
||||
var dialogOptions = $scope.model;
|
||||
|
||||
@@ -16,7 +16,7 @@ angular.module("umbraco").controller("Umbraco.Editors.LinkPickerController",
|
||||
|
||||
if (!$scope.model.title) {
|
||||
localizationService.localize("defaultdialogs_selectLink")
|
||||
.then(function(value) {
|
||||
.then(function (value) {
|
||||
$scope.model.title = value;
|
||||
});
|
||||
}
|
||||
@@ -59,7 +59,7 @@ angular.module("umbraco").controller("Umbraco.Editors.LinkPickerController",
|
||||
|
||||
if (dialogOptions.currentTarget) {
|
||||
// clone the current target so we don't accidentally update the caller's model while manipulating $scope.model.target
|
||||
$scope.model.target = angular.copy(dialogOptions.currentTarget);
|
||||
$scope.model.target = Utilities.copy(dialogOptions.currentTarget);
|
||||
// if we have a node ID, we fetch the current node to build the form data
|
||||
if ($scope.model.target.id || $scope.model.target.udi) {
|
||||
|
||||
@@ -194,7 +194,7 @@ angular.module("umbraco").controller("Umbraco.Editors.LinkPickerController",
|
||||
tree: "content"
|
||||
});
|
||||
},
|
||||
close: function() {
|
||||
close: function () {
|
||||
editorService.close();
|
||||
}
|
||||
};
|
||||
@@ -251,13 +251,13 @@ angular.module("umbraco").controller("Umbraco.Editors.LinkPickerController",
|
||||
}
|
||||
|
||||
function close() {
|
||||
if($scope.model && $scope.model.close) {
|
||||
if ($scope.model && $scope.model.close) {
|
||||
$scope.model.close();
|
||||
}
|
||||
}
|
||||
|
||||
function submit() {
|
||||
if($scope.model && $scope.model.submit) {
|
||||
if ($scope.model && $scope.model.submit) {
|
||||
$scope.model.submit($scope.model);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,9 +8,9 @@ function MacroPickerController($scope, entityResource, macroResource, umbPropEdi
|
||||
$scope.noMacroParams = false;
|
||||
|
||||
function onInit() {
|
||||
if(!$scope.model.title) {
|
||||
localizationService.localize("defaultdialogs_selectMacro").then(function(value){
|
||||
$scope.model.title = value;
|
||||
if (!$scope.model.title) {
|
||||
localizationService.localize("defaultdialogs_selectMacro").then(function (value) {
|
||||
$scope.model.title = value;
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -26,8 +26,8 @@ function MacroPickerController($scope, entityResource, macroResource, umbPropEdi
|
||||
}
|
||||
};
|
||||
|
||||
$scope.close = function() {
|
||||
if($scope.model.close) {
|
||||
$scope.close = function () {
|
||||
if ($scope.model.close) {
|
||||
$scope.model.close();
|
||||
}
|
||||
}
|
||||
@@ -42,7 +42,7 @@ function MacroPickerController($scope, entityResource, macroResource, umbPropEdi
|
||||
.then(function (data) {
|
||||
|
||||
//go to next page if there are params otherwise we can just exit
|
||||
if (!angular.isArray(data) || data.length === 0) {
|
||||
if (!Utilities.isArray(data) || data.length === 0) {
|
||||
|
||||
if (insertIfNoParameters) {
|
||||
$scope.model.submit($scope.model);
|
||||
@@ -51,7 +51,7 @@ function MacroPickerController($scope, entityResource, macroResource, umbPropEdi
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
$scope.wizardStep = "paramSelect";
|
||||
$scope.model.macroParams = data;
|
||||
|
||||
@@ -71,7 +71,7 @@ function MacroPickerController($scope, entityResource, macroResource, umbPropEdi
|
||||
if (val.detectIsJson()) {
|
||||
try {
|
||||
//Parse it to json
|
||||
prop.value = angular.fromJson(val);
|
||||
prop.value = JSON.parse(val);
|
||||
}
|
||||
catch (e) {
|
||||
// not json
|
||||
@@ -104,13 +104,13 @@ function MacroPickerController($scope, entityResource, macroResource, umbPropEdi
|
||||
entityResource.getAll("Macro", ($scope.model.dialogData && $scope.model.dialogData.richTextEditor && $scope.model.dialogData.richTextEditor === true) ? "UseInEditor=true" : null)
|
||||
.then(function (data) {
|
||||
|
||||
if (angular.isArray(data) && data.length == 0) {
|
||||
if (Utilities.isArray(data) && data.length == 0) {
|
||||
$scope.nomacros = true;
|
||||
}
|
||||
|
||||
//if 'allowedMacros' is specified, we need to filter
|
||||
if (angular.isArray($scope.model.dialogData.allowedMacros) && $scope.model.dialogData.allowedMacros.length > 0) {
|
||||
$scope.macros = _.filter(data, function(d) {
|
||||
if (Utilities.isArray($scope.model.dialogData.allowedMacros) && $scope.model.dialogData.allowedMacros.length > 0) {
|
||||
$scope.macros = _.filter(data, function (d) {
|
||||
return _.contains($scope.model.dialogData.allowedMacros, d.alias);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
//used for the media picker dialog
|
||||
angular.module("umbraco")
|
||||
.controller("Umbraco.Editors.MediaPickerController",
|
||||
function ($scope, $timeout, mediaResource, entityResource, userService, mediaHelper, mediaTypeHelper, eventsService, treeService, localStorageService, localizationService, editorService, umbSessionStorage) {
|
||||
function ($scope, $timeout, mediaResource, entityResource, userService, mediaHelper, mediaTypeHelper, eventsService, treeService, localStorageService, localizationService, editorService, umbSessionStorage) {
|
||||
|
||||
var vm = this;
|
||||
|
||||
|
||||
vm.submit = submit;
|
||||
vm.close = close;
|
||||
|
||||
|
||||
vm.toggle = toggle;
|
||||
vm.upload = upload;
|
||||
vm.dragLeave = dragLeave;
|
||||
@@ -26,7 +26,7 @@ angular.module("umbraco")
|
||||
vm.shouldShowUrl = shouldShowUrl;
|
||||
|
||||
var dialogOptions = $scope.model;
|
||||
|
||||
|
||||
$scope.disableFolderSelect = (dialogOptions.disableFolderSelect && dialogOptions.disableFolderSelect !== "0") ? true : false;
|
||||
$scope.disableFocalPoint = (dialogOptions.disableFocalPoint && dialogOptions.disableFocalPoint !== "0") ? true : false;
|
||||
$scope.onlyImages = (dialogOptions.onlyImages && dialogOptions.onlyImages !== "0") ? true : false;
|
||||
@@ -133,21 +133,21 @@ angular.module("umbraco")
|
||||
// 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;
|
||||
|
||||
|
||||
// ID of a UDI or legacy int ID still could be null/undefinied here
|
||||
// As user may dragged in an image that has not been saved to media section yet
|
||||
if (id) {
|
||||
entityResource.getById(id, "Media")
|
||||
.then(function (node) {
|
||||
$scope.target = node;
|
||||
if (ensureWithinStartNode(node)) {
|
||||
selectMedia(node);
|
||||
$scope.target.url = mediaHelper.resolveFileFromEntity(node);
|
||||
$scope.target.thumbnail = mediaHelper.resolveFileFromEntity(node, true);
|
||||
$scope.target.altText = altText;
|
||||
openDetailsDialog();
|
||||
}
|
||||
}, gotoStartNode);
|
||||
.then(function (node) {
|
||||
$scope.target = node;
|
||||
if (ensureWithinStartNode(node)) {
|
||||
selectMedia(node);
|
||||
$scope.target.url = mediaHelper.resolveFileFromEntity(node);
|
||||
$scope.target.thumbnail = mediaHelper.resolveFileFromEntity(node, true);
|
||||
$scope.target.altText = altText;
|
||||
openDetailsDialog();
|
||||
}
|
||||
}, gotoStartNode);
|
||||
} else {
|
||||
// No ID set - then this is going to be a tmpimg that has not been uploaded
|
||||
// User editing this will want to be changing the ALT text
|
||||
@@ -156,15 +156,15 @@ angular.module("umbraco")
|
||||
}
|
||||
}
|
||||
|
||||
function upload(v) {
|
||||
angular.element(".umb-file-dropzone .file-select").trigger("click");
|
||||
function upload() {
|
||||
$(".umb-file-dropzone .file-select").trigger("click");
|
||||
}
|
||||
|
||||
function dragLeave(el, event) {
|
||||
function dragLeave() {
|
||||
$scope.activeDrag = false;
|
||||
}
|
||||
|
||||
function dragEnter(el, event) {
|
||||
function dragEnter() {
|
||||
$scope.activeDrag = true;
|
||||
}
|
||||
|
||||
@@ -240,16 +240,16 @@ angular.module("umbraco")
|
||||
}
|
||||
} else {
|
||||
if ($scope.showDetails) {
|
||||
|
||||
|
||||
$scope.target = media;
|
||||
|
||||
|
||||
// handle both entity and full media object
|
||||
if (media.image) {
|
||||
$scope.target.url = media.image;
|
||||
} else {
|
||||
$scope.target.url = mediaHelper.resolveFile(media);
|
||||
}
|
||||
|
||||
|
||||
openDetailsDialog();
|
||||
} else {
|
||||
selectMedia(media);
|
||||
@@ -301,7 +301,7 @@ angular.module("umbraco")
|
||||
$timeout(function () {
|
||||
if ($scope.multiPicker) {
|
||||
var images = _.rest($scope.images, $scope.images.length - files.length);
|
||||
_.each(images, function(image) {
|
||||
_.each(images, function (image) {
|
||||
selectMedia(image);
|
||||
});
|
||||
} else {
|
||||
@@ -341,7 +341,7 @@ angular.module("umbraco")
|
||||
return false;
|
||||
}
|
||||
|
||||
function gotoStartNode(err) {
|
||||
function gotoStartNode() {
|
||||
gotoFolder({ id: $scope.startNodeId, name: "Media", icon: "icon-folder" });
|
||||
}
|
||||
|
||||
@@ -373,7 +373,7 @@ angular.module("umbraco")
|
||||
if (vm.searchOptions.filter) {
|
||||
searchMedia();
|
||||
} else {
|
||||
|
||||
|
||||
// reset pagination
|
||||
vm.searchOptions = {
|
||||
pageNumber: 1,
|
||||
@@ -383,7 +383,7 @@ angular.module("umbraco")
|
||||
filter: '',
|
||||
dataTypeKey: dataTypeKey
|
||||
};
|
||||
|
||||
|
||||
getChildren($scope.currentFolder.id);
|
||||
}
|
||||
});
|
||||
@@ -411,9 +411,9 @@ angular.module("umbraco")
|
||||
entityResource.getPagedDescendants($scope.filterOptions.excludeSubFolders ? $scope.currentFolder.id : $scope.startNodeId, "Media", vm.searchOptions)
|
||||
.then(function (data) {
|
||||
// update image data to work with image grid
|
||||
angular.forEach(data.items, function (mediaItem) {
|
||||
setMediaMetaData(mediaItem);
|
||||
});
|
||||
if (data.items) {
|
||||
data.items.forEach(mediaItem => setMediaMetaData(mediaItem));
|
||||
}
|
||||
|
||||
// update images
|
||||
$scope.images = data.items ? data.items : [];
|
||||
@@ -497,7 +497,7 @@ angular.module("umbraco")
|
||||
var folderImage = $scope.images[folderIndex];
|
||||
var imageIsSelected = false;
|
||||
|
||||
if ($scope.model && angular.isArray($scope.model.selection)) {
|
||||
if ($scope.model && Utilities.isArray($scope.model.selection)) {
|
||||
for (var selectedIndex = 0;
|
||||
selectedIndex < $scope.model.selection.length;
|
||||
selectedIndex++) {
|
||||
|
||||
@@ -76,7 +76,7 @@ angular.module("umbraco").controller("Umbraco.Editors.TreePickerController",
|
||||
/**
|
||||
* Performs the initialization of this component
|
||||
*/
|
||||
function onInit () {
|
||||
function onInit() {
|
||||
|
||||
if (vm.showLanguageSelector) {
|
||||
// load languages
|
||||
@@ -96,7 +96,7 @@ angular.module("umbraco").controller("Umbraco.Editors.TreePickerController",
|
||||
if (vm.treeAlias === "content") {
|
||||
vm.entityType = "Document";
|
||||
if (!$scope.model.title) {
|
||||
localizationService.localize("defaultdialogs_selectContent").then(function(value){
|
||||
localizationService.localize("defaultdialogs_selectContent").then(function (value) {
|
||||
$scope.model.title = value;
|
||||
});
|
||||
}
|
||||
@@ -104,7 +104,7 @@ angular.module("umbraco").controller("Umbraco.Editors.TreePickerController",
|
||||
else if (vm.treeAlias === "documentTypes") {
|
||||
vm.entityType = "DocumentType";
|
||||
if (!$scope.model.title) {
|
||||
localizationService.localize("defaultdialogs_selectContentType").then(function(value){
|
||||
localizationService.localize("defaultdialogs_selectContentType").then(function (value) {
|
||||
$scope.model.title = value;
|
||||
});
|
||||
}
|
||||
@@ -112,7 +112,7 @@ angular.module("umbraco").controller("Umbraco.Editors.TreePickerController",
|
||||
else if (vm.treeAlias === "member" || vm.section === "member") {
|
||||
vm.entityType = "Member";
|
||||
if (!$scope.model.title) {
|
||||
localizationService.localize("defaultdialogs_selectMember").then(function(value) {
|
||||
localizationService.localize("defaultdialogs_selectMember").then(function (value) {
|
||||
$scope.model.title = value;
|
||||
});
|
||||
}
|
||||
@@ -120,7 +120,7 @@ angular.module("umbraco").controller("Umbraco.Editors.TreePickerController",
|
||||
else if (vm.treeAlias === "memberTypes") {
|
||||
vm.entityType = "MemberType";
|
||||
if (!$scope.model.title) {
|
||||
localizationService.localize("defaultdialogs_selectMemberType").then(function(value){
|
||||
localizationService.localize("defaultdialogs_selectMemberType").then(function (value) {
|
||||
$scope.model.title = value;
|
||||
});
|
||||
}
|
||||
@@ -128,7 +128,7 @@ angular.module("umbraco").controller("Umbraco.Editors.TreePickerController",
|
||||
else if (vm.treeAlias === "media" || vm.section === "media") {
|
||||
vm.entityType = "Media";
|
||||
if (!$scope.model.title) {
|
||||
localizationService.localize("defaultdialogs_selectMedia").then(function(value){
|
||||
localizationService.localize("defaultdialogs_selectMedia").then(function (value) {
|
||||
$scope.model.title = value;
|
||||
});
|
||||
}
|
||||
@@ -136,7 +136,7 @@ angular.module("umbraco").controller("Umbraco.Editors.TreePickerController",
|
||||
else if (vm.treeAlias === "mediaTypes") {
|
||||
vm.entityType = "MediaType";
|
||||
if (!$scope.model.title) {
|
||||
localizationService.localize("defaultdialogs_selectMediaType").then(function(value){
|
||||
localizationService.localize("defaultdialogs_selectMediaType").then(function (value) {
|
||||
$scope.model.title = value;
|
||||
});
|
||||
}
|
||||
@@ -176,7 +176,7 @@ angular.module("umbraco").controller("Umbraco.Editors.TreePickerController",
|
||||
if (angular.isFunction($scope.model.filter)) {
|
||||
$scope.model.filterAdvanced = true;
|
||||
}
|
||||
else if (angular.isObject($scope.model.filter)) {
|
||||
else if (Utilities.isObject($scope.model.filter)) {
|
||||
$scope.model.filterAdvanced = true;
|
||||
}
|
||||
else {
|
||||
@@ -189,7 +189,7 @@ angular.module("umbraco").controller("Umbraco.Editors.TreePickerController",
|
||||
if ($scope.model.filter.startsWith("{")) {
|
||||
$scope.model.filterAdvanced = true;
|
||||
//convert to object
|
||||
$scope.model.filter = angular.fromJson($scope.model.filter);
|
||||
$scope.model.filter = JSON.parse($scope.model.filter);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -218,7 +218,7 @@ angular.module("umbraco").controller("Umbraco.Editors.TreePickerController",
|
||||
}
|
||||
|
||||
var queryString = $.param(queryParams); //create the query string from the params object
|
||||
|
||||
|
||||
if (!queryString) {
|
||||
vm.customTreeParams = $scope.model.customTreeParams;
|
||||
}
|
||||
@@ -243,7 +243,7 @@ angular.module("umbraco").controller("Umbraco.Editors.TreePickerController",
|
||||
$timeout(function () {
|
||||
//reload the tree with it's updated querystring args
|
||||
vm.dialogTreeApi.load(vm.section).then(function () {
|
||||
|
||||
|
||||
//create the list of promises
|
||||
var promises = [];
|
||||
for (var i = 0; i < expandedPaths.length; i++) {
|
||||
@@ -258,7 +258,7 @@ angular.module("umbraco").controller("Umbraco.Editors.TreePickerController",
|
||||
function toggleLanguageSelector() {
|
||||
vm.languageSelectorIsOpen = !vm.languageSelectorIsOpen;
|
||||
};
|
||||
|
||||
|
||||
function nodeExpandedHandler(args) {
|
||||
|
||||
//store the reference to the expanded node path
|
||||
@@ -271,7 +271,7 @@ angular.module("umbraco").controller("Umbraco.Editors.TreePickerController",
|
||||
openMiniListView(args.node);
|
||||
}
|
||||
|
||||
if (angular.isArray(args.children)) {
|
||||
if (Utilities.isArray(args.children)) {
|
||||
|
||||
//iterate children
|
||||
_.each(args.children,
|
||||
@@ -446,7 +446,7 @@ angular.module("umbraco").controller("Umbraco.Editors.TreePickerController",
|
||||
// be allowed to be clicked on
|
||||
nodes = _.filter(nodes,
|
||||
function (n) {
|
||||
return !angular.isObject(n.metaData.listViewNode);
|
||||
return !Utilities.isObject(n.metaData.listViewNode);
|
||||
});
|
||||
|
||||
if ($scope.model.filterAdvanced) {
|
||||
@@ -673,17 +673,17 @@ angular.module("umbraco").controller("Umbraco.Editors.TreePickerController",
|
||||
}
|
||||
|
||||
function submit(model) {
|
||||
if($scope.model.submit) {
|
||||
if ($scope.model.submit) {
|
||||
$scope.model.submit(model);
|
||||
}
|
||||
}
|
||||
|
||||
function close() {
|
||||
if($scope.model.close) {
|
||||
if ($scope.model.close) {
|
||||
$scope.model.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//initialize
|
||||
onInit();
|
||||
|
||||
|
||||
@@ -102,6 +102,10 @@ angular.module("umbraco")
|
||||
});
|
||||
}
|
||||
|
||||
$scope.linkProvider = function (e) {
|
||||
e.target.submit();
|
||||
}
|
||||
|
||||
$scope.unlink = function (e, loginProvider, providerKey) {
|
||||
var result = confirm("Are you sure you want to unlink this account?");
|
||||
if (!result) {
|
||||
|
||||
@@ -49,12 +49,11 @@
|
||||
|
||||
<div ng-repeat="login in externalLoginProviders">
|
||||
|
||||
<form ng-if="login.linkedProviderKey == undefined" method="POST" action="{{externalLinkLoginFormAction}}" id="oauthloginform" name="oauthloginform">
|
||||
<form ng-submit="linkProvider($event)" ng-if="login.linkedProviderKey == undefined" method="POST" action="{{externalLinkLoginFormAction}}" name="oauthloginform" id="oauthloginform-{{login.authType}}">
|
||||
<input type="hidden" name="provider" value="{{login.authType}}" />
|
||||
<button class="btn btn-block btn-social"
|
||||
ng-class="login.properties.SocialStyle"
|
||||
id="{{login.authType}}"
|
||||
onclick="document.forms.oauthloginform.submit();">
|
||||
id="{{login.authType}}">
|
||||
|
||||
<i class="fa" ng-class="login.properties.SocialIcon"></i>
|
||||
<localize key="defaultdialogs_linkYour">Link your</localize> {{login.caption}} <localize key="defaultdialogs_account">account</localize>
|
||||
|
||||
@@ -2,16 +2,16 @@
|
||||
"use strict";
|
||||
|
||||
function NodeNameController($scope) {
|
||||
|
||||
|
||||
var vm = this;
|
||||
var element = angular.element($scope.model.currentStep.element);
|
||||
var element = $($scope.model.currentStep.element);
|
||||
|
||||
vm.error = false;
|
||||
|
||||
|
||||
vm.initNextStep = initNextStep;
|
||||
|
||||
function initNextStep() {
|
||||
if(element.val().toLowerCase() === 'home') {
|
||||
if (element.val().toLowerCase() === 'home') {
|
||||
$scope.model.nextStep();
|
||||
} else {
|
||||
vm.error = true;
|
||||
|
||||
@@ -2,16 +2,16 @@
|
||||
"use strict";
|
||||
|
||||
function DocTypeNameController($scope) {
|
||||
|
||||
|
||||
var vm = this;
|
||||
var element = angular.element($scope.model.currentStep.element);
|
||||
var element = $($scope.model.currentStep.element);
|
||||
|
||||
vm.error = false;
|
||||
|
||||
|
||||
vm.initNextStep = initNextStep;
|
||||
|
||||
function initNextStep() {
|
||||
if(element.val().toLowerCase() === 'home page') {
|
||||
if (element.val().toLowerCase() === 'home page') {
|
||||
$scope.model.nextStep();
|
||||
} else {
|
||||
vm.error = true;
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
"use strict";
|
||||
|
||||
function PropertyNameController($scope) {
|
||||
|
||||
|
||||
var vm = this;
|
||||
var element = angular.element($scope.model.currentStep.element);
|
||||
var element = $($scope.model.currentStep.element);
|
||||
|
||||
vm.error = false;
|
||||
|
||||
|
||||
vm.initNextStep = initNextStep;
|
||||
|
||||
function initNextStep() {
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
"use strict";
|
||||
|
||||
function TabNameController($scope) {
|
||||
|
||||
|
||||
var vm = this;
|
||||
var element = angular.element($scope.model.currentStep.element);
|
||||
var element = $($scope.model.currentStep.element);
|
||||
|
||||
vm.error = false;
|
||||
|
||||
|
||||
vm.initNextStep = initNextStep;
|
||||
|
||||
function initNextStep() {
|
||||
|
||||
@@ -2,16 +2,16 @@
|
||||
"use strict";
|
||||
|
||||
function FolderNameController($scope) {
|
||||
|
||||
|
||||
var vm = this;
|
||||
var element = angular.element($scope.model.currentStep.element);
|
||||
var element = $($scope.model.currentStep.element);
|
||||
|
||||
vm.error = false;
|
||||
|
||||
|
||||
vm.initNextStep = initNextStep;
|
||||
|
||||
function initNextStep() {
|
||||
if(element.val().toLowerCase() === "my images") {
|
||||
if (element.val().toLowerCase() === "my images") {
|
||||
$scope.model.nextStep();
|
||||
} else {
|
||||
vm.error = true;
|
||||
|
||||
@@ -2,12 +2,11 @@
|
||||
"use strict";
|
||||
|
||||
function UploadImagesController($scope, editorState, mediaResource) {
|
||||
|
||||
|
||||
var vm = this;
|
||||
var element = angular.element($scope.model.currentStep.element);
|
||||
|
||||
vm.error = false;
|
||||
|
||||
|
||||
vm.initNextStep = initNextStep;
|
||||
|
||||
function initNextStep() {
|
||||
@@ -23,7 +22,7 @@
|
||||
|
||||
var children = data;
|
||||
|
||||
if(children.items && children.items.length > 0) {
|
||||
if (children.items && children.items.length > 0) {
|
||||
$scope.model.nextStep();
|
||||
} else {
|
||||
vm.error = true;
|
||||
|
||||
@@ -2,13 +2,12 @@
|
||||
"use strict";
|
||||
|
||||
function TemplatesTreeController($scope) {
|
||||
|
||||
var vm = this;
|
||||
var eventElement = angular.element($scope.model.currentStep.eventElement);
|
||||
|
||||
|
||||
var eventElement = $($scope.model.currentStep.eventElement);
|
||||
|
||||
function onInit() {
|
||||
// check if tree is already open - if it is - go to next step
|
||||
if(eventElement.hasClass("icon-navigation-down")) {
|
||||
if (eventElement.hasClass("icon-navigation-down")) {
|
||||
$scope.model.nextStep();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,13 +6,15 @@
|
||||
<a href="#/{{section.alias}}"
|
||||
ng-dblclick="sectionDblClick(section)"
|
||||
ng-click="sectionClick($event, section)"
|
||||
prevent-default>
|
||||
prevent-default
|
||||
ng-attr-aria-current="{{section.alias == currentSection ? 'page' : undefined}}"
|
||||
aria-label="{{section.name + (section.alias == currentSection ? ' (active)' : '')}}">
|
||||
<span class="section__name">{{section.name}}</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li data-element="section-expand" class="expand" ng-class="{ 'open': showTray === true, current: currentSectionInOverflow() }" ng-show="visibleSections < sections.length">
|
||||
<a href="#" ng-click="trayClick()" prevent-default>
|
||||
<a href="#" ng-click="trayClick()" prevent-default aria-label="More sections">
|
||||
<span class="section__name">•••</span>
|
||||
</a>
|
||||
|
||||
@@ -21,7 +23,9 @@
|
||||
<a href="#/{{section.alias}}"
|
||||
ng-dblclick="sectionDblClick(section)"
|
||||
ng-click="sectionClick($event, section)"
|
||||
prevent-default>
|
||||
prevent-default
|
||||
ng-attr-aria-current="{{section.alias == currentSection ? 'page' : undefined}}"
|
||||
aria-label="{{section.name + (section.alias == currentSection ? ' (active)' : '')}}">
|
||||
<span class="section__name">{{section.name}}</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
<ul role="tablist" class="umb-tabs-nav">
|
||||
<li ng-click="vm.clickTab($event, tab)" class="umb-tab" role="tab" aria-selected="true" tabindex="0" ng-repeat="tab in vm.tabs | limitTo: vm.maxTabs" data-element="tab-{{tab.alias}}" ng-class="{'umb-tab--active': tab.active, 'umb-tab--error': tabHasError}" val-tab>
|
||||
<a>{{ tab.label }}</a>
|
||||
<li class="umb-tab" ng-repeat="tab in vm.tabs | limitTo: vm.maxTabs" data-element="tab-{{tab.alias}}" ng-class="{'umb-tab--active': tab.active, 'umb-tab--error': tabHasError}" val-tab>
|
||||
<button class="btn-reset umb-tab-button" ng-click="vm.clickTab($event, tab)" role="tab" aria-selected="{tab.active}" type="button">{{ tab.label }}</button>
|
||||
</li>
|
||||
|
||||
<li data-element="tab-expand" class="umb-tab umb-tab--expand" tabindex="0" ng-click="vm.toggleTray()" ng-class="{ 'open': vm.showTray }" ng-show="vm.needTray">
|
||||
<a ng-href=""><i></i><i></i><i></i></a>
|
||||
<li data-element="tab-expand" class="umb-tab umb-tab--expand" ng-class="{ 'open': vm.showTray }" ng-show="vm.needTray">
|
||||
<button class="btn-reset umb-tab-button umb-tab-button--expand" ng-click="vm.toggleTray()" type="button">
|
||||
<i></i><i></i><i></i>
|
||||
<span class="sr-only"><localize key="visuallyHiddenTexts_tabExpand">View more options</localize></span>
|
||||
</button>
|
||||
<umb-dropdown class="umb-tabs-tray" ng-if="vm.showTray" on-close="vm.hideTray()">
|
||||
<umb-dropdown-item ng-repeat="tab in vm.tabs | limitTo: vm.overflowingTabs" ng-class="{'umb-tabs-tray-item--active': tab.active}" tabindex="0" ng-click="vm.clickTab($event, tab)">
|
||||
<a ng-href="">{{ tab.label }}</a>
|
||||
<umb-dropdown-item ng-repeat="tab in vm.tabs | limitTo: vm.overflowingTabs" ng-class="{'umb-tabs-tray-item--active': tab.active}">
|
||||
<button class="btn-reset umb-tab-button" ng-click="vm.clickTab($event, tab)" role="tab" aria-selected="{tab.active}" type="button">{{ tab.label }}</button>
|
||||
</umb-dropdown-item>
|
||||
</umb-dropdown>
|
||||
</li>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
<i class="{{ layout.icon }} umb-layout-selector__dropdown-item-icon" aria-hidden="true"></i>
|
||||
<span class="sr-only">{{layout.name}}</span>
|
||||
</div>
|
||||
</button>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
(function() {
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
function HealthCheckController($scope, healthCheckResource) {
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
// Get a (grouped) list of all health checks
|
||||
healthCheckResource.getAllChecks()
|
||||
.then(function(response) {
|
||||
.then(function (response) {
|
||||
vm.groups = response;
|
||||
});
|
||||
|
||||
@@ -33,11 +33,11 @@
|
||||
var totalInfo = 0;
|
||||
|
||||
// count total number of statusses
|
||||
angular.forEach(group.checks,
|
||||
function(check) {
|
||||
angular.forEach(check.status,
|
||||
function(status) {
|
||||
switch (status.resultType) {
|
||||
group.checks.forEach(check => {
|
||||
|
||||
if (check.status) {
|
||||
check.status.forEach(status => {
|
||||
switch (status.resultType) {
|
||||
case SUCCESS:
|
||||
totalSuccess = totalSuccess + 1;
|
||||
break;
|
||||
@@ -50,9 +50,10 @@
|
||||
case INFO:
|
||||
totalInfo = totalInfo + 1;
|
||||
break;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
group.totalSuccess = totalSuccess;
|
||||
group.totalError = totalError;
|
||||
@@ -66,7 +67,7 @@
|
||||
check.loading = true;
|
||||
check.status = null;
|
||||
healthCheckResource.getStatus(check.id)
|
||||
.then(function(response) {
|
||||
.then(function (response) {
|
||||
check.loading = false;
|
||||
check.status = response;
|
||||
});
|
||||
@@ -75,7 +76,7 @@
|
||||
function executeAction(check, index, action) {
|
||||
check.loading = true;
|
||||
healthCheckResource.executeAction(action)
|
||||
.then(function(response) {
|
||||
.then(function (response) {
|
||||
check.status[index] = response;
|
||||
check.loading = false;
|
||||
});
|
||||
@@ -94,24 +95,22 @@
|
||||
group.checkCounter = 0;
|
||||
group.loading = true;
|
||||
|
||||
angular.forEach(checks,
|
||||
function(check) {
|
||||
checks.forEach(check => {
|
||||
check.loading = true;
|
||||
|
||||
check.loading = true;
|
||||
healthCheckResource.getStatus(check.id)
|
||||
.then(function (response) {
|
||||
check.status = response;
|
||||
group.checkCounter = group.checkCounter + 1;
|
||||
check.loading = false;
|
||||
|
||||
healthCheckResource.getStatus(check.id)
|
||||
.then(function(response) {
|
||||
check.status = response;
|
||||
group.checkCounter = group.checkCounter + 1;
|
||||
check.loading = false;
|
||||
|
||||
// when all checks are done, set global group result
|
||||
if (group.checkCounter === checks.length) {
|
||||
setGroupGlobalResultType(group);
|
||||
group.loading = false;
|
||||
}
|
||||
});
|
||||
});
|
||||
// when all checks are done, set global group result
|
||||
if (group.checkCounter === checks.length) {
|
||||
setGroupGlobalResultType(group);
|
||||
group.loading = false;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function openGroup(group) {
|
||||
|
||||
@@ -97,7 +97,7 @@ function DocumentTypesCreateController($scope, $location, navigationService, con
|
||||
$scope.error = err;
|
||||
|
||||
//show any notifications
|
||||
if (angular.isArray(err.data.notifications)) {
|
||||
if (Utilities.isArray(err.data.notifications)) {
|
||||
for (var i = 0; i < err.data.notifications.length; i++) {
|
||||
notificationsService.showNotification(err.data.notifications[i]);
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
};
|
||||
|
||||
if ($routeParams.create) {
|
||||
vm.page.name = vm.labels.addLanguage;
|
||||
vm.page.name = vm.labels.addLanguage;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -87,14 +87,14 @@
|
||||
|
||||
if (!$routeParams.create) {
|
||||
|
||||
promises.push(languageResource.getById($routeParams.id).then(function(lang) {
|
||||
promises.push(languageResource.getById($routeParams.id).then(function (lang) {
|
||||
vm.language = lang;
|
||||
|
||||
vm.page.name = vm.language.name;
|
||||
|
||||
/* we need to store the initial default state so we can disable the toggle if it is the default.
|
||||
we need to prevent from not having a default language. */
|
||||
vm.initIsDefault = angular.copy(vm.language.isDefault);
|
||||
vm.initIsDefault = Utilities.copy(vm.language.isDefault);
|
||||
|
||||
makeBreadcrumbs();
|
||||
|
||||
@@ -182,12 +182,12 @@
|
||||
function toggleDefault() {
|
||||
|
||||
// it shouldn't be possible to uncheck the default language
|
||||
if(vm.initIsDefault) {
|
||||
if (vm.initIsDefault) {
|
||||
return;
|
||||
}
|
||||
|
||||
vm.language.isDefault = !vm.language.isDefault;
|
||||
if(vm.language.isDefault) {
|
||||
if (vm.language.isDefault) {
|
||||
vm.showDefaultLanguageInfo = true;
|
||||
} else {
|
||||
vm.showDefaultLanguageInfo = false;
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
vm.versionRegex = /^(\d+\.)(\d+\.)(\*|\d+)$/;
|
||||
|
||||
function onInit() {
|
||||
|
||||
|
||||
if (create) {
|
||||
// Pre populate package with some values
|
||||
packageResource.getEmpty().then(scaffold => {
|
||||
@@ -78,7 +78,7 @@
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
localizationService.localizeMany(["buttons_save", "packager_includeAllChildNodes"]).then(function (values) {
|
||||
vm.labels.button = values[0];
|
||||
vm.labels.includeAllChildNodes = values[1];
|
||||
@@ -232,7 +232,7 @@
|
||||
|
||||
function openFilePicker() {
|
||||
|
||||
let selection = angular.copy(vm.package.files);
|
||||
let selection = Utilities.copy(vm.package.files);
|
||||
|
||||
const filePicker = {
|
||||
title: "Select files",
|
||||
|
||||
@@ -19,7 +19,7 @@ angular.module("umbraco").controller("Umbraco.PrevalueEditors.ColorPickerControl
|
||||
// Make an array from the dictionary
|
||||
var items = [];
|
||||
|
||||
if (angular.isArray($scope.model.prevalues)) {
|
||||
if (Utilities.isArray($scope.model.prevalues)) {
|
||||
|
||||
for (var i in $scope.model.prevalues) {
|
||||
var oldValue = $scope.model.prevalues[i];
|
||||
|
||||
@@ -7,7 +7,7 @@ angular.module("umbraco").controller("Umbraco.PrevalueEditors.MultiValuesControl
|
||||
$scope.hasError = false;
|
||||
$scope.focusOnNew = false;
|
||||
|
||||
if (!angular.isArray($scope.model.value)) {
|
||||
if (!Utilities.isArray($scope.model.value)) {
|
||||
|
||||
//make an array from the dictionary
|
||||
var items = [];
|
||||
|
||||
@@ -118,7 +118,7 @@ angular.module('umbraco')
|
||||
}
|
||||
|
||||
function populate(data) {
|
||||
if (angular.isArray(data)) {
|
||||
if (Utilities.isArray(data)) {
|
||||
_.each(data, function (item, i) {
|
||||
$scope.add(item);
|
||||
});
|
||||
|
||||
@@ -24,7 +24,7 @@ angular.module("umbraco").controller("Umbraco.PropertyEditors.ChangePasswordCont
|
||||
}
|
||||
|
||||
//set the model defaults
|
||||
if (!angular.isObject($scope.model.value)) {
|
||||
if (!Utilities.isObject($scope.model.value)) {
|
||||
//if it's not an object then just create a new one
|
||||
$scope.model.value = {
|
||||
newPassword: null,
|
||||
|
||||
@@ -10,7 +10,7 @@ angular.module("umbraco").controller("Umbraco.PropertyEditors.CheckboxListContro
|
||||
function init() {
|
||||
|
||||
// currently the property editor will onyl work if our input is an object.
|
||||
if (angular.isObject($scope.model.config.items)) {
|
||||
if (Utilities.isObject($scope.model.config.items)) {
|
||||
|
||||
// formatting the items in the dictionary into an array
|
||||
var sortedItems = [];
|
||||
|
||||
@@ -25,7 +25,7 @@ function ColorPickerController($scope, $timeout) {
|
||||
initActiveColor();
|
||||
}
|
||||
|
||||
if (!angular.isArray($scope.model.config.items)) {
|
||||
if (!Utilities.isArray($scope.model.config.items)) {
|
||||
//make an array from the dictionary
|
||||
var items = [];
|
||||
for (var i in $scope.model.config.items) {
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
});
|
||||
});
|
||||
|
||||
if (!angular.isArray($scope.model.value)) {
|
||||
if (!Utilities.isArray($scope.model.value)) {
|
||||
//make an array from the dictionary
|
||||
var items = [];
|
||||
for (var i in $scope.model.value) {
|
||||
|
||||
@@ -152,7 +152,7 @@ function contentPickerController($scope, entityResource, editorState, iconHelper
|
||||
dataTypeKey: $scope.model.dataTypeKey,
|
||||
currentNode: editorState ? editorState.current : null,
|
||||
callback: function (data) {
|
||||
if (angular.isArray(data)) {
|
||||
if (Utilities.isArray(data)) {
|
||||
_.each(data, function (item, i) {
|
||||
$scope.add(item);
|
||||
});
|
||||
@@ -233,7 +233,7 @@ function contentPickerController($scope, entityResource, editorState, iconHelper
|
||||
$scope.currentPicker = dialogOptions;
|
||||
|
||||
$scope.currentPicker.submit = function (model) {
|
||||
if (angular.isArray(model.selection)) {
|
||||
if (Utilities.isArray(model.selection)) {
|
||||
_.each(model.selection, function (item, i) {
|
||||
$scope.add(item);
|
||||
});
|
||||
|
||||
@@ -45,14 +45,14 @@ angular.module("umbraco").controller("Umbraco.PropertyEditors.DropdownFlexibleCo
|
||||
$scope.model.value = [$scope.model.singleDropdownValue];
|
||||
}
|
||||
|
||||
if (angular.isArray($scope.model.config.items)) {
|
||||
if (Utilities.isArray($scope.model.config.items)) {
|
||||
//PP: I dont think this will happen, but we have tests that expect it to happen..
|
||||
//if array is simple values, convert to array of objects
|
||||
if(!angular.isObject($scope.model.config.items[0])){
|
||||
if (!Utilities.isObject($scope.model.config.items[0])){
|
||||
$scope.model.config.items = convertArrayToDictionaryArray($scope.model.config.items);
|
||||
}
|
||||
}
|
||||
else if (angular.isObject($scope.model.config.items)) {
|
||||
else if (Utilities.isObject($scope.model.config.items)) {
|
||||
$scope.model.config.items = convertObjectToDictionaryArray($scope.model.config.items);
|
||||
}
|
||||
else {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user