Welcome Guest to Defaut site!

Projects System Documentation

Projects Overview

The Projects system manages hierarchical project structures with support for parent-child relationships. Each project can have multiple sub-projects, and the system maintains data integrity through proper handling of user permissions and data validation.

Projects Controller

Key features in Comserv::Controller::Project:

Controller Code Example

# Add the projects and filter info to the stash
$c->stash(
    projects => $projects,
    role_filter => $role_filter,
    project_filter => $project_filter,
    priority_filter => $priority_filter,
    template => 'todo/project.tt',
    template_timestamp => time(), # Add a timestamp to force template reload
    additional_css => ['/static/css/components/project-cards.css?v=' . time()], # Add timestamp to force CSS reload
    use_fluid_container => 1, # Use fluid container for better card layout
    debug_mode => 1 # Enable debug mode to see template version
);

Projects Model

The database schema includes these key fields:

Projects Templates

Current template structure:

The template system uses Template Toolkit with the following features:

Projects UI Components

The Projects system uses a vertical card-based UI for displaying projects:

Card Layout

CSS Implementation

The card layout is implemented using a combination of:

Responsive Design

Visual Indicators

Projects Filtering

The Projects system includes a comprehensive filtering system:

Filter Panel

Filtering Logic

Implementation Details

Code Example: Filter Panel

<div class="filter-panel mb-4">
    <form id="projectFilterForm" class="form-inline" method="GET" action="/project/project">
        <div class="form-group mb-2">
            <label for="project_filter" class="mr-2">Project:</label>
            <select id="project_filter" name="project_id" class="form-control">
                <option value="">All Projects</option>
                
            </select>
        </div>
        
        <div class="form-group mb-2 ml-3">
            <label for="priority_filter" class="mr-2">Priority:</label>
            <select id="priority_filter" name="priority" class="form-control">
                <option value="">All Priorities</option>
                <option value="1" >High</option>
                <option value="2" >Medium</option>
                <option value="3" >Low</option>
            </select>
        </div>
        
        <button type="submit" class="btn btn-primary mb-2 ml-3">Apply Filters</button>
        <button type="button" id="clearFilters" class="btn btn-outline-secondary mb-2 ml-2">Clear Filters</button>
    </form>
</div>

Projects Workflow

  1. Project Creation:
  2. Project Management:

System Requirements and Limitations

Active Project Hierarchies

1. Planning & Task Management

Note: This hierarchy is used to organize system-level tasks and daily development priorities.

Troubleshooting

CSS Display Issues

If projects are not displaying correctly as cards:

  1. Verify that the CSS file is being loaded correctly (check browser developer tools)
  2. Ensure the template is using the correct CSS classes
  3. Check that the inline critical CSS is present in the template
  4. Verify that the controller is setting use_fluid_container => 1
  5. Check for JavaScript errors that might be affecting the layout

Collapsible Card Issues

If the collapsible functionality is not working:

  1. Check browser console for JavaScript errors
  2. Verify that the toggleCollapse function is defined in the template
  3. Ensure that card IDs are unique and properly referenced in the onclick handlers
  4. Check that the collapse icon is properly styled and transitions are working

Filtering Issues

If filtering is not working correctly:

  1. Verify that the filter form is submitting to the correct URL
  2. Check that the controller is correctly passing filter parameters to the template
  3. Ensure that the is_parent_of_filtered_project macro is correctly implemented
  4. Check the browser's network tab to confirm filter parameters are being sent
  5. Verify that the NEXT statements in the template are correctly evaluating filter conditions

Debug Mode

Enable debug mode in the controller to see additional information:

$c->stash(debug_mode => 1);

This will display template version and CSS file information at the top of the page.

Common Issues

Logging

The Project controller logs important events to the application log:

$self->logging->log_with_details($c, 'debug', __FILE__, __LINE__, 'project', 'message');

Check logs/application.log for debugging information, especially filter parameters and project data structure.

JavaScript Debugging

For JavaScript-related issues, add console logging to the script:

console.log('Filter parameters:', {
    project: document.getElementById('project_filter').value,
    priority: document.getElementById('priority_filter').value
});

This can help identify issues with the collapsible functionality and filter handling.

Back to top