-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ed1703a
commit a0b4187
Showing
5 changed files
with
242 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<template> | ||
<div class="modal fade" id="AddArticle" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true"> | ||
<div class="modal-dialog" role="document"> | ||
<div class="modal-content"> | ||
<div class="modal-header"> | ||
<h5 class="modal-title" id="exampleModalLabel">Ask The Question</h5> | ||
<button id="closearticle" type="button" class="close" data-dismiss="modal" aria-label="Close"> | ||
<span aria-hidden="true">×</span> | ||
</button> | ||
</div> | ||
<div class="modal-body"> | ||
<form class="needs-validation" novalidate> | ||
<div class="form-group"> | ||
<label for="recipient-name" class="col-form-label">Title:</label> | ||
<input v-model='title' name="title" type="text" class="form-control" id="recipient-name" placeholder="Input Title" v-validate="'required'" :class="{'error': errors.has('title') }"> | ||
</div> | ||
<div class="form-group"> | ||
<label for="message-text" class="col-form-label">Content:</label> | ||
<textarea v-model='content' name="content" class="form-control" id="message-text" placeholder="Input Content" v-validate="'required'" :class="{'error': errors.has('content') }"></textarea> | ||
</div> | ||
<div class="form-group"> | ||
<label for="message-text" class="col-form-label">Category:</label> | ||
<textarea v-model='category' name="category" class="form-control" id="message-text" placeholder="Input Category" v-validate="'required'" :class="{'error': errors.has('category') }"></textarea> | ||
</div> | ||
</form> | ||
</div> | ||
<div class="modal-footer"> | ||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> | ||
<button type="button" class="btn btn-primary" @click='add()'>Add</button> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import { | ||
mapActions, mapMutations,mapState,mapGetters | ||
} from 'vuex' | ||
export default { | ||
name: 'AddArticle', | ||
data () { | ||
return { | ||
title: '', | ||
content: '' | ||
} | ||
}, | ||
methods: { | ||
...mapActions([ | ||
'addArticle' | ||
]), | ||
add () { | ||
let newArticle = { | ||
title: this.title, | ||
content: this.content, | ||
category: this.category, | ||
} | ||
this.addArticle(newArticle) | ||
document.getElementById('closearticle').click() | ||
} | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters