Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merging Gov portal submissions #265

Open
wants to merge 29 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
cdcb983
added link to submissions page at govportal page
uday-kalyan-s Oct 28, 2024
c7be873
added getting submissions function to handler
uday-kalyan-s Oct 28, 2024
8792a82
exported function in handler
uday-kalyan-s Oct 28, 2024
bd2d003
added basic submissions-management template(near duplicate of post-ma…
uday-kalyan-s Oct 28, 2024
3fbe0c2
added get route for submission-management
uday-kalyan-s Oct 28, 2024
fd6b4dd
added and exported deletion handler
uday-kalyan-s Oct 28, 2024
2640af0
fixed lint in handler
uday-kalyan-s Oct 28, 2024
a009815
added post route for deleting submission
uday-kalyan-s Oct 28, 2024
7406a0b
submission management page added to nav
uday-kalyan-s Oct 30, 2024
8375949
Update govportal.js
uday-kalyan-s Oct 30, 2024
4bd3f17
convert Submission to title case in gov portal template
uday-kalyan-s Oct 30, 2024
60e4f34
November Newsletter Data
Mouryagrandhi Dec 1, 2024
073d5a7
Small changes to 4th and 5th article
DalliMani Dec 1, 2024
1e15d29
Images compressed
DalliMani Dec 1, 2024
ce619cb
Merge pull request #270 from kgpmask/novembernews
Mouryagrandhi Dec 1, 2024
4bd5da1
added link to submissions page at govportal page
uday-kalyan-s Oct 28, 2024
d377c8f
added getting submissions function to handler
uday-kalyan-s Oct 28, 2024
c362f8a
exported function in handler
uday-kalyan-s Oct 28, 2024
0a61c69
added basic submissions-management template(near duplicate of post-ma…
uday-kalyan-s Oct 28, 2024
5b59ad6
added get route for submission-management
uday-kalyan-s Oct 28, 2024
ddc6955
added and exported deletion handler
uday-kalyan-s Oct 28, 2024
099989a
fixed lint in handler
uday-kalyan-s Oct 28, 2024
c9ca6d5
added post route for deleting submission
uday-kalyan-s Oct 28, 2024
9fc0ba1
submission management page added to nav
uday-kalyan-s Oct 30, 2024
b330951
added pagination route ation for gov portal
uday-kalyan-s Nov 10, 2024
618218e
changed handler to only return important values
uday-kalyan-s Dec 2, 2024
f5047ae
formatted list to put date in readable format. also put auth back on …
uday-kalyan-s Dec 2, 2024
0085728
changed submission template to add client side pagination
uday-kalyan-s Dec 2, 2024
66d96f2
fixed merge conflict
uday-kalyan-s Dec 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added assets/releases/2024-11-1/1-1.webp
Binary file not shown.
Binary file added assets/releases/2024-11-1/1-2.webp
Binary file not shown.
Binary file added assets/releases/2024-11-1/1-3.webp
Binary file not shown.
Binary file added assets/releases/2024-11-1/1-4.webp
Binary file not shown.
Binary file added assets/releases/2024-11-1/2-1.webp
Binary file not shown.
Binary file added assets/releases/2024-11-1/2-2.webp
Binary file not shown.
Binary file added assets/releases/2024-11-1/2-3.webp
Binary file not shown.
Binary file added assets/releases/2024-11-1/2-4.webp
Binary file not shown.
Binary file added assets/releases/2024-11-1/2-5.webp
Binary file not shown.
Binary file added assets/releases/2024-11-1/3-1.webp
Binary file not shown.
Binary file added assets/releases/2024-11-1/4-1.webp
Binary file not shown.
Binary file added assets/releases/2024-11-1/4-2.webp
Binary file not shown.
Binary file added assets/releases/2024-11-1/4-3.webp
Binary file not shown.
Binary file added assets/releases/2024-11-1/5-1.webp
Binary file not shown.
Binary file added assets/releases/2024-11-1/5-2.webp
Binary file not shown.
Binary file added assets/releases/2024-11-1/5-3.webp
Binary file not shown.
Binary file added assets/releases/2024-11-1/5-4.webp
Binary file not shown.
Binary file added assets/releases/2024-11-1/cover.webp
Binary file not shown.
12 changes: 11 additions & 1 deletion database/handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,14 @@ async function getNewsletterCount () {
return newsletterCounts;
}

async function getSubmissions () {
return await Submission.find().select({ '_id': 0, '__v': 0 });
}

async function deleteSubmission (link) {
const sub = await Submission.findOneAndDelete({ link: link });
return sub;
}

module.exports = {
createNewUser,
Expand Down Expand Up @@ -396,5 +404,7 @@ module.exports = {
addTeam,
addSubmission,
updateNewsletterCount,
getNewsletterCount
getNewsletterCount,
getSubmissions,
deleteSubmission
};
4 changes: 2 additions & 2 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions routes/govportal.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,32 @@ router.patch('/delete-option', async (req, res) => {
}
});

router.get('/submission-management', async (req, res) => {
const submissions = (await dbh.getSubmissions()).map(el => {
return { ...el._doc, date: Date(el._doc.date) };
});
const submissionsFormatted = [];
for (let i = 0; i < submissions.length; i++) {
const groupIndex = Math.floor(i / 20);
if (groupIndex >= submissionsFormatted.length) {
submissionsFormatted.push([]);
}
submissionsFormatted[groupIndex].push(submissions[i]);
}
return res.renderFile('govportal/submissions-management.njk', { submissionsFormatted: submissionsFormatted });
});

router.post('/submission-management', async (req, res) => {
const data = req.body.data;
let response;
try {
response = await dbh.deleteSubmission(data);
return res.send({ success: true, message: 'Successfully deleted post', response: response });
} catch (e) {
return res.send({ success: false, message: 'Something Went Wrong' });
}
});

module.exports = {
route: '/gov-portal',
router
Expand Down
5 changes: 5 additions & 0 deletions src/newsletter_desc.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,10 @@
"link":"2024-10-1",
"title":"October 2024 Issue",
"desc": "Unravel the mystery within our horror anime newsletter, crafted for those who crave the twisted and unknown. Articles on horrors beyond the ghastly await you. A wildcard lures you into a spiral of horror. Enter…ye, and indulge in a discourse of horror."
},
{
"link":"2024-11-1",
"title":"November 2024 Issue",
"desc": "To unmask your daily dose of comedy, MASK's November Newsletter (haha, get it?) has brought you articles on some of the funniest anime that have graced a screen!! From superficial humor to anime references, everything is covered.Hope you have a fantastic time laughing along!"
}
]
8 changes: 8 additions & 0 deletions templates/govportal/govportal.njk
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@
},{
href: 'newsletter',
name: 'Newsletter'
},{
href: 'submission',
<<<<<<< HEAD
name: 'submission'
=======
name: 'Submission'
>>>>>>> 4bd3f172737a69b816aea877884cb943dfedaba0
}] %}

