- 
                Notifications
    
You must be signed in to change notification settings  - Fork 31
 
feat: Make template component folder configurable #285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
          
Reviewer's GuideIntroduce a configurable component folder by adding a new setting and refactoring template discovery and registration to use it, along with tests to verify folder-based selection and a minor inline-field comment update. Sequence Diagram for Configurable Template Component DiscoverysequenceDiagram
    participant CAD as CMSAutoComponentDiscovery
    participant Settings as djangocms_frontend.settings
    participant FCT as find_cms_component_templates
    CAD->>+Settings: Read settings.COMPONENT_FOLDER
    Settings-->>-CAD: COMPONENT_FOLDER value ("new_folder")
    CAD->>+FCT: find_cms_component_templates(subfolder="new_folder")
    FCT-->>-CAD: List of templates from "new_folder"
    Class Diagram of Changes for Configurable Component FolderclassDiagram
    direction LR
    class Settings_djangocms_frontend {
      +COMPONENT_FOLDER: string
    }
    class CMSAutoComponentDiscovery {
      +__init__(register_to)
    }
    class find_cms_component_templates_function {
      <<Function>>
      +find_cms_component_templates(subfolder: str) : list
    }
    CMSAutoComponentDiscovery ..> Settings_djangocms_frontend : Uses
    CMSAutoComponentDiscovery ..> find_cms_component_templates_function : Calls
    File-Level Changes
 Tips and commandsInteracting with Sourcery
 Customizing Your ExperienceAccess your dashboard to: 
 Getting Help
  | 
    
          Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@            Coverage Diff             @@
##           master     #285      +/-   ##
==========================================
+ Coverage   88.69%   88.89%   +0.20%     
==========================================
  Files         124      124              
  Lines        3387     3385       -2     
  Branches      289      288       -1     
==========================================
+ Hits         3004     3009       +5     
+ Misses        265      259       -6     
+ Partials      118      117       -1     ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
  | 
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @fsbraun - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟢 General issues: all looks good
 - 🟢 Security: all looks good
 - 🟢 Testing: all looks good
 - 🟢 Complexity: all looks good
 - 🟢 Documentation: all looks good
 
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
By default, template components are autodetected from the
cms_componentsfolder. This PR adds a settingDJANGOCMS_FRONTEND_COMPONENT_FOLDERto allow setting a different folder.This would allow to have more than one set of components in an app and select the relevant through the component folder.
Example
By default, the
button.htmlcomponent would be discovered. Withthe discovery will find
test_component.htm.Summary by Sourcery
Allow configuring the template component subfolder via a new setting and update discovery logic accordingly
Enhancements:
Documentation:
Tests: