diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/editor/umbeditorsubviews.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/editor/umbeditorsubviews.directive.js
index 1ddb089632..64b80412f5 100644
--- a/src/Umbraco.Web.UI.Client/src/common/directives/components/editor/umbeditorsubviews.directive.js
+++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/editor/umbeditorsubviews.directive.js
@@ -4,22 +4,20 @@ angular.module("umbraco.directives")
restrict: 'E',
replace: true,
templateUrl: 'views/components/editor/umb-editor-sub-views.html',
+ scope: {
+ subViews: "=",
+ model: "="
+ },
link: function (scope, element, attrs, ctrl) {
- scope.tools = [];
scope.activeView = {};
// set toolbar from selected navigation item
- function setToolBar(items) {
-
- scope.tools = [];
+ function setActiveView(items) {
for (var index = 0; index < items.length; index++) {
- var item = items[index];
- if(item.active && item.tools) {
- scope.tools = item.tools;
- }
+ var item = items[index];
if(item.active && item.view) {
scope.activeView = item;
@@ -28,10 +26,9 @@ angular.module("umbraco.directives")
}
// watch for navigation changes
- scope.$watch('page.navigation', function(newValue, oldValue) {
+ scope.$watch('subViews', function(newValue, oldValue) {
if (newValue) {
-
- setToolBar(newValue);
+ setActiveView(newValue);
}
},true);
diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/editor/umbeditortoolbar.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/editor/umbeditortoolbar.directive.js
new file mode 100644
index 0000000000..0e6e390fbc
--- /dev/null
+++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/editor/umbeditortoolbar.directive.js
@@ -0,0 +1,11 @@
+angular.module("umbraco.directives")
+ .directive('umbEditorToolbar', function () {
+ return {
+ restrict: 'E',
+ replace: true,
+ templateUrl: 'views/components/editor/umb-editor-toolbar.html',
+ scope: {
+ tools: "="
+ }
+ };
+ });
\ No newline at end of file
diff --git a/src/Umbraco.Web.UI.Client/src/less/belle.less b/src/Umbraco.Web.UI.Client/src/less/belle.less
index 36152e0b6c..4c2ed6a436 100644
--- a/src/Umbraco.Web.UI.Client/src/less/belle.less
+++ b/src/Umbraco.Web.UI.Client/src/less/belle.less
@@ -92,6 +92,7 @@
@import "components/umb-sub-views.less";
@import "components/umb-editor-navigation.less";
@import "components/umb-editor-sub-views.less";
+@import "components/umb-editor-toolbar.less";
@import "components/umb-file-dropzone.less";
diff --git a/src/Umbraco.Web.UI.Client/src/less/components/umb-editor-sub-views.less b/src/Umbraco.Web.UI.Client/src/less/components/umb-editor-sub-views.less
index a85300c957..ac034cf33b 100644
--- a/src/Umbraco.Web.UI.Client/src/less/components/umb-editor-sub-views.less
+++ b/src/Umbraco.Web.UI.Client/src/less/components/umb-editor-sub-views.less
@@ -20,18 +20,4 @@
.sub-view-column-section {
margin-bottom: 20px;
-}
-
-/* ---------- TOOLS ---------- */
-
-.umb-editor-sub-views-tools {
- display: flex;
- justify-content: flex-end;
- margin-bottom: 20px;
- height: 25px;
-}
-
-.umb-editor-sub-views-tool {
- margin-left: 20px;
- cursor: pointer;
}
\ No newline at end of file
diff --git a/src/Umbraco.Web.UI.Client/src/less/components/umb-editor-toolbar.less b/src/Umbraco.Web.UI.Client/src/less/components/umb-editor-toolbar.less
new file mode 100644
index 0000000000..f2b6995f49
--- /dev/null
+++ b/src/Umbraco.Web.UI.Client/src/less/components/umb-editor-toolbar.less
@@ -0,0 +1,11 @@
+.umb-editor-toolbar {
+ display: flex;
+ justify-content: flex-end;
+ margin-bottom: 20px;
+ height: 25px;
+}
+
+.umb-editor-toolbar-tool {
+ margin-left: 20px;
+ cursor: pointer;
+}
\ No newline at end of file
diff --git a/src/Umbraco.Web.UI.Client/src/views/components/editor/umb-editor-sub-views.html b/src/Umbraco.Web.UI.Client/src/views/components/editor/umb-editor-sub-views.html
index a25918474b..fefe12e233 100644
--- a/src/Umbraco.Web.UI.Client/src/views/components/editor/umb-editor-sub-views.html
+++ b/src/Umbraco.Web.UI.Client/src/views/components/editor/umb-editor-sub-views.html
@@ -1,13 +1,5 @@
diff --git a/src/Umbraco.Web.UI.Client/src/views/components/editor/umb-editor-toolbar.html b/src/Umbraco.Web.UI.Client/src/views/components/editor/umb-editor-toolbar.html
new file mode 100644
index 0000000000..e66cb510d2
--- /dev/null
+++ b/src/Umbraco.Web.UI.Client/src/views/components/editor/umb-editor-toolbar.html
@@ -0,0 +1,5 @@
+
\ No newline at end of file
diff --git a/src/Umbraco.Web.UI.Client/src/views/documenttype/edit.controller.js b/src/Umbraco.Web.UI.Client/src/views/documenttype/edit.controller.js
index 2dd88f312b..3080acac45 100644
--- a/src/Umbraco.Web.UI.Client/src/views/documenttype/edit.controller.js
+++ b/src/Umbraco.Web.UI.Client/src/views/documenttype/edit.controller.js
@@ -6,169 +6,163 @@
* @description
* The controller for the content type editor
*/
-function DocumentTypeEditController($scope, $rootScope, $routeParams, $log, contentTypeResource, entityResource, dataTypeResource, editorState, contentEditingHelper, formHelper, navigationService, iconHelper, contentTypeHelper, dataTypeHelper) {
+(function() {
+ 'use strict';
- $scope.page = {actions: [], menu: [], subViews: [] };
- $scope.currentNode = null; //the editors affiliated node
+ function DocumentTypeEditController($routeParams, contentTypeResource, dataTypeResource, editorState, contentEditingHelper, formHelper, navigationService, iconHelper, contentTypeHelper) {
- $scope.page.navigation = [
- {
- "name": "Design",
- "icon": "document-dashed-line",
- "view": "views/documentType/views/design/design.html",
- "active": true,
- "tools": [
+ var vm = this;
+
+ vm.save = save;
+
+ vm.currentNode = null;
+ vm.contentType = {};
+ vm.page = {};
+ vm.page.navigation = [
{
- "name": "Compositions",
- "icon": "merge",
- "action": function() {
- $scope.page.openCompositionsDialog();
- }
+ "name": "Design",
+ "icon": "document-dashed-line",
+ "view": "views/documentType/views/design/design.html",
+ "active": true
},
{
- "name": "Reorder",
- "icon": "navigation",
- "action": function() {
- $scope.page.toggleSortingMode();
- }
+ "name": "List view",
+ "icon": "list",
+ "view": "views/documentType/views/listview/listview.html"
+ },
+ {
+ "name": "Permissions",
+ "icon": "keychain",
+ "view": "views/documentType/views/permissions/permissions.html"
+ },
+ {
+ "name": "Templates",
+ "icon": "layout",
+ "view": "views/documentType/views/templates/templates.html"
}
- ]
- },
- {
- "name": "List view",
- "icon": "list",
- "view": "views/documentType/views/listview/listview.html"
- },
- {
- "name": "Permissions",
- "icon": "keychain",
- "view": "views/documentType/views/permissions/permissions.html"
- },
- {
- "name": "Templates",
- "icon": "layout",
- "view": "views/documentType/views/templates/templates.html"
- }
- ];
-
- if ($routeParams.create) {
- //we are creating so get an empty data type item
- contentTypeResource.getScaffold($routeParams.id)
- .then(function(dt) {
- init(dt);
- });
- }
- else {
- contentTypeResource.getById($routeParams.id).then(function(dt){
- init(dt);
-
- syncTreeNode($scope.contentType, dt.path, true);
- });
- }
-
-
- /* ---------- SAVE ---------- */
-
- $scope.save = function() {
-
- //perform any pre-save logic here
-
- contentTypeResource.save($scope.contentType).then(function(dt){
-
- formHelper.resetForm({ scope: $scope, notifications: dt.notifications });
- contentEditingHelper.handleSuccessfulSave({
- scope: $scope,
- savedContent: dt,
- rebindCallback: function() {
-
- }
- });
-
- //post save logic here -the saved doctype returns as a new object
- init(dt);
-
- syncTreeNode($scope.contentType, dt.path);
- });
- };
+ ];
- function init(contentType){
-
- $scope.contentType = contentType;
-
- // set all tab to inactive
- if( $scope.contentType.groups.length !== 0 ) {
- angular.forEach($scope.contentType.groups, function(group){
- // set state
- group.tabState = "inActive";
-
- // push init/placeholder property
- contentTypeHelper.addInitProperty(group);
-
- angular.forEach(group.properties, function(property){
-
- // get data type detaisl for each property
- getDataTypeDetails(property);
-
+ if ($routeParams.create) {
+ //we are creating so get an empty data type item
+ contentTypeResource.getScaffold($routeParams.id)
+ .then(function(dt) {
+ init(dt);
});
+ }
+ else {
+ contentTypeResource.getById($routeParams.id).then(function(dt){
+ init(dt);
-
+ syncTreeNode(vm.contentType, dt.path, true);
});
}
- // convert legacy icons
- convertLegacyIcons();
- //set a shared state
- editorState.set($scope.contentType);
+ /* ---------- SAVE ---------- */
- // add init tab
- contentTypeHelper.addInitTab($scope.contentType);
+ function save() {
- }
+ //perform any pre-save logic here
- function convertLegacyIcons() {
+ contentTypeResource.save(vm.contentType).then(function(dt){
- // convert icons for composite content types
- iconHelper.formatContentTypeIcons($scope.contentType.availableCompositeContentTypes);
+ formHelper.resetForm({ scope: vm, notifications: dt.notifications });
+ contentEditingHelper.handleSuccessfulSave({
+ scope: vm,
+ savedContent: dt,
+ rebindCallback: function() {
- // make array to store contentType icon
- var contentTypeArray = [];
-
- // push icon to array
- contentTypeArray.push({"icon":$scope.contentType.icon});
-
- // run through icon method
- iconHelper.formatContentTypeIcons(contentTypeArray);
-
- // set icon back on contentType
- $scope.contentType.icon = contentTypeArray[0].icon;
-
- }
-
- function getDataTypeDetails(property) {
-
- if( property.propertyState !== 'init' ) {
-
- dataTypeResource.getById(property.dataTypeId)
- .then(function(dataType) {
- property.dataTypeIcon = dataType.icon;
- property.dataTypeName = dataType.name;
+ }
});
+
+ //post save logic here -the saved doctype returns as a new object
+ init(dt);
+
+ syncTreeNode(vm.contentType, dt.path);
+ });
+ }
+
+
+ function init(contentType){
+
+ vm.contentType = contentType;
+
+ // set all tab to inactive
+ if( vm.contentType.groups.length !== 0 ) {
+ angular.forEach(vm.contentType.groups, function(group){
+ // set state
+ group.tabState = "inActive";
+
+ // push init/placeholder property
+ contentTypeHelper.addInitProperty(group);
+
+ angular.forEach(group.properties, function(property){
+
+ // get data type detaisl for each property
+ getDataTypeDetails(property);
+
+ });
+
+
+ });
+ }
+
+ // convert legacy icons
+ convertLegacyIcons();
+
+ //set a shared state
+ editorState.set(vm.contentType);
+
+ // add init tab
+ contentTypeHelper.addInitTab(vm.contentType);
+
+ }
+
+ function convertLegacyIcons() {
+
+ // convert icons for composite content types
+ iconHelper.formatContentTypeIcons(vm.contentType.availableCompositeContentTypes);
+
+ // make array to store contentType icon
+ var contentTypeArray = [];
+
+ // push icon to array
+ contentTypeArray.push({"icon":vm.contentType.icon});
+
+ // run through icon method
+ iconHelper.formatContentTypeIcons(contentTypeArray);
+
+ // set icon back on contentType
+ vm.contentType.icon = contentTypeArray[0].icon;
+
+ }
+
+ function getDataTypeDetails(property) {
+
+ if( property.propertyState !== 'init' ) {
+
+ dataTypeResource.getById(property.dataTypeId)
+ .then(function(dataType) {
+ property.dataTypeIcon = dataType.icon;
+ property.dataTypeName = dataType.name;
+ });
+ }
}
- }
- /** Syncs the content type to it's tree node - this occurs on first load and after saving */
- function syncTreeNode(dt, path, initialLoad) {
+ /** Syncs the content type to it's tree node - this occurs on first load and after saving */
+ function syncTreeNode(dt, path, initialLoad) {
- navigationService.syncTree({ tree: "documenttype", path: path.split(","), forceReload: initialLoad !== true }).then(function (syncArgs) {
- $scope.currentNode = syncArgs.node;
- });
+ navigationService.syncTree({ tree: "documenttype", path: path.split(","), forceReload: initialLoad !== true }).then(function (syncArgs) {
+ vm.currentNode = syncArgs.node;
+ });
+
+ }
}
-}
+ angular.module("umbraco").controller("Umbraco.Editors.DocumentType.EditController", DocumentTypeEditController);
-angular.module("umbraco").controller("Umbraco.Editors.DocumentType.EditController", DocumentTypeEditController);
+})();
diff --git a/src/Umbraco.Web.UI.Client/src/views/documenttype/edit.html b/src/Umbraco.Web.UI.Client/src/views/documenttype/edit.html
index 5c7b2dc3df..38b7e5a3e1 100644
--- a/src/Umbraco.Web.UI.Client/src/views/documenttype/edit.html
+++ b/src/Umbraco.Web.UI.Client/src/views/documenttype/edit.html
@@ -1,23 +1,24 @@
-