For the user: Ctrl + L-Mouse to select multiple tasks/shots/assets and then edit the nodes as before. When multiple items are selected a chain icon can be seen in editor next to the fields. If the chain is broken it indicates that the values are not the same on all the selected items. When a field has been edited it will be marked with a green background color. The items are saved one by one in parallel. This means that one item could fail to be saved, while the others get updated. For developers: The editor and activities has been ported to Vue. The table and has been updated to support multi select. MultiEditEngine is the core of the multi edit. It keeps track of what values differs and what has been edited.
77 lines
2.1 KiB
JavaScript
77 lines
2.1 KiB
JavaScript
/**
|
|
* Create a asset and show it in the #item-details div.
|
|
*/
|
|
function thenCreateAsset(project_url)
|
|
{
|
|
if (project_url === undefined) {
|
|
throw new ReferenceError("asset_create(" + project_url+ ") called.");
|
|
}
|
|
var url = '/attract/' + project_url + '/assets/create';
|
|
|
|
data = {
|
|
project_url: project_url
|
|
};
|
|
|
|
return $.post(url, data, function(asset_data) {
|
|
pillar.events.Nodes.triggerCreated(asset_data);
|
|
return asset_data;
|
|
})
|
|
.fail(function(xhr) {
|
|
if (console) {
|
|
console.log('Error creating asset');
|
|
console.log('XHR:', xhr);
|
|
}
|
|
$('#item-details').html(xhr.responseText);
|
|
});
|
|
}
|
|
|
|
|
|
/**
|
|
* Create a task and show it in the #item-details div.
|
|
*
|
|
* 'shot_id' may be undefined, in which case the task will not
|
|
* be attached to a shot.
|
|
*/
|
|
function thenCreateTask(shot_id, task_type)
|
|
{
|
|
if (task_type === undefined) {
|
|
throw new ReferenceError("task_create(" + shot_id + ", " + task_type + ") called.");
|
|
}
|
|
|
|
var project_url = ProjectUtils.projectUrl();
|
|
var url = '/attract/' + project_url + '/tasks/create';
|
|
var has_shot_id = typeof shot_id !== 'undefined';
|
|
|
|
data = {
|
|
task_type: task_type,
|
|
};
|
|
if (has_shot_id) data.parent = shot_id;
|
|
|
|
return $.post(url, data, function(task_data) {
|
|
if (console) console.log('Task created:', task_data);
|
|
pillar.events.Nodes.triggerCreated(task_data);
|
|
return task_data;
|
|
})
|
|
.fail(function(xhr) {
|
|
if (console) {
|
|
console.log('Error creating task');
|
|
console.log('XHR:', xhr);
|
|
}
|
|
$('#item-details').html(xhr.responseText);
|
|
});
|
|
}
|
|
|
|
var save_on_ctrl_enter = ['shot', 'asset', 'task'];
|
|
$(document).on('keyup', function(e){
|
|
if ($.inArray(save_on_ctrl_enter, ProjectUtils.context())) {
|
|
var active = document.activeElement;
|
|
|
|
// Save on Ctrl + Enter anytime except when comment field is on focus
|
|
if (active.id != 'comment_field'){
|
|
if ((e.keyCode == 10 || e.keyCode == 13) && e.ctrlKey){
|
|
$("#item-save").trigger( "click" );
|
|
}
|
|
}
|
|
}
|
|
});
|