mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	Prettify number of issues (#17760)
* Prettify number of issues - Use the PrettyNumber function to add commas in large amount of issues. * Use client-side formatting * prettify on both server and client * remove unused i18n entries * handle more cases, support other int types in PrettyNumber * specify locale to avoid issues with node default locale * remove superfluos argument * introduce template helper, octicon tweaks, js refactor * Update modules/templates/helper.go * Apply some suggestions. * Add comment * Update templates/user/dashboard/issues.tmpl Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
		
							
								
								
									
										14
									
								
								web_src/js/features/formatting.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								web_src/js/features/formatting.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,14 @@
 | 
			
		||||
import {prettyNumber} from '../utils.js';
 | 
			
		||||
 | 
			
		||||
const {lang} = document.documentElement;
 | 
			
		||||
 | 
			
		||||
export function initFormattingReplacements() {
 | 
			
		||||
  // replace english formatted numbers with locale-specific separators
 | 
			
		||||
  for (const el of document.getElementsByClassName('js-pretty-number')) {
 | 
			
		||||
    const num = Number(el.getAttribute('data-value'));
 | 
			
		||||
    const formatted = prettyNumber(num, lang);
 | 
			
		||||
    if (formatted && formatted !== el.textContent) {
 | 
			
		||||
      el.textContent = formatted;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user