diff --git a/README.md b/README.md index 661545b..03e6fa1 100644 --- a/README.md +++ b/README.md @@ -59,13 +59,17 @@ A web-based learning management system for C programming with interactive exerci 2. Run the container: ```bash - podman run -p 5000:5000 -v $(pwd)/content:/app/content -v $(pwd)/static:/app/static -v $(pwd)/templates:/app/templates -v $(pwd)/tokens.csv:/app/tokens.csv lms-c + podman run -p 5000:5000 -v ../content:/app/content -v ./static:/app/static -v ./templates:/app/templates -v ./tokens.csv:/app/tokens.csv lms-c ``` ## Content Structure The system uses Markdown files for content management. There are two main types of content files: +### Content Directory Location + +The content directory is located at the parent directory level, outside of the `elemes/` directory. This allows for easy linking and sharing of content between different instances of the LMS. + ### Home Page (`home.md`) The home page serves as the main landing page and lesson directory. Here's the template structure: @@ -329,7 +333,7 @@ int main() { ### Updating the Home Page -After creating new lessons, update the `content/home.md` file to include links to your new lessons in the `---Available_Lessons---` section: +After creating new lessons, update the `../content/home.md` file to include links to your new lessons in the `---Available_Lessons---` section: ```markdown ---Available_Lessons--- @@ -339,7 +343,7 @@ After creating new lessons, update the `content/home.md` file to include links t ### Content Organization -- Store all lesson files in the `content/` directory +- Store all lesson files in the `../content/` directory (at the parent directory level) - Use descriptive filenames with underscores instead of spaces (e.g., `variables_and_data_types.md`) - Keep lesson files focused on a single topic or concept - Use consistent formatting and structure across all lessons @@ -372,6 +376,30 @@ The CSV file format is: `token;nama_siswa;lesson1;lesson2;...` 6. View the output in the output panel 7. For student tracking, use the token login field in the top navigation bar +## Using as a Submodule + +This LMS can be used as a submodule in another repository. To set it up: + +1. Add this repository as a submodule to your main project: + ```bash + git submodule add elemes + ``` + +2. Create a content directory at the root level of your main project: + ```bash + mkdir content + ``` + +3. Add your lesson files to the content directory + +4. Run the LMS from the elemes directory: + ```bash + cd elemes + podman-compose -f podman-compose.yml up --build + ``` + +The content directory at the root level will be automatically mounted to the application container. + ## Security Considerations - The application runs C code in a containerized environment @@ -382,7 +410,7 @@ The CSV file format is: `token;nama_siswa;lesson1;lesson2;...` ## Project Structure - `app.py`: Main Flask application -- `content/`: Directory for lesson Markdown files +- `../content/`: Directory for lesson Markdown files (at parent directory level) - `templates/`: HTML templates - `static/`: CSS, JavaScript, and other static assets - `tokens.csv`: Student progress tracking file diff --git a/access_container.sh b/access_container.sh index c60a265..dab5da9 100755 --- a/access_container.sh +++ b/access_container.sh @@ -18,7 +18,7 @@ else podman exec -it lms-c-container /bin/bash else echo "Building and starting container..." - podman build -t lms-c . && podman run -d -p 5000:5000 --name lms-c-container lms-c + podman build -t lms-c . && podman run -d -p 5000:5000 --name lms-c-container -v ../content:/app/content -v ./static:/app/static -v ./templates:/app/templates -v ./tokens.csv:/app/tokens.csv lms-c sleep 5 # Wait for the application to start podman exec -it lms-c-container /bin/bash fi diff --git a/app.py b/app.py index 2d44c12..c2aed89 100644 --- a/app.py +++ b/app.py @@ -17,7 +17,7 @@ from datetime import datetime app = Flask(__name__) # Configuration -CONTENT_DIR = 'content' +CONTENT_DIR = '../content' STATIC_DIR = 'static' TEMPLATES_DIR = 'templates' TOKENS_FILE = 'tokens.csv' diff --git a/content/home.md.exclude b/example_content/home.md similarity index 100% rename from content/home.md.exclude rename to example_content/home.md diff --git a/content/introduction_to_c.md.exclude b/example_content/introduction_to_c.md similarity index 100% rename from content/introduction_to_c.md.exclude rename to example_content/introduction_to_c.md diff --git a/generate_tokens.py b/generate_tokens.py index 608ed1d..e79312f 100644 --- a/generate_tokens.py +++ b/generate_tokens.py @@ -9,7 +9,7 @@ import glob import uuid # Configuration -CONTENT_DIR = 'content' +CONTENT_DIR = '../content' TOKENS_FILE = 'tokens.csv' def get_lesson_names(): diff --git a/podman-compose.yml b/podman-compose.yml index ab51c83..c809617 100644 --- a/podman-compose.yml +++ b/podman-compose.yml @@ -6,7 +6,7 @@ services: ports: - "5000:5000" volumes: - - ./content:/app/content + - ../content:/app/content - ./static:/app/static - ./templates:/app/templates - ./tokens.csv:/app/tokens.csv diff --git a/start.sh b/start.sh index 0bb0776..706b410 100755 --- a/start.sh +++ b/start.sh @@ -17,7 +17,7 @@ if [ "$(podman ps -aq -f name=lms-c-container)" ]; then else # Build and run the container echo "Building and starting container..." - podman build -t lms-c . && podman run -d -p 5000:5000 --name lms-c-container lms-c + podman build -t lms-c . && podman run -d -p 5000:5000 --name lms-c-container -v ../content:/app/content -v ./static:/app/static -v ./templates:/app/templates -v ./tokens.csv:/app/tokens.csv lms-c fi echo "Application is now running. Access at http://localhost:5000"