From 9da30d5516ac24016d292f286ec786b3e430ac9c Mon Sep 17 00:00:00 2001 From: BaileyLeeder Date: Thu, 7 Nov 2024 18:13:04 -0800 Subject: [PATCH 1/7] Small cleanup on satire page --- navigation/shared_interests/satire.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/navigation/shared_interests/satire.md b/navigation/shared_interests/satire.md index 45d45708..ad18c016 100644 --- a/navigation/shared_interests/satire.md +++ b/navigation/shared_interests/satire.md @@ -24,8 +24,6 @@ author: Bailey, Travis, Leon, Anyi -DNHS Satire Home Page - + +
+

Add a New Post

+
+ + + +
+
+ + \ No newline at end of file From d3875662eaba61b04ee49a08f116c5f4ed99371b Mon Sep 17 00:00:00 2001 From: BaileyLeeder Date: Tue, 12 Nov 2024 08:56:07 -0800 Subject: [PATCH 5/7] Adding backend to satire --- navigation/shared_interests/satire.md | 273 ++++++++++++++++++++++++++ 1 file changed, 273 insertions(+) diff --git a/navigation/shared_interests/satire.md b/navigation/shared_interests/satire.md index ad18c016..e58260d6 100644 --- a/navigation/shared_interests/satire.md +++ b/navigation/shared_interests/satire.md @@ -447,3 +447,276 @@ author: Bailey, Travis, Leon, Anyi togglePostForm(); } + + + +
+
+

Select Group and Channel

+
+ + + + + +
+
+
+ +
+
+

Add New Post

+
+ + + + + +
+
+
+ +
+
+
+

+
+
+
+
+
+ + From 799db003afc96490a83598b413b5f92b3838f027 Mon Sep 17 00:00:00 2001 From: kchen8478 Date: Tue, 12 Nov 2024 09:28:16 -0800 Subject: [PATCH 6/7] post --- navigation/shared_interests/limitconnect.md | 361 +++++++++++++------- 1 file changed, 240 insertions(+), 121 deletions(-) diff --git a/navigation/shared_interests/limitconnect.md b/navigation/shared_interests/limitconnect.md index 864f2ded..bc204340 100644 --- a/navigation/shared_interests/limitconnect.md +++ b/navigation/shared_interests/limitconnect.md @@ -65,157 +65,276 @@ menu: nav/shared_interests.html - -
-

Add a New Post

-
- - - -
+ +
+
+

Select Group and Channel

+
+ + + + +
+
- \ No newline at end of file + // Fetch groups when the page loads + fetchGroups(); + From c01fa6aff1548c269263346d418d63ed681a687c Mon Sep 17 00:00:00 2001 From: GavinCopley Date: Tue, 12 Nov 2024 09:33:59 -0800 Subject: [PATCH 7/7] posts onto DNHS football --- navigation/shared_interests/football.md | 367 +++++++++++++++++------- 1 file changed, 259 insertions(+), 108 deletions(-) diff --git a/navigation/shared_interests/football.md b/navigation/shared_interests/football.md index ea092ce9..82c59b8f 100644 --- a/navigation/shared_interests/football.md +++ b/navigation/shared_interests/football.md @@ -188,134 +188,285 @@ menu: nav/shared_interests.html
- -
-

Add a New Post

-
- - - -
-
- - \ No newline at end of file + + /** + * Fetch posts based on selected channel + * Handle response: Fetch and display posts + */ + async function fetchData(channelId) { + try { + const response = await fetch(`${pythonURI}/api/posts/filter`, { + ...fetchOptions, + method: 'POST', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify({ channel_id: channelId }) + }); + if (!response.ok) { + throw new Error('Failed to fetch posts: ' + response.statusText); + } + + // Parse the JSON data + const postData = await response.json(); + + // Extract posts count + const postCount = postData.length || 0; + + // Update the HTML elements with the data + document.getElementById('count').innerHTML = `

Count ${postCount}

`; + + // Get the details div + const detailsDiv = document.getElementById('details'); + detailsDiv.innerHTML = ''; // Clear previous posts + + // Iterate over the postData and create HTML elements for each item + postData.forEach(postItem => { + const postElement = document.createElement('div'); + postElement.className = 'post-item'; + postElement.innerHTML = ` +

${postItem.title}

+

Channel: ${postItem.channel_name}

+

User: ${postItem.user_name}

+

${postItem.comment}

+ `; + detailsDiv.appendChild(postElement); + }); + + } catch (error) { + console.error('Error fetching data:', error); + } + } + + // Fetch groups when the page loads + fetchGroups(); +