Skip to content

Commit

Permalink
Fix dropfiles type after symfony BC in 2.8.31 (#240)
Browse files Browse the repository at this point in the history
* update symfony to ^2.8

* remove url from dropfiles in forms

* make uploadimagetransformer save image so that it updates the file name

* some fixes

* fix user profile form to save avatar

* rework of dropfiles type and js

* rework of all forms with dropfiles

* small fixes in model transformers

* remove unnecessary comments from Forms

* Fix AdminStoryEdit form so it can properly add, save and remove the 3 types of images it has

* Refactor to have a unique place where to handle additions, changes or removals of pictures on a form

* Fix ProjectPostForm so it adds, edits and removes pictures correctly

* Feature: Project can share a url to a signature platform (#234)

* Add sign_url field to Project and to Project Forms

* Make new project fields not required

* Add signture button in project skin

* Fix signature css

* Fix css and target blank link

Co-authored-by: Javier Carrillo <javier@goteo.org>
Co-authored-by: David Igón <david@goteo.org>

* make new project sign fields not required in translate overview form (#236)

* update composer.lock to symfony 2.8.52

* Fix AdminSdgEdit form in order to allow removing the Sdf icon

* Fix ProjectStory form, since it wasn't possible to upload, update or remove images to the ProjectStory

* Fix Questionnaire form so it saves the uploaded image ID as the answer for Dropfiles

* fixes on questionnaire form to handle upload of documents instead of images

* Refactor on DropfilesType to include constant and to separate the different view elements added as a DropfilesType

Co-authored-by: David Igón <david@goteo.org>
Co-authored-by: David <david.igon@riseup.net>
Co-authored-by: Javier Carrillo <javier@goteo.org>
  • Loading branch information
4 people committed Sep 23, 2021
1 parent 0ad6f5f commit 0625530
Show file tree
Hide file tree
Showing 32 changed files with 575 additions and 434 deletions.
8 changes: 6 additions & 2 deletions Resources/templates/forms/bootstrap/dropfiles_widget.html.php
Expand Up @@ -2,12 +2,13 @@

$uploads_name = $form['uploads']->vars['full_name'];
$current_name = $form['current']->vars['full_name'];
$removed_name = $form['removed']->vars['full_name'];
// $current_files = $value;
$current_files = is_array($value) ? $value : [$value];

// var_dump($current_files);die;
?>
<div class="dropfiles" data-text-upload="<?= $view->escape($text_upload) ?>" data-text-max-files-reached="<?= $view->escape($text_max_files_reached) ?>" data-text-file-type-error="<?= $view->escape($text_file_type_error) ?>" data-limit="<?= $limit ?>" data-multiple="<?= $attr['multiple'] ? 1 : 0 ?>" data-url="<?= $view->escape($url) ?>" data-current="<?= $view->escape($current_name) ?>" data-name="<?= $view->escape($uploads_name) ?>" data-markdown-link="<?= $view->escape($markdown_link) ?>" data-accepted-files="<?= $view->escape($accepted_files) ?>">
<div class="dropfiles" data-text-upload="<?= $view->escape($text_upload) ?>" data-text-max-files-reached="<?= $view->escape($text_max_files_reached) ?>" data-text-file-type-error="<?= $view->escape($text_file_type_error) ?>" data-limit="<?= $limit ?>" data-multiple="<?= $attr['multiple'] ? 1 : 0 ?>" data-url="<?= $view->escape($url) ?>" data-current="<?= $view->escape($current_name) ?>" data-name="<?= $view->escape($uploads_name) ?>" data-removed="<?= $view->escape($removed_name) ?>" data-markdown-link="<?= $view->escape($markdown_link) ?>" data-accepted-files="<?= $view->escape($accepted_files) ?>">
<div class="image-zone <?= $type ?>" data-section="<?= $key ?>">
<ul class="list-inline image-list-sortable" id="list-sortable-<?= $key ?>">
<?php foreach($current_files as $img) {
Expand All @@ -22,11 +23,14 @@
'text_send_to_markdown' => $text_send_to_markdown,
'text_delete_image' => $text_delete_image,
'text_download' => $text_download,
'hidden_input' => '<input type="hidden" name="' . $current_name . '" value="' . $view->escape($img->getName()) . '">'
'hidden_input' => '<input type="file" style="display: none" name="' . $current_name . '" value="' . $view->escape($img->getName()) . '">'
]);
}
} ?>
</ul>

<input type="text" style="display:none" name="<?= $removed_name ?>[]">

<div class="dragndrop"><div class="dropzone"></div></div>
</div>
<p class="text-danger error-msg hidden"></p>
Expand Down
38 changes: 19 additions & 19 deletions composer.json
Expand Up @@ -19,25 +19,25 @@
"iignatov/lightopenid": "~1.0",
"paypal/adaptivepayments-sdk-php": "*",
"paypal/merchant-sdk-php": "*",
"symfony/class-loader": "2.8.30",
"symfony/http-foundation": "2.8.30",
"symfony/routing": "2.8.30",
"symfony/http-kernel": "2.8.30",
"symfony/security": "2.8.30",
"symfony/config": "2.8.30",
"symfony/stopwatch": "2.8.30",
"symfony/dependency-injection": "2.8.30",
"symfony/debug": "2.8.30",
"symfony/console": "2.8.30",
"symfony/translation": "2.8.30",
"symfony/finder": "2.8.30",
"symfony/dom-crawler": "2.8.30",
"symfony/css-selector": "2.8.30",
"symfony/process": "2.8.30",
"symfony/form": "2.8.30",
"symfony/templating": "2.8.30",
"symfony/framework-bundle": "2.8.30",
"symfony/validator": "2.8.30",
"symfony/class-loader": "^2.8",
"symfony/http-foundation": "^2.8",
"symfony/routing": "^2.8",
"symfony/http-kernel": "^2.8",
"symfony/security": "^2.8",
"symfony/config": "^2.8",
"symfony/stopwatch": "^2.8",
"symfony/dependency-injection": "^2.8",
"symfony/debug": "^2.8",
"symfony/console": "^2.8",
"symfony/translation": "^2.8",
"symfony/finder": "^2.8",
"symfony/dom-crawler": "^2.8",
"symfony/css-selector": "^2.8",
"symfony/process": "^2.8",
"symfony/form": "^2.8",
"symfony/templating": "^2.8",
"symfony/framework-bundle": "^2.8",
"symfony/validator": "^2.8",
"symfony/yaml": "^3.3",
"monolog/monolog": "^1.17",
"gregwar/captcha": "^1.1",
Expand Down

0 comments on commit 0625530

Please sign in to comment.