Use project properties to show shot-level task types
This commit is contained in:
@@ -37,16 +37,19 @@ def for_project(project):
|
||||
|
||||
|
||||
@blueprint.route('/<project_url>/<task_id>')
|
||||
@attract_project_view()
|
||||
def view_embed_task(project, task_id):
|
||||
@attract_project_view(extension_props=True)
|
||||
def view_embed_task(project, attract_props, task_id):
|
||||
api = pillar_api()
|
||||
task = pillarsdk.Node.find(task_id, api=api)
|
||||
node_type = project.get_node_type(node_type_task['name'])
|
||||
|
||||
log.info('Attract properties: %s', attract_props)
|
||||
|
||||
return render_template('attract/tasks/view_task_embed.html',
|
||||
task=task,
|
||||
project=project,
|
||||
task_node_type=node_type)
|
||||
task_node_type=node_type,
|
||||
attract_props=attract_props.to_dict())
|
||||
|
||||
|
||||
@blueprint.route('/<project_url>/<task_id>', methods=['POST'])
|
||||
|
@@ -1 +1,8 @@
|
||||
| {% extends 'layout.html' %}
|
||||
| {% block head %}
|
||||
style(type='text/css').
|
||||
option.invalid_task {
|
||||
color: red;
|
||||
background-color: #fee;
|
||||
}
|
||||
| {% endblock %}
|
||||
|
@@ -6,7 +6,14 @@ script(src="{{ url_for('static_attract', filename='js/tasks.js') }}",async=true)
|
||||
input.form-control(name="name",autofocus=true,type=text,placeholder='Task name',aria-describedby="task-addon-name",value="{{ task.name|hide_none }}")
|
||||
.input-group
|
||||
span.input-group-addon#task-addon-type(title='Task type') T
|
||||
input.form-control(name="task_type",type=text,placeholder='Task type',aria-describedby="task-addon-type",value="{{ task.properties.task_type|hide_none }}")
|
||||
select.form-control(name="task_type",aria-describedby="task-addon-task_type")
|
||||
| {% for task_type in attract_props.task_types.attract_shot %}
|
||||
| <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 %}
|
||||
option(value="{{ task.properties.task_type }}",selected).invalid_task {{ task.properties.task_type|undertitle }}
|
||||
| {% endif %}
|
||||
|
||||
.input-group
|
||||
span.input-group-addon#task-addon-description(title='Description') D
|
||||
textarea.form-control(name="description",type=text,placeholder='Task description',aria-describedby="task-addon-description") {{ task.description|hide_none }}
|
||||
|
Reference in New Issue
Block a user