Merge branch 'temp8' into temp8-ui-cleanup

This commit is contained in:
Mads Rasmussen
2018-09-14 12:35:58 +02:00
16 changed files with 103 additions and 40 deletions

View File

@@ -27,10 +27,13 @@
function init(content) {
// set first app to active
content.apps[0].active = true;
if (infiniteMode) {
createInfiniteModeButtons(content);
} else {
createButtons(content);
createButtons(content, content.apps[0]);
}
editorState.set($scope.content);
@@ -135,7 +138,22 @@
}
function createButtons(content) {
/**
* Create the save/publish/preview buttons for the view
* @param {any} content the content node
* @param {any} app the active content app
*/
function createButtons(content, app) {
// only create the save/publish/preview buttons if the
// content app is "Conent"
if(app && app.alias !== "umbContent" && app.alias !== "umbInfo") {
$scope.defaultButton = null;
$scope.subButtons = null;
$scope.page.showPreviewButton = false;
return;
}
$scope.page.buttonGroupState = "init";
var buttons = contentEditingHelper.configureContentEditorButtons({
create: $scope.page.isNew,
@@ -147,9 +165,10 @@
unPublish: $scope.unPublish
}
});
$scope.defaultButton = buttons.defaultButton;
$scope.subButtons = buttons.subButtons;
$scope.page.showPreviewButton = true;
}
@@ -555,6 +574,14 @@
});
};
/**
* Call back when a content app changes
* @param {any} app
*/
$scope.appChanged = function(app) {
createButtons($scope.content, app);
};
function moveNode(node, target) {
contentResource.move({ "parentId": target.id, "id": node.id })

View File

@@ -315,7 +315,7 @@
// load audit trail when on the info tab
evts.push(eventsService.on("app.tabChange", function (event, args) {
$timeout(function(){
if (args.alias === "info") {
if (args.alias === "umbInfo") {
isInfoTab = true;
loadAuditTrail();
} else {

View File

@@ -28,12 +28,23 @@
var vm = this;
vm.$onInit = onInit;
vm.$postLink = postLink;
vm.$onDestroy = onDestroy;
vm.selectVariant = selectVariant;
vm.openSplitView = openSplitView;
vm.selectApp = selectApp;
function onInit() {
// disable the name field if the active content app is not "Content"
vm.nameDisabled = false;
angular.forEach(vm.editor.content.apps, function(app){
if(app.active && app.alias !== "umbContent" && app.alias !== "umbInfo") {
vm.nameDisabled = true;
}
});
}
/** Called when the component has linked all elements, this is when the form controller is available */
function postLink() {
@@ -67,6 +78,12 @@
* @param {any} item
*/
function selectApp(item) {
// disable the name field if the active content app is not "Content" or "Info"
vm.nameDisabled = false;
if(item && item.alias !== "umbContent" && item.alias !== "umbInfo") {
vm.nameDisabled = true;
}
// call the callback if any is registered
if(vm.onSelectApp) {
vm.onSelectApp({"app": item});
}

View File

@@ -9,7 +9,8 @@
bindings: {
page: "<",
content: "<", //TODO: Not sure if this should be = since we are changing the 'active' property of a variant
culture: "<"
culture: "<",
onSelectApp: "&?"
},
controllerAs: 'vm',
controller: umbVariantContentEditorsController
@@ -39,8 +40,6 @@
/** Called when the component initializes */
function onInit() {
// set first app to active
vm.content.apps[0].active = true;
prevContentDateUpdated = angular.copy(vm.content.updateDate);
setActiveCulture();
}
@@ -192,7 +191,7 @@
//then assign the variant to a view model to the content app
var contentApp = _.find(variant.apps, function (a) {
return a.alias === "content";
return a.alias === "umbContent";
});
contentApp.viewModel = variant;
@@ -222,7 +221,7 @@
var editor = vm.editors[e];
for (var i = 0; i < editor.content.apps.length; i++) {
var app = editor.content.apps[i];
if (app.alias === "content") {
if (app.alias === "umbContent") {
app.active = true;
}
else {
@@ -312,6 +311,9 @@
if(app && app.alias) {
activeAppAlias = app.alias;
}
if(vm.onSelectApp) {
vm.onSelectApp({"app": app});
}
}
}

View File

@@ -97,7 +97,7 @@
templateUrl: 'views/components/editor/umb-editor-content-header.html',
scope: {
name: "=",
nameLocked: "=",
nameDisabled: "<?",
menu: "=",
hideMenu: "<?",
variants: "=",

View File

@@ -102,8 +102,14 @@ input.umb-editor-header__name-input {
background: @white;
border: 1px solid @gray-8;
&:hover {
background-color: @gray-10;
border: 1px solid @gray-8;
border-color: @turquoise-d1;
}
}
input.umb-editor-header__name-input:disabled {
background-color: @gray-10;
&:hover{
border-color: @gray-8;
}
}
@@ -248,15 +254,17 @@ a.umb-variant-switcher__toggle {
height: @editorFooterHeight;
padding: 10px 20px;
background: @white;
// box-shadow: 0 -1px 3px 0 rgba(0, 0, 0, 0.16);
border-top: 1px solid @gray-9;
z-index: 1;
bottom: 0;
display: flex;
align-items: center;
}
.umb-editor-footer-content {
display: flex;
align-items: center;
flex: 1 1 auto;
}
.umb-editor-footer-content__right-side {

View File

@@ -9,7 +9,8 @@
<umb-variant-content-editors
page="page"
content="content"
culture="culture">
culture="culture"
on-select-app="appChanged(app)">
</umb-variant-content-editors>
<umb-editor-footer>
@@ -37,14 +38,14 @@
<umb-button
alias="preview"
ng-if="!page.isNew && content.allowPreview"
ng-if="!page.isNew && content.allowPreview && page.showPreviewButton"
type="button"
button-style="info"
action="preview(content)"
label="Preview page"
label-key="buttons_showPage">
</umb-button>
<umb-button-group
ng-if="defaultButton && !content.trashed && !infiniteModel.infiniteMode"
button-style="success"

View File

@@ -14,5 +14,12 @@
</div>
</div>
<umb-empty-state
ng-if="content.tabs.length === 0"
position="center">
<localize key="content_noProperties"></localize>
</umb-empty-state>
</ng-form>
</div>

View File

@@ -10,6 +10,7 @@
menu="vm.page.menu"
hide-menu="vm.page.hideActionsMenu"
name="vm.editor.content.name"
name-disabled="vm.nameDisabled"
navigation="vm.editor.content.apps"
on-select-navigation-item="vm.selectApp(item)"
variants="vm.editor.content.variants"

View File

@@ -13,19 +13,20 @@
<div id="nameField" style="flex: 1 1 auto;">
<div class="umb-editor-header__name-wrapper">
<ng-form name="headerNameForm">
<input data-element="editor-name-field"
type="text"
class="umb-editor-header__name-input"
localize="placeholder"
placeholder="@placeholders_entername"
name="headerName"
ng-show="!nameLocked"
ng-model="name"
ng-class="{'name-is-empty': $parent.name===null || $parent.name===''}"
umb-auto-focus
val-server-field="{{serverValidationNameField}}"
required
autocomplete="off" />
<input
data-element="editor-name-field"
type="text"
class="umb-editor-header__name-input"
localize="placeholder"
placeholder="@placeholders_entername"
name="headerName"
ng-model="name"
ng-class="{'name-is-empty': $parent.name===null || $parent.name===''}"
ng-disabled="nameDisabled"
umb-auto-focus
val-server-field="{{serverValidationNameField}}"
required
autocomplete="off" />
</ng-form>
<a ng-if="variants.length > 0 && hideChangeVariant !== true" class="umb-variant-switcher__toggle" href="" ng-click="vm.dropdownOpen = !vm.dropdownOpen">
@@ -49,8 +50,6 @@
</div>
<div class="umb-panel-header-name" ng-if="nameLocked">{{ name }}</div>
</div>
</div>