forked from opensource-society/notesvault
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupload.html
More file actions
201 lines (177 loc) · 6.79 KB
/
upload.html
File metadata and controls
201 lines (177 loc) · 6.79 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
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
194
195
196
197
198
199
200
201
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Upload Notes</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<nav>
<a href="index.html">Home</a>
<a href="search.html">Search</a>
<a href="upload.html">Upload Notes</a>
</nav>
<main class="container">
<h1>Upload Notes</h1>
<form>
<!-- <label>Title:<br><input type="text" name="title" required></label><br><br> -->
<label for="title">Title:</label><br>
<input type="text" id="title" name="title" required>
<label>Description:<br><textarea name="description" rows="4" required></textarea></label><br><br>
<label>File:<br><input type="file" name="file" required></label><br><br>
<button type="submit">Upload</button>
</form>
</main>
<!-- Tailwind CSS -->
<script src="https://cdn.tailwindcss.com" ></script>
<!-- Google Font -->
<link href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;700&display=swap" rel="stylesheet" />
<!-- Tailwind Config -->
<script>
tailwind.config = {
theme: {
extend: {
fontFamily: {
jakarta: ['"Plus Jakarta Sans"', 'sans-serif'],
},
colors: {
base: "#f9faf4",
ink: "#161A30",
primary: "#113946",
accent: "#B4CFB0"
}
}
}
};
</script>
<style>
body {
font-family: 'Plus Jakarta Sans', sans-serif;
}
</style>
</head>
<body class="font-jakarta bg-base text-ink">
<!-- Header -->
<header class="bg-white shadow p-5 flex justify-between items-center">
<h1 class="text-2xl font-bold text-ink">NotesVault</h1>
<nav class="hidden md:flex space-x-6 text-sm">
<a href="index.html" class="hover:underline">Overview</a>
<a href="#" class="hover:underline">Student Account</a>
<a href="#" class="hover:underline">About</a>
<a href="#" class="hover:underline">Features</a>
</nav>
<button class="px-4 py-1 bg-primary text-white rounded-full text-sm hover:bg-[#0d2f34]">Sign Up</button>
</header>
<!-- Main Upload Form -->
<main class="max-w-screen-md mx-auto p-6 mt-12 bg-white rounded-xl shadow">
<h2 class="text-2xl font-bold mb-6">Upload Notes</h2>
<form id="uploadForm" class="space-y-5">
<div>
<label for="branch" class="block text-sm font-medium">Branch <span class="text-red-500">*</span></label>
<select id="branch" required
class="mt-1 w-full px-3 py-2 border border-gray-300 rounded-lg">
<option value="">Select Branch</option>
</select>
</div>
<div>
<label for="semester" class="block text-sm font-medium">Semester <span class="text-red-500">*</span></label>
<select id="semester" required
class="mt-1 w-full px-3 py-2 border border-gray-300 rounded-lg">
<option value="">Select Semester</option>
</select>
</div>
<div>
<label for="subject" class="block text-sm font-medium">Subject <span class="text-red-500">*</span></label>
<select id="subject" required
class="mt-1 w-full px-3 py-2 border border-gray-300 rounded-lg">
<option value="">Select Subject</option>
</select>
</div>
<div>
<label for="tags" class="block text-sm font-medium">Tags (optional)</label>
<input type="text" id="tags" placeholder="e.g. algo, PYQ"
class="mt-1 w-full px-3 py-2 border border-gray-300 rounded-lg" />
</div>
<div class="mb-4">
<label for="file" class="block text-sm font-medium text-gray-700">Upload File <span class="text-red-500">*</span></label>
<input
type="file"
id="file"
name="file"
required
accept=".pdf,.docx,.txt"
class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm"
/>
</div>
<button type="submit"
class="w-full bg-primary text-white py-2 rounded-full hover:bg-[#0d2f34] transition-all">
Upload
</button>
</form>
<div id="message" class="mt-4 text-green-600 font-medium"></div>
</main>
<footer class="text-center text-sm mt-10 text-gray-500">© 2025 NotesVault</footer>
<!-- Script to Load Dropdowns from JSON -->
<script>
let data;
fetch('./data/search_parameters/parameters.json')
.then(res => res.json())
.then(json => {
data = json;
const branchSelect = document.getElementById('branch');
json.branches.forEach(b => {
if (typeof b === 'object') {
const option = document.createElement('option');
option.value = b.name;
option.textContent = b.name;
branchSelect.appendChild(option);
} else {
const option = document.createElement('option');
option.value = b;
option.textContent = b;
branchSelect.appendChild(option);
}
});
});
document.getElementById('branch').addEventListener('change', e => {
const semesterSelect = document.getElementById('semester');
semesterSelect.innerHTML = '<option value="">Select Semester</option>';
const subjectSelect = document.getElementById('subject');
subjectSelect.innerHTML = '<option value="">Select Subject</option>';
const selectedBranch = e.target.value;
const branchData = data.branches.find(b => b.name === selectedBranch);
if (!branchData) return;
branchData.semesters.forEach(sem => {
const option = document.createElement('option');
option.value = sem.semester;
option.textContent = `Semester ${sem.semester}`;
semesterSelect.appendChild(option);
});
});
document.getElementById('semester').addEventListener('change', e => {
const subjectSelect = document.getElementById('subject');
subjectSelect.innerHTML = '<option value="">Select Subject</option>';
const branch = document.getElementById('branch').value;
const semester = parseInt(e.target.value);
const branchData = data.branches.find(b => b.name === branch);
if (!branchData) return;
const semesterData = branchData.semesters.find(s => s.semester === semester);
if (!semesterData) return;
semesterData.subjects.forEach(sub => {
const code = Object.keys(sub)[0];
const name = sub[code];
const option = document.createElement('option');
option.value = code;
option.textContent = `${code} - ${name}`;
subjectSelect.appendChild(option);
});
});
document.getElementById("uploadForm").addEventListener("submit", function (e) {
e.preventDefault();
document.getElementById("message").innerText = "✅ Notes uploaded successfully (for demo purposes only — not stored)"
";
this.reset();
});
</script>
</body>
</html>