Load and render public dictionary correctly
This commit is contained in:
		
							parent
							
								
									373414d5c0
								
							
						
					
					
						commit
						6154510af6
					
				
					 4 changed files with 46 additions and 11 deletions
				
			
		
							
								
								
									
										36
									
								
								src/js/view/displayToggles.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								src/js/view/displayToggles.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,36 @@ | |||
| import { renderDescription, renderDetails, renderStats } from './render'; | ||||
| 
 | ||||
| export function showSection(sectionName) { | ||||
|   switch (sectionName) { | ||||
|     case 'description': showDescription(); break; | ||||
|     case 'details': showDetails(); break; | ||||
|     case 'stats': showStats(); break; | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| export function hideDetailsPanel() { | ||||
|   document.getElementById('detailsPanel').style.display = 'none'; | ||||
| } | ||||
| 
 | ||||
| export function getIsDetailsPanelDisplayed() { | ||||
|   return document.getElementById('detailsPanel').style.display !== 'none'; | ||||
| } | ||||
| 
 | ||||
| function showDescription() { | ||||
|   const detailsPanel = document.getElementById('detailsPanel'); | ||||
|   detailsPanel.style.display = 'block'; | ||||
| 
 | ||||
|   renderDescription(); | ||||
| } | ||||
| 
 | ||||
| function showDetails() { | ||||
|   const detailsPanel = document.getElementById('detailsPanel'); | ||||
|   detailsPanel.style.display = 'block'; | ||||
|   renderDetails(); | ||||
| } | ||||
| 
 | ||||
| function showStats() { | ||||
|   const detailsPanel = document.getElementById('detailsPanel'); | ||||
|   detailsPanel.style.display = 'block'; | ||||
|   renderStats(); | ||||
| } | ||||
|  | @ -1,5 +1,6 @@ | |||
| import '../../main.scss'; | ||||
| import { getDictionary } from './dictionaryManagement'; | ||||
| import { renderAll } from './render'; | ||||
| import setupListeners from './setupListeners'; | ||||
| 
 | ||||
| // import setupListeners, { setupSearchFilters } from './js/setupListeners';
 | ||||
| // import { renderAll } from './js/render';
 | ||||
|  | @ -8,8 +9,8 @@ import { getDictionary } from './dictionaryManagement'; | |||
| // import { loadSettings } from './js/settings';
 | ||||
| 
 | ||||
| function initialize() { | ||||
|   getDictionary(); | ||||
|   // setupSearchFilters();
 | ||||
|   renderAll(); | ||||
|   setupListeners(); | ||||
| } | ||||
| 
 | ||||
| window.onload = (function (oldLoad) { | ||||
|  |  | |||
|  | @ -1,4 +1,4 @@ | |||
| import {showSection, hideDetailsPanel} from '../displayToggles'; | ||||
| import {showSection, hideDetailsPanel} from './displayToggles'; | ||||
| import { showSearchModal, clearSearchText, checkAllPartsOfSpeechFilters, uncheckAllPartsOfSpeechFilters } from '../search'; | ||||
| import { renderWords, renderInfoModal } from './render'; | ||||
| 
 | ||||
|  | @ -23,9 +23,6 @@ function setupDetailsTabs() { | |||
|       } | ||||
|     }); | ||||
|   }); | ||||
|   setupEditFormTabs(); | ||||
|   setupEditFormInteractions(); | ||||
|   setupEditFormButtons(); | ||||
| } | ||||
| 
 | ||||
| function setupSearchBar() { | ||||
|  | @ -82,17 +79,17 @@ export function setupSearchFilters() { | |||
| 
 | ||||
| export function setupInfoButtons() { | ||||
|   document.getElementById('helpInfoButton').addEventListener('click', () => { | ||||
|     import('../markdown/help.md').then(html => { | ||||
|     import('../../markdown/help.md').then(html => { | ||||
|       renderInfoModal(html); | ||||
|     }); | ||||
|   }); | ||||
|   document.getElementById('termsInfoButton').addEventListener('click', () => { | ||||
|     import('../markdown/terms.md').then(html => { | ||||
|     import('../../markdown/terms.md').then(html => { | ||||
|       renderInfoModal(html); | ||||
|     }); | ||||
|   }); | ||||
|   document.getElementById('privacyInfoButton').addEventListener('click', () => { | ||||
|     import('../markdown/privacy.md').then(html => { | ||||
|     import('../../markdown/privacy.md').then(html => { | ||||
|       renderInfoModal(html); | ||||
|     }); | ||||
|   }); | ||||
|  |  | |||
|  | @ -14,7 +14,8 @@ switch ($view) { | |||
|         $html = str_replace('{{dict}}', $dict, $html); | ||||
|         $html = str_replace('{{dict_name}}', $dictionary_data['name'] . ' ' . $dictionary_data['specification'], $html); | ||||
|         $html = str_replace('{{public_name}}', $dictionary_data['createdBy'], $html); | ||||
|         $html = str_replace('{{dict_json}}', json_encode($dictionary_data), $html); | ||||
|         $dictionary_json = json_encode($dictionary_data); | ||||
|         $html = str_replace('{{dict_json}}', addslashes($dictionary_json), $html); | ||||
|       } | ||||
|       echo $html; | ||||
|     } | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue