Skip to content
This repository has been archived by the owner on Mar 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #30 from hacettepeoyt/tellus_and_refactor
Browse files Browse the repository at this point in the history
- Added tell us box to enroll form, and forwarded message to Matrix room (Resolves #18)
- Renewed form icons (deleted icon files from repository)
- Updated welcome text for new members
- Added Wiki
  • Loading branch information
furkansimsekli authored Apr 8, 2023
2 parents df9f24e + 0c9fb26 commit 5642ede
Show file tree
Hide file tree
Showing 17 changed files with 44 additions and 13 deletions.
3 changes: 3 additions & 0 deletions middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ const authenticate = (req, res, next) => {

const validateFields = (req, res, next) => {
for (const key in req.body) {
if (key === 'tellus') { // Skip validation for the "tellus" field
continue;
}
if (!utils.validateString(req.body[key])) {
log(`Client string validation failed, length: "${req.body[key].length}"`);
return res.status(400).send();
Expand Down
Binary file removed public/icon/class.png
Binary file not shown.
Binary file removed public/icon/department.png
Binary file not shown.
Binary file removed public/icon/description.png
Binary file not shown.
Binary file removed public/icon/label.png
Binary file not shown.
Binary file removed public/icon/mail.png
Binary file not shown.
Binary file removed public/icon/message.png
Binary file not shown.
Binary file removed public/icon/phone.png
Binary file not shown.
Binary file removed public/icon/profile.png
Binary file not shown.
Binary file removed public/icon/social.png
Binary file not shown.
Binary file removed public/icon/student-number.png
Binary file not shown.
14 changes: 14 additions & 0 deletions routes/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,30 @@ router.post('/enroll', validateFields, async (req, res) => {
groupChat: req.body.groupChat,
};

const message = `Someone used the enroll form:
----
Name: ${req.body.firstName}
Surname: ${req.body.lastName}
E-mail: ${req.body.email}
----
${req.body.tellus}`;

const oldMember = await Member.findOne({studentID: req.body.studentID});

if (oldMember) {
await Member.findOneAndUpdate({studentID: req.body.studentID}, newMember, {runValidators: true, new: true});
log(`Updated member with studentID: "${req.body.studentID}"`);
await utils.sendMessageToAdminRoom(message);
log(`Sending enroll message to Admin Room, message: "${message}"`);
return res.render(boilerplate, {page: '../success'});
}

await Member.create(newMember);
log(`Enrolled member with studentID: "${req.body.studentID}"`);

await utils.sendMessageToAdminRoom(message);
log(`Sending enroll message to Admin Room, message: "${message}"`);

return res.redirect('/welcome');
});

Expand Down
3 changes: 3 additions & 0 deletions views/partials/navbar.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
<li class="nav-item px-1">
<a class="nav-link <%= (page.endsWith('arge')) ? "active" : "" %>" href="/arge">ARGE</a>
</li>
<li class="nav-item px-1">
<a class="nav-link" href="https://wiki.ozguryazilimhacettepe.com">Wiki</a>
</li>
<li class="nav-item px-1">
<a class="nav-link <%= (page.endsWith('faq')) ? "active" : "" %>" href="/faq">SSS</a>
</li>
Expand Down
14 changes: 7 additions & 7 deletions views/sections/forms/contact.ejs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<div class="container-sm align-items-center">
<div class="py-2 mt-4 align-items-center">
<h1>Bize Ulaşın</h1>
<!-- Registeration Form -->
<!-- Registration Form -->
<div class="ml-5 pt-3 align-items-center form-container">
<form method="POST">
<div class="">
<!-- First Name -->
<div class="input-group col-lg-6 mb-4">
<div class="input-group-prepend">
<span class="px-1 border-md border-right-0 me-2">
<img class="" src="/public/icon/profile.png">
<i class="bi bi-person fs-2" style="color: #ff4100;"></i>
</span>
</div>
<input id="firstName" type="text" name="firstname" placeholder="İsim" class="form-control bg-white border-left-0 border-md" required>
Expand All @@ -19,7 +19,7 @@
<div class="input-group col-lg-6 mb-4">
<div class="input-group-prepend">
<span class="px-1 border-md border-right-0 me-2">
<img class="" src="/public/icon/profile.png">
<i class="bi bi-person fs-2" style="color: #ff4100;"></i>
</span>
</div>
<input id="lastName" type="text" name="lastname" placeholder="Soyisim" class="form-control bg-white border-left-0 border-md" required>
Expand All @@ -29,18 +29,18 @@
<div class="input-group col-lg-12 mb-4">
<div class="input-group-prepend">
<span class="px-1 border-md border-right-0 me-2">
<img class="" src="/public/icon/mail.png">
<i class="bi bi-envelope fs-2" style="color: #ff4100;"></i>
</span>
</div>
<input id="email" type="email" name="email" placeholder="Email Address" class="form-control bg-white border-left-0 border-md" required>
<input id="email" type="email" name="email" placeholder="Mail Adresi" class="form-control bg-white border-left-0 border-md" required>
</div>


<!-- Message -->
<div class="input-group col-lg-6 mb-4">
<div class="input-group-prepend">
<span class="px-1 border-md border-right-0 me-2">
<img class="" src="/public/icon/message.png">
<i class="bi bi-send fs-2" style="color: #ff4100;"></i>
</span>
</div>
<textarea class="form-control bg-white border-left-0 border-md" id="message" placeholder="Mesajınız" name="message" rows="3" required></textarea>
Expand All @@ -49,7 +49,7 @@
<!-- Captcha -->
<div class="input-group mb-3 col-lg-6">
<% num1 = Math.floor(Math.random() * 100); %>
<% num2 = Math.floor(Math.random() * 100); %>
<% num2 = Math.floor(Math.random() * 100); %>
<input name="num1" type="number" id="num1" style="display: none;" value=<%= num1 %>>
<input name="num2" type="number" id="num2" style="display: none;" value=<%= num2 %>>

Expand Down
10 changes: 10 additions & 0 deletions views/sections/forms/enroll.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,16 @@
</select>
</div>

<!-- Tell us -->
<div class="input-group col-lg-12 mb-4">
<div class="input-group-prepend">
<span class="px-1 border-md border-right-0 me-2">
<i class="bi bi-send fs-2" style="color: #ff4100;"></i>
</span>
</div>
<textarea class="form-control bg-white border-left-0 border-md" id="tellus" placeholder="Söylemek istediğin bir şey var mı?" name="tellus" rows="3"></textarea>
</div>

<!-- Submit Button -->
<div class="form-group mb-0" style="margin-left: 47px;">
<input id="signup-btn" class="btn btn-outline" type="submit" value="Üye Ol">
Expand Down
10 changes: 5 additions & 5 deletions views/sections/forms/idea.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<div class="input-group col-lg-6 mb-4">
<div class="input-group-prepend">
<span class="px-1 border-md border-right-0 me-2">
<img class="" src="/public/icon/profile.png">
<i class="bi bi-person fs-2" style="color: #ff4100;"></i>
</span>
</div>
<input id="firstName" type="text" name="firstname" placeholder="İsim" class="form-control bg-white border-left-0 border-md" required>
Expand All @@ -20,7 +20,7 @@
<div class="input-group col-lg-6 mb-4">
<div class="input-group-prepend">
<span class="px-1 border-md border-right-0 me-2">
<img class="" src="/public/icon/profile.png">
<i class="bi bi-person fs-2" style="color: #ff4100;"></i>
</span>
</div>
<input id="lastName" type="text" name="lastname" placeholder="Soyisim" class="form-control bg-white border-left-0 border-md" required>
Expand All @@ -30,7 +30,7 @@
<div class="input-group col-lg-12 mb-4">
<div class="input-group-prepend">
<span class="px-1 border-md border-right-0 me-2">
<img class="" src="/public/icon/mail.png">
<i class="bi bi-envelope fs-2" style="color: #ff4100;"></i>
</span>
</div>
<input id="email" type="email" name="email" placeholder="Mail Adresi" class="form-control bg-white border-left-0 border-md" required>
Expand All @@ -40,7 +40,7 @@
<div class="input-group col-lg-12 mb-4">
<div class="input-group-prepend">
<span class="px-1 border-md border-right-0 me-2">
<img class="" src="/public/icon/label.png">
<i class="bi bi-pencil fs-2" style="color: #ff4100;"></i>
</span>
</div>
<input id="projectName" type="text" name="projectName" placeholder="Proje Adı" class="form-control bg-white border-left-0 border-md" required>
Expand All @@ -50,7 +50,7 @@
<div class="input-group col-lg-12 mb-4">
<div class="input-group-prepend">
<span class="px-1 border-md border-right-0 me-2">
<img class="" src="/public/icon/description.png">
<i class="bi bi-code fs-2" style="color: #ff4100;"></i>
</span>
</div>
<textarea class="form-control bg-white border-left-0 border-md" id="projectDesc" placeholder="Açıklama" name="projectDesc" rows="3" required></textarea>
Expand Down
3 changes: 2 additions & 1 deletion views/welcome.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
<div class="card-body p-5">
<h1>Aramıza Hoşgeldin!</h1>
<br>
<p class="font-italic text-muted">Yapacağımız etkinlikleri görmek için etkinlikler sayfasını(yapım aşamasında) veya sosyal medya hesaplarımızı takip edebilirsin.</p>
<p class="font-italic text-muted">En kısa süre içerisinde sohbet gruplarına ekleyeceğiz seni. Bu süre zarfında sosyal medya sayfalarımızı takip edebilir,
websitemizden <a href="/events">etkinliklerimize</a> göz atabilirsin!</p>
</div>
</div>
</div>
Expand Down

0 comments on commit 5642ede

Please sign in to comment.