mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-16 22:43:19 +00:00
PHRAS-937 - fix navigation in preview
This commit is contained in:
@@ -156,7 +156,11 @@ class QueryController extends Controller
|
||||
. $this->app->trans('%total% reponses', ['%total%' => '<span>'.$result->getTotal().'</span>']) . '</a>';
|
||||
|
||||
$json['infos'] = $infoResult;
|
||||
$json['navigation'] = $string;
|
||||
$json['navigationTpl'] = $string;
|
||||
$json['navigation'] = [
|
||||
'page' => $page,
|
||||
'perPage' => $perPage
|
||||
];
|
||||
|
||||
$prop = null;
|
||||
|
||||
|
@@ -566,7 +566,7 @@ function initAnswerForm() {
|
||||
$('#answers').append('<div id="paginate"><div class="navigation"><div id="tool_navigate"></div></div></div>');
|
||||
|
||||
$('#tool_results').empty().append(datas.infos);
|
||||
$('#tool_navigate').empty().append(datas.navigation);
|
||||
$('#tool_navigate').empty().append(datas.navigationTpl);
|
||||
|
||||
$.each(p4.Results.Selection.get(), function (i, el) {
|
||||
$('#IMGT_' + el).addClass('selected');
|
||||
@@ -575,6 +575,7 @@ function initAnswerForm() {
|
||||
p4.tot = datas.total_answers;
|
||||
p4.tot_options = datas.form;
|
||||
p4.tot_query = datas.query;
|
||||
p4.navigation = datas.navigation;
|
||||
|
||||
if (datas.next_page) {
|
||||
$("#NEXT_PAGE, #answersNext").bind('click', function () {
|
||||
|
@@ -73,6 +73,12 @@ function openPreview(env, pos, contId, reload) {
|
||||
|
||||
var options_serial = p4.tot_options;
|
||||
var query = p4.tot_query;
|
||||
var navigation = p4.navigation;
|
||||
|
||||
// keep relative position for answer train:
|
||||
var relativePos = pos;
|
||||
// update real absolute position with pagination:
|
||||
var absolutePos = parseInt(navigation.perPage,10) * (parseInt(navigation.page, 10) - 1) + parseInt(pos,10);
|
||||
|
||||
prevAjax = $.ajax({
|
||||
type: "POST",
|
||||
@@ -80,7 +86,7 @@ function openPreview(env, pos, contId, reload) {
|
||||
dataType: 'json',
|
||||
data: {
|
||||
env: env,
|
||||
pos: pos,
|
||||
pos: absolutePos,
|
||||
cont: contId,
|
||||
roll: roll,
|
||||
options_serial: options_serial,
|
||||
@@ -141,7 +147,7 @@ function openPreview(env, pos, contId, reload) {
|
||||
p4.preview.current.width = parseInt($('#PREVIEWIMGCONT input[name=width]').val());
|
||||
p4.preview.current.height = parseInt($('#PREVIEWIMGCONT input[name=height]').val());
|
||||
p4.preview.current.tot = data.tot;
|
||||
p4.preview.current.pos = data.pos;
|
||||
p4.preview.current.pos = relativePos;
|
||||
|
||||
if ($('#PREVIEWBOX img.record.zoomable').length > 0) {
|
||||
$('#PREVIEWBOX img.record.zoomable').draggable();
|
||||
@@ -334,7 +340,7 @@ function getNext() {
|
||||
else {
|
||||
if (p4.preview.mode == 'RESULT') {
|
||||
posAsk = parseInt(p4.preview.current.pos) + 1;
|
||||
posAsk = (posAsk > parseInt(p4.tot) || isNaN(posAsk)) ? 0 : posAsk;
|
||||
posAsk = (posAsk >= parseInt(p4.tot) || isNaN(posAsk)) ? 0 : posAsk;
|
||||
openPreview('RESULT', posAsk, '', false);
|
||||
}
|
||||
else {
|
||||
|
Reference in New Issue
Block a user