fix #PHRAS-492

#time 1d
This commit is contained in:
Jean-Yves Gaulier
2015-05-04 19:32:25 +02:00
parent 33bf1ba7d5
commit f77a425ae9
3 changed files with 5 additions and 6 deletions

View File

@@ -227,9 +227,11 @@ class Query implements ControllerProviderInterface
$record = new \record_preview($app, 'RESULT', $pos, '', $app['phraseanet.SE'], $query, $options); $record = new \record_preview($app, 'RESULT', $pos, '', $app['phraseanet.SE'], $query, $options);
$index = ($pos - 3) < 0 ? 0 : ($pos - 3);
return $app->json([ return $app->json([
'current' => $app['twig']->render('prod/preview/result_train.html.twig', [ 'current' => $app['twig']->render('prod/preview/result_train.html.twig', [
'records' => $record->get_train(), 'records' => $record->get_train(),
'index' => $index,
'selected' => $pos 'selected' => $pos
]) ])
]); ]);

View File

@@ -111,7 +111,6 @@ class record_preview extends record_adapter
$this->original_item = $record; $this->original_item = $record;
$sbas_id = $record->getDataboxId(); $sbas_id = $record->getDataboxId();
$record_id = $record->getRecordId(); $record_id = $record->getRecordId();
file_put_contents("/tmp/phraseanet_debug", sprintf("%s (%d) pos=%s, rid=%s\n", __FILE__, __LINE__, $pos, $record_id), FILE_APPEND);
break; break;
} }
break; break;
@@ -213,11 +212,9 @@ file_put_contents("/tmp/phraseanet_debug", sprintf("%s (%d) pos=%s, rid=%s\n", _
case 'RESULT': case 'RESULT':
$perPage = 56; $perPage = 56;
$index = ($this->pos - 3) < 0 ? 0 : ($this->pos - 3); $index = ($this->pos - 3) < 0 ? 0 : ($this->pos - 3);
file_put_contents("/tmp/phraseanet_debug", sprintf("%s (%d) pos=%s, index=%s\n", __FILE__, __LINE__, $this->pos, $index), FILE_APPEND);
$results = $this->searchEngine->query($this->query, $index, $perPage, $this->options); $results = $this->searchEngine->query($this->query, $index, $perPage, $this->options);
$this->train = $results->getResults()->toArray(); $this->train = $results->getResults()->toArray();
file_put_contents("/tmp/phraseanet_debug", sprintf("%s (%d) train=%s\n", __FILE__, __LINE__, var_export($this->train, true)), FILE_APPEND);
break; break;
case 'BASK': case 'BASK':
$this->train = $this->container->getElements(); $this->train = $this->container->getElements();

View File

@@ -25,9 +25,9 @@
{"width":box_w, "height":box_h} {"width":box_w, "height":box_h}
) )
%} %}
{% set rec_number = loop.index0 + index %}
<li class="prevTrainCurrent current{{loop.index0}} {% if loop.index0 == selected %}selected{% endif %}"> <li class="prevTrainCurrent current{{rec_number}} {% if rec_number == selected %}selected{% endif %}">
<img jsargs="RESULT|{{loop.index0}}|" class="openPreview" src="{{url}}" <img jsargs="RESULT|{{rec_number}}|" class="openPreview" src="{{url}}"
src="{{url}}" src="{{url}}"
style=" style="
width:{{fit_size.width}}px; width:{{fit_size.width}}px;