forked from EVOgeek/Vmeda.Online
		
	MOBILE-3021 calendar: Display current month/day button before other buttons
This commit is contained in:
		
							parent
							
								
									949467a11b
								
							
						
					
					
						commit
						0521fda729
					
				| @ -1,6 +1,6 @@ | |||||||
| 
 | 
 | ||||||
| <!-- Add buttons to the nav bar. --> | <!-- Add buttons to the nav bar. --> | ||||||
| <core-navbar-buttons end> | <core-navbar-buttons end prepend> | ||||||
|     <button [hidden]="!canNavigate || isCurrentMonth || !displayNavButtons" ion-button icon-only clear (click)="goToCurrentMonth()"> |     <button [hidden]="!canNavigate || isCurrentMonth || !displayNavButtons" ion-button icon-only clear (click)="goToCurrentMonth()"> | ||||||
|         <core-icon  name="fa-calendar-times-o"></core-icon> |         <core-icon  name="fa-calendar-times-o"></core-icon> | ||||||
|     </button> |     </button> | ||||||
|  | |||||||
| @ -2,12 +2,12 @@ | |||||||
|     <ion-navbar core-back-button> |     <ion-navbar core-back-button> | ||||||
|         <ion-title>{{ 'addon.calendar.calendarevents' | translate }}</ion-title> |         <ion-title>{{ 'addon.calendar.calendarevents' | translate }}</ion-title> | ||||||
|         <ion-buttons end> |         <ion-buttons end> | ||||||
|             <button *ngIf="courses && courses.length" ion-button icon-only (click)="openCourseFilter($event)" [attr.aria-label]="'core.courses.filter' | translate"> |  | ||||||
|                 <ion-icon name="funnel"></ion-icon> |  | ||||||
|             </button> |  | ||||||
|             <button *ngIf="!isCurrentDay" ion-button icon-only clear (click)="goToCurrentDay()"> |             <button *ngIf="!isCurrentDay" ion-button icon-only clear (click)="goToCurrentDay()"> | ||||||
|                 <core-icon name="fa-calendar-times-o"></core-icon> |                 <core-icon name="fa-calendar-times-o"></core-icon> | ||||||
|             </button> |             </button> | ||||||
|  |             <button *ngIf="courses && courses.length" ion-button icon-only (click)="openCourseFilter($event)" [attr.aria-label]="'core.courses.filter' | translate"> | ||||||
|  |                 <ion-icon name="funnel"></ion-icon> | ||||||
|  |             </button> | ||||||
|             <core-context-menu> |             <core-context-menu> | ||||||
|                 <core-context-menu-item [hidden]="!loaded || !hasOffline || !isOnline"  [priority]="400" [content]="'core.settings.synchronizenow' | translate" (action)="doRefresh(null, $event, true)" [iconAction]="syncIcon" [closeOnClick]="false"></core-context-menu-item> |                 <core-context-menu-item [hidden]="!loaded || !hasOffline || !isOnline"  [priority]="400" [content]="'core.settings.synchronizenow' | translate" (action)="doRefresh(null, $event, true)" [iconAction]="syncIcon" [closeOnClick]="false"></core-context-menu-item> | ||||||
|             </core-context-menu> |             </core-context-menu> | ||||||
|  | |||||||
| @ -25,6 +25,8 @@ import { CoreContextMenuComponent } from '../context-menu/context-menu'; | |||||||
|  * If this component indicates a position (start/end), the buttons will only be added if the header has some buttons in that |  * If this component indicates a position (start/end), the buttons will only be added if the header has some buttons in that | ||||||
|  * position. If no start/end is specified, then the buttons will be added to the first <ion-buttons> found in the header. |  * position. If no start/end is specified, then the buttons will be added to the first <ion-buttons> found in the header. | ||||||
|  * |  * | ||||||
|  |  * If this component has a "prepend" attribute, the buttons will be added before other existing buttons in the header. | ||||||
|  |  * | ||||||
|  * You can use the [hidden] input to hide all the inner buttons if a certain condition is met. |  * You can use the [hidden] input to hide all the inner buttons if a certain condition is met. | ||||||
|  * |  * | ||||||
|  * IMPORTANT: Do not use *ngIf in the buttons inside this component, it can cause problems. Please use [hidden] instead. |  * IMPORTANT: Do not use *ngIf in the buttons inside this component, it can cause problems. Please use [hidden] instead. | ||||||
| @ -92,7 +94,8 @@ export class CoreNavBarButtonsComponent implements OnInit, OnDestroy { | |||||||
|                 if (buttonsContainer) { |                 if (buttonsContainer) { | ||||||
|                     this.mergeContextMenus(buttonsContainer); |                     this.mergeContextMenus(buttonsContainer); | ||||||
| 
 | 
 | ||||||
|                     this.movedChildren = this.domUtils.moveChildren(this.element, buttonsContainer); |                     const prepend = this.element.hasAttribute('prepend'); | ||||||
|  |                     this.movedChildren = this.domUtils.moveChildren(this.element, buttonsContainer, prepend); | ||||||
|                     this.showHideAllElements(); |                     this.showHideAllElements(); | ||||||
| 
 | 
 | ||||||
|                 } else { |                 } else { | ||||||
|  | |||||||
| @ -795,16 +795,18 @@ export class CoreDomUtilsProvider { | |||||||
|      * |      * | ||||||
|      * @param {HTMLElement} oldParent The old parent. |      * @param {HTMLElement} oldParent The old parent. | ||||||
|      * @param {HTMLElement} newParent The new parent. |      * @param {HTMLElement} newParent The new parent. | ||||||
|  |      * @param {boolean} [prepend] If true, adds the children to the beginning of the new parent. | ||||||
|      * @return {Node[]} List of moved children. |      * @return {Node[]} List of moved children. | ||||||
|      */ |      */ | ||||||
|     moveChildren(oldParent: HTMLElement, newParent: HTMLElement): Node[] { |     moveChildren(oldParent: HTMLElement, newParent: HTMLElement, prepend?: boolean): Node[] { | ||||||
|         const movedChildren: Node[] = []; |         const movedChildren: Node[] = []; | ||||||
|  |         const referenceNode = prepend ? newParent.firstChild : null; | ||||||
| 
 | 
 | ||||||
|         while (oldParent.childNodes.length > 0) { |         while (oldParent.childNodes.length > 0) { | ||||||
|             const child = oldParent.childNodes[0]; |             const child = oldParent.childNodes[0]; | ||||||
|             movedChildren.push(child); |             movedChildren.push(child); | ||||||
| 
 | 
 | ||||||
|             newParent.appendChild(child); |             newParent.insertBefore(child, referenceNode); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         return movedChildren; |         return movedChildren; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user