Remove "create task" buttons when user has no rights to create tasks.

Has some dirty hacks to infer the permissions based on the allowed methods
on shots/project.
This commit is contained in:
2016-10-11 15:36:24 +02:00
parent 1461fd2064
commit b7c6402453
2 changed files with 6 additions and 2 deletions

View File

@@ -53,11 +53,14 @@
class="status-{{ task.properties.status }} task-link",
title="Task: {{ task.name }}")
| {% endfor %}
//- Dirty hack, assume a user can create a task for a shot if they can edit the shot.
| {% if 'PUT' in shot.allowed_methods %}
a.task-add(
title="Add a new '{{ task_type }}' task",
class="task-add-link {% if tasks_for_shots[shot._id][task_type] %}hidden{% endif %}"
href="javascript:task_create('{{ shot._id }}', '{{ task_type }}');")
| + Task
| {% endif %}
| {% endfor %}
| {% endfor %}

View File

@@ -6,9 +6,10 @@
.col_header.task-list-header
| Tasks
a.task-project(href="{{url_for('projects.view', project_url=project.url)}}") {{ project.name }}
//- Dirty hack, assume a user can create a task if they can edit the project.
| {% if 'PUT' in project.allowed_methods %}
a#task-add(href="javascript:task_create(undefined, 'generic');") + Create Task
| {% endif %}
#task-list.col-list
| {% for task in tasks %}
//- NOTE: this is tightly linked to the JS in tasks.js, function task_add()