This seems like a widespread issue, but I have not found it in the issue queue.

Basically, on context edit form, when user adds a block to a region, that block's weight (-10) does not correspond to its displayed position (last item on the list). When saved, block weight is preserved, although user thinks that its weight corresponds to its displayed position. The block gets a proper weight if user moves blocks around within the same region.

Solution would be to update block's weight value upon adding it to a region.
Can someone point me to a JS function that manipulates blocks on edit form?

Comments

joelcollinsdc’s picture

subscribe

carn1x’s picture

subscribe

carn1x’s picture

I don't seem to be able to get the block weight to save no matter how much dragging around of blocks I do.

EDIT: Even displaying the weight menu and manually altering the values fails to save the weights. When I reloading the edit form, the weights have reset to -20 again.

EDIT 2:

Here's the relevant section of the export:

$context->reactions = array(
  'block' => array(
    'blocks' => array(
      'views-video-front' => array(
        'module' => 'views',
        'delta' => 'video-front',
        'region' => 'sidebar_second',
        'weight' => '-20',
      ),
      'fb_social-Facebook Like Box' => array(
        'module' => 'fb_social',
        'delta' => 'Facebook Like Box',
        'region' => 'sidebar_second',
        'weight' => NULL,
      ),
    ),
  ),
);

I tried manually modifying the export and re-importing, to no effect.

slackrunner’s picture

Im getting the same behavior.
The order of the blocks does not correspond to the weights AND weights return to their previous value on refresh after save.

bc’s picture

slackrunner, are you having the problem with fb social like as well?

pbfleetwood’s picture

I'm having the same problem. It's very annoying, because once I add one or more blocks to a context and save it, I have to reopen it to adjust the blocks to the correct weight. Because of other blocks that I'm using, I have to use weights well below -10, so the limited choice of weights that is available on adding a block is a constant annoyance.

fxarte’s picture

I'm having the same issue and I just found this solution that might be related: http://drupal.org/node/1439134#comment-5648172

tekante’s picture

Adding tag for tracking

aaronbauman’s picture

Version: 7.x-3.0-beta1 » 7.x-3.x-dev
tekante’s picture

I believe the attached patch fixes this issue, please test out and post if it works for you.

tekante’s picture

Status: Active » Needs review

Flipping status to indicate patch review needed.

tekante’s picture

Status: Needs review » Fixed

Patch committed, thanks for the bug report.

Status: Fixed » Closed (fixed)

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

justindodge’s picture

It looks like the patch in #10 introduces a min and max weight of -10 and 10 respectively for block weighting.

This is causing issues for me, as I have a lot of blocks with weights outside of that range from before this patch. Now, when I add a new block to a context that had a wider weight range, I get the message "Desired block weight exceeds available weight options, please check weights for blocks before saving".

I can drag the blocks around and get them to re-weight themselves, but of course that changes their weighting relative to other contexts that may be positioning blocks on the same page within the same region, causing their orders to change visually. This may possibly be related to #1468864: Save correct weight for all blocks in all contexts of region when saving.

I just wanted to make a note of this here - I feel like -10 to 10 (aside from messing with old contexts) may be a little bit too narrow if you're dealing with a lot of interrelated contexts and their block weightings - it's nice to have a little more space in between, so probably a new issue with a patch to widen the range is the next logical step.

loparr’s picture

Hi, I just changed -10 and 10 to -100 and 100 inside context_reaction_block.js and it works ok for now.