-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added group and person component for #111
- Loading branch information
Showing
16 changed files
with
207 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<ion-item-sliding color="white"> | ||
<ion-item color="white" detail-push tappable (click)="onRowSelected($event)"> | ||
<ion-icon item-left class="group-icon" ios="ios-people" md="md-people"></ion-icon> | ||
<h2>{{group.name}}</h2> | ||
<p>{{group.member_count || 0}} people</p> | ||
</ion-item> | ||
<ion-item-options side="right" *ngIf="user && user.isOwnerOrAdmin()"> | ||
<button ion-button color="danger" (click)="onRemoveSelected()"> | ||
<ion-icon name="trash"></ion-icon> Remove | ||
</button> | ||
</ion-item-options> | ||
</ion-item-sliding> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { IonicPageModule } from 'ionic-angular'; | ||
|
||
import { GroupRowComponent } from './group-row'; | ||
|
||
@NgModule({ | ||
declarations: [ | ||
GroupRowComponent, | ||
], | ||
imports: [ | ||
IonicPageModule.forChild(GroupRowComponent), | ||
], | ||
exports: [ | ||
GroupRowComponent | ||
] | ||
}) | ||
export class GroupRowModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
group-row { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { Component, Input, Output, EventEmitter } from '@angular/core'; | ||
|
||
import { Group } from '../../models/group'; | ||
import { Person } from '../../models/person'; | ||
|
||
@Component({ | ||
selector: 'group-row', | ||
templateUrl: 'group-row.html' | ||
}) | ||
export class GroupRowComponent { | ||
|
||
@Input() | ||
group:Group; | ||
|
||
@Input() | ||
user:Person; | ||
|
||
@Input() | ||
selected:boolean = false; | ||
|
||
@Output() | ||
rowSelected = new EventEmitter(); | ||
|
||
@Output() | ||
removeSelected = new EventEmitter(); | ||
|
||
hasRowSelected:boolean = false; | ||
|
||
hasRemoveSelected:boolean = false; | ||
|
||
constructor() { | ||
} | ||
|
||
ngOnInit() { | ||
this.hasRowSelected = this.rowSelected && this.rowSelected.observers.length > 0; | ||
this.hasRemoveSelected = this.removeSelected && this.removeSelected.observers.length > 0; | ||
} | ||
|
||
onRowSelected(event:any) { | ||
this.rowSelected.emit(); | ||
} | ||
|
||
onRemoveSelected(event:any) { | ||
this.removeSelected.emit(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<ion-item-sliding color="white"> | ||
<ion-item color="white" detail-push tappable (click)="onRowSelected($event)"> | ||
<person-avatar item-left [initials]="person.initials" [image]="person.profile_picture" [large]="false"></person-avatar> | ||
<h2>{{person.name}}</h2> | ||
</ion-item> | ||
<ion-item-options side="right" *ngIf="user && user.isOwnerOrAdmin()"> | ||
<button ion-button color="danger" (click)="onRemoveSelected()"> | ||
<ion-icon name="trash"></ion-icon> Remove | ||
</button> | ||
</ion-item-options> | ||
</ion-item-sliding> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { IonicPageModule } from 'ionic-angular'; | ||
|
||
import { PersonRowComponent } from './person-row'; | ||
|
||
import { PersonAvatarModule } from '../../components/person-avatar/person-avatar.module'; | ||
|
||
@NgModule({ | ||
declarations: [ | ||
PersonRowComponent, | ||
], | ||
imports: [ | ||
PersonAvatarModule, | ||
IonicPageModule.forChild(PersonRowComponent), | ||
], | ||
exports: [ | ||
PersonRowComponent | ||
] | ||
}) | ||
export class PersonRowModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
person-row { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { Component, Input, Output, EventEmitter } from '@angular/core'; | ||
|
||
import { Person } from '../../models/person'; | ||
|
||
@Component({ | ||
selector: 'person-row', | ||
templateUrl: 'person-row.html' | ||
}) | ||
export class PersonRowComponent { | ||
|
||
@Input() | ||
person:Person; | ||
|
||
@Input() | ||
user:Person; | ||
|
||
@Input() | ||
selected:boolean = false; | ||
|
||
@Output() | ||
rowSelected = new EventEmitter(); | ||
|
||
@Output() | ||
removeSelected = new EventEmitter(); | ||
|
||
hasRowSelected:boolean = false; | ||
|
||
hasRemoveSelected:boolean = false; | ||
|
||
constructor() { | ||
} | ||
|
||
ngOnInit() { | ||
this.hasRowSelected = this.rowSelected && this.rowSelected.observers.length > 0; | ||
this.hasRemoveSelected = this.removeSelected && this.removeSelected.observers.length > 0; | ||
} | ||
|
||
onRowSelected(event:any) { | ||
this.rowSelected.emit(); | ||
} | ||
|
||
onRemoveSelected(event:any) { | ||
this.removeSelected.emit(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters