v7.3.0

TaskMenu
Feature

Displays a context menu for tasks. Items are populated by other features and/or application code.

You can optionally also use a TaskMenuItem button to display the menu.

Default items

These are the default items provided by TaskBoard features:

Reference Weight Feature Description
editTask 100 TaskEdit Open task editor. Hidden when read-only
resources 200 This feature Assign/unassign resources. Hidden when read-only
column 300 This feature Move to column. Hidden when read-only
swimlane 400 This feature Move to swimlane. Hidden when read-only
removeTask 500 This feature Remove task. Hidden when read-only

Default items in the menu can be changed or removed and new items can be added. This is handled using the items config of the feature.

Add items

Add menu items for all tasks by adding a key (used as menu item ref) with a config object for a menu item as the value to the items config:

const taskBoard = new TaskBoard({
    features : {
        taskMenu : {
            items : {
                flagTask : {
                    text : 'Flag task',
                    icon : 'fa fa-fw fa-flag',
                    onItem({ taskRecord }) {
                        taskRecord.flagged = true;
                    }
                }
            }
        }
    }
});

Remove items

To remove default items, configure them as null in the items config:

const taskBoard = new TaskBoard({
    features : {
        taskMenu : {
            items : {
                removeTask : null,
                resources : null
            }
        }
    }
});

Customize items

To customize default items, supply a new config object for them in the items config. It will merge with the default config object:

const taskBoard = new TaskBoard({
    features : {
        taskMenu : {
            items : {
                removeTask : {
                    text : 'Delete card'
                }
            }
        }
    }
});

Manipulating items at runtime

Manipulate items for all tasks or specific tasks at runtime by supplying a processItems function:

const taskBoard = new TaskBoard({
    features : {
        taskMenu : {
            // Process items before menu is shown
            processItems({ taskRecord, items }) {
                 // Push an extra item for done tasks
                 if (taskRecord.status === 'done') {
                     items.archive = {
                         text : 'Archive',
                         icon : 'fa fa-fw fa-archive'
                         onItem({ taskRecord }) {
                             taskRecord.archived = true;
                         }
                     };
                 }

// Do not show menu for low prio tasks if (taskRecord.prio === 'low') { return false; } } } } });
The `processItems` implementation my be an `async` function which `awaits` a result to mutate the `items` object.

This feature is enabled by default.

Keyboard shortcuts

This feature has the following default keyboard shortcuts:

Keys Action Action description
Space showContextMenuByKey Shows context menu for currently focused task
Ctrl+Space showContextMenuByKey Shows context menu for currently focused task
Please note that Ctrl is the equivalent to Command and Alt is the equivalent to Option for Mac users

For more information on how to customize keyboard shortcuts, please see our guide.

No results

Configs

Configs are options you supply in a configuration object when creating an instance of this class
  • triggerEvent : String/BooleantaskContextMenu

    The mouse / touch gesture which should show this context menu (e.g. 'taskClick' or 'taskContextMenu'). Set to false to never trigger it from UI.

Properties

Properties are getters/setters or publicly accessible variables on this class
  • isTaskMenu : Booleantrue
    READONLY
    static
    ADVANCED
    Identifies an object as an instance of TaskMenu class, or subclass thereof.

Functions

Functions are methods available for calling on the class

    Events

    Events are triggered for certain actions in this class and can be listened for to react to those actions in your code

    Event handlers

    Event handlers are callbacks called as a result of certain actions in this class

    CSS variables

    CSS variables that can be set to adjust appearance
    Name Description
    --b-task-board-task-menu-resource-check-icon Resource menu item check icon (font icon)
    id: taskMenu

    Source path

    TaskBoard/feature/TaskMenu.js

    Contents