File tree 6 files changed +15
-7
lines changed
6 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ export class MyScheduleComponent implements OnInit {
30
30
31
31
ngOnInit ( ) {
32
32
this . sessions$ = this . sessionService . getSessionList ( ) ;
33
- this . sections$ = this . sectionService . getSectionList ( ) ;
33
+ this . sections$ = this . sectionService . getSectionList ( { orderByChild : 'rank' } ) ;
34
34
this . mySessions$ = this . scheduleService . getScheduleList ( this . authService . userId ) ;
35
35
}
36
36
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ export class SessionEditComponent implements OnInit {
35
35
} ) ;
36
36
} ) ;
37
37
38
- this . sections = this . sectionService . getSectionList ( ) ;
38
+ this . sections = this . sectionService . getSectionList ( { orderByChild : 'rank' } ) ;
39
39
this . speakers = this . speakerService . getSpeakerList ( { orderByChild : 'name' } ) ;
40
40
}
41
41
Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ <h5>Stay tuned! Sessions will be added soon!</h5>
56
56
<!-- Modal -->
57
57
< div mdbModal #sectionModal ="mdb-modal " class ="modal fade " tabindex ="-1 " role ="dialog " aria-labelledby ="CreateSection " aria-hidden ="true ">
58
58
< div class ="modal-dialog " role ="document ">
59
- < form (submit) ="addSection(title.value) ">
59
+ < form (submit) ="addSection(title.value, rank.value ) ">
60
60
< div class ="modal-content ">
61
61
< div class ="modal-header ">
62
62
< h4 class ="modal-title w-100 " id ="CreateSection "> Create Section</ h4 >
@@ -70,6 +70,11 @@ <h4 class="modal-title w-100" id="CreateSection">Create Section</h4>
70
70
< input mdbActive type ="text " id ="sectionName " class ="form-control " #title >
71
71
< label for ="sectionName "> Section name</ label >
72
72
</ div >
73
+ < div class ="md-form form-sm ">
74
+ < i class ="fa fa-sort-numeric-asc prefix "> </ i >
75
+ < input mdbActive type ="number " id ="sectionRank " class ="form-control " #rank >
76
+ < label for ="sectionRank "> Section rank</ label >
77
+ </ div >
73
78
</ div >
74
79
< div class ="modal-footer ">
75
80
< button type ="submit " class ="btn btn-primary "> Save</ button >
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ export class SessionListComponent implements OnInit {
32
32
33
33
ngOnInit ( ) {
34
34
this . sessions = this . sessionService . getSessionList ( ) ;
35
- this . sections = this . sectionService . getSectionList ( ) ;
35
+ this . sections = this . sectionService . getSectionList ( { orderByChild : 'rank' } ) ;
36
36
}
37
37
38
38
isLoggedIn ( ) {
@@ -49,8 +49,10 @@ export class SessionListComponent implements OnInit {
49
49
}
50
50
}
51
51
52
- addSection ( value ) {
53
- this . section . title = value . replace ( / ^ \s + | \s + $ / g, '' ) ;
52
+ addSection ( title , rank ) {
53
+ this . section . title = title . replace ( / ^ \s + | \s + $ / g, '' ) ;
54
+ let integerRegex = new RegExp ( '^\\d+$' ) ;
55
+ this . section . rank = integerRegex . test ( rank ) ? parseInt ( rank ) : 0 ;
54
56
this . sectionService . createSection ( this . section ) ;
55
57
this . section = new Section ( ) ;
56
58
this . sectionModal . hide ( ) ;
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ export class SessionNewComponent implements OnInit {
26
26
) { }
27
27
28
28
ngOnInit ( ) {
29
- this . sections = this . sectionService . getSectionList ( ) ;
29
+ this . sections = this . sectionService . getSectionList ( { orderByChild : 'rank' } ) ;
30
30
this . speakers = this . speakerService . getSpeakerList ( { orderByChild : 'name' } ) ;
31
31
}
32
32
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import * as firebase from 'firebase/app';
3
3
export class Section {
4
4
$key : string ;
5
5
title : string ;
6
+ rank : number ;
6
7
timeStamp : any = firebase . database . ServerValue . TIMESTAMP ;
7
8
active : boolean = true ;
8
9
}
You can’t perform that action at this time.
0 commit comments