Some tweaks for shot editing
This commit is contained in:
@@ -19,6 +19,16 @@
|
|||||||
;
|
;
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$.fn.removeClassPrefix = function(prefix) {
|
||||||
|
this.each(function(i, el) {
|
||||||
|
var classes = el.className.split(" ").filter(function(c) {
|
||||||
|
return c.lastIndexOf(prefix, 0) !== 0;
|
||||||
|
});
|
||||||
|
el.className = $.trim(classes.join(" "));
|
||||||
|
});
|
||||||
|
return this;
|
||||||
|
};
|
||||||
}(jQuery));
|
}(jQuery));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -150,10 +160,11 @@ function task_save(task_id, task_url) {
|
|||||||
$task.find('span.type').text(saved_task.task_type);
|
$task.find('span.type').text(saved_task.task_type);
|
||||||
$task.find('span.status').text(saved_task.properties.status.replace('_', ' '));
|
$task.find('span.status').text(saved_task.properties.status.replace('_', ' '));
|
||||||
|
|
||||||
// FIXME: remove all existing status-XXX classes.
|
|
||||||
$task
|
$task
|
||||||
.removeClass('col-list-item task-list-item')
|
.removeClassPrefix('status-')
|
||||||
.addClass('col-list-item task-list-item status-' + saved_task.properties.status);
|
.addClass('status-' + saved_task.properties.status)
|
||||||
|
.flashOnce()
|
||||||
|
;
|
||||||
},
|
},
|
||||||
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);
|
||||||
@@ -165,12 +176,12 @@ function shot_save(shot_id, shot_url) {
|
|||||||
return attract_form_save('shot_form', 'shot-' + shot_id, shot_url, {
|
return attract_form_save('shot_form', 'shot-' + shot_id, shot_url, {
|
||||||
done: function($shot, saved_shot) {
|
done: function($shot, saved_shot) {
|
||||||
// Update the shot list.
|
// Update the shot list.
|
||||||
$('.shot-name-' + saved_shot._id).text(saved_shot.name).flashOnce();
|
$('.shot-name-' + saved_shot._id).text(saved_shot.name);
|
||||||
|
|
||||||
// FIXME: remove all existing status-XXX classes.
|
|
||||||
$shot
|
$shot
|
||||||
.removeClass('col-list-item shot-list-item')
|
.removeClassPrefix('status-')
|
||||||
.addClass('col-list-item shot-list-item status-' + saved_shot.properties.status);
|
.addClass('status-' + saved_shot.properties.status)
|
||||||
|
.flashOnce()
|
||||||
|
;
|
||||||
},
|
},
|
||||||
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);
|
||||||
|
@@ -18,7 +18,7 @@
|
|||||||
| {% endfor %}
|
| {% endfor %}
|
||||||
.table-body
|
.table-body
|
||||||
| {% for shot in shots %}
|
| {% for shot in shots %}
|
||||||
.table-row
|
.table-row(id="shot-{{ shot._id }}")
|
||||||
.table-cell
|
.table-cell
|
||||||
img(src="http://placehold.it/100x60")
|
img(src="http://placehold.it/100x60")
|
||||||
.table-cell.shot-name
|
.table-cell.shot-name
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
class="status-{{ shot.properties.status }}")
|
class="status-{{ shot.properties.status }}")
|
||||||
span(class="shot-name-{{ shot._id }}") {{ shot.name }}
|
span(class="shot-name-{{ shot._id }}") {{ shot.name }}
|
||||||
| {% for task_type in task_types %}
|
| {% for task_type in task_types %}
|
||||||
.table-cell.task-name
|
.table-cell
|
||||||
| {% for task in tasks_for_shots[shot._id][task_type] %}
|
| {% for task in tasks_for_shots[shot._id][task_type] %}
|
||||||
a(
|
a(
|
||||||
href="javascript:task_open('{{ task._id }}', '{{ project.url }}');",
|
href="javascript:task_open('{{ task._id }}', '{{ project.url }}');",
|
||||||
|
Reference in New Issue
Block a user