Problem: When a block is active in a context, the HTML for that item is hidden through the jQuery .hide() option. This prevents the ability to both display this hidden item and render it differently from addable-blocks that are not active in a context.

Use case: I would like to always show all possible blocks for a category regardless if that block is currently active in the context being edited. Active blocks will appear differently within the block browser to convey to the viewer that those blocks are currently in use.

Solution: The patch provided removes .hide() and uses 'context-block-addable' and 'context-block-added' to differentiate between active and inactive blocks. It introduces a 'context-block-item' class so all blocks can share a common style when desired. The draggable state is disabled and enabled as needed. Appropriate CSS styles have been updated, and the hidden effect of 'added' blocks has been retained. Note that the ginko theme will likely need to be updated (e.g.: palette).

Using this patch has allowed me to implement the use case I outlined above.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

yhahn’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

hefox’s picture

Status: Closed (fixed) » Active

This is currently not working quite well, as I believe context is no longer using draggable? but sortable? So the item is never un-draggable/sortable, so draggable(disable) and draggable(enable) really aren't doing anything. Well, some change broke it.

hefox’s picture

Category: feature » bug
Status: Active » Needs review
FileSize
1.62 KB

This appears to work, use sortable cancel arg to say what items aren't sortable.

Grayside’s picture

Attached is a straight reroll for easier patching.

  • yhahn committed 786e081 on 8.x-4.x
    #754436 by ceardach: More versatile class implementation of addable...

  • yhahn committed 786e081 on 8.x-0.x
    #754436 by ceardach: More versatile class implementation of addable...

  • yhahn committed 786e081 on 8.x-1.x
    #754436 by ceardach: More versatile class implementation of addable...
DeaOm’s picture

Issue summary: View changes
Status: Needs review » Closed (outdated)