Skip to content

Commit

Permalink
Replace angular.copy with Utilities.copy
Browse files Browse the repository at this point in the history
  • Loading branch information
BatJan authored and nul800sebastiaan committed Apr 14, 2020
1 parent 7f64abb commit bd26cb3
Show file tree
Hide file tree
Showing 25 changed files with 1,992 additions and 1,994 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
];

// 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;

Expand All @@ -40,10 +40,10 @@

}));

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 (Utilities.isArray(scope.user.avatars)) {
Expand All @@ -54,10 +54,10 @@
}
});
}));

scope.rememberFocus = focusService.rememberFocus;
scope.searchClick = function() {

scope.searchClick = function () {
var showSearch = appState.getSearchState("show");
appState.setSearchState("show", !showSearch);
};
Expand All @@ -71,7 +71,7 @@
};

scope.avatarClick = function () {
if(!scope.userDialog) {
if (!scope.userDialog) {
scope.userDialog = {
view: "user",
show: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

/** Called when the component initializes */
function onInit() {
prevContentDateUpdated = angular.copy(vm.content.updateDate);
prevContentDateUpdated = Utilities.copy(vm.content.updateDate);
setActiveCulture();
}

Expand All @@ -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);
}
}

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand All @@ -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;
}
});
Expand Down Expand Up @@ -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) {
Expand All @@ -313,7 +313,7 @@

//update the editors collection
insertVariantEditor(editorIndex, contentVariant);

}
}

Expand All @@ -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;
}
});
Expand Down
Loading

0 comments on commit bd26cb3

Please sign in to comment.