Use User.locale in lieu of Settings.js
This commit is contained in:
+1
-1
@@ -107,7 +107,7 @@ module.exports = function(grunt) {
|
||||
{expand: true, cwd: 'app/', src: ['package.manifest'], dest: '<%= dest %>', flatten: true},
|
||||
{expand: true, cwd: 'app/views/', src: ['archetype.html', 'archetype.config.html'], dest: '<%= dest %>/views', flatten: true},
|
||||
{expand: true, cwd: 'app/config/', src: ['propertyEditors.views.js'], dest: '<%= dest %>/js', flatten: true},
|
||||
{expand: true, cwd: 'app/config/', src: ['settings.js'], dest: '<%= dest %>/js', flatten: true},
|
||||
{expand: true, cwd: 'app/config/', src: ['en-gb.js'], dest: '<%= dest %>/js', flatten: true},
|
||||
{expand: true, cwd: 'app/config/', src: ['en-us.js'], dest: '<%= dest %>/js', flatten: true},
|
||||
{expand: true, cwd: 'app/config/', src: ['fr-fr.js'], dest: '<%= dest %>/js', flatten: true},
|
||||
{expand: true, cwd: 'app/Umbraco/Umbraco.Archetype/bin/Debug/', src: ['Archetype.dll'], dest: '<%= dest %>/bin', flatten: true}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"label": "Label",
|
||||
"alias": "Alias",
|
||||
"hideFieldsetControls": "Hide Fieldset Controls?",
|
||||
"hideFieldsetControlsDescription": "Hides the fieldset add/remove/sort controls.",
|
||||
"toggleAdvanced": "Toggle Advanced Options",
|
||||
"toggleAdvancedDescription": "Show advanced options.",
|
||||
"hidePropertyLabels": "Hide Property Labels?",
|
||||
"hidePropertyLabelsDescription": "Hides the property labels.",
|
||||
"maxFieldsets": "Max Fieldsets",
|
||||
"maxFieldsetsDescription": "How many Fieldsets are allowed? Entering '1' will disable the controls. Default is unlimited.",
|
||||
"enableMultipleFieldsets": "Enable Multiple Fieldsets?",
|
||||
"enableMultipleFieldsetsDescription": "Allows multiple types of fieldsets within this archetype.",
|
||||
"hideFieldsetToolbar": "Hide Fieldset Toolbar?",
|
||||
"hideFieldsetToolbarDescription": "Hides the fieldset toolbar that appears when more than one fieldset model appears.",
|
||||
"customWrapperClass": "Custom Wrapper Class",
|
||||
"customWrapperClassDescription": "(Optional) Enter a custom CSS class that will be applied to the wrapper div.",
|
||||
"cssFile": "CSS File",
|
||||
"cssFileDescription": "(Optional) Enter a path for a custom CSS file to be included on the page.",
|
||||
"jsFile": "JS File",
|
||||
"jsFileDescription": "(Optional) Enter a path for a custom JS file to be included on the page.",
|
||||
"toggleDeveloperMode": "Toggle Developer Mode",
|
||||
"toggleDeveloperModeDescription": "Turn on for developer options.",
|
||||
"configModel": "Config Model",
|
||||
"configModelDescription": "Be careful editing the text below, it controls the schema for this archetype.",
|
||||
"helpText": "Help Text",
|
||||
"defaultValue": "Default Value",
|
||||
"dataType": "DataType",
|
||||
"required": "Required",
|
||||
"properties": "Properties",
|
||||
"labelTemplate": "Label Template",
|
||||
"select": "Select",
|
||||
"icon": "Icon"
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
angular.module("umbraco").controller("Imulus.ArchetypeConfigController", function ($scope, $http, assetsService, dialogService, archetypePropertyEditorResource) {
|
||||
angular.module("umbraco").controller("Imulus.ArchetypeConfigController", function ($scope, $http, assetsService, dialogService, archetypePropertyEditorResource, userService) {
|
||||
|
||||
//$scope.model.value = "";
|
||||
//console.log($scope.model.value);
|
||||
@@ -19,25 +19,30 @@ angular.module("umbraco").controller("Imulus.ArchetypeConfigController", functio
|
||||
$scope.availableDataTypes = data;
|
||||
});
|
||||
|
||||
//get the current user
|
||||
|
||||
userService.getCurrentUser().then(function (user) {
|
||||
$scope.model.language = user.locale;
|
||||
console.log($scope.model.language);
|
||||
});
|
||||
|
||||
//load the localization info
|
||||
archetypePropertyEditorResource.getSettings()
|
||||
.then(function(settings) {
|
||||
$scope.settings = settings;
|
||||
return settings.langIso;
|
||||
userService.getCurrentUser()
|
||||
.then(function (user) {
|
||||
$scope.model.langIso = user.locale;
|
||||
return user.locale;
|
||||
})
|
||||
.then(function(langIso){
|
||||
archetypePropertyEditorResource.getLocale(langIso)
|
||||
.then(function(locale) {
|
||||
return locale;
|
||||
}).then(function(locale){
|
||||
archetypePropertyEditorResource.getDefaultLocale(locale)
|
||||
.then(function(defaultLocale) {
|
||||
$scope.locales = {}
|
||||
$scope.locales.locale = locale;
|
||||
$scope.locales.defaultLocale = defaultLocale;
|
||||
.then(function(langIso){
|
||||
archetypePropertyEditorResource.getLocale(langIso)
|
||||
.then(function(locale){
|
||||
archetypePropertyEditorResource.getDefaultLocale(locale)
|
||||
.then(function(defaultLocale) {
|
||||
$scope.locales = {}
|
||||
$scope.locales.locale = locale;
|
||||
$scope.locales.defaultLocale = defaultLocale;
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$scope.getLocales = function(){
|
||||
if($scope.locales){
|
||||
|
||||
@@ -29,14 +29,9 @@ angular.module('umbraco.resources').factory('archetypePropertyEditorResource', f
|
||||
return "";
|
||||
});
|
||||
},
|
||||
getSettings: function() {
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.get("/App_plugins/Archetype/js/settings.js"), 'Failed to retrieve config'
|
||||
);
|
||||
},
|
||||
getLocale: function(langIso) {
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.get("/App_plugins/Archetype/js/" + langIso + ".js"), 'Failed to retrieve locale'
|
||||
$http.get("/App_plugins/Archetype/js/" + langIso.toLowerCase() + ".js"), 'Failed to retrieve locale'
|
||||
);
|
||||
},
|
||||
getDefaultLocale: function() {
|
||||
|
||||
Reference in New Issue
Block a user