Mark all links as 'deactivated' when opening a new item.

This fixes the issue of a task "ball" showing as "active", even when
navigating away to a shot.
This commit is contained in:
2016-11-10 08:56:04 +01:00
parent 4e3416c653
commit 1a6fb58d6e

View File

@@ -12,6 +12,17 @@ function _remove_task_from_list(task_id) {
});
}
/**
* Removes the 'active' class from any element whose ID starts with
* shot-, asset-, or task-.
*/
function deactivateItemLinks()
{
$('[id^="shot-"]').removeClass('active');
$('[id^="asset-"]').removeClass('active');
$('[id^="task-"]').removeClass('active');
}
/**
* Open an item such as tasks/shots in the #item-details div
*/
@@ -31,7 +42,7 @@ function item_open(item_id, item_type, pushState, project_url)
$('#col_right .col_header span.header_text').text(item_type + ' details');
// Style elements starting with item_type and dash, e.g. "#shot-uuid"
$('[id^="' + item_type + '-"]').removeClass('active');
deactivateItemLinks();
$('#' + item_type + '-' + item_id).addClass('active');
// Special case to highlight the shot row when opening task in shot or asset context