More logical ordering of blocks in the Page Builder

Bug #1236102 reported by Aaron Wells on 2013-10-06
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Wishlist
Aaron Wells

Bug Description

I'm talking about the order of the blocks in the "Block Pallette" that is now off to the left hand side of the "Edit Content" tab of the Page builder. The current order is kind of random:

Text Box
Image
Media
 - File(s) to download
 - Folder
 - Image gallery
 - Some HTML
 - Image
 - Embedded media
 - PDF
Journals
 - Journal
 - Journal entry
 - Recent journal entries
 - Tagged journal entries
General
 - Creative Commons License
 - Navigation
 - Plans
 - Recent forum posts
 - Text box
Personal Info
 - Contact information
 - Your entire resume
 - Profile information
 - One resume field
External
 - External feed
 - External media
 - Google Apps
Theme

Aaron Wells (u-aaronw) wrote :

I suspect the way it's currently ordered, is based on how frequently they're used. And that's good, but we also should put the logically-related ones next to each other. For instance, "My entire resume" should be adjacent to "One resume field"; and "Image" should be next to "Image gallery".

I'll suggest a general ordering for logically-related blocks, based on how we currently order the Journal blocks:

1. A block that displays all your artefacts
2. A block that displays one artefact
3. A block that displays an automatically-selected subset of those artefacts (i.e. "recent" or "tagged")

So in keeping with that principle:

Text Box
Image
Media
 - File(s) to download
 - Folder
 - Image gallery
 - Image
 - Embedded media
 - PDF
 - Some HTML
Journals
 - (unchanged)
General
 - (unchanged)
Personal Info
 - Profile information
 - Contact information
 - My entire resume
 - One resume field

Aaron Wells (u-aaronw) wrote :

Lol, ah, I see now that the way they're ordered is the alphabetical order of the filesystem name of the block. :)

In that case, re-ordering the blocks is going to have to be an item for 1.9.0. We'll need to add a "gravity" sortorder (much like we have for sideblocks) to blocktypes, maybe spacing out the core ones by 10 or 100 so that there's plenty of space in between for 3rd-party plugin blocks.

Changed in mahara:
milestone: 1.8.0 → 1.9.0
importance: High → Wishlist
status: In Progress → Confirmed
Robert Lyon (robertl-9) wrote :

Could we do something like have
    public static function get_order() {
        return array(2 => 'gallery');
    }

in each lib.php file for a blocktype

and then collect up all of them into an array like

$blocklistorder = array(0 => 'filedownload', 1 => 'folder', 2=> 'gallery', 3 => 'image', 4=> 'internalmedia', 5 => 'pdf', 6=> 'html');

then do
$proper_ordered_array = array_merge(array_flip($blocklistorder), $blocklist);

To put them all in the order we want.

Not sure how that will work with 3rd party plugins yet - but will leave this comment as something to ponder.

Aaron Wells (u-aaronw) wrote :

I was thinking we'd do something similar to what we've done for blocktype categories in "install_blocktype_categories_for_plugin()".

So,

1. We add a "public static function get_gravity()" or maybe "get_sortorder()" to PluginBlocktype, so that each blocktype plugin will override it and define their own sortorder/gravity number

2. At installation or upgrade time, we check that function to find out the blocktype's sortorder. Then we store that value in the database somewhere.

3. Then when we're displaying the block palette on the "edit page" screen, as well as pulling which category each block's in, we also pull its sortorder/gravity. We sort accordingly. In case of a tie, we break the tie with block name. For backwards compatibility with older 3rd party plugins, blocks with no sortorder just come last, sorted by block name.

4. For the core plugins, we space their sortorder out by 100 so that there's plenty of space in between for 3rd party plugins to fit into the sort order.

Third party developers simply add a "get_sortorder()" method to their blocktype plugins, and they'll be inserted into the sortorder accordingly. There is the potential for multiple 3rd party block plugins from separate authors to interfere with each other's ordering. In theory it might be a good idea to provide an admin screen to let admins reorder the blocks, but that might be overkill for something not many would bother to do.

The admin screen would be the best, but not so quickly done.

If there is a conflict, I think it might be best to go with the lang string for the block title and display the two blocks alphabetically. As that depends on the language, the lang string might make more sense than the name of the plugin.

Aaron Wells (u-aaronw) on 2014-04-15
Changed in mahara:
milestone: 1.9.0 → 1.10.0
Changed in mahara:
milestone: 1.10.0 → 1.11.0
Aaron Wells (u-aaronw) wrote :

Submitted a patch for this: https://reviews.mahara.org/#/c/3944/

Mahara Bot (dev-mahara) wrote :

Patch for "master" branch: https://reviews.mahara.org/3976

For testing patch 3944, test that the "Text" block is above the "Image" block in the shortcuts area of the content chooser. And test it on an upgraded site and a clean install.

Changed in mahara:
status: Confirmed → In Progress

Reviewed: https://reviews.mahara.org/3944
Committed: http://gitorious.org/mahara/mahara/commit/5b7b292730b1774384a9c5917835e49da6fc9407
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit 5b7b292730b1774384a9c5917835e49da6fc9407
Author: Aaron Wells <email address hidden>
Date: Fri Nov 7 20:00:33 2014 +1300

Add sortorder for blocktypes in categories

Bug 1236102. Also sorting the "text" and "image" blocks while I'm at it.

Change-Id: I09c3a1bec1ec9a7ddf0b3f1cfca735759dd2bbbe

Robert Lyon (robertl-9) on 2015-02-01
Changed in mahara:
status: In Progress → Fix Committed
Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/3976
Committed: http://gitorious.org/mahara/mahara/commit/efdfa62339cc53bbcf9cb67d4e1a8226c08cddf2
Submitter: Aaron Wells (<email address hidden>)
Branch: master

commit efdfa62339cc53bbcf9cb67d4e1a8226c08cddf2
Author: Robert Lyon <email address hidden>
Date: Wed Nov 12 14:02:53 2014 +1300

Setting default sort order for blocktypes in categories (Bug 1236102)

- Currently ordered as per this comment https://bugs.launchpad.net/mahara/+bug/1236102/comments/1

Change-Id: I95b5eac314dcbf2fef58e8b16836d4a6822b8b40
Signed-off-by: Robert Lyon <email address hidden>

Reviewed: https://reviews.mahara.org/4270
Committed: http://gitorious.org/mahara/mahara/commit/c61c9b5b69a5141ef9e975e6e2bc83c44aa117d9
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit c61c9b5b69a5141ef9e975e6e2bc83c44aa117d9
Author: Aaron Wells <email address hidden>
Date: Thu Feb 12 16:21:17 2015 +1300

Revert unintentional changes to lib/db/upgrade.php

Bug 1236102: In commit 5b7b292730b177, a bad rebase resulted in
additional changes to lib/db/upgrade.php being committed, beyond
those actually needed for the patch.

Change-Id: I3d22ea01f17ded7a4304b2fa8eb74cc48e317002

tags: added: nominatedfeature
Robert Lyon (robertl-9) on 2015-04-17
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers