Description

Currently in Confluence there is no way for the user to order pages within it’s tree (ordered by title by default). The ability to order pages would be a useful feature for html/pdf exports. CONF-1031 is a very highly voted for feature with 99 votes and also something I wanted so I could correctly produce my thesis report.

Implementation

The thing I found most difficult about this feature was to encapsulate it into an appropriate and user friendly UI. I concluded that a ‘drag-and-drop’ approach would be the most appealing to users and found a tool called tool man which supported a simple drag-drop library. I was able to integrate the top level pages with this tool without too much difficulty and also add an ajax request to update the page “weight” upon drag/drops.

In terms of storing a page’s order, I added a new field “weight” to the ContentEntityObject (which evidently is not the most ideal implementation but was the easiest). When a CEO’s bag of “children” are retrieved, it is returned ordered upon this new “weight” field. Additionally, usages of the CEOTitleComparator were replaced with a CEOWeightComparator.

Problems

The drag-drop library I had chosen did not support nested lists to be drag-and-droppable, so I was only able to get the top level page ordering implemented (i.e in my current implementation the children pages of a top level page cannot be ordered). I did try my best to tweak the library but to much dismay failed to get nested lists working.

A few more issues that would need to be dealt with for a complete implementation would be:

  • upgrade task to order pages existing pages with a “weight”
  • deal with add/move of pages
  • maybe try to think of a better store mechanism than adding a weight field to all CEOs

Fresh ideas, announcements, and inspiration for your team, delivered weekly.

Subscribe now

Fresh ideas, announcements, and inspiration for your team, delivered weekly.

Subscribe now