Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancements to CoreBlock Monthly Archives and Tag Archives #53

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Enhancements to CoreBlock Monthly Archives and Tag Archives #53

wants to merge 3 commits into from

Conversation

DrewHeath
Copy link

Changes to CoreBlocks are as follows:

  1. Tag Archives insertion of post count parentheses moved out of plugin and into template. This is output styling and should be left to the theme author's discretion, not hardcoded inside the plugin.

  2. New tag archive style: cloud. Individual tag font sizes are calculated based on relative post count within a range of (em) specified by the user.

  3. Added ability to control monthly archive list order (newest to oldest or vice versa).

All changes tested and functioning on habari:master fork.

added option for user to control list order of monthly archives
-= adds new core tag archives style of cloud =-

features:
* sizing driven by post counts
* user can set minimum size (em)
* user can set maximum size (em)
1) moved post count parentheses out of plugin and into template where it
belongs

2) moved all of tag cloud code out of template and into plugin where it
belongs
@chrismeller
Copy link
Member

I'm not a fan of #1. Very few themes specify individual block templates (nor should they need to) and removing functionality is generally negative anyway.

#3: By your logic in #1 shouldn't the order of elements be controlled by the theme author as well?

On Aug 14, 2013, at 10:43 AM, Drew Heath [email protected] wrote:

Changes to CoreBlocks are as follows:

  1. Tag Archives insertion of post count parentheses moved out of plugin and into template. This is output styling and should be left to the theme author's discretion, not hardcoded inside the plugin.

  2. New tag archive style: cloud. Individual tag font sizes are calculated based on relative post count within a range of (em) specified by the user.

  3. Added ability to control monthly archive list order (newest to oldest or vice versa).

All changes tested and functioning on habari:master fork.

You can merge this Pull Request by running

git pull https://github.com/DrewHeath/system master
Or view, comment on, or merge it at:

#53

Commit Summary

control monthly archive order direction
new tag archives style: cloud
tag archive enhancement complete
File Changes

A plugins/coreblocks/block.cloud.tag_archives.php (13)
M plugins/coreblocks/block.dropdown.tag_archives.php (2)
M plugins/coreblocks/block.tag_archives.php (2)
M plugins/coreblocks/coreblocks.plugin.php (37)
Patch Links:

https://github.com/habari/system/pull/53.patch
https://github.com/habari/system/pull/53.diff

@mikelietz
Copy link
Member

I'm getting blank monthly archives blocks with PostgreSQL. Sqlite doesn't seem to have these troubles, so I'll try to figure out what is going on.

Tag cloud seems to only show different sizes if the counts are displayed. Rather, they all have the same font-size if they aren't counted.

Month sort order in the block config seems fine to me.

@mikelietz mikelietz closed this Aug 14, 2013
@mikelietz mikelietz reopened this Aug 14, 2013
@mikelietz
Copy link
Member

Accidentally closed this, so I reopened it.

The tag cloud appears to work fine with or without post counts if the check for $block->show_counts is removed (https://github.com/DrewHeath/system/blob/d66c0ede/plugins/coreblocks/coreblocks.plugin.php#L312), passing $count through even when it is not used. Then the font sizes are different either way, but the post counts are only shown when the option is set. I've not looked at the template, though. This also makes the post count show up regardless of the option when the dropdown or list output is chosen.

Tag cloud could be its own block type. I had forgotten habari-extras/commonblocks had one in it: https://github.com/habari-extras/commonblocks/blob/master/commonblocks.plugin.php#L100

As for the month query. Postgres doesn't seem to like the argument for orderby being something not actually selected.

Without an orderby, the current query does
ORDERBY year,month
For both sqlite and Postgres that is equivalent to
ORDERBY year ASC, month ASC

so to sort by oldest,
ORDERBY year DESC, month DESC
seems to work.

So, if they want newest to oldest, change the orderby to 'year desc, month desc'. If they want existing functionality, blanks are fine. Presumably the existing code could be modified to do this instead of using pubdate.

'orderby' => "year {$block->order}, month {$block->order}")

@DrewHeath
Copy link
Author

@chrismeller - Regarding #1, I argue that my proposed change adds functionality whereas the current behavior is restricting functionality. If we roughly divide Habari users into three descending levels of competence:

A) capable of editing code
B) capable of designing themes
C) stock installation users

currently only the first group can access the post count for styling.

To offer some typical use case examples, groups B and C are not able to:

  • change the bracket type () [] {} etc. or spacing from tag: habari (2) vs habari(2)
  • change the color of the post number to be different from the tag
  • reduce the post count font-size in relation to the tag
  • move the post count to a superscript, and so on

I see no advantage whatsoever to hardcoding insertion of parentheses characters deep within the plugin code.

@chrismeller - Regarding #3, including a sort direction option in the plugin config screen makes this feature neatly accessible to the latter two user skillgroups mentioned above. It would not be appropriate to put that directly into the template because templates should have as little PHP as possible (as they currently do). Separation of concerns and all that...

@mikelietz - I apologize for the Postgres problems. I'm only familiar with MySQL. I will patch along your suggestions later today when I have time. Thank you for testing!

@chrismeller
Copy link
Member

Sorry, I was at lunch and saw this on my phone without having the chance to look at the code. The description you provided gave me the impression it was something other than what it is. Ignore my objections, I'm an idiot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants