diff options
author | Dessalines <happydooby@gmail.com> | 2019-08-15 16:53:59 -0700 |
---|---|---|
committer | Dessalines <happydooby@gmail.com> | 2019-08-15 16:53:59 -0700 |
commit | 42c9c57a1c169720b8ac5182dc20da5051bd6dcc (patch) | |
tree | 02944106433ef4daa981094b6074583585b27c36 /ui/src/components/post-form.tsx | |
parent | 1070cd6921ba533772d1ee1cf4e28cbb0c938f32 (diff) | |
parent | d3ecba4405e8a2bfb7ea02ac17c2c9f5be978d4a (diff) |
Merge branch 'dev'
Diffstat (limited to 'ui/src/components/post-form.tsx')
-rw-r--r-- | ui/src/components/post-form.tsx | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/ui/src/components/post-form.tsx b/ui/src/components/post-form.tsx index 79d37b42..704b1cdd 100644 --- a/ui/src/components/post-form.tsx +++ b/ui/src/components/post-form.tsx @@ -31,6 +31,7 @@ export class PostForm extends Component<PostFormProps, PostFormState> { private emptyState: PostFormState = { postForm: { name: null, + nsfw: false, auth: null, community_id: null, creator_id: (UserService.Instance.user) ? UserService.Instance.user.id : null, @@ -54,6 +55,7 @@ export class PostForm extends Component<PostFormProps, PostFormState> { edit_id: this.props.post.id, creator_id: this.props.post.creator_id, url: this.props.post.url, + nsfw: this.props.post.nsfw, auth: null } } @@ -128,6 +130,14 @@ export class PostForm extends Component<PostFormProps, PostFormState> { } <div class="form-group row"> <div class="col-sm-10"> + <div class="form-check"> + <input class="form-check-input" type="checkbox" checked={this.state.postForm.nsfw} onChange={linkEvent(this, this.handlePostNsfwChange)}/> + <label class="form-check-label"><T i18nKey="nsfw">#</T></label> + </div> + </div> + </div> + <div class="form-group row"> + <div class="col-sm-10"> <button type="submit" class="btn btn-secondary mr-2"> {this.state.loading ? <svg class="icon icon-spinner spin"><use xlinkHref="#icon-spinner"></use></svg> : @@ -196,6 +206,11 @@ export class PostForm extends Component<PostFormProps, PostFormState> { i.setState(i.state); } + handlePostNsfwChange(i: PostForm, event: any) { + i.state.postForm.nsfw = event.target.checked; + i.setState(i.state); + } + handleCancel(i: PostForm) { i.props.onCancel(); } |