Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-14306

The course category hierarchy should be reflected in CSS classes on the body tag

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9
    • Fix Version/s: 2.0
    • Component/s: Themes
    • Labels:
      None
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE

      Description

      If a course is within a category, that should be reflected in the CSS classes to allow it to be styled appropriately. The category id number could be used, combined with some text e.g. "category-1" and added as a class to the body tag.

      If a course is nested within one or more categories, then all of them should be added to the body tag as classes. To ensure that the CSS cascade works properly the designer should ensure that the CSS for the lower level categories comes later than the higher categories (assuming that you wish them to override).

      This would make it much easier to make subtle style changes via categories. We're currently trying to theme over a hundred departments, which mostly involves just changing a prominent header image and have implemented something similar just by adding PHP code to the header.

        Gliffy Diagrams

          Activity

          Hide
          dougiamas Martin Dougiamas added a comment -

          +1 for this

          Show
          dougiamas Martin Dougiamas added a comment - +1 for this
          Hide
          timhunt Tim Hunt added a comment -

          OK so, it will always add a "category-123" class with the current category (unless you are in the front page, or somewhere else where there is no category).

          If $CFG->allowcategorythemes is on, then it also adds classes for any parent categories - we don't do that all the time becuase it costs DB queries.

          Show
          timhunt Tim Hunt added a comment - OK so, it will always add a "category-123" class with the current category (unless you are in the front page, or somewhere else where there is no category). If $CFG->allowcategorythemes is on, then it also adds classes for any parent categories - we don't do that all the time becuase it costs DB queries.
          Hide
          timhunt Tim Hunt added a comment -

          That is, it does this in my git development branch. Not in CVS yet.

          Show
          timhunt Tim Hunt added a comment - That is, it does this in my git development branch. Not in CVS yet.
          Hide
          timhunt Tim Hunt added a comment -

          Went into CVS weeks ago as part of MDL-12212. Resolving this bug now.

          Show
          timhunt Tim Hunt added a comment - Went into CVS weeks ago as part of MDL-12212 . Resolving this bug now.

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                24/Nov/10