{% block navbar %}
Expand Down Expand Up @@ -68,6 +75,7 @@
<a href="/gov-portal/add-poll" class="add-item"> Add Poll </a>
<a href="/gov-portal/add-post" class="add-item"> Add Post </a>
<a href="/gov-portal/newsletter-management" class="add-item"> View Newsletter Count </a>
<a href="/gov-portal/submission-management" class="add-item"> View Submissions </a>
</div>
{% endblock %}
</div>
Expand Down
230 changes: 230 additions & 0 deletions templates/govportal/submissions-management.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,230 @@
{% extends "govportal/govportal.njk" %}

{% set thispage = 'Submission' %}
{% set pagetitle = 'Governor Portal | Submission Management' %}
{% set actionname = 'Submission Management' %}

{% set scripts = ['https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js'] %}

{% block actioncontent %}
<div class="message hidden"></div>
<<<<<<< HEAD
<div id="card-container">
</div>
<div id="button_container" class="container">
{% for num in submissionsFormatted.keys() %}
<button onclick="displayItems({{ num }})">{{ num+1 }}</button>
{% endfor %}
</div>
=======
{% for submission in submissions %}
<div class="container">
<div class="card1">
{% for key, value in submission %}
{% if key != '_id' and key != '__v' and key != 'metadata' %}
<b> {{ key | capitalize }}: </b> {% if key != 'date' %} {{ value }} {% else %} {{ value | string | truncate(15, true, "") }} {% endif %}<br>
{% endif %}
{% endfor %}
</div>

