-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcodeReview.html
More file actions
85 lines (82 loc) · 3.57 KB
/
codeReview.html
File metadata and controls
85 lines (82 loc) · 3.57 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<script src='./resources/vue.min.js'></script>
<script src='./resources/Sortable.min.js'></script>
<script src='./resources/vuedraggable.umd.min.js'></script>
<script src="./resources/gsap.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="codeReview.css">
<title>CodeReview</title>
</head>
<body>
<h1>Code Review</h1>
<div id="mainApp">
<transition name="fade" mode="out-in" key="showChooseQ">
<div v-if="chooseQ">
<h3>Beginning to forget how you solved certain coding problems? <br />
Review your code without having to type it all in again.</h3>
<button class="rndTopicButton" v-on:click="randomQ">Pick a random piece of code</button>
<fieldset>
<legend>Determine which questions to include in the list</legend>
<input type="text" placeholder="search for..." v-on:input="filterQs" v-model:value="searchTerm">
<div>
<input type="checkbox" id="onlyDefAuthor" v-on:change="filterQs" checked="true" v-bind:value="defaultAuthor"
v-model="author">
<label for="onlyDefAuthor">only the code of {{defaultAuthor}}</label>
</div>
</fieldset>
<button v-for="q of filteredQs" v-on:click="setQ(q.id)" class="q-card">{{q.name}}
</button>
</div>
<div v-if="!chooseQ" key="showQ">
<button class="chooseQbutton" v-on:click="chooseQ = true; showFeedback=false">Choose another Q</button>
<sort-q v-if="!showFeedback" v-bind:q-data="question" >
</sort-q>
<div v-if="showFeedback" v-for="fb of feedback">{{fb}}</div>
</div>
</transition>
</div>
<script src="components/sortQ.js"></script>
<script type="module">
// privacy.file_unique_origin set to false
//
import { qList } from './qList.js'
var mainApp = new Vue({
el: '#mainApp',
data: {
filteredQs: [],
chooseQ: true, searchTerm: '',
question: qList[0],
defaultAuthor: 'Samir70', author: ['Samir70'],
feedback: 'default feedback',
showFeedback: false
},
created: function () {
this.filterQs()
},
methods: {
makeFeedback: function (ans) {
this.feedback = [ans.mark, ans.extra];
this.showFeedback = true;
},
filterQs: function () {
this.filteredQs = qList.filter(item =>
item.name.toLowerCase().search(this.searchTerm.toLowerCase()) !== -1
&& item.author.search(this.author[0]) !== -1
)
},
randomQ : function () {
let rnd = Math.floor(Math.random() * this.filteredQs.length);
this.setQ(this.filteredQs[rnd].id)
},
setQ: function (qID) {
this.question = qList[qID];
this.chooseQ = false;
}
}
});
</script>
</body>
</html>