forked from latestchatty/chatty
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathReplyBox.ts
40 lines (34 loc) · 1.03 KB
/
ReplyBox.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import {Component, Input} from 'angular2/core'
import {ActionService} from '../services/ActionService'
import {TagGroups} from '../util/TagGroups'
import {PostService} from '../services/PostService'
import {AutoFocus} from '../directives/AutoFocus'
import {DisableHotkeys} from '../directives/DisableHotkeys'
import './replybox.scss';
import './tagLegend.scss';
@Component({
selector: 'replybox',
template: require('./replybox.html'),
directives: [AutoFocus, DisableHotkeys]
})
export class ReplyBox {
@Input() public post
@Input() public replyclass
public replyBody = ''
public tagGroups = TagGroups
constructor(private actionService:ActionService,
private postService:PostService) {
}
addTag(tag) {
this.replyBody += tag.open + tag.close
}
submitPost() {
if (this.replyBody) {
this.postService.submitPost(this.post.id, this.replyBody)
this.close()
}
}
close() {
this.actionService.closePostReplyBox(this.post)
}
}