<div class="card2">
<button class="deleteP" onclick="deleteSubmission('{{submission.link}}')">Delete</button>
</div>
</div>
{% endfor %}

>>>>>>> 4bd3f172737a69b816aea877884cb943dfedaba0
{% endblock %}

{% block customcss %}
{{ super() }}
<style>
#add-item {
display: block;
width: fit-content;
margin: 20px auto;
border: 3px solid var(--off-white);
border-radius: 5px;
padding: 10px;
background-color: var(--dark-gray);
transition: color 0.3s, border-color 0.3s, background-color 0.3s;
}
#add-item:hover {
color: var(--error-red);
border-color: var(--white);
background-color: var(--darker-gray);
}
.container {
margin: 3rem auto;
display:flex;
flex-direction:row;
border: 2px solid rgba(255,255,255,0.1);
border-radius: 8px;
padding: 20px 5px;
width: 80%;
background-color: rgba(255,255,255,0.13);
backdrop-filter: blur(5px);
align-self:center;
}
.card1{
flex:80%;
width:40%;
padding-left:5px;
word-wrap: break-word;
text-align: left;
}
.card2{
flex:20%;
display:flex;
flex-direction:column;
justify-content: center;
align-items: center;
}
table{
word-wrap: break-word;
}
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
th, td {
padding: 5px;
text-align: left;
word-wrap: break-word;
overflow-wrap: anywhere;
}
th{
width:30%;
}
.deleteP {
border-radius: 4px;
color:white;
cursor: pointer;
border: 0px;
padding: 2% 3%;
margin: 10px 20px;
}
button{
background-color: var(--red);
width: 7em;
height: 2.5em;
}
.message {
position: absolute;
top: 0;
right: calc(50vw - 220px);
padding: 20px;
z-index: 1;
color: #fff;
font-weight: 600;
font-size: 18px;
width: 400px;
transform-origin: top;
transition: transform 0.3s ease;
border-bottom-left-radius: 6px;
border-bottom-right-radius: 6px;
}
.error {
background-color: rgba(255, 51, 51, 0.85);
}
.success {
background-color: rgba(75, 189, 67, 0.85);
}
.hidden {
transform: scaleY(0);
}

@media (max-width: 600px) {
button{
width:4rem;
}
.container{
margin-left:3rem;
}
}

@media (max-width: 500px) {
.container {
flex-direction:column;
}
.card1{
width:95%;
}
.card2{
flex-direction:row;
}
button{
margin-right:5rem;
}
.editP{
margin:1rem 3rem;
}
.deleteP{
margin:1rem 2rem;
}
.container{
margin-left:2rem;
}
}
@media (max-width:300px){
.editP{
margin-right:1rem;
margin-left:2rem;
}
.deleteP{
margin-left:1rem;
}
.container{
margin-left:1.5rem;
}
}

</style>
{% endblock %}

