Added /attract/<project_url>/shots/<shot-id> endpoint

This commit is contained in:
2016-09-22 17:22:43 +02:00
parent f1dc2b2d06
commit 0767463ead
3 changed files with 13 additions and 7 deletions

View File

@@ -35,7 +35,7 @@ def index():
@perproject_blueprint.route('/', endpoint='index')
@perproject_blueprint.route('/with-task/<task_id>', endpoint='with-task')
@attract_project_view(extension_props=True)
def for_project(project, attract_props, task_id=None):
def for_project(project, attract_props, task_id=None, shot_id=None):
api = pillar_api()
found = pillarsdk.Node.all({
@@ -58,6 +58,7 @@ def for_project(project, attract_props, task_id=None):
tasks_for_shots=tasks_for_shots,
task_types=task_types,
open_task_id=task_id,
open_shot_id=shot_id,
project=project,
attract_props=attract_props)
@@ -65,17 +66,16 @@ def for_project(project, attract_props, task_id=None):
@perproject_blueprint.route('/<shot_id>')
@attract_project_view(extension_props=True)
def view_shot(project, attract_props, shot_id):
if not request.is_xhr:
return for_project(project, attract_props, shot_id=shot_id)
api = pillar_api()
shot = pillarsdk.Node.find(shot_id, api=api)
node_type = project.get_node_type(node_type_shot['name'])
if request.is_xhr:
template = 'attract/shots/view_shot_embed.html'
else:
template = 'attract/shots/view_shot.html'
return render_template(template,
return render_template('attract/shots/view_shot_embed.html',
shot=shot,
project=project,
shot_node_type=node_type,

View File

@@ -41,6 +41,7 @@ function task_open(task_id, project_url) {
}
$('[id^="task-"]').removeClass('active');
$('#task-' + task_id).addClass('active');
var task_url = '/attract/' + project_url + '/tasks/' + task_id;
@@ -65,6 +66,8 @@ function shot_open(shot_id, project_url) {
return;
}
$('#col_right .col_header').text('Shot details');
$('#shot-list').find('a').removeClass('active');
$('#shot-link' + shot_id).addClass('active');

View File

@@ -62,6 +62,9 @@ script.
{% if open_task_id %}
$(function() { task_open('{{ open_task_id }}', '{{ project.url }}'); });
{% endif %}
{% if open_shot_id %}
$(function() { shot_open('{{ open_shot_id }}', '{{ project.url }}'); });
{% endif %}
$('.table-head .table-cell span').on('click', function(e){
e.stopPropagation();