Task-add: Use a button instead of a link, and prevent default
Avoids the issue of re-loading the page on task-add
This commit is contained in:
@@ -206,18 +206,6 @@ nav.sidebar
|
|||||||
&.active
|
&.active
|
||||||
background-image: none
|
background-image: none
|
||||||
|
|
||||||
&.task-add
|
|
||||||
width: auto
|
|
||||||
border-radius: initial
|
|
||||||
opacity: 0
|
|
||||||
vertical-align: middle
|
|
||||||
padding: 5px
|
|
||||||
display: flex
|
|
||||||
justify-content: center
|
|
||||||
|
|
||||||
&:hover, &:focus
|
|
||||||
opacity: 1
|
|
||||||
|
|
||||||
&:hover
|
&:hover
|
||||||
&:before
|
&:before
|
||||||
opacity: .8
|
opacity: .8
|
||||||
@@ -225,6 +213,22 @@ nav.sidebar
|
|||||||
&.active:before
|
&.active:before
|
||||||
transform: translate(-50%, -50%) scale(1.3)
|
transform: translate(-50%, -50%) scale(1.3)
|
||||||
|
|
||||||
|
button.task-add
|
||||||
|
display: flex
|
||||||
|
width: auto
|
||||||
|
border-radius: initial
|
||||||
|
opacity: 0
|
||||||
|
vertical-align: middle
|
||||||
|
padding: 5px
|
||||||
|
justify-content: center
|
||||||
|
|
||||||
|
color: $color-primary
|
||||||
|
border: none
|
||||||
|
background: none
|
||||||
|
|
||||||
|
&:hover, &:focus
|
||||||
|
opacity: 1
|
||||||
|
|
||||||
.item-list-header
|
.item-list-header
|
||||||
a
|
a
|
||||||
color: $color-text-dark
|
color: $color-text-dark
|
||||||
|
@@ -63,10 +63,11 @@
|
|||||||
| {% endfor %}
|
| {% endfor %}
|
||||||
//- Dirty hack, assume a user can create a task for a asset if they can edit the asset.
|
//- Dirty hack, assume a user can create a task for a asset if they can edit the asset.
|
||||||
| {% if 'PUT' in asset.allowed_methods %}
|
| {% if 'PUT' in asset.allowed_methods %}
|
||||||
a.task-add(
|
button.task-add(
|
||||||
title="Add a new '{{ task_type }}' task",
|
title="Add a new '{{ task_type }}' task",
|
||||||
class="task-add-link {% if tasks_for_assets[asset._id][task_type] %}hidden{% endif %}"
|
class="task-add-link {% if tasks_for_assets[asset._id][task_type] %}hidden{% endif %}",
|
||||||
href="javascript:task_create('{{ asset._id }}', '{{ task_type }}');")
|
data-parent-id='{{ asset._id }}',
|
||||||
|
data-task-type='{{ task_type }}')
|
||||||
i.pi-plus
|
i.pi-plus
|
||||||
| Task
|
| Task
|
||||||
| {% endif %}
|
| {% endif %}
|
||||||
@@ -93,6 +94,14 @@ script.
|
|||||||
$(function() { item_open('{{ open_asset_id }}', 'asset', false); });
|
$(function() { item_open('{{ open_asset_id }}', 'asset', false); });
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
$('button.task-add').on('click', function(e){
|
||||||
|
e.preventDefault();
|
||||||
|
var parent_id = $(this).attr('data-parent-id');
|
||||||
|
var task_type = $(this).attr('data-task-type');
|
||||||
|
|
||||||
|
task_create(parent_id, task_type);
|
||||||
|
});
|
||||||
|
|
||||||
var same_cells;
|
var same_cells;
|
||||||
|
|
||||||
/* Collapse columns by clicking on the title */
|
/* Collapse columns by clicking on the title */
|
||||||
|
@@ -62,10 +62,11 @@
|
|||||||
| {% endfor %}
|
| {% endfor %}
|
||||||
//- Dirty hack, assume a user can create a task for a shot if they can edit the shot.
|
//- Dirty hack, assume a user can create a task for a shot if they can edit the shot.
|
||||||
| {% if 'PUT' in shot.allowed_methods %}
|
| {% if 'PUT' in shot.allowed_methods %}
|
||||||
a.task-add(
|
button.task-add(
|
||||||
title="Add a new '{{ task_type }}' task",
|
title="Add a new '{{ task_type }}' task",
|
||||||
class="task-add-link {% if tasks_for_shots[shot._id][task_type] %}hidden{% endif %}"
|
class="task-add-link {% if tasks_for_shots[shot._id][task_type] %}hidden{% endif %}"
|
||||||
href="javascript:task_create('{{ shot._id }}', '{{ task_type }}');")
|
data-parent-id='{{ shot._id }}',
|
||||||
|
data-task-type='{{ task_type }}')
|
||||||
i.pi-plus
|
i.pi-plus
|
||||||
| Task
|
| Task
|
||||||
| {% endif %}
|
| {% endif %}
|
||||||
@@ -92,6 +93,14 @@ script.
|
|||||||
$(function() { item_open('{{ open_shot_id }}', 'shot', false); });
|
$(function() { item_open('{{ open_shot_id }}', 'shot', false); });
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
$('button.task-add').on('click', function(e){
|
||||||
|
e.preventDefault();
|
||||||
|
var parent_id = $(this).attr('data-parent-id');
|
||||||
|
var task_type = $(this).attr('data-task-type');
|
||||||
|
|
||||||
|
task_create(parent_id, task_type);
|
||||||
|
});
|
||||||
|
|
||||||
var same_cells;
|
var same_cells;
|
||||||
|
|
||||||
/* Collapse columns by clicking on the title */
|
/* Collapse columns by clicking on the title */
|
||||||
|
Reference in New Issue
Block a user