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:
Shannon
2018-04-11 09:21:12 +10:00
6 changed files with 475 additions and 507 deletions

View File

@@ -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) {
@@ -246,11 +246,9 @@ 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;
}
scope.selectVariant = function (event, 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: "&?",

View File

@@ -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">

View File

@@ -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"
@@ -93,4 +92,4 @@
</umb-editor-view>
</form>
</div>
</div>

View File

@@ -8,21 +8,20 @@
*/
function ContentEditController($scope, $routeParams, contentResource) {
function scaffoldEmpty() {
return contentResource.getScaffold($routeParams.id, $routeParams.doctype);
}
function scaffoldBlueprint() {
return contentResource.getBlueprintScaffold($routeParams.id, $routeParams.blueprintId);
}
function scaffoldEmpty() {
return contentResource.getScaffold($routeParams.id, $routeParams.doctype);
}
function scaffoldBlueprint() {
return contentResource.getBlueprintScaffold($routeParams.id, $routeParams.blueprintId);
}
$scope.contentId = $routeParams.id;
$scope.saveMethod = contentResource.save;
$scope.getMethod = contentResource.getById;
$scope.getScaffoldMethod = $routeParams.blueprintId ? scaffoldBlueprint : scaffoldEmpty;
$scope.page = $routeParams.page;
$scope.isNew = $routeParams.create;
$scope.contentId = $routeParams.id;
$scope.saveMethod = contentResource.save;
$scope.getMethod = contentResource.getById;
$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);

View File

@@ -1,11 +1,12 @@
<div data-element="editor-content" ng-controller="Umbraco.Editors.Content.EditController">
<content-editor create-options="createOptions"
content-id="contentId"
page="page"
save-method="saveMethod"
get-method="getMethod"
get-scaffold-method="getScaffoldMethod"
tree-alias="content"
is-new="isNew">
</content-editor>
<content-editor create-options="createOptions"
content-id="contentId"
page="page"
save-method="saveMethod"
get-method="getMethod"
get-scaffold-method="getScaffoldMethod"
tree-alias="content"
is-new="isNew"
language-id="languageId">
</content-editor>
</div>