render tab bar in content section
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
'use strict';
|
||||
|
||||
/** This directive is used to render out the current variant tabs and properties and exposes an API for other directives to consume */
|
||||
function tabbedContentDirective($timeout) {
|
||||
function tabbedContentDirective($timeout, $filter) {
|
||||
|
||||
function link($scope, $element) {
|
||||
|
||||
@@ -15,7 +15,8 @@
|
||||
scrollableNode.addEventListener("scroll", onScroll);
|
||||
scrollableNode.addEventListener("mousewheel", cancelScrollTween);
|
||||
|
||||
$scope.activeAppId = '1';
|
||||
$scope.activeTabKey = '';
|
||||
$scope.tabs = [];
|
||||
|
||||
function onScroll(event) {
|
||||
|
||||
@@ -97,6 +98,22 @@
|
||||
$scope.registerPropertyGroup = function(element, appAnchor) {
|
||||
propertyGroupNodesDictionary[appAnchor] = element;
|
||||
};
|
||||
|
||||
$scope.setActiveTab = function(tab) {
|
||||
$scope.activeTabKey = tab.key;
|
||||
$scope.content.tabs.forEach(tab => tab.active = false);
|
||||
tab.active = true;
|
||||
};
|
||||
|
||||
$scope.$watchCollection('content.tabs', () => {
|
||||
$scope.tabs = $filter("filter")($scope.content.tabs, (tab) => {
|
||||
return tab.type === 1;
|
||||
});
|
||||
|
||||
if ($scope.tabs.length > 0 && !$scope.activeTabKey) {
|
||||
$scope.activeTabKey = $scope.tabs[0].key;
|
||||
}
|
||||
});
|
||||
|
||||
$scope.$on("editors.apps.appChanged", function($event, $args) {
|
||||
// if app changed to this app, then we want to scroll to the current anchor
|
||||
@@ -104,9 +121,6 @@
|
||||
var activeAnchor = getActiveAnchor();
|
||||
$timeout(jumpTo.bind(null, [activeAnchor.id]));
|
||||
}
|
||||
|
||||
$scope.activeAppId = $args.app.id;
|
||||
$scope.$evalAsync();
|
||||
});
|
||||
|
||||
$scope.$on("editors.apps.appAnchorChanged", function($event, $args) {
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* A component to render the editor tab bar
|
||||
*/
|
||||
|
||||
function umbEditorTabBarController() {
|
||||
|
||||
const vm = this;
|
||||
|
||||
}
|
||||
|
||||
const umbEditorTabBarComponent = {
|
||||
templateUrl: 'views/components/editor/umb-editor-tab-bar.html',
|
||||
controllerAs: 'vm',
|
||||
transclude: true,
|
||||
controller: umbEditorTabBarController
|
||||
};
|
||||
|
||||
angular.module('umbraco.directives').component('umbEditorTabBar', umbEditorTabBarComponent);
|
||||
})();
|
||||
@@ -160,6 +160,28 @@ input.umb-editor-header__name-input:disabled {
|
||||
}
|
||||
}
|
||||
|
||||
// Tab bar
|
||||
.umb-editor-tab-bar {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: @zIndexEditor;
|
||||
margin: -20px -20px 20px -20px;
|
||||
padding: 0 20px;
|
||||
background: white;
|
||||
|
||||
.umb-tabs-nav {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.umb-tab {
|
||||
button {
|
||||
padding: 15px 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// container
|
||||
.umb-editor-container {
|
||||
position: absolute;
|
||||
|
||||
@@ -1,6 +1,30 @@
|
||||
<div>
|
||||
<ng-form name="tabbedContentForm">
|
||||
<div class="umb-group-panel" retrive-dom-element="registerPropertyGroup(element[0], attributes.appAnchor)" data-app-anchor="{{group.id}}" data-element="group-{{group.alias}}" ng-repeat="group in content.tabs track by group.id">
|
||||
|
||||
<umb-editor-tab-bar>
|
||||
<umb-tabs-nav tabs="tabs" on-tab-change="setActiveTab(tab)"></umb-tabs-nav>
|
||||
</umb-editor-tab-bar>
|
||||
|
||||
<umb-box ng-repeat="tab in tabs" ng-show="tab.key === activeTabKey && tab.properties.length > 0">
|
||||
<umb-box-content>
|
||||
<umb-property
|
||||
data-element="property-{{property.alias}}"
|
||||
ng-repeat="property in tab.properties track by property.alias"
|
||||
property="property"
|
||||
show-inherit="propertyEditorDisabled(property)"
|
||||
inherits-from="defaultVariant.displayName">
|
||||
|
||||
<div ng-class="{'o-40 cursor-not-allowed': propertyEditorDisabled(property) }">
|
||||
<umb-property-editor
|
||||
model="property"
|
||||
preview="propertyEditorDisabled(property)">
|
||||
</umb-property-editor>
|
||||
</div>
|
||||
</umb-property>
|
||||
</umb-box-content>
|
||||
</umb-box>
|
||||
|
||||
<div class="umb-group-panel" retrive-dom-element="registerPropertyGroup(element[0], attributes.appAnchor)" data-app-anchor="{{group.id}}" data-element="group-{{group.alias}}" ng-repeat="group in content.tabs track by group.id" ng-show="group.parentKey === activeTabKey || tabs.length === 0">
|
||||
<div class="umb-group-panel__header">
|
||||
<div id="group-{{group.id}}">{{ group.label }}</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
<div data-element="editor-tab-bar" class="umb-editor-tab-bar">
|
||||
<ng-transclude></ng-transclude>
|
||||
</div>
|
||||
Reference in New Issue
Block a user