Moodle
  1. Moodle
  2. MDL-32689

Allow Blocks to decide whether they are collapsible.

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.3
    • Fix Version/s: 2.3, DEV backlog
    • Component/s: Blocks
    • Labels:
    • Testing Instructions:
      Hide
      1. Go to Admin > Appearance > Themes
      2. Ensure allowuserblockhiding is set to yes
      3. Go to a course
      4. As a student attempt to hide blocks using the -/+ icon
      5. Pick a block and add the following code to the blocks on the page you are testing:
        public function instance_can_be_collapsed() { return false; }
        
      6. Make sure the collapse/expand icons are no longer visible and that the block is expanded
      7. Go to Admin > Apperance > Themes
      8. Set allowuserblockhiding to no
      9. Go to a course
      10. Ensure you can't collapse any blocks
      11. Attempt to add new blocks to a course page and ensure this works fine
      Show
      Go to Admin > Appearance > Themes Ensure allowuserblockhiding is set to yes Go to a course As a student attempt to hide blocks using the -/+ icon Pick a block and add the following code to the blocks on the page you are testing: public function instance_can_be_collapsed() { return false ; } Make sure the collapse/expand icons are no longer visible and that the block is expanded Go to Admin > Apperance > Themes Set allowuserblockhiding to no Go to a course Ensure you can't collapse any blocks Attempt to add new blocks to a course page and ensure this works fine
    • Affected Branches:
      MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE
    • Pull from Repository:
    • Pull Master Branch:
    • Rank:
      39644

      Description

      Currently, the primary display control methods for blocks allow the block instance to decide whether it should be dockable, hidable or display the header. The notable missing capability is to determine whether they are collapsible.

        Activity

        Hide
        Michael de Raadt added a comment -

        Thanks for proposing that and providing a patch.

        I've added you to the jira-developers group. With this you now have the potential to edit issues, to have issues assigned to you and to push issues to peer review.

        It would be handy if you could include testing instructions. Once added, you could push this to peer review.

        Show
        Michael de Raadt added a comment - Thanks for proposing that and providing a patch. I've added you to the jira-developers group. With this you now have the potential to edit issues, to have issues assigned to you and to push issues to peer review. It would be handy if you could include testing instructions. Once added, you could push this to peer review.
        Hide
        Michael de Raadt added a comment -

        Also, it would be ideal to see your patch implemented in Git branches.

        Show
        Michael de Raadt added a comment - Also, it would be ideal to see your patch implemented in Git branches.
        Hide
        Jonathan Champ added a comment - - edited

        Thanks Michael de Raadt! Added git branches and testing instructions.

        Show
        Jonathan Champ added a comment - - edited Thanks Michael de Raadt ! Added git branches and testing instructions.
        Hide
        Adrian Greeve added a comment -

        The patch looks good and works fine. I just tidied up the git branch urls on this page for the integrators. Please submit for integration review.

        Show
        Adrian Greeve added a comment - The patch looks good and works fine. I just tidied up the git branch urls on this page for the integrators. Please submit for integration review.
        Hide
        Jonathan Champ added a comment -

        Adrian Greeve or Michael de Raadt, can you please submit for integration review? The interface doesn't give me that button.

        Show
        Jonathan Champ added a comment - Adrian Greeve or Michael de Raadt , can you please submit for integration review? The interface doesn't give me that button.
        Hide
        Adrian Greeve added a comment -

        done

        Show
        Adrian Greeve added a comment - done
        Hide
        Dan Poltawski added a comment -

        Hi Jonathan,

        I'm just wondering what the use case is for this?

        (The reason we allow the other methods is mainly for technical reasons so i'm intrigued by this)

        Show
        Dan Poltawski added a comment - Hi Jonathan, I'm just wondering what the use case is for this? (The reason we allow the other methods is mainly for technical reasons so i'm intrigued by this)
        Hide
        Jonathan Champ added a comment -

        Hi Dan,

        I wrote a replacement login block that meets our branding and technical needs. During testing, some users complained that they were confused about where to log in. We discovered that some users were getting the collapsed view of the block and due to their unfamiliar knowledge of Moodle 2.x (it was their first time logging in), it wasn't clear that the block could be expanded. Where most of the other blocks defer to the user's preference based on their ability to customize their experience, we felt that it was important that the login block always be visible when a user is not logged in.

        Show
        Jonathan Champ added a comment - Hi Dan, I wrote a replacement login block that meets our branding and technical needs. During testing, some users complained that they were confused about where to log in. We discovered that some users were getting the collapsed view of the block and due to their unfamiliar knowledge of Moodle 2.x (it was their first time logging in), it wasn't clear that the block could be expanded. Where most of the other blocks defer to the user's preference based on their ability to customize their experience, we felt that it was important that the login block always be visible when a user is not logged in.
        Hide
        Dan Poltawski added a comment -

        Ok, so documenting me own discovery on this as I go..

        The difference between this and instance_can_be_hidden() is that the instance_can_be_hidden() feature is for hiding in editing mode, rather than the 'js hide'.

        Show
        Dan Poltawski added a comment - Ok, so documenting me own discovery on this as I go.. The difference between this and instance_can_be_hidden() is that the instance_can_be_hidden() feature is for hiding in editing mode, rather than the 'js hide'.
        Hide
        Dan Poltawski added a comment -

        Thanks a lot for the patch, i've integrated this now!

        Show
        Dan Poltawski added a comment - Thanks a lot for the patch, i've integrated this now!
        Hide
        Sam Hemelryk added a comment -

        Thanks guys passing this now.

        Show
        Sam Hemelryk added a comment - Thanks guys passing this now.
        Hide
        Eloy Lafuente (stronk7) added a comment -

        This is now part of Moodle and a few millions people around the globe will be using it soon. Isn't that awesome?

        Many, many thanks and don't forget http://youtu.be/4N7dPaP5Z8U

        Closing, ciao

        Show
        Eloy Lafuente (stronk7) added a comment - This is now part of Moodle and a few millions people around the globe will be using it soon. Isn't that awesome? Many, many thanks and don't forget http://youtu.be/4N7dPaP5Z8U Closing, ciao

          People

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

            Dates

            • Created:
              Updated:
              Resolved: