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