|
| 1 | +{% trans_default_domain 'PrestaImageBundle' %} |
| 2 | + |
| 3 | +{% block image_widget %} |
| 4 | +{% apply spaceless %} |
| 5 | + <div class="cropper" data-cropper-options="{{ form.vars.cropper_options }}" data-max-width="{{ max_width }}" data-max-height="{{ max_height }}" data-mimetype="{{ upload_mimetype }}" data-quality="{{ upload_quality }}"> |
| 6 | + <div class="row"> |
| 7 | + {% if enable_locale %} |
| 8 | + <div class="col-4 cropper-local"> |
| 9 | + <input type="file" name="file" class="d-none" /> |
| 10 | + <button type="button" class="{{ upload_button_class }}"> |
| 11 | + <span class="{{ upload_button_icon }}"></span> |
| 12 | + {{ 'btn_import_image_local'|trans }} |
| 13 | + </button> |
| 14 | + </div> |
| 15 | + {% endif %} |
| 16 | + {% if enable_remote %} |
| 17 | + <div class="col-8 cropper-remote"> |
| 18 | + <div class="input-group"> |
| 19 | + <input type="url" class="image-url-input form-control form-control-sm" placeholder="{{ 'image_dist_placeholder'|trans }}" /> |
| 20 | + <div class="input-group-append"> |
| 21 | + <button type="button" class="btn btn-sm btn-primary btn-upload-dist" disabled="disabled" data-url="{{ path('presta_image_url_to_base64') }}"> |
| 22 | + <span class="fa fa-upload"></span> |
| 23 | + {{ 'btn_import_image_remote'|trans }} |
| 24 | + </button> |
| 25 | + <div class="remote-loader spinner d-none"> |
| 26 | + <div class="rect1"></div> |
| 27 | + <div class="rect2"></div> |
| 28 | + <div class="rect3"></div> |
| 29 | + <div class="rect4"></div> |
| 30 | + </div> |
| 31 | + </div> |
| 32 | + </div> |
| 33 | + </div> |
| 34 | + {% endif %} |
| 35 | + {% if form.delete is defined %} |
| 36 | + <div class="col-12"> |
| 37 | + {{ form_row(form.delete) }} |
| 38 | + </div> |
| 39 | + {% endif %} |
| 40 | + </div> |
| 41 | + |
| 42 | + <div class="cropper-canvas-container mt-2{% if form.delete is defined %} cropper-canvas-has-delete{% endif %}" data-preview-width="{{ preview_width }}" data-preview-height="{{ preview_height }}"> |
| 43 | + {% if form.vars.download_uri is defined and form.vars.download_uri %} |
| 44 | + <img id="pula" src="{{ asset(form.vars.download_uri) }}" style="max-width: {{ preview_width }}; max-height: {{ preview_height }};"> |
| 45 | + {% endif %} |
| 46 | + </div> |
| 47 | + {{ form_row(form.base64) }} |
| 48 | + |
| 49 | + {% set show_aspect_ratios = aspect_ratios|length > 1 %} |
| 50 | + <div class="modal fade"> |
| 51 | + <div class="modal-dialog modal-lg"> |
| 52 | + <div class="modal-content"> |
| 53 | + <div class="modal-header"> |
| 54 | + <h5 class="modal-title">{{ 'resize_image'|trans }}</h5> |
| 55 | + <button type="button" class="btn-close" data-bs-dismiss="modal"></button> |
| 56 | + </div> |
| 57 | + <div class="modal-body"> |
| 58 | + <div class="row"> |
| 59 | + <div class="{% if show_aspect_ratios %}col-10{% else %}col-12{% endif %}"> |
| 60 | + <div class="cropper-preview"></div> |
| 61 | + </div> |
| 62 | + {% if show_aspect_ratios %} |
| 63 | + <div class="col-2"> |
| 64 | + <div class="btn-group-vertical float-right"> |
| 65 | + {% for aspect_ratio in aspect_ratios %} |
| 66 | + <label class="btn btn-primary mb-0{% if aspect_ratio.checked %} active{% endif %}"> |
| 67 | + <input type="radio" name="cropperAspectRatio" class="d-none" value="{{ aspect_ratio.value }}"{% if aspect_ratio.checked %} checked="checked"{% endif %}> |
| 68 | + {{ aspect_ratio.label|trans }} |
| 69 | + </label> |
| 70 | + {% endfor %} |
| 71 | + </div> |
| 72 | + </div> |
| 73 | + {% else %} |
| 74 | + {% for aspect_ratio in aspect_ratios %} |
| 75 | + <input type="hidden" name="cropperAspectRatio" value="{{ aspect_ratio.value }}"{% if aspect_ratio.checked %} checked="checked"{% endif %}> |
| 76 | + {% endfor %} |
| 77 | + {% endif %} |
| 78 | + </div> |
| 79 | + {% if enable_rotation %} |
| 80 | + <div class="row"> |
| 81 | + <div class="toolbar {% if show_aspect_ratios %}col-10{% else %}col-12{% endif %}"> |
| 82 | + <button class="btn btn-default rotate" data-rotate="90"></button> |
| 83 | + <button class="btn btn-default rotate anti-rotate" data-rotate="-90"></button> |
| 84 | + </div> |
| 85 | + </div> |
| 86 | + {% endif %} |
| 87 | + </div> |
| 88 | + <div class="modal-footer"> |
| 89 | + <button type="button" class="{{ cancel_button_class }}" data-bs-dismiss="modal">{{ 'btn_cancel'|trans }}</button> |
| 90 | + <button type="button" class="{{ save_button_class }}" data-method="getCroppedCanvas">{{ 'btn_validate'|trans }}</button> |
| 91 | + </div> |
| 92 | + </div> |
| 93 | + </div> |
| 94 | + </div> |
| 95 | + </div> |
| 96 | +{% endapply %} |
| 97 | +{% endblock %} |
0 commit comments