From f3f51b6ecf52fbc483b72d08bb85d39fe7169dbb Mon Sep 17 00:00:00 2001 From: Julio Date: Fri, 1 Jul 2016 21:16:20 +0200 Subject: [PATCH] Add preview of popup see BT#10849 --- main/inc/lib/display.lib.php | 4 ++-- main/template/rainbow/layout/header.js.tpl | 12 +++++++++--- search.php | 11 +++++++++-- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/main/inc/lib/display.lib.php b/main/inc/lib/display.lib.php index e443a291a7..e80fa92195 100755 --- a/main/inc/lib/display.lib.php +++ b/main/inc/lib/display.lib.php @@ -2302,7 +2302,7 @@ class Display * * @return string */ - public static function panel($content, $title = '', $footer = '', $style = '', $extra = '') + public static function panel($content, $title = '', $footer = '', $style = '', $extra = '', $id = '') { $title = !empty($title) ? '

'.$title.'

'.$extra.'
' : ''; $footer = !empty($footer) ? '' : ''; @@ -2310,7 +2310,7 @@ class Display $style = !in_array($style, $styles) ? 'default' : $style; return ' -
+
'.$title.' '.self::contentPanel($content).' '.$footer.' diff --git a/main/template/rainbow/layout/header.js.tpl b/main/template/rainbow/layout/header.js.tpl index 69538b4cab..9fae5a7384 100644 --- a/main/template/rainbow/layout/header.js.tpl +++ b/main/template/rainbow/layout/header.js.tpl @@ -132,9 +132,15 @@ $(document).ready(function(){ $('body').on('click', 'a.ajax', function(e) { e.preventDefault(); - var contentUrl = this.href, - loadModalContent = $.get(contentUrl), - self = $(this); + var panelId = $('#' + this.id+ '_panel'); + if (panelId.length) { + var loadModalContent = panelId.html(); + self = $(this); + } else { + var contentUrl = this.href, + loadModalContent = $.get(contentUrl), + self = $(this); + } $.when(loadModalContent).done(function(modalContent) { var modalDialog = $('#global-modal').find('.modal-dialog'), diff --git a/search.php b/search.php index fcf6984e39..8dbad61efd 100644 --- a/search.php +++ b/search.php @@ -205,11 +205,18 @@ if ($form->validate()) { } $extraField = new ExtraField('user'); - $userForm = new FormValidator('user_form', 'post', api_get_self()); $jqueryExtra = ''; -$userForm->addHeader(get_lang('Filière')); +$htmlHeadXtra[] =''; + +$panel = Display::panel(get_lang('FiliereExplanation'), '', '', '', '', 'filiere_panel'); +$userForm->addHeader(Display::url(get_lang('Filière'), '#', ['id'=> 'filiere', 'class' => 'ajax']).''.$panel); $fieldsToShow = [ 'statusocial', 'filiere_user',