It would be nice to have disabled blocks sorted by name, not by weight. When you have more then 10 blocks, it's getting messy. To find block that you are looking for, often you have to use searching. With blocks sorted by name, it would be much easier to find block that you are looking for. Instead of searching, you just scroll down block's page and find it.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

yoroy’s picture

Title: Sort disabled block by title, not by weight » Sort disabled blocks by title, not by weight

This would be helpful indeed. I didn't realize disabled blocks are sorted by weight now, but I do know that it does get messy quick. If sorted alphabetically, then knowing the title of the block provides a shortcut, you can 'guesstimate' where to start looking in the list. Now, you have to go through the whole list to find it.

ultimateboy’s picture

I am not completely sure about this one. Often, I use the fact that you can sort the disabled blocks to my advantage by ordering them by importance and placing blocks that will not be used on a specific site near the bottom of the list. Maybe I am alone on this one.. but I kinda like the way it currently works.

yoroy’s picture

I never even imagined the disabled blocks were sorted by weight, let alone actively 'weighting' them to my advantage. But I can see how that is useful too.

So, do we need to make it more obvious that even disabled blocks are sorted by weight or change the sort? I certainly learned something new from your comment. I wonder how we can make that more clear.

Anonymous’s picture

Maybe it could be set in blocks page settings -> new tab with option to choose weight or title sorting(only for disabled blocks), or ahah select above disabled blocks.

AlexisWilke’s picture

Component: usability » block.module

My personal comment, I would say that for most people the alphabetical order would be best.

It should be easy to reset the weight of disabled blocks to 0 and voila. The rest would work automatically already.

In regard to those block we'd never want to use, maybe adding a "hide" feature and a "show hidden blocks" would solve the problem? That way, block that I know I do not want to use I can just hide forever.

And speaking of alphabetical order, the "Component" of the Drupal issues are NOT in alphabetical order. Very annoying too. 8-)

Thank you.
Alexis Wilke

NancyDru’s picture

Actually I solved this with a simple "if" statement in function _block_compare following

  if ($status) {
    return $status;
  }

Do this:

  // If disabled, then region and weight are meaningless.
  if ($a['status']) {
    // Sort by region (in the order defined by theme .info file).
    if ((!empty($a['region']) && !empty($b['region'])) && ($place = ($regions[$a['region']] - $regions[$b['region']]))) {
      return $place;
    }
    // Sort by weight.
    $weight = $a['weight'] - $b['weight'];
    if ($weight) {
      return $weight;
    }
  }

Unfortunately, a Windoze problem temporarily prevents me from creating a patch file. If someone else can do that, it would help a lot.

This is identical on 6.x. Frankly, I consider this a bug and it should be back-ported.

AlexisWilke’s picture

Hi Nancy,

Nice to see you around 8-)

One thing, btw, switch to Linux!

There are two patches: D6 & D7.

Thank you.
Alexis Wilke

NancyDru’s picture

Thanks, Alexis. I was given another PC with which to begin my transition to Linux. Unfortunately, my current PC's CD writer has a CD stuck in it, so I can't create a CD to build Linux with yet. It will happen soon though.

NancyDru’s picture

Assigned: Unassigned » NancyDru
Status: Active » Needs review
Issue tags: +API clean-up
FileSize
737 bytes

We never had this marked CNR. Also tagging so it might get looked at for D7.

Here's a simpler version that is identical for 6.x and 7.x.

NancyDru’s picture

Yee haw! Got past the test bot in the first try.

yoroy’s picture

Version: 7.x-dev » 8.x-dev

Features are frozen for D7

NancyDru’s picture

Version: 8.x-dev » 7.x-dev
Issue tags: -API clean-up +#d7ux

This is neither a feature nor an API change. It is a UI improvement, which should make it a good candidate for 7.

yoroy’s picture

Issue tags: -#d7ux +Usability

Fair enough :)
Patch in #9 doesn't apply anymore. Sorting disabled blocks alphabetically would be good, I find myself scrolling up and down disabled block lists in D6 every time.

Looking at D7 head, I see disabled blocks are now sorted alphabetically. Already fixed then?

