File tree Expand file tree Collapse file tree 2 files changed +38
-3
lines changed
client/imports/ui/pages/course Expand file tree Collapse file tree 2 files changed +38
-3
lines changed Original file line number Diff line number Diff line change 13
13
< th class ="md-text-cell "> Lab</ th >
14
14
< th > Tasks Completed</ th >
15
15
< th > Due Date</ th >
16
+ < th *ngIf ="isInstruct() "> </ th >
16
17
</ tr >
17
18
</ thead >
18
19
< tbody >
19
- < tr *ngFor ="let lab of getLabs() " [routerLink] =" ['/course/' + courseId + '/labs/' + lab._id] " >
20
- < td class ="md-text-cell "> {{ lab.lab_name }}</ td >
20
+ < tr *ngFor ="let lab of getLabs() ">
21
+ < td class ="md-text-cell " [routerLink] =" ['/course/' + courseId + '/labs/' + lab._id] " > {{ lab.lab_name }}</ td >
21
22
< td > {{ lab.completed }}</ td >
22
23
< td > soon</ td >
24
+ < td *ngIf ="isInstruct() ">
25
+ < button md-button (click) ="export.show(); exportLab(lab._id); "> Export</ button >
26
+ < md-dialog #export >
27
+ < md-dialog-title >
28
+ Exported Markdown
29
+ </ md-dialog-title >
30
+ < div > {{ exportData }}</ div >
31
+ < md-dialog-actions ok ="Got It "> </ md-dialog-actions >
32
+ </ md-dialog >
33
+ </ td >
23
34
</ tr >
24
35
</ tbody >
25
36
</ md-data-table >
Original file line number Diff line number Diff line change 8
8
// Angular Material Imports
9
9
import { MATERIAL_DIRECTIVES , MATERIAL_PROVIDERS } from 'ng2-material' ;
10
10
import { MdProgressBar } from '@angular2-material/progress-bar' ;
11
+ import { OVERLAY_PROVIDERS } from '@angular2-material/core/overlay/overlay' ;
11
12
12
13
// Angular Meteor Imports
13
14
import { MeteorComponent } from 'angular2-meteor' ;
14
15
import { InjectUser } from 'angular2-meteor-accounts-ui' ;
15
16
17
+ // Roles
18
+ import { Roles } from '../../../../../collections/users.ts' ;
19
+
16
20
// Declare Collections
17
21
declare var Collections : any ;
18
22
declare var _ : any ;
29
33
ROUTER_DIRECTIVES ,
30
34
MATERIAL_DIRECTIVES
31
35
] ,
32
- providers : [ MATERIAL_PROVIDERS ]
36
+ providers : [ MATERIAL_PROVIDERS , OVERLAY_PROVIDERS ]
33
37
} )
34
38
35
39
export class LabList extends MeteorComponent {
36
40
user : Meteor . User ;
37
41
courseId : string ;
38
42
userId : string = Meteor . userId ( ) ;
39
43
courseRecord : any ;
44
+ exportData : string = "" ;
40
45
41
46
// Test
42
47
allLabs : Array < Object > ;
101
106
this . courseId = this . router . routerState . parent ( this . route ) . snapshot . params [ 'courseid' ] ;
102
107
}
103
108
109
+ isInstruct ( ) {
110
+ if ( typeof this . courseId !== "undefined" ) {
111
+ return Roles . isInstructorFor ( this . courseId ) ;
112
+ }
113
+ else {
114
+ return false ;
115
+ }
116
+ }
117
+ exportLab ( lab_id ) {
118
+ var self = this ;
119
+ Meteor . call ( 'exportLab' , lab_id , function ( err , res ) {
120
+ if ( err ) {
121
+ self . exportData = "Error getting data" ;
122
+ }
123
+ else {
124
+ self . exportData = res ;
125
+ }
126
+ } ) ;
127
+ }
104
128
}
You can’t perform that action at this time.
0 commit comments