{% block customjs %}
<script>
axios.defaults.withCredentials = true;
axios.defaults.headers.common['X-CSRF-TOKEN'] = '{{ csrfToken }}';
let submissionsData = {{ submissionsFormatted | dump | safe }};
function displayItems(num) {
let holder = document.getElementById("card-container");
holder.innerHTML = ""
for(let submission of submissionsData[num]) {
let main_cont = document.createElement("div");
main_cont.className = "container";
let card1 = document.createElement("div");
card1.className = "card1";
for (let key in submission) {
if(key != "link") {
card1.innerHTML += `<b> ${key}: </b> ${submission[key]} | `;
}
else {
card1.innerHTML += `<b> ${key}: </b> <a href="${submission[key]}">${submission[key]} <a> | `;
}
}
main_cont.appendChild(card1);
main_cont.innerHTML += `<div class="card2"><button class="deleteP" onclick="deleteSubmission('${submission.link}')">Delete</button></div>`
holder.appendChild(main_cont);
}
}

async function postSubmission (data) {
var res = (await axios.post('/gov-portal/submission-management', { data: data })).data;
const e = document.getElementsByClassName('message')[0];
e.innerHTML = res.message;
e.classList.add(res.success ? 'success' : 'error');
e.classList.remove('hidden');
setTimeout(function () {e.classList.add('hidden')}, 2000);
if (res.success) {
setTimeout(function () { location.reload() }, 3000);
}
}
function deleteSubmission (link) {
console.log(link);
if (confirm("Are you sure you want to delete the submission?")) {
postSubmission(link);
}
}
</script>
{% endblock %}
63 changes: 63 additions & 0 deletions templates/newsletters/2024-11-1/01#supernatural-humor.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{# Ready for review #}
<div class="page">
<div class="article-full">
<h2> Supernatural Humor: The Comedic Powers of Komi and Saiki </h2>

<br/>
<div class="article-author">By: Arcane</div>
<br>
<div class="article-content">
<center><h3><i><b>Comedy and Connection: The Fun Side of Komi's Struggles</b></i></h3></center>

<h4>Basic introductions</h4>

<p>Well, most of us have thought about this once in our lifetime that being attractive could solve most of our problems in schools and colleges. So let's explore an anime where you will see immense problems and perks of being beautiful from our main female character, komi-san, and the way of solving her problem will give you a hard laugh.</p>

<h4>Origin and Storyline</h4>

<p>Komi Can’t Communicate is a Japanese manga series written and illustrated by Tomohita Oda, and its anime was aired in 2021. The series is centred around a high school girl who suffers from extreme social anxiety and struggles to communicate with others wanna guess who that high school girl is? It's our own Komi-san; it's hard to believe, isn’t it, that a girl this gorgeous doesn’t know how to converse.“But remember, Just Because A Person Has Problems Communicating Doesn't Mean That Person Doesn't Want To Communicate With Others”. and just like that Komi also tries to communicate with others. With the help of her classmate Hitohito Tadano, they embark on a mission to make 100 friends and improve Komi's communication skills. In this journey, she meets different people like Tadano(MMC), Najimi(everybody's mutual), Yamai(the obsessed one), Agari(lapdog), Nakanaka(living in her world), etc. After going through hardship(which will make you laugh) and facing problems together, komi accomplishes her goal of creating 100 friends but still can't talk properly.</p>

<br/><center><img src="/assets/releases/2024-11-1/1-1.webp" alt="." style="height: calc(min(300px, 35vw));margin-right: 10px;"><img src="/assets/releases/2024-11-1/1-2.webp" alt="." style="height: calc(min(300px, 35vw));"></center><br>

<h4>Let's talk about a review of anime.</h4>

<p>The animation is vibrant and expressive, capturing the characters' emotions effectively. The character designs are good, especially Komi’s. The animation quality is consistent, making it enjoyable to watch.</p>

<p>The series also addresses themes of communication, anxiety, and friendship, resonating with anyone who has faced social challenges. At its core, "Komi Can't Communicate" delivers a positive message about the importance of communication. It encourages viewers to understand and support those who struggle with social anxiety, reinforcing the value of patience and kindness in building relationships.</p>

<p>The series provides good humour, and it often arises because of misunderstandings and the awkwardness of social interactions between characters, which leads to some incredibly hilarious situations.</p>

