v8: Fix general localization (#4274)

This commit is contained in:
Bjarne Fyrstenborg
2019-01-30 14:01:22 +01:00
committed by Sebastiaan Janssen
parent f1b168fc46
commit 69af591b78
11 changed files with 247 additions and 107 deletions

View File

@@ -0,0 +1,58 @@
(function () {
'use strict';
function MemberGroupNodeInfoDirective(eventsService, userService, dateHelper) {
function link(scope, element, attrs, ctrl) {
var evts = [];
function onInit() {
// make sure dates are formatted to the user's locale
formatDatesToLocal();
}
function formatDatesToLocal() {
// get current backoffice user and format dates
userService.getCurrentUser().then(function (currentUser) {
scope.node.createDateFormatted = dateHelper.getLocalDate(scope.node.createDate, currentUser.locale, 'LLL');
scope.node.updateDateFormatted = dateHelper.getLocalDate(scope.node.updateDate, currentUser.locale, 'LLL');
});
}
// watch for content updates - reload content when node is saved, published etc.
scope.$watch('node.updateDate', function(newValue, oldValue){
if(!newValue) { return; }
if(newValue === oldValue) { return; }
// Update the create and update dates
formatDatesToLocal();
});
//ensure to unregister from all events!
scope.$on('$destroy', function () {
for (var e in evts) {
eventsService.unsubscribe(evts[e]);
}
});
onInit();
}
var directive = {
restrict: 'E',
replace: true,
templateUrl: 'views/components/member/umb-membergroup-node-info.html',
scope: {
node: "="
},
link: link
};
return directive;
}
angular.module('umbraco.directives').directive('umbMembergroupNodeInfo', MemberGroupNodeInfoDirective);
})();

View File

@@ -8,7 +8,7 @@
<umb-drawer-content>
<!-- Tours -->
<!-- Tours -->
<div class="umb-help-section" ng-if="vm.tours" data-element="help-tours">
<h5 class="umb-help-section__title">Tours</h5>
@@ -47,72 +47,71 @@
</div>
</div>
</div>
</div>
<!-- Show in custom help dashboard -->
<!-- Show in custom help dashboard -->
<div class="umb-help-section" data-element="help-custom-dashboard" ng-if="vm.customDashboard.length > 0">
<div ng-repeat="tab in vm.customDashboard">
<div ng-repeat="property in tab.properties">
<div>
<h5 ng-if="property.caption">{{property.caption}}</h5>
<div ng-include="property.path"></div>
</div>
<div ng-repeat="tab in vm.customDashboard">
<div ng-repeat="property in tab.properties">
<div>
<h5 ng-if="property.caption">{{property.caption}}</h5>
<div ng-include="property.path"></div>
</div>
</div>
</div>
</div>
<!-- Help Content -->
<!-- Help Content -->
<div class="umb-help-section" data-element="help-articles" ng-if="vm.topics.length > 0">
<h5 class="umb-help-section__title">Articles</h5>
<ul class="umb-help-list">
<li class="umb-help-list-item" ng-repeat="topic in vm.topics track by $index">
<a class="umb-help-list-item__content" data-element="help-article-{{topic.name}}" target="_blank" ng-href="{{topic.url}}?utm_source=core&utm_medium=help&utm_content=link&utm_campaign=tv">
<span>
<span class="umb-help-list-item__title">
<span class="bold">{{topic.name}}</span>
<span class="umb-help-list-item__open-icon icon-out"></span>
</span>
<span class="umb-help-list-item__description">{{topic.description}}</span>
<ul class="umb-help-list">
<li class="umb-help-list-item" ng-repeat="topic in vm.topics track by $index">
<a class="umb-help-list-item__content" data-element="help-article-{{topic.name}}" target="_blank" ng-href="{{topic.url}}?utm_source=core&utm_medium=help&utm_content=link&utm_campaign=tv">
<span>
<span class="umb-help-list-item__title">
<span class="bold">{{topic.name}}</span>
<span class="umb-help-list-item__open-icon icon-out"></span>
</span>
</a>
</li>
</ul>
</div>
<span class="umb-help-list-item__description">{{topic.description}}</span>
</span>
</a>
</li>
</ul>
</div>
<!-- Umbraco tv content -->
<!-- Umbraco tv content -->
<div class="umb-help-section" data-element="help-videos" ng-if="vm.hasAccessToSettings">
<h5 class="umb-help-section__title" ng-if="vm.videos.length > 0">Videos</h5>
<ul class="umb-help-list">
<li class="umb-help-list-item" ng-repeat="video in vm.videos track by $index">
<a class="umb-help-list-item__content" data-element="help-article-{{video.title}}" target="_blank" ng-href="{{video.link}}?utm_source=core&utm_medium=help&utm_content=link&utm_campaign=tv">
<i class="umb-help-list-item__icon icon-tv-old"></i>
<span class="umb-help-list-item__title">{{video.title}}</span>
<i class="umb-help-list-item__open-icon icon-out"></i>
</a>
</li>
</ul>
</div>
<ul class="umb-help-list">
<li class="umb-help-list-item" ng-repeat="video in vm.videos track by $index">
<a class="umb-help-list-item__content" data-element="help-article-{{video.title}}" target="_blank" ng-href="{{video.link}}?utm_source=core&utm_medium=help&utm_content=link&utm_campaign=tv">
<i class="umb-help-list-item__icon icon-tv-old"></i>
<span class="umb-help-list-item__title">{{video.title}}</span>
<i class="umb-help-list-item__open-icon icon-out"></i>
</a>
</li>
</ul>
</div>
<!-- Links -->
<!-- Links -->
<div class="umb-help-section" data-element="help-links" ng-if="vm.hasAccessToSettings">
<a data-element="help-link-umbraco-tv" class="umb-help-badge" target="_blank" href="https://umbraco.tv?utm_source=core&utm_medium=help&utm_content=link&utm_campaign=tv">
<i class="umb-help-badge__icon icon-tv-old"></i>
<div class="umb-help-badge__title">Visit umbraco.tv</div>
<small>
<localize key="help_theBestUmbracoVideoTutorials">The best Umbraco video tutorials</localize>
</small>
</a>
<i class="umb-help-badge__icon icon-tv-old"></i>
<div class="umb-help-badge__title">Visit umbraco.tv</div>
<small>
<localize key="help_theBestUmbracoVideoTutorials">The best Umbraco video tutorials</localize>
</small>
</a>
<a data-element="help-link-our-umbraco" class="umb-help-badge" target="_blank" href="https://our.umbraco.com?utm_source=core&utm_medium=help&utm_content=link&utm_campaign=our">
<i class="umb-help-badge__icon icon-favorite"></i>
<i class="umb-help-badge__icon icon-favorite"></i>
<div class="umb-help-badge__title">Visit our.umbraco.com</div>
<small>
<localize key="defaultdialogs_theFriendliestCommunity">The friendliest community</localize>
</small>
</a>
</div>
<div class="umb-help-badge__title">Visit our.umbraco.com</div>
<small>
<localize key="defaultdialogs_theFriendliestCommunity">The friendliest community</localize>
</small>
</a>
</div>
</umb-drawer-content>
@@ -123,7 +122,7 @@
alias="close"
type="button"
button-style="link"
label="Close"
label-key="general_close"
action="vm.closeDrawer()">
</umb-button>
</div>
@@ -132,4 +131,4 @@
</umb-drawer-view>
</div>
</div>

View File

@@ -0,0 +1,30 @@
<div class="umb-package-details">
<div class="umb-package-details__main-content">
<umb-box>
<umb-box-header title-key="content_membergroup"></umb-box-header>
<umb-box-content class="block-form">
<umb-empty-state size="small">
<localize key="member_memberGroupNoProperties">Member groups have no additional properties for editing.</localize>
</umb-empty-state>
</umb-box-content>
</umb-box>
</div>
<div class="umb-package-details__sidebar">
<umb-box data-element="node-info-general">
<umb-box-header title-key="general_general"></umb-box-header>
<umb-box-content class="block-form">
<umb-control-group ng-if="node.id !== 0" data-element="node-info-id" label="Id">
<div>{{ node.id }}</div>
<small>{{ node.key }}</small>
</umb-control-group>
</umb-box-content>
</umb-box>
</div>
</div>

View File

@@ -16,8 +16,7 @@ function MacrosEditController($scope, $q, $routeParams, macroResource, editorSta
vm.page.loading = false;
vm.page.saveButtonState = "init";
vm.page.menu = {}
vm.labels = {};
function toggleValue(key) {
vm.macro[key] = !vm.macro[key];
@@ -132,21 +131,32 @@ function MacrosEditController($scope, $q, $routeParams, macroResource, editorSta
vm.page.loading = false;
});
vm.page.navigation = [
{
"name": "Settings",
"alias": "settings",
"icon": "icon-settings",
"view": "views/macros/views/settings.html",
"active": true
},
{
"name": "Parameters",
"alias": "parameters",
"icon": "icon-list",
"view": "views/macros/views/parameters.html"
}
var labelKeys = [
"general_settings",
"macro_parameters"
];
localizationService.localizeMany(labelKeys).then(function (values) {
// navigation
vm.labels.settings = values[0];
vm.labels.parameters = values[1];
vm.page.navigation = [
{
"name": vm.labels.settings,
"alias": "settings",
"icon": "icon-settings",
"view": "views/macros/views/settings.html",
"active": true
},
{
"name": vm.labels.parameters,
"alias": "parameters",
"icon": "icon-list",
"view": "views/macros/views/parameters.html"
}
];
});
}
init();

View File

@@ -47,7 +47,6 @@ function MacrosParametersController($scope, editorService) {
parameter.key = newParameter.key;
parameter.label = newParameter.label;
parameter.editor = newParameter.editor;
parameter.editor = newParameter.editor;
$scope.model.setDirty();
});
}

View File

@@ -2,8 +2,8 @@
<umb-box-content>
<div class="sub-view-columns">
<div class="sub-view-column-left">
<h5>Parameters</h5>
<small>Define the parameters hat should be available when using his macro</small>
<h5><localize key="macro_parameters">Parameters</localize></h5>
<small>Define the parameters that should be available when using this macro.</small>
</div>
<div class="sub-view-column-right">
<div class="umb-property-editor umb-stylesheet-rules form-horizontal" ng-controller="Umbraco.Editors.Macros.ParametersController" >

View File

@@ -19,10 +19,11 @@
<umb-editor-container class="form-horizontal">
<p><localize key="member_memberGroupNoProperties">Member groups have no additional properties for editing.</localize></p>
<umb-membergroup-node-info ng-if="content"
node="content">
</umb-membergroup-node-info>
</umb-editor-container>
<umb-editor-footer>