Simplified data structure around template files
This commit is contained in:
76
README.md
76
README.md
@ -7,10 +7,11 @@ Created as a prototype by Nathan Schneider with Claude Code.
|
||||
## Features
|
||||
|
||||
- Interactive protocol builder with multi-stage process
|
||||
- Pre-defined modules for common dispute resolution approaches
|
||||
- Complete protocol templates for different facilitation styles
|
||||
- Simple template system with direct content application
|
||||
- Export protocols as Markdown, PDF, or JSON
|
||||
- Import previously created protocols (JSON format)
|
||||
- Markdown support for rich text formatting
|
||||
- Responsive design for desktop and mobile
|
||||
|
||||
## Setup and Installation
|
||||
@ -59,59 +60,27 @@ For example, to add components to a stage with ID "new-stage", create `data/comp
|
||||
required: true
|
||||
```
|
||||
|
||||
### Adding Pre-defined Modules
|
||||
|
||||
Modules provide pre-written content that users can select for specific fields. There are two places where modules are defined:
|
||||
|
||||
1. **YAML Definition (source of truth):** Create or edit files in the `data/modules/` directory.
|
||||
|
||||
```yaml
|
||||
- id: new-module
|
||||
title: New Module Title
|
||||
componentId: new-component
|
||||
fieldId: newComponentField
|
||||
content: |
|
||||
This is the pre-defined content that will be inserted when
|
||||
the user selects this module. It can include multiple lines.
|
||||
```
|
||||
|
||||
2. **JavaScript Implementation:** The frontend uses modules defined in `static/js/data/modules.js`. When adding new modules to the YAML files, you should also add them to this JavaScript file to make them available in the builder interface.
|
||||
|
||||
```javascript
|
||||
const moduleData = {
|
||||
module_category: [
|
||||
{
|
||||
id: "new-module",
|
||||
title: "New Module Title",
|
||||
componentId: "new-component",
|
||||
fieldId: "newComponentField",
|
||||
content: `This is the pre-defined content that will be inserted when
|
||||
the user selects this module. It can include multiple lines.`
|
||||
}
|
||||
]
|
||||
};
|
||||
```
|
||||
|
||||
**Important:** Make sure the `componentId` and `fieldId` values match exactly with the component and field IDs defined in the `data/components/` directory.
|
||||
|
||||
### Using Protocol Templates
|
||||
|
||||
The application includes complete protocol templates that pre-fill all components with consistent content. Three templates are provided:
|
||||
The application includes complete protocol templates that pre-fill all components with consistent content. Several templates are provided:
|
||||
|
||||
1. **Peer-to-Peer Protocol**: A self-facilitated process where participants work together directly to resolve disputes without a formal facilitator.
|
||||
1. **Shalish Mediation**: A process based on the traditional shalish process for village-level mediation in Bangladesh, with modernizing improvements.
|
||||
|
||||
2. **Chosen Facilitator Protocol**: A process where participants mutually select a facilitator who may not have specialized skills but can help guide the discussion.
|
||||
2. **Restorative Justice**: A collaborative process that focuses on healing relationships and repairing harm rather than punitive measures.
|
||||
|
||||
3. **Facilitation Council Protocol**: A structured process with a trained council of facilitators who manage the dispute resolution process.
|
||||
3. **Transformative Justice**: A process that addresses immediate harm while working to transform the conditions that allowed harm to occur.
|
||||
|
||||
Users can select a template from the dropdown at the top of the builder page to automatically populate all fields. They can then customize the content as needed for their community's specific requirements.
|
||||
|
||||
#### Adding New Protocol Templates
|
||||
|
||||
To add a new protocol template, edit the file `static/js/data/templates.js`. Each template follows this structure:
|
||||
To add a new protocol template:
|
||||
|
||||
1. Create a new JavaScript file in the `static/js/templates/` directory
|
||||
2. Define your template with the following structure:
|
||||
|
||||
```javascript
|
||||
{
|
||||
const newTemplate = {
|
||||
id: "template-id",
|
||||
title: "Template Name",
|
||||
description: "Brief description of this template approach",
|
||||
@ -120,9 +89,26 @@ To add a new protocol template, edit the file `static/js/data/templates.js`. Eac
|
||||
// Full protocol data structure with content for all stages and components
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export default newTemplate;
|
||||
```
|
||||
|
||||
3. Register the template in `static/js/templates/index.js`:
|
||||
|
||||
```javascript
|
||||
import newTemplate from './template-id.js';
|
||||
|
||||
const templates = [
|
||||
// existing templates...
|
||||
newTemplate,
|
||||
];
|
||||
|
||||
export default templates;
|
||||
```
|
||||
|
||||
The builder will automatically load all templates registered in the index.js file at startup.
|
||||
|
||||
## Deployment
|
||||
|
||||
### Building for Production
|
||||
@ -188,8 +174,10 @@ RewriteRule ^(.*)$ /index.html [L]
|
||||
## Technologies Used
|
||||
|
||||
- Hugo static site generator
|
||||
- JavaScript for interactive features
|
||||
- Modern JavaScript (ES Modules) for template management
|
||||
- Modular template architecture with simplified importing
|
||||
- jsPDF for PDF generation
|
||||
- Marked.js for Markdown rendering
|
||||
|
||||
## License
|
||||
|
||||
|
Reference in New Issue
Block a user