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; return;
} }
$('[id^="task-"]').removeClass('active'); $('#col_right .col_header span.header_text').text('Task details');
$('[id^="task-"]').removeClass('active');
$('#task-' + task_id).addClass('active'); $('#task-' + task_id).addClass('active');
var task_url = '/attract/' + project_url + '/tasks/' + task_id; var task_url = '/attract/' + project_url + '/tasks/' + task_id;
@@ -66,7 +67,7 @@ function shot_open(shot_id, project_url) {
return; 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-list').find('a').removeClass('active');
$('#shot-link' + shot_id).addClass('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); $button.attr('disabled', true);
$item.addClass('processing'); $item.addClass('processing');
$('#status-bar').text('Saving task...'); $('#status-bar').text('Saving ' + options.type + '...');
if (console) console.log('Sending:', payload); if (console) console.log('Sending:', payload);
$.post(item_save_url, payload) $.post(item_save_url, payload)
.done(function(saved_item) { .done(function(saved_item) {
if (console) console.log('Done saving', 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); 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) { fail: function($item, xhr_or_response_data) {
$('#task-details').html(xhr_or_response_data.responseText); $('#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) { fail: function($item, xhr_or_response_data) {
$('#task-details').html(xhr_or_response_data.responseText); $('#task-details').html(xhr_or_response_data.responseText);
} },
type: 'shot'
}); });
} }

View File

@@ -115,7 +115,7 @@ select.input-transparent
#status-bar #status-bar
color: $color-text-dark-secondary color: $color-text-dark-secondary
margin-left: auto margin-left: auto
font-size: .9em text-align: right
.table .table
display: table display: table

View File

@@ -41,10 +41,8 @@
padding: 3px 10px padding: 3px 10px
&.active &.active
font-weight: bold
+status-border-color +status-border-color
a[class^="status-"] a[class^="status-"]
opacity: 1 opacity: 1

View File

@@ -52,7 +52,7 @@
#col_right #col_right
.col_header .col_header
| Task Details span.header_text Shot details
#status-bar #status-bar
#task-details #task-details

View File

@@ -24,7 +24,7 @@
| {% endfor %} | {% endfor %}
#col_right #col_right
.col_header .col_header
| Task Details span.header_text Task Details
#status-bar #status-bar
#task-details #task-details
#task-view #task-view