Skip to content

Commit

Permalink
bug with ng2-bootstrap - ignoring for now
Browse files Browse the repository at this point in the history
Subscribed to this thread to follow the issue: valor-software/ngx-bootstrap#854
  • Loading branch information
Tahler committed Sep 13, 2016
1 parent 3a502b9 commit f1657a4
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 37 deletions.
2 changes: 2 additions & 0 deletions src/app/problems/problem/problem.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { RankingComponent } from './leaderboard/ranking';
import { SharingService } from './shared';
import { FormattingModule } from '../../shared';
import { CodeEditorModule } from '../../code-editor';
import { SubmissionModule } from '../../submission-modal';

@NgModule({
imports: [
Expand All @@ -24,6 +25,7 @@ import { CodeEditorModule } from '../../code-editor';

FormattingModule,
CodeEditorModule,
SubmissionModule,
problemRouting
],
declarations: [
Expand Down
1 change: 0 additions & 1 deletion src/app/shared/services/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export * from './login-modal.service';
export * from './submission.service';
20 changes: 0 additions & 20 deletions src/app/shared/services/submission.service.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/app/submission-modal/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * from './submission-modal.component';
export * from './submission-modal.module';
export * from './submission.module';
5 changes: 4 additions & 1 deletion src/app/submission-modal/submission-modal.component.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<!--TODO: once fixed-->
<!--[config]="{backdrop: 'static'}"-->

<div bsModal #modal="bs-modal" class="modal fade"
[config]="{backdrop: 'static'}" tabindex="-1"
[config]="{backdrop: false}" tabindex="-1"
(onHide)="onHide()"
role="dialog" aria-labelledby="modal" aria-hidden="true">
<div class="vertical-alignment-helper">
Expand Down
15 changes: 8 additions & 7 deletions src/app/submission-modal/submission-modal.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,17 @@ import { Component, Input, OnDestroy, ViewChild } from '@angular/core';
import { Subscription } from 'rxjs/Rx';
import { ModalDirective, ModalOptions } from 'ng2-bootstrap';

import { AuthService, Result, Submission, SubmissionService } from '../shared';
import { AuthService, Result, Submission } from '../shared';
import { SubmissionService } from './submission.service';

const configPreventCloseOnClickOutside: ModalOptions = { backdrop: 'static' };
const configPreventCloseOnClickOutside: ModalOptions = { }; // backdrop: 'static'
const configAllowCloseOnClickOutside: ModalOptions = {};

@Component({
moduleId: module.id,
selector: 'app-submission-modal',
templateUrl: 'submission-modal.component.html',
styleUrls: ['submission-modal.component.css'],
providers: [
SubmissionService
]
styleUrls: ['submission-modal.component.css']
})
export class SubmissionModalComponent implements OnDestroy {
@Input() problemId: string;
Expand Down Expand Up @@ -56,9 +55,11 @@ export class SubmissionModalComponent implements OnDestroy {
},
() => {
// Allow click outside
this.modal.config = {};
this.modal.config = configAllowCloseOnClickOutside;
this.killSubscription();
});
console.log('before');

this.modal.show();
});
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { RouterModule } from '@angular/router';
import { HttpModule } from '@angular/http';

import { ModalModule } from 'ng2-bootstrap';

import { SubmissionModalComponent } from './submission-modal.component';
import { SubmissionService } from './submission.service';
import { FormattingModule } from '../shared';

@NgModule({
imports: [
CommonModule,
FormsModule,
ReactiveFormsModule,
RouterModule,
ModalModule
HttpModule,

ModalModule,

FormattingModule
],
declarations: [SubmissionModalComponent],
providers: [SubmissionService],
exports: [SubmissionModalComponent]
})
export class SubmissionModalModule { }
export class SubmissionModule { }
20 changes: 20 additions & 0 deletions src/app/submission-modal/submission.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Injectable } from '@angular/core';
import { Http, Headers } from '@angular/http';

import { Observable } from 'rxjs/Rx';

import { Result, Submission } from '../shared';

const url = 'http://code.neumont.edu/submit';
const requestHeaders = new Headers({ 'Content-Type': 'application/json' });

@Injectable()
export class SubmissionService {
constructor(private http: Http) { }

submit(submission: Submission): Observable<Result> {
return this.http
.post(url, submission, {headers: requestHeaders})
.map(res => res.json() as Result);
}
}

0 comments on commit f1657a4

Please sign in to comment.