Test schedule nav
This commit is contained in:
		
							parent
							
								
									b89b5b5aa2
								
							
						
					
					
						commit
						ea613bccb8
					
				
					 1 changed files with 10 additions and 5 deletions
				
			
		|  | @ -91,22 +91,27 @@ | |||
|     'friday': '25' | ||||
|   }; | ||||
|   var trailing = ' January 2019'; | ||||
|    | ||||
| 
 | ||||
|   $('a[data-toggle="tab"]').on('show.bs.tab', function (e) { | ||||
|     var day = e.target.attributes['aria-controls'].value.split('-'); | ||||
|     var controls = e.target.attributes['aria-controls'].value | ||||
|     var day = controls.split('-'); | ||||
|     day = day[day.length - 1]; | ||||
|     $('#schedule-date').text(day + ' ' + dates[day] + trailing); | ||||
|     var loc = window.location.toString().split('?')[0] += '?schedule=' + controls; | ||||
|     window.history.pushState({path: loc}, '', loc); | ||||
|   }) | ||||
| </script> | ||||
| 
 | ||||
| <script> | ||||
|     const urlParams = new URLSearchParams(window.location.search); | ||||
|     const scheduleName = urlParams.get('schedule'); | ||||
|     if (schedule == null) { | ||||
|       var currentName = $('div#schedule-nav').children('a.active').first().attr('aria-controls'); | ||||
|       window.location += '?schedule=' + currentName; | ||||
|     } else { | ||||
|     if(scheduleName !== null) { | ||||
|       $('a[href="#' + scheduleName + '"]').tab('show'); | ||||
|     } else { | ||||
|       var currLoc = $('a[data-toggle="tab"].active').first().attr('aria-controls'); | ||||
|       var loc = window.location.toString().split('?')[0] += '?schedule=' + currLoc; | ||||
|       window.history.replaceState({path: loc}, '', loc); | ||||
|     } | ||||
|   </script> | ||||
| {{ block.super }} | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Tobias
						Tobias