Skip to content
Snippets Groups Projects
Commit e8c21dd6 authored by llaffont's avatar llaffont
Browse files

Upload vignette: aperçu de la vignette dans le formulaire

parent 113b9947
Branches
Tags 5.29
No related merge requests found
......@@ -86,6 +86,7 @@ $(document).ready(function () {
}
$this->view->form = $form;
$this->view->url_vignette = Class_Notice::find($this->_getParam('id'))->getUrlVignette();
}
}
?>
\ No newline at end of file
......@@ -9,6 +9,10 @@ echo $this->renderForm($this->form);
?>
<img class="patience" style="display:none; margin: 0 auto" src="<?php echo URL_ADMIN_IMG ?>patience.gif" border="0" alt="'.$this->_('Chargement en cours').'" />
<div style="text-align: center; margin-top: 10px">
<?php echo $this->_('Aperçu:') ?>
<img class="preview" width="150px" style="display:block; margin: 10px auto" src="<?php echo $this->url_vignette ?>"/>
</div>
</div>
......@@ -16,4 +20,13 @@ echo $this->renderForm($this->form);
$('input[type=submit]').click(function() {
$('img.patience').css('display', 'block');
});
var url_input = $('input[name=url_vignette]');
var update_preview = function() {
$('img.preview').attr('src', url_input.attr('value'))
};
url_input.keyup(update_preview);
url_input.mouseup(update_preview);
</script>
\ No newline at end of file
......@@ -55,7 +55,7 @@ $notice_html=new Class_NoticeHtml($this->notice);
printf('<img src="%s" width="100" border="0" alt="%s"/>', $this->url_img["vignette"], $this->_('Vignette'));
if (Class_Users::isCurrentUserCanAccesBackend())
echo sprintf('<a href="#" onclick="showPopWin(\'%s\', 700, 200); return false;">%s</a>',
echo sprintf('<a href="#" onclick="showPopWin(\'%s\', 700, 300); return false;">%s</a>',
$this->url(['module' => 'admin',
'controller' => 'upload',
'action' => 'vignette-notice',
......
......@@ -146,7 +146,7 @@ class UploadControllerMultipleProcessPostAction extends AbstractControllerTestCa
class UploadControllerVignetteNoticeActionTest extends AbstractControllerTestCase {
public function setUp() {
parent::setUp();
Class_Notice::newInstanceWithId(12345, ['url_vignette' => 'http://harrypotter.com/poster.jpg']);
$this->dispatch('/admin/upload/vignette-notice/id/12345', true);
}
......@@ -161,6 +161,12 @@ class UploadControllerVignetteNoticeActionTest extends AbstractControllerTestCas
public function formShouldHaveSubmitButtonEnvoyer() {
$this->assertXPath('//form//input[@type="submit"][@value="Envoyer"]');
}
/** @test */
public function previewImgSrcShouldBePosterDotJpeg() {
$this->assertXPath('//img[@class="preview"][@src="http://harrypotter.com/poster.jpg"]');
}
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment