Skip to content
Snippets Groups Projects
Commit bcb1db4f authored by robinwilliam.hundt's avatar robinwilliam.hundt
Browse files

Submitted feedback is now stored inside the store

parent 1595dd48
Branches
Tags
2 merge requests!23Resolve "Logout of tutors after inactivity",!18WIP: Submission notes
Pipeline #
...@@ -9,8 +9,16 @@ ...@@ -9,8 +9,16 @@
</td> </td>
<td> <td>
<pre class="prettyprint"><code class="lang-c"> {{ code }}</code></pre> <pre class="prettyprint"><code class="lang-c"> {{ code }}</code></pre>
<feedback-comment v-if="feedback[index] && !showEditorOnLine[index]" :feedback="feedback[index]"></feedback-comment> <feedback-comment
<comment-form v-if="showEditorOnLine[index]" :feedback="feedback[index]"></comment-form> v-if="feedback[index] && !showEditorOnLine[index]"
@click="toggleEditorOnLine(index)">{{ feedback[index] }}
</feedback-comment>
<comment-form
v-if="showEditorOnLine[index]"
@collapseFeedbackForm="showEditorOnLine[index] = false"
:feedback="feedback[index]"
:index="index">
</comment-form>
</td> </td>
</tr> </tr>
</table> </table>
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<div class="body"> <div class="body">
<span class="tip tip-up"></span> <span class="tip tip-up"></span>
<div class="message"> <div class="message">
<span>{{ feedback }}</span> <slot></slot>
</div> </div>
</div> </div>
</div> </div>
...@@ -12,8 +12,7 @@ ...@@ -12,8 +12,7 @@
<script> <script>
export default { export default {
name: 'feedback-comment', name: 'feedback-comment'
props: ['feedback']
} }
</script> </script>
......
...@@ -4,14 +4,16 @@ ...@@ -4,14 +4,16 @@
name="feedback-input" name="feedback-input"
label="Please provide your feedback here" label="Please provide your feedback here"
v-model="current_feedback" v-model="current_feedback"
@keyup.enter.ctrl.exact="submitFeedback"
@keyup.esc="collapseTextField"
rows="2" rows="2"
textarea textarea
autofocus autofocus
auto-grow auto-grow
hide-details hide-details
></v-text-field> ></v-text-field>
<v-btn color="success" @click="submitFeedback()">Submit</v-btn> <v-btn color="success" @click="submitFeedback">Submit</v-btn>
<v-btn>Discard</v-btn> <v-btn @click="discardFeedback">Discard changes</v-btn>
</div> </div>
</template> </template>
...@@ -19,15 +21,26 @@ ...@@ -19,15 +21,26 @@
<script> <script>
export default { export default {
name: 'comment-form', name: 'comment-form',
props: ['feedback'], props: ['feedback', 'index'],
data () { data () {
return { return {
current_feedback: this.feedback current_feedback: this.feedback
} }
}, },
methods: { methods: {
collapseTextField () {
this.$emit('collapseFeedbackForm')
},
submitFeedback () { submitFeedback () {
console.log(this.current_feedback) this.$store.dispatch('updateFeedback', {
lineIndex: this.index,
content: this.current_feedback
})
this.collapseTextField()
},
discardFeedback () {
this.current_feedback = this.feedback
} }
} }
} }
......
...@@ -55,8 +55,8 @@ const submissionNotes = { ...@@ -55,8 +55,8 @@ const submissionNotes = {
'SET_FEEDBACK': function (state, feedback) { 'SET_FEEDBACK': function (state, feedback) {
state.feedback = feedback state.feedback = feedback
}, },
'UPDATE_FEEDBACK': function (state, lineIndex, feedbackContent) { 'UPDATE_FEEDBACK': function (state, feedback) {
Vue.set(state.feedback, lineIndex, feedbackContent) Vue.set(state.feedback, feedback.lineIndex, feedback.content)
} }
}, },
actions: { actions: {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment