Skip to content

Commit

Permalink
Merge pull request TeamTobb#19 from TeamTobb/Dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Wimsen committed Apr 20, 2016
2 parents f7828d8 + fe021b7 commit 0e9368c
Show file tree
Hide file tree
Showing 45 changed files with 10,936 additions and 902 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
*.js
!public/lib/**
!jspdf.debug.js
node_modules/
typings/
*.map
.vscode/*
public/uploads/document/*
public/uploads/document/*
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"dependencies": {
"angular2": "latest",
"angular2-jwt": "^0.1.9",
"angular2-modal": "^0.1.3",
"body-parser": "latest",
"connect-flash": "^0.1.1",
"cookie-parser": "^1.3.3",
Expand All @@ -39,6 +40,7 @@
"passport-http-bearer": "^1.0.1",
"passport-local": "^1.0.0",
"passport-local-mongoose": "^1.0.0",
"public-ip": "^1.2.0",
"reflect-metadata": "latest",
"rxjs": "latest",
"serve-favicon": "^2.2.0",
Expand Down
28 changes: 18 additions & 10 deletions public/controllers/chapteritem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,36 +8,44 @@ import {Document, Line, Chapter} from '../domain/document.ts';


@Component({
selector: 'chapteritem',
templateUrl: 'views/components/chapteritem.html'
selector: 'chapteritem',
templateUrl: 'views/components/chapteritem.html'

})
export class ChapterItem implements OnChanges {
@Input() chapterName: string;
@Input() chapterNr: string;
@Input() chapterId: string;
@Input() documentId: string;
@Output() toBeDeleted : EventEmitter<any> = new EventEmitter();
@Output() toBeDeleted: EventEmitter<any> = new EventEmitter();

constructor(private documentService: DocumentService) {}
constructor(private documentService: DocumentService) { }
// TODO Make alert, sure you want to delete this chapter?
delete(event, nr: any){
delete(event, nr: any) {
event.stopPropagation();
nr = this.chapterNr;
this.toBeDeleted.emit(nr)
}

rename($event, chapterId, documentId){
rename($event, chapterId, documentId) {
var newchapterName: string = $event.target.innerHTML
this.documentService.sendDiff({newchapterName}, chapterId)
this.documentService.sendDiff({ newchapterName }, this.chapterNr)
$event.target.setAttribute("contenteditable", "false");
}

ngOnChanges(changes: {[propertyName: string]: SimpleChange}) {
console.log("Something has Changed in chapterItem")
ngOnChanges(changes: { [propertyName: string]: SimpleChange }) {
// TODO: Find a better way to set the first item as selected
if (changes["chapterNr"] && this.chapterNr == 0+"") {
var selectedChapter = document.getElementById('chapter_item_' + this.chapterNr);
var otherChapters = document.getElementsByClassName('droptarget');
for (var i = 0; i < otherChapters.length; i++) {
otherChapters[i].className = "droptarget";
}
selectedChapter.className = "droptarget active";
}
}

ondblclickChapter($event){
ondblclickChapter($event) {
console.log("ondblclickChapter")
$event.target.setAttribute("contenteditable", "true");
}
Expand Down
Loading

0 comments on commit 0e9368c

Please sign in to comment.