Show shot thumbnails.
This commit is contained in:
@@ -12,6 +12,7 @@ from pillar.web.system_util import pillar_api
|
|||||||
from attract.routes import attract_project_view
|
from attract.routes import attract_project_view
|
||||||
from attract.node_types.shot import node_type_shot
|
from attract.node_types.shot import node_type_shot
|
||||||
from attract import current_attract, ROLES_REQUIRED_TO_VIEW_ITEMS
|
from attract import current_attract, ROLES_REQUIRED_TO_VIEW_ITEMS
|
||||||
|
from pillar.web.utils import get_file
|
||||||
|
|
||||||
perproject_blueprint = Blueprint('attract.shots.perproject', __name__,
|
perproject_blueprint = Blueprint('attract.shots.perproject', __name__,
|
||||||
url_prefix='/<project_url>/shots')
|
url_prefix='/<project_url>/shots')
|
||||||
@@ -35,6 +36,15 @@ def for_project(project, attract_props, task_id=None, shot_id=None):
|
|||||||
}, api=api)
|
}, api=api)
|
||||||
shots = found['_items']
|
shots = found['_items']
|
||||||
|
|
||||||
|
thumb_placeholder = flask.url_for('static_attract', filename='assets/img/placeholder.jpg')
|
||||||
|
for shot in shots:
|
||||||
|
picture = get_file(shot.picture, api=api)
|
||||||
|
if picture:
|
||||||
|
shot._thumbnail = next((var.link for var in picture.variations
|
||||||
|
if var.size == 't'), thumb_placeholder)
|
||||||
|
else:
|
||||||
|
shot._thumbnail = thumb_placeholder
|
||||||
|
|
||||||
tasks_for_shots = current_attract.shot_manager.tasks_for_shots(
|
tasks_for_shots = current_attract.shot_manager.tasks_for_shots(
|
||||||
shots,
|
shots,
|
||||||
attract_props.task_types.attract_shot,
|
attract_props.task_types.attract_shot,
|
||||||
|
@@ -15,10 +15,8 @@
|
|||||||
.table-head
|
.table-head
|
||||||
.table-row
|
.table-row
|
||||||
.table-cell.shot-status
|
.table-cell.shot-status
|
||||||
| {# Temporarily hide thumbnails until they're implemented
|
|
||||||
.table-cell.shot-thumbnail
|
.table-cell.shot-thumbnail
|
||||||
span.collapser(title="Collapse thumbnails") Thumbnail
|
span.collapser(title="Collapse thumbnails") Thumbnail
|
||||||
| #}
|
|
||||||
.table-cell.shot-name
|
.table-cell.shot-name
|
||||||
span.collapser(title="Collapse name column") Name
|
span.collapser(title="Collapse name column") Name
|
||||||
| {% for task_type in task_types %}
|
| {% for task_type in task_types %}
|
||||||
@@ -32,15 +30,13 @@
|
|||||||
id="shot-{{ shot._id }}",
|
id="shot-{{ shot._id }}",
|
||||||
class="status-{{ shot.properties.status }}")
|
class="status-{{ shot.properties.status }}")
|
||||||
.table-cell.shot-status
|
.table-cell.shot-status
|
||||||
| {# Temporarily hide thumbnails until they're implemented
|
|
||||||
.table-cell.shot-thumbnail
|
.table-cell.shot-thumbnail
|
||||||
a(
|
a(
|
||||||
data-shot-id="{{ shot._id }}",
|
data-shot-id="{{ shot._id }}",
|
||||||
href="{{ url_for('attract.shots.perproject.view_shot', project_url=project.url, shot_id=shot._id) }}",
|
href="{{ url_for('attract.shots.perproject.view_shot', project_url=project.url, shot_id=shot._id) }}",
|
||||||
class="status-{{ shot.properties.status }} shot-link")
|
class="status-{{ shot.properties.status }} shot-link")
|
||||||
img(src="{{ url_for('static_attract', filename='assets/img/placeholder.jpg') }}",
|
img(src="{{ shot._thumbnail }}",
|
||||||
alt="Thumbnail",width="110",height='60')
|
alt="Thumbnail",width="110",height='60')
|
||||||
| #}
|
|
||||||
.table-cell.shot-name
|
.table-cell.shot-name
|
||||||
a(
|
a(
|
||||||
data-shot-id="{{ shot._id }}",
|
data-shot-id="{{ shot._id }}",
|
||||||
|
Reference in New Issue
Block a user