blog, forum, and statistics.module show their blocks even if they have no contents. this looks quite dull, eg.

+----------------------+
| Forum topics         |
|                      |
| Active forum topics: |
|                      |
| New forum topics:    |
|                      |
| more                 |
+----------------------+

+----------------------+
| Popular content      |
|                      |
| Today's:             |
|                      |
| All time:            |
|                      |
| Last viewed:         |
|                      |
+----------------------+

and isn't what the rest of the drupal blocks do (not showing up if there is no content). this patch fixes this. additional improvements:

* removed the "more" links from blog and forum.module and replaced them with block titles linking to the respective module page. rationales:
  + "more" means there are more blog entries/forum topics than those linked from the blocks. this, however, wasn't always the case.
  + it is common user expectation that the title of a "content excerpt" links to the complete content. examples: node titles on the homepage, links in admin tables, tracker, etc.
  + it saves screen estate
* fixed the forum link description ('Read the latest forum topics.' > 'Go to the forums.')
* added a link from the 'Popular content' block title to the 'Most popular content' page (statistics). this wasn't accessible before.

please review and apply.

Comments

dries’s picture

I haven't tested the patch yet but it would be nice if more block titles were links (eg. the title of the archive block could link to the main archive page).

ax’s picture

want me to make all block titles link to the respective module page?

dries’s picture

I'd like to discuss this at the very least. :-)

boris mann’s picture

I don't want clickable block titles! This is a theming issue, and I don't think it should be in by default. What is wrong with the "more" link?

Empty blocks not displaying content (i.e. block doesn't show at all) is OK for some blocks, not OK for others. This would ideally be a configuration option: "display even if empty" and a checkbox.

I've always wanted "Active" and "New" forum topics a) either split into two blocks or b) made it configurable to display one or the other or both.

gábor hojtsy’s picture

Targets for block title links could be provided by modules, but it is after all the decision of modules to print out block titles using those links.

Kjartan’s picture

Once upon a time blocks defind a link along with the subject and content. I think we should re-introduce it, and have it replace the more link that some blocks add. This way themes can choose how and where they put the link (title, text, icon, etc).

moshe weitzman’s picture

we already pass the 'more' link separate from the content. this is about how the core themes should present that 'more' link

Kjartan’s picture

From my quick look at blocks in HEAD this is not true for the aggregator or blog blocks, they have specific div & CSS class around them yes, but they are not 100% controlable in the theme.

boris mann’s picture

Once upon a time blocks defind a link along with the subject and content. I think we should re-introduce it, and have it replace the more link that some blocks add. This way themes can choose how and where they put the link (title, text, icon, etc).

+10!! Yes, make more block stuff themeable.

This is a great solution, since you could also add a "link" field to custom blocks that would display in the same way. Ideally, both the text (e.g. "more", "check this out", "extra stuff", etc. etc.) and the link would be configurable, and the theme would take care of how this is displayed.

dries’s picture

I'm marking this patch 'active' as we agreed to disagree with the suggested patch/approach. Please resubmit or split your patch in smaller chunks. Thanks.

robin monks’s picture

Assigned: ax » robin monks
StatusFileSize
new3 KB

This patch fixes the actual goal of the bug "don't show blocks if they have no content".

This is basically ax's patch broken up and updated to HEAD. This patches forum.module and stats. It's been tested to work on CVS HEAD.

I'll take responsibility for upcoming changes to this patch.

Robin

robin monks’s picture

StatusFileSize
new3.16 KB

Chx recommended moving the returns into their relative ifs. This also works on HEAD.

Robin

robin monks’s picture

StatusFileSize
new3.17 KB

...wrong patch version...

Robin

mfb’s picture

Looks good, +1

jose reyero’s picture

+1
Tried the patch, it works

dries’s picture

Committed to HEAD.

Anonymous’s picture

Anonymous’s picture

Anonymous’s picture

Anonymous’s picture

Anonymous’s picture

Anonymous’s picture

Anonymous’s picture

Status: Fixed » Closed (fixed)
ax’s picture

Version: » x.y.z
Status: Closed (fixed) » Active

there are more blocks that appear without having (any meaningful) content: "recent comments", aggregator category blocks, and more. would be nice if these could be fixed, too. to do this systematically, every _block() should be checked. it would probably be a good idea to include this policy as a coding guideline. in http://drupaldocs.org/api/head/file/contributions/docs/developer/hooks/c... and the handbook.

i'll try to submit a patch for this, but greatly appreciate any help.

lennart’s picture

see also this - it relates to some earlier thougts in this issue http://drupal.org/node/24438

ax’s picture

lennart: linking from block titles is a different issue and should be discussed so (in a separate issue)

robin monks’s picture

Status: Active » Closed (fixed)

Please file a new issue on other blank blocks.