Skip to content
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

POC: For Style Plugin, Support Automatic Tag #432

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

wesleyboar
Copy link
Member

Overview

Intelligently choose HTML tag for user choice of class (for example, in Django Style).

Tickets

Changes

To our default settings:

  • Add preferred_tag_for_class template tag.
  • Add DJANGOCMS_STYLE_TAGS_DEFAULT (custom setting).
    • to allow dev to define default tag (should probably always be div)
    • to ensure the default tag is defined in only one location
  • (Optional) Add DJANGOCMS_STYLE_TAGS (docs).
    • to support a use case of DJANGOCMS_STYLE_TAGS_DEFAULT

New files:

  • (Optional) Override djangocms-style template.
    • to use preferred_tag_for_class template tag
  • Add preferred_tag_for_class template tag.

Screenshots

(pending)

Testing

local testing: instructions
remote testing: (not provided)

  1. On any page, create a Style plugin.
  2. Test default tag choice logic:
    1. Choose TAG TYPE div, CLASS NAME ---------.
    2. Confirm element added has tag of <div>.
  3. Test automatic tag choice logic:
    1. Choose TAG TYPE div, CLASS NAME o-section o-section--style-light.
    2. Confirm element added has tag of <section>.
    3. Choose TAG TYPE div, CLASS NAME o-section o-section--style-dark.
    4. Confirm element added has tag of <section>.
    5. Choose TAG TYPE div, CLASS NAME c-callout.
    6. Confirm element added has tag of <aside>.
    7. Choose TAG TYPE div, CLASS NAME c-recognition c-recognition--style-light.
    8. Confirm element added has tag of <aside>.
    9. Choose TAG TYPE div, CLASS NAME c-recognition c-recognition--style-dark.
    10. Confirm element added has tag of <aside>.
  4. Test manual tag choice logic:
    1. Choose TAG TYPE article, CLASS NAME o-section o-section--style-light.
    2. Confirm element added has tag of <article>.
    3. Choose TAG TYPE article, CLASS NAME o-section o-section--style-dark.
    4. Confirm element added has tag of <article>.
    5. Choose TAG TYPE article, CLASS NAME c-callout.
    6. Confirm element added has tag of <article>.
    7. Choose TAG TYPE article, CLASS NAME c-recognition c-recognition--style-light.
    8. Confirm element added has tag of <article>.
    9. Choose TAG TYPE article, CLASS NAME c-recognition c-recognition--style-dark.
    10. Confirm element added has tag of <article>.

@wesleyboar wesleyboar force-pushed the poc/djangocms_style-automatic-tag branch 2 times, most recently from e5aabf2 to 711acfd Compare January 18, 2022 18:37
@wesleyboar wesleyboar force-pushed the poc/djangocms_style-automatic-tag branch from 711acfd to a4114c5 Compare January 18, 2022 18:42
@wesleyboar wesleyboar added the enhancement Improvements or additions to existing features label Feb 2, 2022
@wesleyboar wesleyboar added the paused Started but not actively in progress label Jun 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvements or additions to existing features paused Started but not actively in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant