Task types are now determined by the page context, not hard-coded to shot task types
This commit is contained in:
@@ -67,7 +67,7 @@ def setup_for_attract(project_url, replace=False, svn_url=None):
|
||||
Returns the updated project.
|
||||
"""
|
||||
|
||||
from .node_types import NODE_TYPES, shot
|
||||
from .node_types import NODE_TYPES, shot, asset
|
||||
|
||||
# Copy permissions from the project, then give everyone with PUT
|
||||
# access also DELETE access.
|
||||
@@ -103,6 +103,7 @@ def setup_for_attract(project_url, replace=False, svn_url=None):
|
||||
# Set up task types
|
||||
task_types = attract_props.setdefault('task_types', {})
|
||||
task_types.setdefault(shot.node_type_shot['name'], shot.task_types)
|
||||
task_types.setdefault(asset.node_type_asset['name'], asset.task_types)
|
||||
|
||||
_update_project(project)
|
||||
|
||||
|
@@ -13,7 +13,7 @@ import pillar.web.subquery
|
||||
|
||||
from attract.routes import attract_project_view
|
||||
from attract.node_types.task import node_type_task
|
||||
from attract import current_attract, ROLES_REQUIRED_TO_VIEW_ITEMS
|
||||
from attract import current_attract, ROLES_REQUIRED_TO_VIEW_ITEMS, EXTENSION_NAME
|
||||
|
||||
blueprint = Blueprint('attract.tasks', __name__, url_prefix='/tasks')
|
||||
perproject_blueprint = Blueprint('attract.tasks.perproject', __name__,
|
||||
@@ -67,6 +67,16 @@ def view_task(project, attract_props, task_id):
|
||||
task = pillarsdk.Node.find(task_id, api=api)
|
||||
node_type = project.get_node_type(node_type_task['name'])
|
||||
|
||||
# Figure out which task types are available, defaulting to the shot task types.
|
||||
context = request.args.get('context', None) or 'shot'
|
||||
ctx_node_type_name = '%s_%s' % (EXTENSION_NAME, context)
|
||||
try:
|
||||
task_types = attract_props['task_types'][ctx_node_type_name]
|
||||
except KeyError:
|
||||
log.warning('Project %s does not have an Attract task type definition for %s',
|
||||
project['_id'], ctx_node_type_name)
|
||||
task_types = []
|
||||
|
||||
if task.properties.due_date:
|
||||
task.properties.due_date = parser.parse('%s' % task.properties.due_date)
|
||||
|
||||
@@ -87,6 +97,7 @@ def view_task(project, attract_props, task_id):
|
||||
task=task,
|
||||
project=project,
|
||||
task_node_type=node_type,
|
||||
task_types=task_types,
|
||||
attract_props=attract_props.to_dict(),
|
||||
attract_context=request.args.get('context'))
|
||||
|
||||
|
@@ -57,10 +57,10 @@
|
||||
.input-group.field-type
|
||||
label#task-task_type Type:
|
||||
select(name="task_type",aria-describedby="task-task_type")
|
||||
| {% for task_type in attract_props.task_types.attract_shot %}
|
||||
| {% for task_type in task_types %}
|
||||
| <option value="{{ task_type }}" {% if task_type == task.properties.task_type %}selected{% endif %}>{{ task_type | undertitle }}</option>
|
||||
| {% endfor %}
|
||||
| {% if task.properties.task_type not in attract_props.task_types.attract_shot %}
|
||||
| {% if task.properties.task_type not in task_types %}
|
||||
option(value="{{ task.properties.task_type }}",selected).invalid_task {{ task.properties.task_type | undertitle }}
|
||||
| {% endif %}
|
||||
|
||||
|
Reference in New Issue
Block a user