labels for localization support

This commit is contained in:
perploug
2013-10-09 15:07:09 +02:00
parent e3102cf95b
commit de14a6dad7
6 changed files with 79 additions and 17 deletions

View File

@@ -4,10 +4,10 @@
* @restrict E
**/
angular.module("umbraco.directives.html")
.directive('umbControlGroup', function () {
.directive('umbControlGroup', function (localizationService) {
return {
scope: {
label: "@",
label: "@label",
description: "@",
hideLabel: "@",
alias: "@"
@@ -15,6 +15,13 @@ angular.module("umbraco.directives.html")
transclude: true,
restrict: 'E',
replace: true,
templateUrl: 'views/directives/html/umb-control-group.html'
templateUrl: 'views/directives/html/umb-control-group.html',
link: function (scope, element, attr){
if(scope.label && scope.label[0] === "@"){
scope.labelstring = localizationService.localize(scope.label.substring(1));
}else{
scope.labelstring = scope.label;
}
}
};
});

View File

@@ -27,6 +27,22 @@ function tinyMceService(dialogService, $log, imageHelper, $http, $timeout, macro
'Failed to retreive entity data for id ');
},
/**
* @ngdoc method
* @name umbraco.services.tinyMceService#defaultPrevalues
* @methodOf umbraco.services.tinyMceService
*
* @description
* Returns a default configration to fallback on in case none is provided
*
*/
defaultPrevalues: function () {
var cfg = {};
cfg.toolbar = ["code", "bold", "italic", "umbracocss","alignleft", "aligncenter", "alignright", "bullist","numlist", "outdent", "indent", "link", "image", "umbmediapicker", "umbembeddialog", "umbmacro"];
cfg.stylesheets = [];
cfg.dimensions = {height: 400, width: 600};
return cfg;
},
/**
* @ngdoc method

View File

@@ -1,7 +1,7 @@
<div class="umb-panel" ng-controller="Umbraco.Dialogs.LinkPickerController">
<div class="umb-panel-body no-header with-footer compact">
<umb-pane>
<umb-control-group label="Url">
<umb-control-group label="@content_urls">
<input type="text"
placeholder="Enter url"
class="umb-editor umb-textstring"
@@ -9,12 +9,15 @@
ng-disabled="target.id"
/>
</umb-control-group>
<umb-control-group label="Title">
<input type="text"
placeholder="Enter title"
<umb-control-group label="@content_nodeName">
<input type="text"
localize="placeholder"
placeholder="@assignDomain_domainCreated:target.name"
class="umb-editor umb-textstring"
ng-model="target.name" />
</umb-control-group>
</umb-pane>
<umb-tree

View File

@@ -19,13 +19,17 @@
</div>
<div class="btn-group">
<a class="btn" ng-click="preview(content)">Preview page</a>
<a class="btn" ng-click="preview(content)">
<localize key="buttons_showPage">Preview page</localize>
</a>
</div>
<div class="btn-group">
<a class="btn btn-success" href="#" ng-click="saveAndPublish()"
prevent-default data-hotkey="ctrl+p">Publish</a>
prevent-default data-hotkey="ctrl+p">
<localize key="buttons_saveAndPublish">Publish</localize>
</a>
<a class="btn btn-success dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
@@ -33,9 +37,11 @@
<ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
<li><a href="#" ng-click="save()"
prevent-default data-hotkey="ctrl+s">Save draft</a></li>
prevent-default data-hotkey="ctrl+s">
<localize key="buttons_save">Save</localize>
</a></li>
<li ng-show="content.publishDate"><a href="#" ng-click="unPublish()"
prevent-default>Unpublish</a></li>
prevent-default><localize key="content_unPublish">Unpublish</localize></a></li>
</ul>
</div>
</div>

View File

@@ -41,9 +41,9 @@ namespace Umbraco.Web.Models.Mapping
/// setting up the properties such as Created date, udpated date, template selected, etc...
/// </remarks>
public static void MapGenericProperties<TPersisted>(
TPersisted content,
TPersisted content,
ContentItemDisplayBase<ContentPropertyDisplay, TPersisted> display,
params ContentPropertyDisplay[] customProperties)
params ContentPropertyDisplay[] customProperties)
where TPersisted : IContentBase
{
@@ -105,6 +105,7 @@ namespace Umbraco.Web.Models.Mapping
//re-assign
genericProps.Properties = contentProps;
}
protected override IEnumerable<Tab<ContentPropertyDisplay>> ResolveCore(IContentBase content)
@@ -141,7 +142,7 @@ namespace Umbraco.Web.Models.Mapping
{
Id = rootGroup.Id,
Alias = rootGroup.Name,
Label = rootGroup.Name,
Label = TranslateTab(rootGroup.Name),
Properties = aggregateProperties,
IsActive = false
});
@@ -155,16 +156,45 @@ namespace Umbraco.Web.Models.Mapping
aggregateTabs.Add(new Tab<ContentPropertyDisplay>
{
Id = 0,
Label = "Generic properties",
Label = ui.Text("general", "properties"),
Alias = "Generic properties",
Properties = Mapper.Map<IEnumerable<Property>, IEnumerable<ContentPropertyDisplay>>(orphanProperties)
});
//set the first tab to active
aggregateTabs.First().IsActive = true;
return aggregateTabs;
}
private string TranslateTab(string tabName)
{
if (!tabName.StartsWith("#"))
return tabName;
return tabName.Substring(1);
/*
* The below currently doesnt work on my machine, since the dictonary always creates an entry with lang id = 0, but I dont have a lang id zero
* so the query always fails, which is odd
*
var local = ApplicationContext.Current.Services.LocalizationService;
var dic = local.GetDictionaryItemByKey(tabName);
if (dic == null || !dic.Translations.Any())
return tabName;
var lang = local.GetLanguageByCultureCode(UmbracoContext.Current.Security.CurrentUser.Language);
if (lang == null)
return tabName;
var translation = dic.Translations.Where(x => x.Language == lang).FirstOrDefault();
if (translation == null)
return tabName;
return translation.Value;*/
}
}
}

View File

@@ -37,7 +37,7 @@ namespace umbraco.uicontrols
var inGroup = this.Parent.GetType() == typeof(PropertyGroup);
if (string.IsNullOrEmpty(m_Text))
CssClass += " hideLabel";
CssClass += " hidelabel";
writer.WriteLine("<div class=\"umb-el-wrap " + CssClass + "\">");