kanbanworkflowstimelinescrumrubyroadmapproject-planningproject-managementopenprojectangularissue-trackerifcgantt-chartganttbug-trackerboardsbcf
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.5 KiB
48 lines
1.5 KiB
8 years ago
|
import {debugLog} from "../../../../helpers/debug_output";
|
||
|
import {injectorBridge} from "../../../angular/angular-injector-bridge.functions";
|
||
|
import {WorkPackageTable} from "../../wp-fast-table";
|
||
|
import {TableEventHandler} from "../table-handler-registry";
|
||
7 years ago
|
import {tableRowClassName} from "../../builders/rows/single-row-builder";
|
||
8 years ago
|
import {uiStateLinkClass} from "../../builders/ui-state-link-builder";
|
||
|
import {ContextMenuService} from "../../../context-menus/context-menu.service";
|
||
8 years ago
|
import {timelineCellClassName} from "../../builders/timeline/timeline-row-builder";
|
||
7 years ago
|
import {ContextMenuHandler} from "./context-menu-handler";
|
||
8 years ago
|
|
||
7 years ago
|
export class ContextMenuRightClickHandler extends ContextMenuHandler {
|
||
8 years ago
|
constructor(table: WorkPackageTable) {
|
||
7 years ago
|
super(table);
|
||
8 years ago
|
}
|
||
|
|
||
|
public get EVENT() {
|
||
|
return 'contextmenu.table.rightclick';
|
||
|
}
|
||
|
|
||
|
public get SELECTOR() {
|
||
7 years ago
|
return `.${tableRowClassName},.${timelineCellClassName}`;
|
||
8 years ago
|
}
|
||
|
|
||
8 years ago
|
public handleEvent(table: WorkPackageTable, evt:JQueryEventObject):boolean {
|
||
8 years ago
|
let target = jQuery(evt.target);
|
||
|
|
||
|
// We want to keep the original context menu on hrefs
|
||
|
// (currently, this is only the id
|
||
|
if (target.closest(`.${uiStateLinkClass}`).length) {
|
||
8 years ago
|
debugLog('Allowing original context menu on state link');
|
||
8 years ago
|
return true;
|
||
8 years ago
|
}
|
||
7 years ago
|
|
||
8 years ago
|
evt.preventDefault();
|
||
|
evt.stopPropagation();
|
||
|
|
||
|
// Locate the row from event
|
||
8 years ago
|
const element = target.closest(this.SELECTOR);
|
||
|
const wpId = element.data('workPackageId');
|
||
|
|
||
7 years ago
|
if (wpId) {
|
||
|
super.openContextMenu(evt, wpId);
|
||
8 years ago
|
}
|
||
8 years ago
|
|
||
|
return false;
|
||
|
}
|
||
|
}
|