1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-24 23:59:47 +02:00

Set org and per user locale

This commit is contained in:
Harvey Kandola 2022-03-19 18:07:38 -04:00
parent 23abcf1585
commit 4494ace0a2
30 changed files with 125 additions and 41 deletions

View file

@ -30,12 +30,28 @@ export default Component.extend(Notifier, {
hasTitleInputError: and('titleEmpty', 'titleError'),
hasMessageInputError: and('messageEmpty', 'messageError'),
hasConversionEndpointInputError: and('conversionEndpointEmpty', 'conversionEndpointError'),
locale: {},
locales: null,
init() {
this._super(...arguments);
let l = this.get('appMeta.locales');
let t = [];
l.forEach((locale) => {
t.pushObject( {name: locale} );
});
this.set('locales', t);
},
didReceiveAttrs() {
this._super(...arguments);
this.set('maxTags', this.get('model.general.maxTags'));
this.set('domain', this.get('model.general.domain'));
this.set('locale', { name: this.get('model.general.locale') });
},
didInsertElement() {
@ -149,6 +165,10 @@ export default Component.extend(Notifier, {
},
actions: {
onSelectLocale(locale) {
this.set('model.general.locale', locale.name);
},
change() {
const selectEl = $('#maxTags')[0];
const selection = selectEl.selectedOptions[0].value;

View file

@ -46,13 +46,34 @@ export default Component.extend(AuthProvider, {
return '';
}
}),
locale: {},
locales: null,
init() {
this._super(...arguments);
this.password = { password: "", confirmation: "" };
let l = this.get('appMeta.locales');
let t = [];
l.forEach((locale) => {
t.pushObject( {name: locale} );
});
this.set('locales', t);
},
didReceiveAttrs() {
this._super(...arguments);
this.set('locale', { name: this.get('model.locale') });
},
actions: {
onSelectLocale(locale) {
this.set('model.locale', locale.name);
},
save() {
let password = this.get('password.password');
let confirmation = this.get('password.confirmation');

View file

@ -21,6 +21,7 @@ export default Model.extend({
allowAnonymousAccess: attr('boolean', { defaultValue: false }),
maxTags: attr('number', {defaultValue: 3}),
theme: attr('string'),
locale: attr('string', { defaultValue: "en-US" }),
created: attr(),
revised: attr()
});

View file

@ -17,8 +17,7 @@ export default Controller.extend({
actions: {
onUpdate() {
return this.get('orgService').save(this.model.general).then(() => {
});
return this.get('orgService').save(this.model.general).then(() => {});
},
onDefaultLogo(orgId) {

View file

@ -31,7 +31,7 @@ export default Route.extend({
dbname: document.head.querySelector("[property=dbname]").content,
dbhash: pwd,
title: "",
message: this.i18n.localize('setup_default_message'),
message: "Documize Community instance contains all our documentation",
allowAnonymousAccess: false,
firstname: "",
lastname: "",

View file

@ -45,6 +45,7 @@ export default Service.extend({
// empty theme uses default theme
theme: '',
locale: '',
locales: null,
getBaseUrl(endpoint) {
return [this.get('endpoint'), endpoint].join('/');

View file

@ -35,7 +35,8 @@ export default Service.extend({
message: org.get('message'),
title: org.get('title'),
maxTags: org.get('maxTags'),
conversionEndpoint: org.get('conversionEndpoint')
conversionEndpoint: org.get('conversionEndpoint'),
locale: org.get('locale')
});
return this.get('ajax').request(`organization/${id}`, {

View file

@ -58,6 +58,10 @@
</select>
<small class="form-text text-muted">{{localize 'customize_tags_explain'}}</small>
</div>
<div class="form-group">
<label>{{localize 'locale'}}</label>
{{ui/ui-select content=locales selection=locale optionValuePath="name" optionLabelPath="name" action=(action "onSelectLocale")}}
</div>
{{ui/ui-button color=constants.Color.Green light=true icon=constants.Icon.Settings label=(localize 'save') onClick=(action "save")}}
</div>

View file

@ -97,7 +97,7 @@
<div id="document-print-modal" class="modal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">{{localize 'Print'}}</div>
<div class="modal-header">{{localize 'print'}}</div>
<div class="modal-body">
<p>{{localize 'print_explain'}}</p>
{{#each pages as |item|}}

View file

@ -1,6 +1,6 @@
{{layout/logo-heading
title=(localize 'content')
desc=(localize 'setings')
desc=(localize 'settings')
icon=constants.Icon.Settings}}
<form class="view-document">

View file

@ -6,7 +6,7 @@
<small class="form-text text-muted">{{localize 'password_strong'}}</small>
</div>
<div class="form-group">
<label>{{localize 'confirm_password'}}</label>
<label>{{localize 'password_confirm'}}</label>
{{input type="password" value=passwordConfirm id="passwordConfirm" autocomplete="new-password" class=(if hasConfirmError "form-control is-invalid" "form-control")}}
</div>
<div class="margin-top-10 margin-bottom-20">

View file

@ -11,13 +11,18 @@
<label for="email">{{localize 'email'}}</label>
{{input id="email" type="email" value=model.email class=(if hasEmailError "form-control is-invalid" "form-control")}}
</div>
<div class="form-group">
<label>{{localize 'locale'}}</label>
{{ui/ui-select content=locales selection=locale optionValuePath="name" optionLabelPath="name" action=(action "onSelectLocale")}}
</div>
{{#if isAuthProviderDocumize}}
<div class="form-group">
<label for="password">{{localize 'password'}}</label>
{{input id="password" type="password" value=password.password class=(if hasPasswordError "form-control is-invalid" "form-control")}}
</div>
<div class="form-group">
<label for="confirmPassword">{{localize 'confirm_password'}}</label>
<label for="confirmPassword">{{localize 'password_confirm'}}</label>
{{input id="confirmPassword" type="password" value=password.confirmation class=(if hasConfirmPasswordError "form-control is-invalid" "form-control")}}
</div>
{{/if}}

View file

@ -124,6 +124,7 @@
"no_access": "Access Denied",
"drag_drop_reorder": "Drag-drop to reorder",
"select": "Select",
"locale": "Locale",
"public": "Public",
"public_explain": "Public - can be seen by everyone",
@ -186,6 +187,7 @@
"created": "Created",
"markdown": "Markdown accepted",
"rename": "Rename",
"status": "Status",
"toc": "table of contents",
"new_canvas": "Blank anvas",