Friday, December 25, 2015

Adding unbookmark context menu

Authors are always trained to use bookmark function while creating or updating assets for associating assets to other asset in an attribute or association. Usually authors keep on bookmarking assets in Contributor UI for a site as they tend to bookmark asset frequently while creating or updating assets but often forget to unbookmark when work is completed.

If you double-click bookmarks node from left pane under "My Work" tab in Contributor UI, bookmarks list gets populated in center pane showing bookmarked assets for the current site. And if an author right-click's any asset or group of assets, he/she still sees bookmark option in context-menu but assets are already bookmarked and don't know how to unbookmark them! Should he/she unbookmark each asset one by one by opening them from Top Navigation - Content menu? Sounds boring and time consuming task.

Bookmarks Dashboard Widget

But wait, there is already OOTB dashboard in WebCenter Sites which also shows bookmarked assets and thus an author can unbookmark multiple assets at a time by either CTRL + CLICK for selective asset or Shift + Click for selecting all assets. That's it, multiple assets can be unbookmarked easily.

But in one of my recent project, there was a scenario wherein these dashboards were deleted so that Contributor UI loads faster as authors used to bookmark many assets, also many assets were assigned due to workflow and many assets were checked out. And thus, Contributor UI load time was really slow as many authors worked at same time on the Authoring Instance.

So now problem again was how can an author unbookmark multiple assets?
Well, with simple customization, one can provide unbookmark option in context menu which can help authors/contributors to unbookmark multiple assets again when assets are opened on double-clicking Bookmarks node under My Work tab. This customization is mentioned in guide here.

So basically, you just need to create either global or for a single site; a config element under CustomElements folder and write the following logic which will provide unbookmark option:

config.contextMenus = {
  "default":["bookmark", "unbookmark", "tagasset", "delete"],
  "asset":["edit", "copy", "preview", "share", "delete", "bookmark", "unbookmark", "tagasset"],
  "asset/Page":["edit", "copy", "preview", "delete", "bookmark", "unbookmark", "tagasset"],
  "proxy":["preview", "bookmark", "unbookmark", "tagasset", "delete"]
};

I tested it for avisports site by updating CustomElements/avisports/UI/Config/SiteConfigHtml element and it works well. That's it, problem solved. Now authors/contributors can bookmark and unbookmark as many assets as they desire.  

Unbookmark multiple assets

Note: After unbookmarking asset in list pane, one has to reload list pane so that only bookmarked assets are visible by either double-clicking again on Bookmarks node or by clicking on refresh buttom from right side.

Disclaimer: Any sample code on this blog is not officially recommended, use at your own risk.

No comments:

Post a Comment

A simple code compare functionality

One of the most important aspect of any development cycle is deployment and while deployment, it is very important to note the changes don...