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

Add CSS class to blocks with editing controls so that these can be themed differently

    XMLWordPrintable

    Details

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

      Description

      When creating themes it is sometimes necessary to know whether a block contains editing controls. Unfortunately there is no way for a theme to tell (apart from literally the existence of the 'controls' div, which is fine, but you might need to make changes at the level above).

      A potential mistake (which I made) is to assume that the .editing class on BODY provides this information but it does not. This class is only reliable on course view pages. Everywhere else it may or may not coincide with editing status of blocks.

      I have attached a trivial patch (affects one line of code, uses existing logic) which adds the 'block_with_controls' class to existing classes if a block contains editing controls. Effect on generated html is as follows:

      1) If block does not have editing controls - no change

      2) If block does have editing controls -

      Before patch:
      <div id="inst21" class="block_html sideblock">

      After patch:
      <div id="inst21" class="block_html block_with_controls sideblock">

        Attachments

          Activity

            People

            • Assignee:
              quen Sam Marshall
              Reporter:
              quen Sam Marshall
              Participants:
              Component watchers:
              Adrian Greeve, Mihail Geshoski, Peter Dias
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

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