-
Notifications
You must be signed in to change notification settings - Fork 0
/
admin.html
193 lines (164 loc) · 8.11 KB
/
admin.html
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
<!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Question Bank Admin</title>
<link href="lib/tabulator.min.css" rel="stylesheet">
<link href="lib/bootstrap.min.css" rel="stylesheet">
<link href="lib/selectize.bootstrap5.min.css" rel="stylesheet" />
<link href="lib/open-iconic-bootstrap.min.css" rel="stylesheet" />
<script src="lib/jquery-3.6.0.min.js" type="text/javascript"></script>
<script src="lib/bootstrap.bundle.min.js"></script>
<script src="lib/tabulator.min.js" type="text/javascript"></script>
<script src="lib/selectize.min.js"></script>
<style>
textarea#question {
min-height: 200px;
height: 15em;
width: 100%;
font-family: monospace;
}
textarea#summary {
width: 100%;
font-family: monospace;
height: 6.5em;
}
.imgPreview {
width: 250px;
height: auto;
border-radius: 5px;
padding-right: 20px;
padding-bottom: 20px;
}
.mono {
font-family: monospace;
}
select#question_template {
height: 2em;
width: 100%;
}
.tabulator {
background: white;
}
select#admins_list {
width: 100%;
font-size: 1.25em;
}
</style>
</head>
<body>
<div class="container-fluid">
<h2>Login as Admin</h2>
<p><input id="email" placeholder="email"> <button class="btn btn-warning" onclick="sendOTP()">Send OTP</button> <span id="sendOTP_status"></span></p>
<p><input id="otp" placeholder="OTP" type="number" step="1" min="1000" max="9999"> <button class="btn btn-primary" onclick="verifyOTP()">Login</button> <span id="verifyOTP_status"></span></p>
</p>
<hr />
<p>Choose a section:</p>
<ul class="nav nav-pills mb-3" id="pills-tab" role="tablist">
<li class="nav-item" role="presentation">
<button class="nav-link active" id="pills-home-tab" data-bs-toggle="pill" data-bs-target="#pills-home" type="button" role="tab" aria-controls="pills-home" aria-selected="true">Add a Question</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" id="pills-profile-tab" data-bs-toggle="pill" data-bs-target="#pills-profile" type="button" role="tab" aria-controls="pills-profile" aria-selected="false">Manage Subjects, Topics, Subtopics</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" id="pills-contact-tab" data-bs-toggle="pill" data-bs-target="#pills-contact" type="button" role="tab" aria-controls="pills-contact" aria-selected="false">Manage Admins</button>
</li>
</ul>
<div class="tab-content" id="pills-tabContent">
<div class="tab-pane fade show active" id="pills-home" role="tabpanel" aria-labelledby="pills-home-tab">
<h2>Add a Question</h2>
<div class="row">
<div class="col-md-3">
Choose a template:<br>
<select id="question_template" onchange="load_template(this.value)"></select>
</div>
<div class="col-md-3">
Select subject:<br>
<select id="subject_id"></select>
</div>
<div class="col-md-3">
Select topic:<br>
<select id="topic_id"></select>
</div>
<div class="col-md-3">
Select sub-topic:<br>
<select id="subtopic_id"></select>
</div>
</div>
<!-- <button class="btn btn-warning" onclick="clearFilters()">Clear Filters</button> -->
<br>
<div class="row">
<div class="col-md-6">
<p><textarea id="summary" disabled></textarea><br>
<p><textarea id="question" ondrop="handleDrop(event)"></textarea></p>
<p><button class="btn btn-primary" onclick="addQuestion()">Add Question</button> <span id="addQuestion_status"></span></p>
</div>
<div class="col-md-6">
<h4>Attach image(s)</h4>
<p><input type="file" id="file1" accept="image/*" multiple class="form-control"></p>
<div id="uploadTray"></div>
<p id="embedInstruction">To add the attached image(s) to your question,
<br>- First bring the cursor to the place in the question where you want the image to appear,
<br>- Then click on the image preview thumbnail above.
<br>Its placeholder like <span class="mono">{{img:img1}}</span> Will be added in the question at current typing location.
<br>You can also cut-paste to move it around.</p>
<!-- <p align="right"><button class="btn btn-sm btn-danger" onclick="clearUploads()"> Clear </button></p> -->
<!-- <p><button>Add Image</button></p> -->
</div>
</div>
</div>
<div class="tab-pane fade" id="pills-profile" role="tabpanel" aria-labelledby="pills-profile-tab">
<h2>Manage Subjects, Topics, Subtopics</h2>
<div class="row">
<div class="col-md-7">
<p>Click on a subject, topic or subtopic cell to edit it.<br>
Once done, press Enter to save the changes.<br>
Note: the _id values will remain fixed once created.</p>
<div id="topics_table"></div>
</div>
<div class="col-md-5 topic_side_column">
<h3>Add a new subject / topic / subtopic</h3>
<p>Select existing Subject / Topic, or type to add a new one.</p>
<p>Subject: <select id="new_subject"></select></p>
<p>Topic: <select id="new_topic"></select></p>
<p>Subtopic: <input id="new_subtopic"></p>
<p><button class="btn btn-secondary" onclick="add_subtopic()"">Add New</button>
<span id="add_subtopic_status"></p>
<hr>
<h3>Delete a subtopic</h3>
<button class="btn btn-danger" onclick="delete_subtopic()">Delete selected subtopic</button>
<p id="delete_topic_status"><small>Note: this will also remove the parent Subject / Topic if it's the only subtopic under them.</small></p>
</div>
</div>
</div>
<div class="tab-pane fade" id="pills-contact" role="tabpanel" aria-labelledby="pills-contact-tab">
<div class="row">
<div class="col-md-6">
<h2>Admins</h2>
<select id="admins_list" multiple size="5"></select>
</div>
<div class="col-md-6">
<p><input id="new_admin_email" placeholder="email address" type="email"></p>
<p><button class="btn btn-primary" onclick="admin_add()">Add as Admin</button> <span id="admin_add_status"></span></p>
<hr>
<p><button class="btn btn-danger" onclick="admin_remove()">Remove selected Admin</button> <span id="admin_remove_status"></span></p>
</div>
</div>
</div>
</div>
<hr>
</div>
<br>
<div class="container-fluid bg-light bg-gradient">
<div class="container footer">
<p><a href="index.html">Main Page</a></p>
<p>Created by <a href="https://nikhilvj.co.in" target="_blank" class="link">Nikhil, Kaisyn Consultancy and Training Pvt Ltd</a> for Sci-Beacon project<br>
<a href="https://github.com/orgs/sci-beacon/repositories" target="_blank" class="link-light">See the source code on github</a><br>
</div>
</div>
<script src="js/common.js"></script>
<script src="js/admin.js"></script>
</body>
</html>