<p>This anime, too, has some shortcomings, such as the animation could be better, there are pacing issues in early episodes, and they tend to rely heavily on repetitive gags and jokes, which may irritate you sometimes.</p>

<p>But still, overall, it's one of the best comedy and slice-of-life anime you will ever see, and if you want something that focuses on nuances of communication and friendships, then this is a must-watch for you.</p><br/>

<center><h3><i><b>The Comedy of Chaos: Saiki Kusuo’s Daily Life</b></i></h3></center>

<h4>Basic introduction</h4>

<p>I bet every one of us has thought at least once in our life that if we had superpowers, life would be easy(even I wanted teleportation and telekinesis). We felt that if we had them, our lives would have no problems, but is that true?</p>

<p>Well, let's explore an anime where a boy has many superpowers but still suffers from a lot of problems. The way he uses his powers to solve those problems will make you laugh a lot.</p>

<h4>Origin and Storyline</h4>

<p>The Disastrous Life of Saiki K (Saiki Kusuo no Psi-nan) is a Japanese manga and anime series created by Shuichi Asou and was aired in 2016. The anime has two seasons. The series revolves around a kid named Saiki who was born with extraordinary supernatural abilities such as telekinesis, levitation, x-ray vision, clairvoyance, astral projection, pyrokinesis, mind control, psychometrics, invisibility, and a lot more. Believe it or not, his only wish is to live an everyday life, which is a considerable challenge given his extraordinary abilities and the colourful characters around him. So, he prefers to keep a low profile and avoid drawing attention to himself, which often leads to laughable dilemmas. While going through high school, he makes a lot of troublesome friends(in his thoughts) like Nendou(a lovable dim-witted brute), Kaido(a wannabe hero), Teruhashi(a beautiful narcissist), Hairo(energetic CR), Yumehara(bearing crush on Saiki), and many more. The dynamic between Saiki and his oddball classmates is the primary source of endless comedic tension. His deadpan reactions to their personalities keep the humour fresh and lighthearted. The series effectively uses visual gags and clever dialogue to maintain a lighthearted tone, appealing to a broad audience. Its comedic style is reminiscent of classic sitcoms, where misunderstandings and character quirks drive the humour.</p>

<br/><center><img src="/assets/releases/2024-11-1/1-3.webp" alt="." style="height: calc(min(300px, 35vw));margin-right: 10px;"><img src="/assets/releases/2024-11-1/1-4.webp" alt="." style="height: calc(min(300px, 35vw));"></center><br>

<h4>So yeah, let's talk about a review of anime.</h4>

<p>It sets a unique premise: combining a high school setting with psychic abilities provides a fresh take on the slice-of-life genre. The series subtly explores themes of isolation, friendship, and the desire for normalcy.</p>

<p>The vibrant and expressive animation captures the humour and defining character traits beautifully. The character designs are distinct and memorable, with each character’s quirks reflected in their appearances.</p>

<p>The series excels in clever writing, featuring sharp dialogue, situational comedy, and visual gags that keep viewers laughing. The pacing is rapid, keeping the audience engaged with quick punchlines and hilarious misunderstandings. Saiki’s internal monologues provide insight into his frustrations, making viewers empathise with his desire for peace amidst chaos.</p>

<p>While being one of the best comedy anime, it also has some things that could be improved, such as a fast-paced style that can result in rushed storylines, leading to character arcs that need to be developed. Some viewers may find that the humour can become repetitive over time, which might lead to diminishing returns for long-term viewers. The comedic tone often means that there are less severe stakes. This may feel somewhat lacking for viewers looking for more intense drama or character development.</p>

<p>But still, overall, it's one of the best comedy and slice-of-life anime around, and if you’re seeking a fun series that captures the absurdities of everyday life through a unique lens, "Saiki K." is definitely worth adding to your watchlist.</p>

<div class="article-end"></div>
</div>
</div>
</div>
Loading