Merge and simplify the variants selector to use routing logic now that we have routing built in for languages, now the pending changes alert is just using the default route change
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
function ContentEditController($rootScope, $scope, $routeParams, $q, $timeout, $window, $location, appState, contentResource, entityResource, navigationService, notificationsService, angularHelper, serverValidationManager, contentEditingHelper, treeService, fileManager, formHelper, umbRequestHelper, keyboardService, umbModelMapper, editorState, $http, eventsService, relationResource, overlayService) {
|
||||
function ContentEditController($rootScope, $scope, $routeParams, $q, $timeout, $window, $location,
|
||||
appState, contentResource, entityResource, navigationService, notificationsService, angularHelper,
|
||||
serverValidationManager, contentEditingHelper, treeService, fileManager, formHelper, umbRequestHelper,
|
||||
keyboardService, umbModelMapper, editorState, $http, eventsService, relationResource, overlayService) {
|
||||
|
||||
var evts = [];
|
||||
|
||||
@@ -17,6 +20,7 @@
|
||||
$scope.page.listViewPath = null;
|
||||
$scope.page.isNew = $scope.isNew ? true : false;
|
||||
$scope.page.buttonGroupState = "init";
|
||||
$scope.page.languageId = $scope.languageId;
|
||||
$scope.allowOpen = true;
|
||||
|
||||
// add all editors to an editors array to support split view
|
||||
@@ -109,7 +113,7 @@
|
||||
$scope.editors.push(editor);
|
||||
}
|
||||
else if ($scope.editors.length === 1) {
|
||||
$scope.editors[0].content = $scope.content
|
||||
$scope.editors[0].content = $scope.content;
|
||||
}
|
||||
else {
|
||||
//fixme - need to fix something here if we are re-loading a content item that is in a split view
|
||||
@@ -253,11 +257,11 @@
|
||||
}
|
||||
else {
|
||||
|
||||
getNode();
|
||||
//Browse content nodes based on the selected tree language variant
|
||||
$scope.page.languageId ? getNode($scope.page.languageId) : getNode();
|
||||
|
||||
}
|
||||
|
||||
|
||||
$scope.unPublish = function () {
|
||||
|
||||
if (formHelper.submitForm({ scope: $scope, skipValidation: true })) {
|
||||
@@ -429,41 +433,8 @@
|
||||
$scope.page.buttonRestore = "error";
|
||||
notificationsService.error(error.headline, error.content);
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
$scope.selectVariant = function(variant, variants, form) {
|
||||
// show the discard changes dialog it there are unsaved changes
|
||||
if(form.$dirty) {
|
||||
var notification = {
|
||||
view: "confirmroutechange",
|
||||
args: {
|
||||
onDiscard: function() {
|
||||
setSelectedVariant(variant, variants);
|
||||
notificationsService.remove(notification);
|
||||
form.$setPristine();
|
||||
}
|
||||
}
|
||||
};
|
||||
notificationsService.add(notification);
|
||||
return;
|
||||
}
|
||||
// switch variant if all changes are saved
|
||||
setSelectedVariant(variant, variants);
|
||||
};
|
||||
|
||||
function setSelectedVariant(selectedVariant, variants) {
|
||||
angular.forEach(variants, function(variant) {
|
||||
variant.current = false;
|
||||
});
|
||||
|
||||
selectedVariant.current = true;
|
||||
|
||||
//go get the variant
|
||||
getNode(selectedVariant.language.id);
|
||||
}
|
||||
|
||||
$scope.closeSplitView = function (index, editor) {
|
||||
// hacky animation stuff - it will be much better when angular is upgraded
|
||||
editor.loading = true;
|
||||
@@ -554,7 +525,8 @@
|
||||
page: "=?",
|
||||
saveMethod: "&",
|
||||
getMethod: "&",
|
||||
getScaffoldMethod: "&?"
|
||||
getScaffoldMethod: "&?",
|
||||
languageId: "=?"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -204,7 +204,7 @@ Use this directive to construct a header inside the main editor window.
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
function EditorHeaderDirective(iconHelper) {
|
||||
function EditorHeaderDirective(iconHelper, $location) {
|
||||
|
||||
function link(scope, el, attr, ctrl) {
|
||||
|
||||
@@ -247,10 +247,8 @@ Use this directive to construct a header inside the main editor window.
|
||||
};
|
||||
|
||||
scope.selectVariant = function (event, variant) {
|
||||
if(scope.onSelectVariant) {
|
||||
scope.onSelectVariant({"variant": variant});
|
||||
scope.vm.dropdownOpen = false;
|
||||
}
|
||||
$location.search({ languageId: variant.language.id });
|
||||
};
|
||||
|
||||
scope.openIconPicker = function() {
|
||||
@@ -323,7 +321,6 @@ Use this directive to construct a header inside the main editor window.
|
||||
hideDescription: "@",
|
||||
descriptionLocked: "@",
|
||||
variants: "=",
|
||||
onSelectVariant: "&",
|
||||
navigation: "=",
|
||||
key: "=",
|
||||
onBack: "&?",
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<div class="umb-dashboard__content">
|
||||
|
||||
<umb-tabs-content view="true">
|
||||
<umb-tab id="tab{{tab.id}}" ng-repeat="tab in dashboard.tabs" rel="{{tab.id}}">
|
||||
<umb-tab id="tab{{tab.id}}" ng-repeat="tab in dashboard.tabs" rel="{{tab.id}}" class="row-fluid">
|
||||
|
||||
<div ng-repeat="property in tab.properties" ng-switch on="property.serverSide">
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
hide-alias="true"
|
||||
navigation="editor.content.apps"
|
||||
variants="editor.content.variants"
|
||||
on-select-variant="selectVariant(variant, editor.content.variants, contentForm)"
|
||||
on-back="backToListView()"
|
||||
show-back-button="{{page.listViewPath}}"
|
||||
split-view-open="editors.length > 1"
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
*/
|
||||
function ContentEditController($scope, $routeParams, contentResource) {
|
||||
|
||||
|
||||
|
||||
function scaffoldEmpty() {
|
||||
return contentResource.getScaffold($routeParams.id, $routeParams.doctype);
|
||||
}
|
||||
@@ -23,6 +21,7 @@ function ContentEditController($scope, $routeParams, contentResource) {
|
||||
$scope.getScaffoldMethod = $routeParams.blueprintId ? scaffoldBlueprint : scaffoldEmpty;
|
||||
$scope.page = $routeParams.page;
|
||||
$scope.isNew = $routeParams.create;
|
||||
$scope.languageId = $routeParams.languageId;
|
||||
}
|
||||
|
||||
angular.module("umbraco").controller("Umbraco.Editors.Content.EditController", ContentEditController);
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
get-method="getMethod"
|
||||
get-scaffold-method="getScaffoldMethod"
|
||||
tree-alias="content"
|
||||
is-new="isNew">
|
||||
is-new="isNew"
|
||||
language-id="languageId">
|
||||
</content-editor>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user