(and: use #d7ux tag only for proposals from the d7ux project, other ux issues use the generic 'usability' tag, thanks!)

AlexisWilke’s picture

yoroy,

By default, the disabled blocks are sorted. If you move them around, Save, and they come back in alphabetical order, then it is indeed done (it could be that disabled blocks have their weight reset in D7?) D6 was like that. After a while, it's all messed up. But a Fresh install looks good. Most certainly why it was not noticed by the author.

Thank you.
Alexis

NancyDru’s picture

Issue tags: -Usability

#9: block_001.patch queued for re-testing.

Status: Needs review » Needs work
Issue tags: +Usability

The last submitted patch, block_001.patch, failed testing.

yoroy’s picture

AlexisWilke: ah of course, that was shortsighted of me, thank you for explaining. Yep, still worth doing for D7, this is.

NancyDru’s picture

I don't currently have the capability to re-roll the patch, and it may take a few days to do so. Can someone else re-roll it?

AlexisWilke’s picture

FileSize
704 bytes

Updated D7 patch

yoroy’s picture

Status: Needs work » Needs review

Needs review for testbot

Status: Needs review » Needs work

The last submitted patch, block.admin_.inc-D7.patch, failed testing.

yoroy’s picture

Status: Needs work » Needs review
FileSize
743 bytes

How's this then. Untested.

NancyDru’s picture

It's tested now. Thanks, Roy.

AlexisWilke’s picture

Yoroy,

I guess the test server does not like the -D7 on the filename... 8-)

Thank you.
Alexis

NancyDru’s picture

Now, if we can just get Webchick or Dries to look at this...

yoroy’s picture

They only look at patches that are RTBC :)
Would be good to have one more reviewer actually apply the patch, give this a thumbs up and mark this rtbc

NancyDru’s picture

@Alexis, have you tested this patch? If so, I think three is adequate for such a trivial patch.

AlexisWilke’s picture

Nancy,

I run the patch on all my D6 sites. This was a D6 post at the start... I have not tested on D7, although the code is exactly the same so I don't see a problem with it... I just don't have the time to run a D7 yet!

Sorry,
Alexis

yoroy’s picture

Status: Needs review » Reviewed & tested by the community

That should work then :)

aspilicious’s picture

Code looks good

Dries’s picture

If region is none, why do we calculate the weight?

NancyDru’s picture

We don't, Dries, at least not with this patch. Using the weight when the region is "none" (i.e. disabled) is what led to the blocks being out of order to start with. This patch ignores weight when the block is disabled. It was originally developed and tested on 6.x and now ported to 7.x, so it can be applied to both versions to greatly improve the user experience on both.

Dries’s picture

+++ modules/block/block.admin.inc	31 Mar 2010 21:07:33 -0000
@@ -171,9 +171,9 @@
+  // Sort by weight unless region is none.
   $weight = $a['weight'] - $b['weight'];
-  if ($weight) {
+  if ($weight && $a['region'] != BLOCK_REGION_NONE) {
     return $weight;
   }

We do calculate $weight, even though it might not be used. If $a['region'] != BLOCK_REGION_NONE evaluates to FALSE, $weight is never used. I know -- it is a minor code optimization. Not sure it is worth it. :)

NancyDru’s picture

Ah, I see. Yes, we were trying to modify the code as little as possible, so we stuck the extra condition on the end of the existing IF. Considering that there are sites with hundreds of blocks, it might make a small difference (the page is so slow anyway).

webchick’s picture

Status: Reviewed & tested by the community » Needs review

Sounds like this still needs work, or discussion, or something.

However, I think it's worth doing.

NancyDru’s picture

FileSize
877 bytes

Here's what he wants, I think.

Status: Needs review » Needs work

The last submitted patch, block_354133.patch, failed testing.

NancyDru’s picture

Status: Needs work » Needs review
FileSize
852 bytes

line endings, bah humbug!

AlexisWilke’s picture

Just wondering, how come we're not checking that $b['region'] is not defined?

Thank you.
Alexis

NancyDru’s picture

Because this is only supposed to affect unenabled blocks, so both regions would be the same. If the block is enabled, you want to use the weight.

I hope someone remembers to put this back to RTBC.

yoroy’s picture

Status: Needs review » Reviewed & tested by the community

voila

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD. Thanks.

NancyDru’s picture

Fabulous! Thanks, Dries. I don't suppose there is any chance of back-porting this to 6.x?

yoroy’s picture

One more yay for actually improving the blocks page a bit!

AlexisWilke’s picture

Can we have that back ported to D6 or was it already added there and I missed it?!

Thank you.
Alexis

NancyDru’s picture

No, it is not in 6.x, AFAIK. IMHO, this patch does not violate the no-changing rule for 6.x. Other than possibly line numbers, it will apply just as well to 6.x.

Status: Fixed » Closed (fixed)
Issue tags: -Usability

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