Gallery & Publication Control
Gallery Management
The Gallery module provides a dual-interface for managing visual content, supporting both image collections and video links (specifically YouTube). It allows for categorized media organization within the CMS.
Media Types
The system distinguishes between two gallery types:
- Image: A collection of one or more uploaded image files.
- Video: Embedded video content (parsed via YouTube URL).
Gallery API Reference
The galleryApii.js module provides methods to interact with the gallery backend. Most write operations require an authenticated admin session.
Fetching Content
import { getAllGallery, getGalleryById } from './galleryApi';
// Retrieve all gallery items (Images and Videos)
const galleryData = await getAllGallery();
// Retrieve a specific gallery by ID
const specificGallery = await getGalleryById('gallery_id_123');
Managing Media
| Function | Description | Input |
| :--- | :--- | :--- |
| addGallery(data) | Creates a new gallery entry. | FormData or Object (Title, Type, etc.) |
| addMultipleImage(id, data) | Appends multiple images to an existing gallery. | GalleryID, FormData |
| updateGalleryById(id, data) | Updates gallery metadata. | GalleryID, Update Object |
| deleteImageOfGallery(id) | Deletes a specific image from a collection. | ImageID |
| deleteGallery(id) | Removes the entire gallery entry. | GalleryID |
Public Gallery Component
The GalleryPage component displays content using a tabbed interface. It filters the gallery data based on the galleryType attribute.
Usage Example:
// The component automatically handles fetching and filtering
// Usage in routing:
<Route path="/gallery/:tab" element={<GalleryPage />} />
Publication Control
The Publication system is designed for document management, allowing the organization of files (PDFs, Reports, Journals) into manageable categories.
Publication Hierarchy
- Categories: High-level groups (e.g., "Annual Reports", "Research Papers").
- Publications: Individual entries containing the file, title, and description.
Publication API Reference
Located in publicationApi.js, these functions handle the CRUD operations for both categories and individual files.
Category Management
import { getPublicationCategory, addPublicationCategory } from './publicationApi';
// Fetch all available categories
const categories = await getPublicationCategory();
// Add a new category
await addPublicationCategory({ name: "Newsletter", status: true });
Document Operations
| Function | Description |
| :--- | :--- |
| getPublicationByCategoryId(id) | Filters documents by their parent category. |
| addPublication(data) | Uploads a new document with metadata. |
| downloadPublicationFile(filename) | Initiates a secure file download from the server. |
File Download Implementation
The system includes a dedicated utility for downloading publication assets. It converts the server response into a blob and triggers a browser download.
import { downloadPublicationFile } from './publicationApi';
// Trigger download for a specific file
const handleDownload = (fileName) => {
downloadPublicationFile(fileName);
};
Integration Notes
- Authentication: All
POST,PATCH, andDELETErequests automatically include theAuthorization: Bearer <token>header, provided the user is logged into the CMS. - Conditional Rendering: Public pages (like
FaqPageorGalleryPage) typically filter for items wherestatus === trueto ensure only published content is visible to end-users.