WorldWide Wildcats
Documentation

Initialization

$(document).ready(function () { ... });

Initializes the document when ready and sets up event listeners, loads data, and handles pagination.

Properties

posts

The array holding all posts data.

Type: Array

searchTerm

The search term used to filter posts.

Type: string

currentPage

The current page number in pagination.

Type: number

postsPerPage

The number of posts displayed per page.

Type: number

filteredPosts

The array holding the filtered posts data.

Type: Array

totalPages

The total number of pages after filtering.

Type: number

Methods

populatePosts(postsToPopulate)

Populates the posts container with the given posts.

Parameters: postsToPopulate (Array) - The posts to populate in the container.

filterBySearchTerm(posts)

Filters posts by search term.

Parameters: posts (Array) - The posts to filter.

Returns: Array - The filtered posts.

filterByDate(posts, startDate, endDate)

Filters posts by date range.

Parameters: posts (Array) - The posts to filter. startDate (string) - The start date of the range. endDate (string) - The end date of the range.

Returns: Array - The filtered posts.

filterPostsByDateAndSearch(posts, startDate, endDate, searchTerm)

Filters posts by date range and search term.

Parameters: posts (Array) - The posts to filter. startDate (string) - The start date of the range. endDate (string) - The end date of the range. searchTerm (string) - The search term to filter by.

Returns: Array - The filtered posts.

goToPage(page)

Goes to the specified page of posts.

Parameters: page (number) - The page number to go to.

updatePagination(currentPage)

Updates the pagination links.

Parameters: currentPage (number) - The current page number.

updatePaginationLinks(currentPage)

Updates the pagination links for navigating between pages.

Parameters: currentPage (number) - The current page number.

formatDate(date)

Formats a date to the YYYY-MM-DD format.

Parameters: date (string) - The date to format.

Returns: string - The formatted date.

SetDates()

Sets the default start and end dates for the date inputs.

filterByDateRange(posts, startDate, endDate)

Filters posts by date range, adjusting the range if no posts are found.

Parameters: posts (Array) - The posts to filter. startDate (string) - The start date of the range. endDate (string) - The end date of the range.

Returns: Array - The filtered posts.

Video Tutorials

How to Add a Post

How to Update a Post

How to Delete a Post

How to add a new sheet

Steps to Manage Posts

Add a Post

Follow these steps to add a new post:

  1. Navigate to the posts google sheet.
  2. Fill in the required fields such as content, picture URL, and date.
  3. Head back to the WorldWide Wildcats page to see the changes(remember to refresh the page incase the changes are not showing).

Update a Post

Follow these steps to update an existing post:

  1. Navigate to the posts google sheet.
  2. Select the post you want to update.
  3. Make the necessary changes in the form.
  4. Head back to the WorldWide Wildcats page to see the changes(remember to refresh the page incase the changes are not showing).

Delete a Post

Follow these steps to delete a post:

  1. Navigate to the posts google sheet.
  2. Select the row of the post you want to delete.
  3. Left Click the "Delete Row" button.
  4. Head back to the WorldWide Wildcats page to see the changes(remember to refresh the page incase the changes are not showing).

Add a new sheet

Follow these steps to delete a post:

  1. Navigate to the posts google sheet.
  2. Select the "+" at the bottom right.
  3. Rename the new sheet to be "posts_{current Year}.
  4. Head to the WorldWide Wildcats Source Code and click the "Edit" tab.
  5. Find "const sheets" and add the name of the new sheet.
  6. Click save and publish.
  7. Head back to the WorldWide Wildcats page to see the changes(remember to refresh the page incase the changes are not showing).