Added 'type' to options when saving form, for status-bar details

Also fixed the title of the header. It was removing the status-bar when setting "Shot details"
This commit is contained in:
2016-09-22 17:46:17 +02:00
parent 0767463ead
commit 1b4cd09281
5 changed files with 13 additions and 11 deletions

View File

@@ -40,8 +40,9 @@ function task_open(task_id, project_url) {
return;
}
$('[id^="task-"]').removeClass('active');
$('#col_right .col_header span.header_text').text('Task details');
$('[id^="task-"]').removeClass('active');
$('#task-' + task_id).addClass('active');
var task_url = '/attract/' + project_url + '/tasks/' + task_id;
@@ -66,7 +67,7 @@ function shot_open(shot_id, project_url) {
return;
}
$('#col_right .col_header').text('Shot details');
$('#col_right .col_header span.header_text').text('Shot details');
$('#shot-list').find('a').removeClass('active');
$('#shot-link' + shot_id).addClass('active');
@@ -123,14 +124,15 @@ function attract_form_save(form_id, item_id, item_save_url, options={})
$button.attr('disabled', true);
$item.addClass('processing');
$('#status-bar').text('Saving task...');
$('#status-bar').text('Saving ' + options.type + '...');
if (console) console.log('Sending:', payload);
$.post(item_save_url, payload)
.done(function(saved_item) {
if (console) console.log('Done saving', saved_item);
$('#status-bar').text('Saved item. ' + saved_item._updated);
$('#status-bar')
.text('Saved ' + options.type + '. ' + saved_item._updated);
if (options.done) options.done($item, saved_item);
})
@@ -170,7 +172,8 @@ function task_save(task_id, task_url) {
},
fail: function($item, xhr_or_response_data) {
$('#task-details').html(xhr_or_response_data.responseText);
}
},
type: 'task'
});
}
@@ -187,6 +190,7 @@ function shot_save(shot_id, shot_url) {
},
fail: function($item, xhr_or_response_data) {
$('#task-details').html(xhr_or_response_data.responseText);
}
},
type: 'shot'
});
}