mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 10:26:08 +01:00 
			
		
		
		
	client,server: Add first day of week option
This commit is contained in:
		| @@ -206,4 +206,11 @@ export default class CalendarWidget extends RightDropdownButtonWidget { | ||||
|         this.$monthSelect.val(this.date.getMonth()); | ||||
|         this.$yearSelect.val(this.date.getFullYear()); | ||||
|     } | ||||
|  | ||||
|     async entitiesReloadedEvent({loadResults}) { | ||||
|         if (loadResults.getOptionNames().includes("firstDayOfWeek")) { | ||||
|             this.init(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -12,6 +12,14 @@ const TPL = ` | ||||
|             <label>${t("i18n.language")}</label> | ||||
|             <select class="locale-select form-control"></select> | ||||
|         </div> | ||||
|  | ||||
|         <div class="col-6"> | ||||
|             <label>First day of the week</label> | ||||
|             <select class="first-day-of-week-select form-control"> | ||||
|                 <option value="0">Sunday</option> | ||||
|                 <option value="1">Monday</option> | ||||
|             </select> | ||||
|         </div> | ||||
|     </div> | ||||
| </div> | ||||
| `; | ||||
| @@ -19,12 +27,18 @@ const TPL = ` | ||||
| export default class LocalizationOptions extends OptionsWidget { | ||||
|     doRender() { | ||||
|         this.$widget = $(TPL); | ||||
|          | ||||
|         this.$localeSelect = this.$widget.find(".locale-select"); | ||||
|         this.$localeSelect.on("change", async() => { | ||||
|             const newLocale = this.$localeSelect.val(); | ||||
|             await server.put(`options/locale/${newLocale}`); | ||||
|             utils.reloadFrontendApp("locale change"); | ||||
|         }); | ||||
|  | ||||
|         this.$firstDayOfWeek = this.$widget.find(".first-day-of-week-select"); | ||||
|         this.$firstDayOfWeek.on("change", () => { | ||||
|             this.updateOption("firstDayOfWeek", this.$firstDayOfWeek.val()); | ||||
|         }); | ||||
|     } | ||||
|  | ||||
|     async optionsLoaded(options) { | ||||
| @@ -38,5 +52,6 @@ export default class LocalizationOptions extends OptionsWidget { | ||||
|         } | ||||
|  | ||||
|         this.$localeSelect.val(options.locale); | ||||
|         this.$firstDayOfWeek.val(options.firstDayOfWeek); | ||||
|     } | ||||
| } | ||||
| @@ -59,7 +59,8 @@ const ALLOWED_OPTIONS = new Set([ | ||||
|     'customSearchEngineUrl', | ||||
|     'promotedAttributesOpenInRibbon', | ||||
|     'editedNotesOpenInRibbon', | ||||
|     'locale' | ||||
|     'locale', | ||||
|     'firstDayOfWeek' | ||||
| ]); | ||||
|  | ||||
| function getOptions() { | ||||
|   | ||||
| @@ -95,7 +95,10 @@ const defaultOptions: DefaultOption[] = [ | ||||
|     { name: 'customSearchEngineUrl', value: 'https://duckduckgo.com/?q={keyword}', isSynced: true }, | ||||
|     { name: 'promotedAttributesOpenInRibbon', value: 'true', isSynced: true }, | ||||
|     { name: 'editedNotesOpenInRibbon', value: 'true', isSynced: true }, | ||||
|     { name: 'locale', value: 'en', isSynced: true } | ||||
|  | ||||
|     // Internationalization | ||||
|     { name: 'locale', value: 'en', isSynced: true }, | ||||
|     { name: 'firstDayOfWeek', value: '1', isSynced: true } | ||||
| ]; | ||||
|  | ||||
| function initStartupOptions() { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user